From 34c05aa919b621e366782744a7209bd5b211096a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 12 Mar 2021 17:50:40 -0500 Subject: [PATCH] LPXXX Holds pull list Angular port Signed-off-by: Bill Erickson --- .../eg2/src/app/staff/circ/holds/holds.module.ts | 28 +++++++++++++++ .../app/staff/circ/holds/pull-list.component.html | 10 ++++++ .../app/staff/circ/holds/pull-list.component.ts | 31 +++++++++++++++++ .../eg2/src/app/staff/circ/holds/routing.module.ts | 15 ++++++++ .../src/eg2/src/app/staff/circ/routing.module.ts | 15 ++++---- .../src/app/staff/share/holds/grid.component.html | 3 +- .../src/app/staff/share/holds/grid.component.ts | 40 +++++++++++++++++----- 7 files changed, 127 insertions(+), 15 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/holds/holds.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/circ/holds/routing.module.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 index 0000000000..5526c365be --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/holds/holds.module.ts @@ -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 index 0000000000..048e8cd48f --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.html @@ -0,0 +1,10 @@ + + + + + + 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 index 0000000000..5af54c2962 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/holds/pull-list.component.ts @@ -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 index 0000000000..960eaee76a --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/holds/routing.module.ts @@ -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 {} diff --git a/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts index fae4330cb4..d4940e314e 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/routing.module.ts @@ -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)], diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html index ec89ded58a..5d8c3beb6c 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html @@ -52,7 +52,8 @@ [multiSortable]="true" [persistKey]="persistKey" (onRowActivate)="showDetail($event)"> - diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts index 92a2538aca..a725629abb 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts @@ -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 { // 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; -- 2.11.0