LPXXX Patron UI WIP
authorBill Erickson <berickxx@gmail.com>
Fri, 14 Aug 2020 15:02:26 +0000 (11:02 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 21 Aug 2020 20:41:27 +0000 (16:41 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.html
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts
Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql [new file with mode: 0644]

index b5bb776..3780ca4 100644 (file)
         <li ngbNavItem="holds" [disabled]="!context.patron">
           <a ngbNavLink i18n>Holds</a>
           <ng-template ngbNavContent>
-            <div class="">
-            </div>
+            <eg-holds-grid [recordId]="recordId"
+              preFetchSetting="eg.circ.patron.holds.prefetch"
+              printTemplate="holds_for_patron"
+              persistKey="circ.patron.holds"
+              [hidePickupLibFilter]="true"
+              [defaultSort]="[{name:'request_time',dir:'asc'}]"
+              [patronId]="patronId"></eg-holds-grid>
           </ng-template>
         </li>
 
index 898048b..79b76bb 100644 (file)
@@ -19,7 +19,7 @@
   <ng-container *ngIf="mode == 'list' && initComplete()">
 
     <div class="row" *ngIf="!hidePickupLibFilter">
-      <div class="col-lg-4">
+      <div class="col-lg-5">
         <div class="input-group">
           <div class="input-group-prepend">
             <div class="input-group-text" i18n>Pickup Library</div>
       [multiSortable]="true" [persistKey]="persistKey"
       (onRowActivate)="showDetail($event)">
 
-      <eg-grid-toolbar-checkbox (onChange)="preFetchHolds($event)"
-        [initialValue]="enablePreFetch" i18n-label label="Pre-Fetch All Holds">
-      </eg-grid-toolbar-checkbox>
+      <ng-container *ngIf="preFetchSetting">
+        <eg-grid-toolbar-checkbox (onChange)="preFetchHolds($event)"
+          [initialValue]="enablePreFetch" i18n-label label="Pre-Fetch All Holds">
+        </eg-grid-toolbar-checkbox>
+      </ng-container>
 
       <eg-grid-toolbar-action
         i18n-label label="Show Hold Details" i18n-group group="Hold"
         i18-group group="Hold" i18n-label label="Print Holds"
         (onClick)="printHolds()"></eg-grid-toolbar-action>
 
+      <eg-grid-toolbar-action
+        i18n-label label="Show Hold Details" i18n-group group="Show"
+        (onClick)="showDetails($event)"></eg-grid-toolbar-action>
+
+      <eg-grid-toolbar-action
+        i18n-label label="Show Holds For Title" i18n-group group="Show"
+        (onClick)="showHoldsForTitle($event)"></eg-grid-toolbar-action>
+
       <eg-grid-column i18n-label label="Hold ID" path='id' [index]="true" datatype="id">
       </eg-grid-column>
 
index ff25149..aba05cd 100644 (file)
@@ -1,4 +1,5 @@
 import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {Location} from '@angular/common';
 import {Observable, Observer, of} from 'rxjs';
 import {IdlObject} from '@eg/core/idl.service';
 import {NetService} from '@eg/core/net.service';
@@ -83,13 +84,20 @@ export class HoldsGridComponent implements OnInit {
         }
     }
 
-    _userId: number;
-    @Input() set userId(id: number) {
-        this._userId = id;
+    get recordId(): number {
+        return this._recordId;
+    }
+
+    _patronId: number;
+    @Input() set patronId(id: number) {
+        this._patronId = id;
         if (this.initDone) {
             this.holdsGrid.reload();
         }
     }
+    get patronId(): number {
+        return this._patronId;
+    }
 
     // Include holds canceled on or after the provided date.
     // If no value is passed, canceled holds are not displayed.
@@ -100,6 +108,9 @@ export class HoldsGridComponent implements OnInit {
             this.holdsGrid.reload();
         }
     }
+    get showCanceledSince(): Date {
+        return this._showCanceledSince;
+    }
 
     // Include holds fulfilled on or after hte provided date.
     // If no value is passed, fulfilled holds are not displayed.
@@ -110,10 +121,14 @@ export class HoldsGridComponent implements OnInit {
             this.holdsGrid.reload();
         }
     }
+    get showFulfilledSince(): Date {
+        return this._showFulfilledSince;
+    }
 
     cellTextGenerator: GridCellTextGenerator;
 
     constructor(
+        private ngLocation: Location,
         private net: NetService,
         private org: OrgService,
         private store: ServerStoreService,
@@ -126,14 +141,15 @@ export class HoldsGridComponent implements OnInit {
 
     ngOnInit() {
         this.initDone = true;
-        this.pickupLib = this.org.get(this.initialPickupLib);
-
-        if (this.preFetchSetting) {
 
-                this.store.getItem(this.preFetchSetting).then(
-                    applied => this.enablePreFetch = Boolean(applied)
-                );
+        if (this.initialPickupLib) {
+            this.pickupLib = this.org.get(this.initialPickupLib);
+        }
 
+        if (this.preFetchSetting) {
+            this.store.getItem(this.preFetchSetting).then(
+                applied => this.enablePreFetch = Boolean(applied)
+            );
         }
 
         if (!this.defaultSort) {
@@ -180,10 +196,10 @@ export class HoldsGridComponent implements OnInit {
     applyFilters(): any {
         const filters: any = {
             is_staff_request: true,
-            fulfillment_time: this._showFulfilledSince ?
-                this._showFulfilledSince.toISOString() : null,
-            cancel_time: this._showCanceledSince ?
-                this._showCanceledSince.toISOString() : null,
+            fulfillment_time: this.showFulfilledSince ?
+                this.showFulfilledSince.toISOString() : null,
+            cancel_time: this.showCanceledSince ?
+                this.showCanceledSince.toISOString() : null,
         };
 
         if (this.pickupLib) {
@@ -191,12 +207,12 @@ export class HoldsGridComponent implements OnInit {
                 this.org.descendants(this.pickupLib, true);
         }
 
-        if (this._recordId) {
-            filters.record_id = this._recordId;
+        if (this.recordId) {
+            filters.record_id = this.recordId;
         }
 
-        if (this._userId) {
-            filters.usr_id = this._userId;
+        if (this.patronId) {
+            filters.usr_id = this.patronId;
         }
 
         return filters;
@@ -205,7 +221,7 @@ export class HoldsGridComponent implements OnInit {
     fetchHolds(pager: Pager, sort: any[]): Observable<any> {
 
         // We need at least one filter.
-        if (!this._recordId && !this.pickupLib && !this._userId) {
+        if (!this.recordId && !this.pickupLib && !this.patronId) {
             return of([]);
         }
 
@@ -266,6 +282,15 @@ export class HoldsGridComponent implements OnInit {
         this.showDetail(rows[0]);
     }
 
+    showHoldsForTitle(rows: any[]) {
+        if (rows.length === 0) { return; }
+
+        const url = this.ngLocation.prepareExternalUrl(
+            `/staff/catalog/record/${rows[0].record_id}/holds`);
+
+        window.open(url, '_blank');
+    }
+
     showDetail(row: any) {
         if (row) {
             this.mode = 'detail';
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql
new file mode 100644 (file)
index 0000000..c7b9bad
--- /dev/null
@@ -0,0 +1,24 @@
+
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); 
+
+/*
+INSERT INTO config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.catalog.results.count', 'gui', 'integer',
+    oils_i18n_gettext(
+        'eg.catalog.results.count',
+        'Catalog Results Page Size',
+        'cwst', 'label'
+    )
+);
+*/
+
+eg.circ.patron.holds.prefetch
+
+eg.grid.circ.patron.holds
+
+holds_for_patron print template
+
+COMMIT;