LP#1879983: add Curbside Pickup to the Angular navbar
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 2 Jun 2020 18:51:35 +0000 (14:51 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 22 Jun 2020 21:34:41 +0000 (17:34 -0400)
For both the Angular and AngularJS staff interfaces, the
Curbside Pickup option in the Circulation menu is displayed
only if circ.curbside has been enabled for the workstation
library.

Sponsored-by: PaILS
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/nav.component.html
Open-ILS/src/eg2/src/app/staff/nav.component.ts

index 70ca9f5..deb6b84 100644 (file)
             <span class="material-icons">signal_wifi_off</span>
             <span i18n>Offline Circulation</span>
           </a>
+          <div *ngIf="curbsideEnabled" class="dropdown-divider"></div>
+          <a *ngIf="curbsideEnabled" class="dropdown-item" href="/eg/staff/circ/curbside/index">
+            <span class="material-icons">directions_bus</span>
+            <span i18n>Curbside Pickup</span>
+          </a>
         </div>
       </div>
     </div>
index 970277c..92860b6 100644 (file)
@@ -18,6 +18,7 @@ export class StaffNavComponent implements OnInit {
     // Locales that have Angular staff translations
     locales: any[];
     currentLocale: any;
+    curbsideEnabled: boolean;
 
     constructor(
         private router: Router,
@@ -40,6 +41,15 @@ export class StaffNavComponent implements OnInit {
                     l => l.code() === this.locale.currentLocaleCode())[0];
             }
         );
+
+        // Avoid attempts to fetch org settings if the user has not yet
+        // logged in (e.g. this is the login page).
+        if (this.user()) {
+            this.org.settings('circ.curbside')
+            .then(settings => this.curbsideEnabled =
+                Boolean(settings['circ.curbside']));
+        }
+
     }
 
     user() {