From 0d176852f82c406122319cfd06bfee89422396c4 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sun, 7 Apr 2019 11:29:35 -0700 Subject: [PATCH] LP1816475: adding an alert when library timezones don't match Signed-off-by: Jane Sandberg --- .../app/staff/booking/create-reservation.component.html | 14 +++++++++++--- .../app/staff/booking/create-reservation.component.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) 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 3cf0f3f2db..af736ba1d7 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 @@ -148,7 +148,7 @@ @@ -174,13 +174,21 @@ - + + + + + +
Pickup library uses a different timezone than your library does. Please choose times in the pickup library's timezone.
+
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 91a3ea64b6..75a66a60d7 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 @@ -12,6 +12,7 @@ import {GridComponent} from '@eg/share/grid/grid.component'; import {GridDataSource, GridRowFlairEntry} from '@eg/share/grid/grid'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; +import {OrgService} from '@eg/core/org.service'; import {PatronService} from '@eg/staff/share/patron.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {ResourceTypeComboboxComponent} from './resource-type-combobox.component'; @@ -40,6 +41,8 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { resourceId: number; resourceTypeId: number; + pickupLibUsesDifferentTz: string; + startOfDay: NgbTimeStruct = {hour: 9, minute: 0, second: 0}; endOfDay: NgbTimeStruct = {hour: 17, minute: 0, second: 0}; granularity: 15 | 30 | 60 | 1440 = 30; // 1440 minutes = 24 hours @@ -59,6 +62,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { handleMultiDayReservation: () => void; handleSingleDayReservation: () => void; changeGranularity: ($event: ComboboxEntry) => void; + handlePickupLibChange: ($event: IdlObject) => void; @ViewChildren('dateLimiter') dateLimiters: QueryList; @ViewChildren('dateRangeLimiter') dateRangeLimiters: QueryList; @@ -72,6 +76,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { private auth: AuthService, private format: FormatService, private net: NetService, + private org: OrgService, private patron: PatronService, private pcrud: PcrudService, private route: ActivatedRoute, @@ -193,6 +198,17 @@ export class CreateReservationComponent implements OnInit, AfterViewInit { this.fetchData(); }; + this.handlePickupLibChange = ($event) => { + this.newDialog.record.pickup_lib($event); + this.org.settings('lib.timezone', $event.id()).then((tz) => { + if (tz['lib.timezone'] && (this.format.wsOrgTimezone !== tz['lib.timezone'])) { + this.pickupLibUsesDifferentTz = tz['lib.timezone'] + } else { + this.pickupLibUsesDifferentTz = null; + } + }); + }; + this.useCurrentResourceBarcode = () => { if (this.resourceBarcode) { this.router.navigate(['/staff', 'booking', 'create_reservation', 'for_resource', this.resourceBarcode]); -- 2.11.0