From b96529a42970affa006434740821c97f47493081 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 26 Feb 2021 15:59:34 -0500 Subject: [PATCH] LP1904036 Claims returned Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/items.component.ts | 2 +- .../src/app/staff/circ/patron/patron.component.ts | 6 +-- .../app/staff/circ/patron/summary.component.html | 4 +- .../circ/claims-returned-dialog.component.html | 9 ++-- .../share/circ/claims-returned-dialog.component.ts | 53 ++++++++++++++++++++-- 5 files changed, 61 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.ts index 170f84f1b4..40ee8fd918 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.ts @@ -135,7 +135,7 @@ export class ItemsComponent implements OnInit, AfterViewInit { // Determine which grid ('checkouts' or 'other') a circ should appear in. promoteCircs(list: number[], displayCode: number, xactOpen?: boolean) { if (xactOpen) { - if (1 & displayCode) { // bitflag 1 == top list + if (1 & displayCode) { // bitflag 1 == main list this.mainList = this.mainList.concat(list); } else { this.altList = this.altList.concat(list); diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts index 1105f497a6..9c28ee7d4c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts @@ -143,12 +143,12 @@ export class PatronComponent implements OnInit, AfterViewInit { } routeToAlertsPane() { - console.log('testing route change for alerts'); if (this.patronTab !== 'search' && this.context.patron && this.context.alerts.hasAlerts() && - !this.context.patronAlertsShown()) { - this.router.navigate(['/staff/circ/patron', this.patronId, 'alerts']) + !this.context.patronAlertsShown()) { + + this.router.navigate(['/staff/circ/patron', this.patronId, 'alerts']); } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html index 4b6e162794..47081789ca 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html @@ -7,7 +7,7 @@ {{patronService.namePart(context.patron, 'second_given_name')}} -
+
Patron account will expire soon. Please renew.
@@ -49,7 +49,7 @@
Create Date
{{context.patron.create_date() | date:'shortDate'}}
-
+
Expire Date
{{context.patron.expire_date() | date:'shortDate'}}
diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.html index 4f43fd1f35..ea3c8ecede 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.html @@ -22,12 +22,13 @@
-
-
+
+
Patron exceeds claims returned count. Force this action?
-
- +
+
diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.ts index be32a103b6..2580d144bc 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/claims-returned-dialog.component.ts @@ -1,6 +1,11 @@ import {Component, OnInit, Output, Input, ViewChild, EventEmitter} from '@angular/core'; -import {Observable, empty, of, from} from 'rxjs'; +import {Observable, empty, of, from, throwError} from 'rxjs'; +import {concatMap, mergeMap, map} from 'rxjs/operators'; +import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; +import {NetService} from '@eg/core/net.service'; +import {AuthService} from '@eg/core/auth.service'; +import {EventService} from '@eg/core/event.service'; @Component({ templateUrl: 'claims-returned-dialog.component.html', @@ -12,18 +17,60 @@ export class ClaimsReturnedDialogComponent barcodes: string[]; returnDate: string; patronExceeds: boolean; + completed: {[barcode: string]: boolean} = {}; + + constructor( + private modal: NgbModal, + private net: NetService, + private auth: AuthService, + private evt: EventService + ) { super(modal); } ngOnInit() { this.onOpen$.subscribe(_ => { - this.returnDate = new Date().toISOString() + this.returnDate = new Date().toISOString(); this.patronExceeds = false; + this.completed = {}; }); } - modifyBatch() { + modifyBatch(override?: boolean) { + + let method = 'open-ils.circ.circulation.set_claims_returned'; + if (override) { method += '.override'; } + + from(this.barcodes).pipe(concatMap(barcode => { + + return this.net.request( + 'open-ils.circ', method, this.auth.token(), + {barcode: barcode, backdate: this.returnDate} + ).pipe(mergeMap(response => { + + if (Number(response) === 1) { return of(true); } + + console.warn(response); + + const evt = this.evt.parse(response); + + if (evt && + evt.textcode === 'PATRON_EXCEEDS_CLAIMS_RETURN_COUNT') { + this.patronExceeds = true; + return throwError('Patron Exceeds Count'); // stop it all + } + + return of(false); + })); + })) + .subscribe( + null, + err => console.log('Claims returned stopped with', err), + () => this.close(Object.keys(this.completed).length) + ); } confirmExceeds() { + this.barcodes = this.barcodes.filter(b => !this.completed[b]); + this.modifyBatch(true); } } -- 2.11.0