From: Bill Erickson Date: Mon, 23 Aug 2021 15:06:32 +0000 (-0400) Subject: LP1904036 Patron holds uncancel option; display title X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c0da94006d657e0d43a396ec5c0520356e0148f2;p=working%2FEvergreen.git LP1904036 Patron holds uncancel option; display title Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html index bd3f24568d..758cb78355 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html @@ -9,6 +9,7 @@ printTemplate="holds_for_patron" persistKey="circ.patron.holds" (placeHoldRequested)="newHold()" + [patronFocused]="true" [noLoadProgress]="true" [showPlaceHoldButton]="true" [hidePickupLibFilter]="true" @@ -23,6 +24,7 @@ + @@ -77,7 +82,7 @@ i18n-label label="Show Last Few Circulations" group="Item" i18n-group (onClick)="showRecentCircs($event)"> - @@ -101,9 +106,14 @@ i18n-group group="Hold" i18n-label label="Find Another Target" (onClick)="showRetargetDialog($event)"> - + (onClick)="showUncancelDialog($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 1d392e2f2d..3acafcf4fc 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 @@ -1,6 +1,7 @@ import {Component, OnInit, Input, Output, EventEmitter, ViewChild} from '@angular/core'; import {Location} from '@angular/common'; -import {Observable, Observer, of} from 'rxjs'; +import {Observable, Observer, of, from} from 'rxjs'; +import {concatMap} from 'rxjs/operators'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {OrgService} from '@eg/core/org.service'; @@ -10,6 +11,7 @@ import {ServerStoreService} from '@eg/core/server-store.service'; import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; import {ProgressDialogComponent} from '@eg/share/dialog/progress.component'; +import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {MarkDamagedDialogComponent } from '@eg/staff/share/holdings/mark-damaged-dialog.component'; import {MarkMissingDialogComponent @@ -66,6 +68,10 @@ export class HoldsGridComponent implements OnInit { // has it's own generic embedded 'loading' progress indicator. @Input() noLoadProgress = false; + // Some default columns and actions do or don't make sense when + // displaying holds for a specific patron vs. e.g. a specific title. + @Input() patronFocused = false; + mode: 'list' | 'detail' | 'manage' = 'list'; initDone = false; holdsCount: number; @@ -75,6 +81,7 @@ export class HoldsGridComponent implements OnInit { detailHold: any; editHolds: number[]; transferTarget: number; + uncancelHoldCount: number; @ViewChild('holdsGrid', { static: false }) private holdsGrid: GridComponent; @ViewChild('progressDialog', { static: true }) @@ -91,6 +98,7 @@ export class HoldsGridComponent implements OnInit { private cancelDialog: HoldCancelDialogComponent; @ViewChild('manageDialog', { static: true }) private manageDialog: HoldManageDialogComponent; + @ViewChild('uncancelDialog') private uncancelDialog: ConfirmDialogComponent; // Bib record ID. _recordId: number; @@ -550,6 +558,36 @@ export class HoldsGridComponent implements OnInit { } } + showUncancelDialog(rows: any[]) { + const holdIds = rows.map(r => r.id).filter(id => Boolean(id)); + if (holdIds.length === 0) { return; } + this.uncancelHoldCount = holdIds.length; + + this.uncancelDialog.open().subscribe(confirmed => { + if (!confirmed) { return; } + this.progressDialog.open(); + + from(holdIds).pipe(concatMap(holdId => { + return this.net.request( + 'open-ils.circ', + 'open-ils.circ.hold.uncancel', + this.auth.token(), holdId + ) + })).subscribe( + resp => { + if (Number(resp) !== 1) { + console.error('Failed uncanceling hold', resp); + } + }, + null, + () => { + this.progressDialog.close(); + this.holdsGrid.reload(); + } + ); + }); + } + printHolds() { // Request a page with no limit to get all of the wide holds for // printing. Call requestPage() directly instead of grid.reload()