<eg-patron-search-dialog #patronSearch>
</eg-patron-search-dialog>
+<eg-alert-dialog #activeDateAlert
+ i18n-dialogTitle i18n-dialogBody
+ dialogTitle="Invalid Hold Activation Date"
+ dialogBody="Hold activation date {{activeDateYmd}} is not valid.
+ Please chose a date in the future">
+</eg-alert-dialog>
+
<div class="row">
<div class="col-lg-1">
<button class="btn btn-info label-with-material-icon"
</div>
</div>
<div class="col-lg-6">
- <eg-date-select [(ngModel)]="activeDate" name='active-date'
- (onChangeAsIso)="activeDateSelected($event)" [disabled]="!suspend">
- </eg-date-select>
+ <div [ngClass]="{'border border-danger rounded': activeDateInvalid}">
+ <eg-date-select [(ngModel)]="activeDate" name='active-date'
+ (onChangeAsYmd)="activeDateYmd = $event"
+ (onChangeAsDate)="setActiveDate($event)"
+ (onChangeAsIso)="activeDateSelected($event)" [disabled]="!suspend">
+ </eg-date-select>
+ </div>
</div>
</div>
<div class="row mt-2" *ngIf="multiHoldsActive">
<li class="list-group-item">
<button class="btn btn-success" (click)="placeHolds()"
[disabled]="!readyToPlaceHolds()" i18n>Place Hold(s)</button>
-
<button class="btn btn-outline-dark ml-2" (click)="resetForm()" i18n>Reset</button>
</li>
</ul><!-- col -->
-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';
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;
smsValue: string;
suspend: boolean;
activeDateStr: string;
+ activeDateYmd: string;
activeDate: Date;
+ activeDateInvalid = false;
holdContexts: HoldContext[];
recordSummaries: BibRecordSummary[];
@ViewChild('smsCbox', {static: false}) smsCbox: ComboboxComponent;
+ @ViewChild('activeDateAlert') private activeDateAlert: AlertDialogComponent;
+
constructor(
private router: Router,
private route: ActivatedRoute,
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;
}
readyToPlaceHolds(): boolean {
- if (!this.user || this.placeHoldsClicked) {
+ if (!this.user || this.placeHoldsClicked || this.activeDateInvalid) {
return false;
}
if (this.notifySms) {