fixing lifecycle issue
authorJane Sandberg <sandbej@linnbenton.edu>
Wed, 27 Mar 2019 00:51:54 +0000 (17:51 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 27 Mar 2019 00:51:54 +0000 (17:51 -0700)
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts

index c42558f..f2da2d1 100644 (file)
@@ -29,8 +29,6 @@ export class CreateReservationComponent implements OnInit {
 
     scheduleSource: GridDataSource = new GridDataSource();
 
-    handleResourceTypeChange: ($event: ComboboxEntry) => void;
-
     resources: IdlObject[] = [];
     limitByAttr: (attributeId: number, $event: ComboboxEntry) => void;
 
@@ -101,19 +99,6 @@ export class CreateReservationComponent implements OnInit {
             console.log('event: ' + JSON.stringify($event));
         };
 
-        this.handleResourceTypeChange = ($event: ComboboxEntry) => {
-            // TODO: unset resource barcode
-            this.attributes = [];
-            if ($event.id) {
-                this.pcrud.search('bra', {resource_type : $event.id}, {
-                    order_by: 'name ASC',
-                    flesh: 1,
-                    flesh_fields: {'bra' : ['valid_values']}
-                }).subscribe(
-                    a => { this.attributes.push(a); });
-                this.fetchData('type', $event.id);
-            }
-        };
 
     }
     showNewDialog(idlThing: IdlObject) {
@@ -125,6 +110,21 @@ export class CreateReservationComponent implements OnInit {
             err => {}
         );
     }
+
+    this.handleResourceTypeChange($event: ComboboxEntry) {
+            // TODO: unset resource barcode
+        this.attributes = [];
+        if ($event.id) {
+            this.pcrud.search('bra', {resource_type : $event.id}, {
+                order_by: 'name ASC',
+                flesh: 1,
+                flesh_fields: {'bra' : ['valid_values']}
+            }).subscribe(
+                a => { this.attributes.push(a); });
+            this.fetchData('type', $event.id);
+        }
+    }
+
     private _firstTimeIsSmaller(first: NgbTimeStruct, second: NgbTimeStruct) {
         if (first.hour < second.hour) { return true; }
         if ((first.hour === second.hour) && (first.minute < second.minute)) { return true; }