From 421f1de3c438128374a3272dc6a0a33ae6a6fa9f Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sat, 18 Jan 2020 10:44:02 -0800 Subject: [PATCH] LP#1835982 follow-up: Add cellTextGenerator to booking schedule grid Signed-off-by: Jane Sandberg --- .../app/staff/booking/create-reservation.component.html | 3 ++- .../app/staff/booking/create-reservation.component.ts | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 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 1d6e6843f6..9addf19c32 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 @@ -163,6 +163,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 339561180e..e026920807 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 @@ -8,7 +8,7 @@ import {AuthService} from '@eg/core/auth.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {FormatService} from '@eg/core/format.service'; import {GridComponent} from '@eg/share/grid/grid.component'; -import {GridDataSource, GridRowFlairEntry} from '@eg/share/grid/grid'; +import {GridDataSource, GridRowFlairEntry, GridCellTextGenerator} from '@eg/share/grid/grid'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; @@ -43,6 +43,7 @@ export class CreateReservationComponent implements OnInit, AfterViewInit, OnDest attributes: IdlObject[] = []; multiday = false; resourceAvailabilityIcon: (row: ScheduleRow) => GridRowFlairEntry; + cellTextGenerator: GridCellTextGenerator; patronId: number; resourceBarcode: string; @@ -305,6 +306,19 @@ export class CreateReservationComponent implements OnInit, AfterViewInit, OnDest this.granularity, this.format.wsOrgTimezone ); + }, (err) => { + }, () => { + this.cellTextGenerator = { + 'Time': row => { + return this.multiday ? row['time'].format('LT') : + this.format.transform({value: row['time'], datatype: 'timestamp', datePlusTime: true}); + } + }; + this.resources.forEach(resource => { + this.cellTextGenerator[resource.barcode()] = row => { + return row[resource.barcode()] ? row[resource.barcode()].map(reservation => reservation['patronLabel']).join(', ') : ''; + }; + }); }); } // TODO: make this into cross-field validation, and don't fetch data if true -- 2.11.0