LP1816475: Fixes to granularity handling in create reservations user/sandbergja/lp1816475_booking_refresh
authorJane Sandberg <sandbej@linnbenton.edu>
Mon, 15 Apr 2019 22:45:52 +0000 (15:45 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 17 Apr 2019 20:41:53 +0000 (13:41 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.html
Open-ILS/src/eg2/src/app/staff/booking/create-reservation.component.ts

index bcb3726..8f08c20 100644 (file)
@@ -85,7 +85,7 @@
           <span class="input-group-prepend">
             <label class="input-group-text" for="granularity" i18n>Granularity</label>
           </span>
-          <eg-combobox (onChange)="changeGranularity($event)" [startId]="granularity">
+          <eg-combobox (onChange)="changeGranularity($event)" [startId]="granularity ? granularity : 30">
             <eg-combobox-entry entryId="15" entryLabel="15 minutes"
             i18n-entryLabel></eg-combobox-entry>
             <eg-combobox-entry entryId="30" entryLabel="30 minutes"
index 4454b7f..0880529 100644 (file)
@@ -199,14 +199,12 @@ export class CreateReservationComponent implements OnInit, AfterViewInit {
         this.handleMultiDayReservation = () => {
             this.multiday = true;
             this.store.setItem('eg.booking.create.multiday', true);
-            this.setGranularity();
             this.fetchData();
         };
 
         this.handleSingleDayReservation = () => {
             this.multiday = false;
             this.store.setItem('eg.booking.create.multiday', false);
-            this.setGranularity();
             this.handleDateChange(new Date());
         };
 
@@ -250,14 +248,13 @@ export class CreateReservationComponent implements OnInit, AfterViewInit {
         };
 
         this.minuteStep = () => {
-            return (this.granularity < 60) ? this.granularity : 15;
+            return (this.granularity < 60) ? this.granularity : 30;
         };
 
     }
 
     ngAfterViewInit() {
         this.dateLimiters.forEach((dl) => dl.initialDate = new Date());
-        this.setGranularity();
         this.fetchData();
 
         this.openTheDialog = (rows: IdlObject[]) => {
@@ -351,6 +348,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit {
     }
 
     fetchData () {
+        this.setGranularity();
         this.resources = [];
         let where = {'owner': this.owningLibraries};