From 4985fd3f6c27d876532d8ad19f09293454b485b1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 27 Jul 2021 14:04:03 -0400 Subject: [PATCH] LP1903357 Angstcat Hold Activate Date Validation Prevent setting activation dates in the past when placing holds in the Angular Staff Catalog. Signed-off-by: Bill Erickson --- .../src/app/staff/catalog/hold/hold.component.html | 21 ++++++++++++++++----- .../src/app/staff/catalog/hold/hold.component.ts | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html index 0e764ff9d6..3ce32c2788 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html @@ -2,6 +2,13 @@ + + +
- - +
+ + +
@@ -190,8 +201,8 @@
  • - + [disabled]="!user || placeHoldsClicked || (suspend && activeDateInvalid)" + i18n>Place Hold(s)
  • diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index ef10228109..805ecdb926 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, Input, ViewChild} from '@angular/core'; +import {Component, OnInit, ViewChild} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {tap} from 'rxjs/operators'; import {EventService} from '@eg/core/event.service'; @@ -18,6 +18,7 @@ import {ComboboxEntry, ComboboxComponent} from '@eg/share/combobox/combobox.comp import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronSearchDialogComponent } from '@eg/staff/share/patron/search-dialog.component'; +import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; class HoldContext { holdMeta: HoldRequestTarget; @@ -64,7 +65,9 @@ export class HoldComponent implements OnInit { smsValue: string; suspend: boolean; activeDateStr: string; + activeDateYmd: string; activeDate: Date; + activeDateInvalid = false; holdContexts: HoldContext[]; recordSummaries: BibRecordSummary[]; @@ -94,6 +97,8 @@ export class HoldComponent implements OnInit { @ViewChild('smsCbox', {static: false}) smsCbox: ComboboxComponent; + @ViewChild('activeDateAlert') private activeDateAlert: AlertDialogComponent; + constructor( private router: Router, private route: ActivatedRoute, @@ -328,6 +333,16 @@ export class HoldComponent implements OnInit { this.activeDateStr = dateStr; } + setActiveDate(date: Date) { + this.activeDate = date; + if (date && date < new Date()) { + this.activeDateInvalid = true; + this.activeDateAlert.open(); + } else { + this.activeDateInvalid = false; + } + } + userBarcodeChanged() { const newBc = this.userBarcode; -- 2.11.0