From 02c822d9af2d5bc68023e3c2999be74735239b07 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sun, 7 Apr 2019 00:01:27 -0700 Subject: [PATCH] LP1816475: improving create fmeditor Signed-off-by: Jane Sandberg --- .../app/staff/booking/create-reservation.component.html | 12 +++++++++--- .../src/app/staff/booking/create-reservation.component.ts | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html index e007598657..91ad9a6c33 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html +++ b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html @@ -146,6 +146,7 @@ @@ -160,7 +161,12 @@ - - - + +
+
+ + + +
+
diff --git a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts index b2bb56a918..ad69ad51ba 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts @@ -12,6 +12,7 @@ import {GridComponent} from '@eg/share/grid/grid.component'; import {GridDataSource, GridRowFlairEntry} from '@eg/share/grid/grid'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; +import {PatronService} from '@eg/staff/share/patron.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {ResourceTypeComboboxComponent} from './resource-type-combobox.component'; import {ServerStoreService} from '@eg/core/server-store.service'; @@ -33,6 +34,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { isBooked: (col: any, row: any) => string; resourceAvailabilityIcon: (row: any) => GridRowFlairEntry; + patronBarcode: string; patronId: number; resourceBarcode: string; resourceId: number; @@ -47,6 +49,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { resources: IdlObject[] = []; limitByAttr: (attributeId: number, $event: ComboboxEntry) => void; useCurrentResourceBarcode: () => void; + findPatronByBarcode: () => void; setGranularity: () => void; handleMultiDayReservation: () => void; @@ -65,6 +68,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { private auth: AuthService, private format: FormatService, private net: NetService, + private patron: PatronService, private pcrud: PcrudService, private route: ActivatedRoute, private router: Router, @@ -186,6 +190,14 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { this.router.navigate(['/staff', 'booking', 'create_reservation', 'for_resource', this.resourceBarcode]); } }; + this.findPatronByBarcode = () => { + if (this.patronBarcode) { + this.patron.bcSearch(this.patronBarcode).pipe(single()).subscribe( + resp => { this.patronId = resp[0].id; }, + err => { this.toast.danger('No patron found with this barcode'); }, + ); + } + }; } @@ -198,7 +210,8 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { showNewDialog(idlThing: IdlObject) { return this.newDialog.open({size: 'lg'}).then( - ok => { + response => { + console.log(response); this.toast.success('Reservation successfully created'); // TODO: needs i18n, pluralization this.fetchData(); }, -- 2.11.0