From: Jane Sandberg Date: Tue, 26 Mar 2019 22:39:56 +0000 (-0700) Subject: handle grid population on activated route subscription X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fd3690ec3f8cdec7591c17685cca60f48e77b28a;p=working%2FEvergreen.git handle grid population on activated route subscription --- diff --git a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts index f346c472e0..df7ba59bdb 100644 --- a/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts @@ -58,38 +58,37 @@ export class ManageReservationsComponent implements OnInit { ngOnInit() { this.route.paramMap.subscribe((params: ParamMap) => { this.patronId = +params.get('patron_id'); + if (this.patronId) { + this.pcrud.search('au', { + 'id': this.patronId, + }, { + limit: 1, + flesh: 1, + flesh_fields: {'au': ['card']} + }).subscribe( + (resp) => { this.patronBarcode = resp.card().barcode(); }, + (err) => { console.log(err); } + ); + } this.resourceBarcode = params.get('resource_barcode'); + if (this.resourceBarcode) { + this.pcrud.search('brsrc', + {'barcode' : this.resourceBarcode}, {'limit': 1}) + .pipe(single()) + .subscribe((res) => { + if (res.id()) { + this.resourceId = res.id(); + this.reservationsGrid.reloadGrid(); + } else { + this.resourceId = -1; + this.toast.danger('No resource found with this barcode'); + } + }); + } this.resourceTypeId = +params.get('resource_type_id'); this.chooseAppropriateFilter(); }); - if (this.patronId) { - this.pcrud.search('au', { - 'id': this.patronId, - }, { - limit: 1, - flesh: 1, - flesh_fields: {'au': ['card']} - }).subscribe( - (resp) => { this.patronBarcode = resp.card().barcode(); }, - (err) => { console.log(err); } - ); - } - - if (this.resourceBarcode) { - this.pcrud.search('brsrc', - {'barcode' : this.resourceBarcode}, {'limit': 1}) - .pipe(single()) - .subscribe((res) => { - if (res.id()) { - this.resourceId = res.id(); - this.reservationsGrid.reloadGrid(); - } else { - this.resourceId = -1; - this.toast.danger('No resource found with this barcode'); - } - }); - } this.setStickyFilter = ($event: NgbTabChangeEvent) => { this.store.setItem('eg.booking.manage.filter', $event.nextId);