From 19f26d58ad1cdb7405e743c15d3087b3148e243f Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sat, 6 Apr 2019 08:32:31 -0700 Subject: [PATCH] LP1816475: respect hours of operation Signed-off-by: Jane Sandberg --- .../staff/booking/create-reservation.component.html | 2 +- .../staff/booking/create-reservation.component.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) 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 91f0b94865..b8d1e095c5 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 @@ -42,7 +42,7 @@
- + 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 6b3882e77a..ef6682a331 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 @@ -1,5 +1,6 @@ import { Component, Input, OnInit, AfterViewInit, QueryList, ViewChildren, ViewChild } from '@angular/core'; import { NgbTimeStruct } from '@ng-bootstrap/ng-bootstrap'; +import { AuthService } from '@eg/core/auth.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {DateSelectComponent} from '@eg/share/date-select/date-select.component'; import {DateRangeSelectComponent} from '@eg/share/daterange-select/daterange-select.component'; @@ -24,6 +25,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { advancedCollapsed = true; attributes: IdlObject[] = []; multiday = false; + handleDateChange: ($event: Date) => void; isBooked: (col: any, row: any) => string; resourceAvailabilityIcon: (row: any) => GridRowFlairEntry; @@ -49,6 +51,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { @ViewChild('newDialog') newDialog: FmRecordEditorComponent; constructor( + private auth: AuthService, private format: FormatService, private pcrud: PcrudService, private store: ServerStoreService, @@ -93,6 +96,23 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { this.scheduleGrids.forEach((g) => g.reload()); }; + this.handleDateChange = ($event: Date) => { + this.pcrud.retrieve('aouhoo', this.auth.user().ws_ou()) + .subscribe(hours => { + const startArray = hours['dow_' + ($event.getDay() + 6) % 7 + '_open']().split(':'); + const endArray = hours['dow_' + ($event.getDay() + 6) % 7 + '_close']().split(':'); + this.startOfDay = { + hour: ('00' == startArray[0]) ? 9 : +startArray[0], + minute: +startArray[1], + second: 0}; + this.endOfDay = { + hour: ('00' == endArray[0]) ? 17 : +endArray[0], + minute: +endArray[1], + second: 0}; + this.scheduleGrids.forEach((g) => g.reload()); + }); + } + this.handleMultiDayReservation = () => { this.multiday = true; this.setGranularity(); -- 2.11.0