From: Galen Charlton Date: Tue, 21 Jan 2020 01:02:32 +0000 (-0500) Subject: implement additional navigation links X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bd811bda816fa98957e1922aa19d5470c4834eb9;p=working%2FEvergreen.git implement additional navigation links Along the way, also: - make the acq search components react to route and route query param changes - add user_id and ws_ou to the Angular and AngularJS nav bars Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html index 3a5e477f1f..72143a0d85 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html @@ -37,6 +37,7 @@ { + this.urlSearchTerms = []; const fields = params.getAll('f'); const ops = params.getAll('op'); const values1 = params.getAll('val1'); @@ -52,13 +53,25 @@ export class AcqSearchComponent implements OnInit, AfterViewInit { } if (idx < values1.length) { term.value1 = values1[idx]; + if (term.value1 === 'null') { + // convert the string 'null' to a true + // null value, mostly for the benefit of the + // open invoices navigation link + term.value1 = null; + } } if (idx < values2.length) { term.value2 = values2[idx]; } this.urlSearchTerms.push(term); + this.ngOnInit(); // TODO: probably overkill }); }); + this.router.events.subscribe(routeEvent => { + if (routeEvent instanceof NavigationEnd) { + this.ngOnInit(); // TODO: probably overkill + } + }); } ngOnInit() { diff --git a/Open-ILS/src/eg2/src/app/staff/nav.component.html b/Open-ILS/src/eg2/src/app/staff/nav.component.html index 34d850304d..120cae1ee7 100644 --- a/Open-ILS/src/eg2/src/app/staff/nav.component.html +++ b/Open-ILS/src/eg2/src/app/staff/nav.component.html @@ -245,7 +245,8 @@ + routerLink="/staff/acq/search/selectionlists" + [queryParams]="{f: 'acqpl:owner', val1: user_id()}"> view_list My Selection Lists @@ -276,7 +277,8 @@ Load MARC Order Records + routerLink="/staff/acq/search/purchaseorders" + [queryParams]="{f: ['acqpo:ordering_agency','acqpo:state'], val1: [ws_ou(), 'on-order']}"> shopping_cart Purchase Orders @@ -291,7 +293,8 @@ Claim-Ready Items + routerLink="/staff/acq/search/invoices" + [queryParams]="{f: ['acqinv:receiver', 'acqinv:close_date'], val1: [ws_ou(), null]}"> attach_money Open Invoices diff --git a/Open-ILS/src/eg2/src/app/staff/nav.component.ts b/Open-ILS/src/eg2/src/app/staff/nav.component.ts index f143727a33..14978707a3 100644 --- a/Open-ILS/src/eg2/src/app/staff/nav.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/nav.component.ts @@ -60,10 +60,18 @@ export class StaffNavComponent implements OnInit { return this.auth.user() ? this.auth.user().usrname() : ''; } + user_id() { + return this.auth.user() ? this.auth.user().id() : ''; + } + workstation() { return this.auth.user() ? this.auth.workstation() : ''; } + ws_ou() { + return this.auth.user() ? this.auth.user().ws_ou() : ''; + } + setLocale(locale: any) { this.locale.setLocale(locale.code()); } diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index 818cde4063..731926f10a 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -363,7 +363,7 @@
  • - + [% l('My Selection Lists') %] @@ -400,7 +400,7 @@
  • - + [% l('Purchase Orders') %] @@ -419,7 +419,7 @@
  • - + [% l('Open Invoices') %] diff --git a/Open-ILS/web/js/ui/default/staff/services/navbar.js b/Open-ILS/web/js/ui/default/staff/services/navbar.js index b6ff1d31fe..9c01748675 100644 --- a/Open-ILS/web/js/ui/default/staff/services/navbar.js +++ b/Open-ILS/web/js/ui/default/staff/services/navbar.js @@ -108,6 +108,8 @@ angular.module('egCoreMod') if (egCore.auth.user()) { $scope.op_changed = egCore.auth.OCtoken() ? true : false; $scope.username = egCore.auth.user().usrname(); + $scope.user_id = egCore.auth.user().id(); + $scope.ws_ou = egCore.auth.user().ws_ou(); $scope.workstation = egCore.auth.workstation(); egCore.org.settings([