</button>
</div>
<eg-grid #scheduleGrid
+ [cellTextGenerator]="cellTextGenerator"
[sortable]="false"
(onRowActivate)="openTheDialog([$event])"
[dataSource]="scheduleSource"
<eg-grid-toolbar-button label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-button>
<eg-grid-toolbar-action label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-action>
<eg-grid-column path="time" [index]="true" name="Time" i18n-name [cellTemplate]="timeTemplate" ></eg-grid-column>
- <eg-grid-column *ngFor="let resource of resources" path="{{resource.barcode()}}" [cellTemplate]="reservationsTemplate" [disableTooltip]="true"></eg-grid-column>
+ <eg-grid-column *ngFor="let resource of resources" path="{{resource.barcode()}}" [cellTemplate]="reservationsTemplate" [name]="resource.barcode()" [disableTooltip]="true"></eg-grid-column>
</eg-grid>
</ng-container>
<div class="text-sm-center" *ngIf="this.resourceType.value && !resources.length" i18n>
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';
attributes: IdlObject[] = [];
multiday = false;
resourceAvailabilityIcon: (row: ScheduleRow) => GridRowFlairEntry;
+ cellTextGenerator: GridCellTextGenerator;
patronId: number;
resourceBarcode: string;
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