LPXXX Holds pull list Angular port
authorBill Erickson <berickxx@gmail.com>
Fri, 12 Mar 2021 22:50:40 +0000 (17:50 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 12 Mar 2021 22:50:40 +0000 (17:50 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/circ/holds/holds.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/holds/routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts

diff --git a/Open-ILS/src/eg2/src/app/staff/circ/holds/holds.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/holds/holds.module.ts
new file mode 100644 (file)
index 0000000..5526c36
--- /dev/null
@@ -0,0 +1,28 @@
+import {NgModule} from '@angular/core';
+import {FmRecordEditorModule} from '@eg/share/fm-editor/fm-editor.module';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {HoldsModule} from '@eg/staff/share/holds/holds.module';
+import {HoldingsModule} from '@eg/staff/share/holdings/holdings.module';
+import {BookingModule} from '@eg/staff/share/booking/booking.module';
+import {PatronModule} from '@eg/staff/share/patron/patron.module';
+import {HoldsUiRoutingModule} from './routing.module';
+import {HoldsPullListComponent} from './pull-list.component';
+
+@NgModule({
+  declarations: [
+    HoldsPullListComponent
+  ],
+  imports: [
+    StaffCommonModule,
+    FmRecordEditorModule,
+    HoldsModule,
+    HoldingsModule,
+    BookingModule,
+    PatronModule,
+    HoldsUiRoutingModule
+  ],
+  providers: [
+  ]
+})
+
+export class HoldsUiModule {}
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.html b/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.html
new file mode 100644 (file)
index 0000000..048e8cd
--- /dev/null
@@ -0,0 +1,10 @@
+
+<eg-staff-banner i18n-bannerText bannerText="Holds Pull List"></eg-staff-banner>
+
+<eg-holds-grid
+  printTemplate="holds_pull_list"
+  persistKey="circ.holds.pull_list"
+  [hidePickupLibFilter]="true"
+  [pullListOrg]="targetOrg()">
+</eg-holds-grid>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.ts
new file mode 100644 (file)
index 0000000..5af54c2
--- /dev/null
@@ -0,0 +1,31 @@
+import {Component, OnInit, Input, ViewChild, HostListener} from '@angular/core';
+import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {IdlObject} from '@eg/core/idl.service';
+import {AuthService} from '@eg/core/auth.service';
+import {StoreService} from '@eg/core/store.service';
+
+@Component({
+  selector: 'eg-holds-pull-list',
+  templateUrl: 'pull-list.component.html'
+})
+export class HoldsPullListComponent implements OnInit {
+
+    constructor(
+        private router: Router,
+        private route: ActivatedRoute,
+        private pcrud: PcrudService,
+        private auth: AuthService,
+        private store: StoreService
+    ) {}
+
+    ngOnInit() {
+    }
+
+    targetOrg(): number {
+        // TODO: selector
+        return this.auth.user().ws_ou();
+    }
+}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/holds/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/holds/routing.module.ts
new file mode 100644 (file)
index 0000000..960eaee
--- /dev/null
@@ -0,0 +1,15 @@
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {HoldsPullListComponent} from './pull-list.component';
+
+const routes: Routes = [{
+  path: 'pull-list',
+  component: HoldsPullListComponent
+}];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule]
+})
+
+export class HoldsUiRoutingModule {}
index fae4330..d4940e3 100644 (file)
@@ -1,12 +1,15 @@
 import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
 
-const routes: Routes = [
-  { path: 'patron',
-    loadChildren: () =>
-      import('./patron/routing.module').then(m => m.CircPatronRoutingModule)
-  }
-];
+const routes: Routes = [{
+  path: 'patron',
+  loadChildren: () =>
+    import('./patron/routing.module').then(m => m.CircPatronRoutingModule)
+}, {
+  path: 'holds',
+  loadChildren: () =>
+    import('./holds/holds.module').then(m => m.HoldsUiModule)
+}];
 
 @NgModule({
   imports: [RouterModule.forChild(routes)],
index ec89ded..5d8c3be 100644 (file)
@@ -52,7 +52,8 @@
       [multiSortable]="true" [persistKey]="persistKey"
       (onRowActivate)="showDetail($event)">
 
-      <eg-grid-toolbar-checkbox (onChange)="preFetchHolds($event)" *ngIf="!hopeless"
+      <eg-grid-toolbar-checkbox
+        (onChange)="preFetchHolds($event)" *ngIf="!hopeless && this.preFetchSetting"
         [initialValue]="enablePreFetch" i18n-label label="Pre-Fetch All Holds">
       </eg-grid-toolbar-checkbox>
 
index 92a2538..a725629 100644 (file)
@@ -33,6 +33,9 @@ export class HoldsGridComponent implements OnInit {
     @Input() initialPickupLib: number | IdlObject;
     @Input() hidePickupLibFilter: boolean;
 
+    // Setting a value here puts us into "pull list" mode.
+    @Input() pullListOrg: number;
+
     // If true, only retrieve holds with a Hopeless Date
     // and enable related Actions
     @Input() hopeless: boolean;
@@ -161,6 +164,8 @@ export class HoldsGridComponent implements OnInit {
             this.store.getItem(this.preFetchSetting).then(
                 applied => this.enablePreFetch = Boolean(applied)
             );
+        } else {
+            this.enablePreFetch = false;
         }
 
         if (!this.defaultSort) {
@@ -215,13 +220,27 @@ 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,
-        };
+        const filters: any = {};
+
+        if (this.pullListOrg) {
+            filters.cancel_time = null;
+            filters.capture_time = null;
+
+            // Oddly, there are aliases for these (cp_status, cp_circ_lib),
+            // but the API complains when I use them.
+            filters['cp.status'] = [0, 7];
+            filters['cp.circ_lib'] = this.pullListOrg;
+
+            return filters;
+        }
+
+        if (this._showFulfilledSince) {
+            filters.fulfillment_time = this._showFulfilledSince.toISOString();
+        }
+
+        if (this._showCanceledSince) {
+            filters.cancel_time = this._showCanceledSince.toISOString();
+        }
 
         if (this.hopeless) {
           filters['hopeless_holds'] = {
@@ -263,7 +282,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._userId && !this.pullListOrg) {
             return of([]);
         }
 
@@ -276,6 +295,11 @@ export class HoldsGridComponent implements OnInit {
                 subObj[obj.name] = {dir: obj.dir, nulls: 'last'};
                 orderBy.push(subObj);
             });
+        } else if (this.pullListOrg) {
+            orderBy.push(
+                {copy_location_order_position: {dir: 'asc', nulls: 'last'}},
+                {cn_label_sortkey: {dir: 'asc'}}
+            );
         }
 
         const limit = this.enablePreFetch ? null : pager.limit;