make sure to reload grids after inputs change
authorJane Sandberg <sandbej@linnbenton.edu>
Tue, 26 Mar 2019 23:13:12 +0000 (16:13 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Tue, 26 Mar 2019 23:13:12 +0000 (16:13 -0700)
Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts

index 2e149ee..3e00b89 100644 (file)
@@ -58,6 +58,9 @@ export class ManageReservationsComponent implements OnInit {
     ngOnInit() {
         this.route.paramMap.subscribe((params: ParamMap) => {
             this.patronId = +params.get('patron_id');
+            this.resourceBarcode = params.get('resource_barcode');
+            this.resourceTypeId = +params.get('resource_type_id');
+
             if (this.patronId) {
                 this.pcrud.search('au', {
                     'id': this.patronId,
@@ -66,12 +69,12 @@ export class ManageReservationsComponent implements OnInit {
                     flesh: 1,
                     flesh_fields: {'au': ['card']}
                 }).subscribe(
-                    (resp) => { this.patronBarcode = resp.card().barcode(); },
+                    (resp) => {
+                        this.reservationsGrid.reloadGrid();
+                        this.patronBarcode = resp.card().barcode(); },
                     (err) => { console.log(err); }
                 );
-            }
-            this.resourceBarcode = params.get('resource_barcode');
-            if (this.resourceBarcode) {
+            } else if (this.resourceBarcode) {
                 this.pcrud.search('brsrc',
                 {'barcode' : this.resourceBarcode}, {'limit': 1})
                 .pipe(single())
@@ -82,8 +85,9 @@ export class ManageReservationsComponent implements OnInit {
                     this.resourceId = -1;
                     this.toast.danger('No resource found with this barcode');
                 });
+            } else if (this.resourceTypeId) {
+                this.reservationsGrid.reloadGrid();
             }
-            this.resourceTypeId = +params.get('resource_type_id');
             this.chooseAppropriateFilter();
         });