+<eg-patron-search-dialog #patronSearch>
+</eg-patron-search-dialog>
<ng-template #dialogContent>
<div class="modal-header bg-info">
<h3 class="modal-title" i18n>Confirm Reservation Details</h3>
<div class="form-group row">
<label class="col-lg-4 text-right font-weight-bold"
i18n for="create-patron-barcode">Patron barcode</label>
- <input type="text" id="create-patron-barcode"
- class="form-control col-lg-7" formControlName="patronBarcode" [disabled]="patronId">
+ <div class="col-lg-7">
+ <input type="text" id="create-patron-barcode"
+ class="form-control " formControlName="patronBarcode" [disabled]="patronId">
+ <button class="btn btn-outline-dark btn-sm" (click)="searchPatrons()">
+ <span class="material-icons mat-icon-in-button align-middle"
+ i18n-title title="Search for Patron">search</span>
+ <span class="align-middle" i18n>Search for Patron</span>
+ </button>
+ </div>
<span class="col-lg-7 offset-lg-4" i18n>
{{ (patron$ | async)?.first_given_name}}
{{ (patron$ | async)?.second_given_name}}
import {DialogComponent} from '@eg/share/dialog/dialog.component';
import {notBeforeMomentValidator} from '@eg/share/validators/not_before_moment_validator.directive';
import {PatronBarcodeValidator} from '@eg/share/validators/patron_barcode_validator.directive';
+import {PatronSearchDialogComponent} from '@eg/staff/share/patron/search-dialog.component';
import {ToastService} from '@eg/share/toast/toast.service';
import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
public disableOrgs: () => number[];
addBresv$: () => Observable<any>;
@ViewChild('fail', { static: true }) private fail: AlertDialogComponent;
+ @ViewChild('patronSearch') patronSearch: PatronSearchDialogComponent;
handlePickupLibChange: ($event: IdlObject) => void;
ngOnInit() {
this.create = new FormGroup({
- // TODO: replace this control with a patron search form
- // when available in the Angular client
'patronBarcode': new FormControl('',
[Validators.required],
[this.pbv.validate]
.subscribe(() => this.openPatronReservations());
}
+ searchPatrons() {
+ this.patronSearch.open({size: 'xl'}).toPromise().then(
+ patrons => {
+ if (!patrons || patrons.length === 0) { return; }
+ const user = patrons[0];
+ this.create.patchValue({patronBarcode: user.card().barcode()});
+ }
+ );
+ }
+
get emailNotify() {
return this.create.get('emailNotify').value;
}