From 673a7f4ba5f2fc465626b9f23f3cd65f38c55eb5 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 Signed-off-by: Josh Stompro --- .../staff/catalog/hold/hold.component.html | 18 ++++++++++++++---- .../app/staff/catalog/hold/hold.component.ts | 19 +++++++++++++++++-- 2 files changed, 31 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 cdc864ddcb..a5fcb520fe 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 @@ + + +
- - +
+ + +
@@ -192,7 +203,6 @@
  • -
  • 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 5399cd389e..25943b9e69 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; @@ -476,7 +491,7 @@ export class HoldComponent implements OnInit { } readyToPlaceHolds(): boolean { - if (!this.user || this.placeHoldsClicked) { + if (!this.user || this.placeHoldsClicked || this.activeDateInvalid) { return false; } if (this.notifySms) { -- 2.43.2