1 <eg-staff-banner bannerText="Create Reservation" i18n-bannerText>
3 <eg-title i18n-prefix i18n-suffix prefix="Booking" suffix="Create Reservation"></eg-title>
4 <form [formGroup]="criteria" class="row">
8 <div class="input-group">
9 <div class="input-group-prepend">
10 <label class="input-group-text" for="ideal-reservation-type" i18n>Reservation type</label>
12 <select class="form-control" id="ideal-reservation-type" formControlName="reservationType">
13 <option *ngFor="let type of reservationTypes" [ngValue]="type" i18n>{{type.name}}</option>
18 <div class="input-group">
19 <div class="input-group-prepend">
20 <label class="input-group-text" for="ideal-reservation-date" i18n>Reservation date</label>
22 <eg-date-select *ngIf="!multiday" #dateLimiter domId="ideal-reservation-date" formControlName="idealDate"></eg-date-select>
23 <eg-daterange-select *ngIf="multiday" formControlName="idealDateRange"></eg-daterange-select>
28 <div class="card col-sm-6">
29 <h2 class="card-header" i18n>Reservation details</h2>
30 <ngb-tabset #details="ngbTabset">
31 <ngb-tab id="select-resource-type">
32 <ng-template ngbTabTitle>
33 <span class="material-icons">dns</span>
34 <ng-container i18n>Choose resource by type</ng-container>
36 <ng-template ngbTabContent>
37 <div ngbPanelContent class="row">
39 <div class="input-group">
40 <div class="input-group-prepend">
41 <label class="input-group-text" for="ideal-resource-type" i18n>Search by resource type</label>
44 formControlName="resourceType"
45 domId="ideal-resource-type"
47 [asyncSupportsEmptyTermClick]="true">
51 <eg-org-family-select [hideAncestorSelector]="true" labelText="Owning library" i18n-labelText formControlName="owningLibrary">
52 </eg-org-family-select>
59 <ngb-tab id="select-resource">
60 <ng-template ngbTabTitle>
61 <span class="material-icons">assignment</span>
62 <ng-container i18n>Choose resource by barcode</ng-container>
64 <ng-template ngbTabContent>
65 <div ngbPanelContent class="row">
67 <div class="input-group">
68 <div class="input-group-prepend">
69 <label class="input-group-text" for="ideal-resource-barcode" i18n>Search by resource barcode</label>
71 <input type="text" id="ideal-resource-barcode" class="form-control" formControlName="resourceBarcode">
78 <ngb-tab id="attributes" [disabled]="0 === attributes.length">
79 <ng-template ngbTabTitle>
80 <span class="material-icons">filter_list</span>
81 <ng-container i18n>Limit by attributes</ng-container>
83 <ng-template ngbTabContent>
84 <ul class="list-group list-group-flush" formArrayName="selectedAttributes">
85 <li *ngFor="let attribute of attributes; let i = index" class="list-group-item">
86 <span class="input-group">
87 <span class="input-group-prepend">
88 <label class="input-group-text" for="attribute-{{attribute.id()}}" i18n>{{attribute.name()}}</label>
90 <eg-combobox [formControlName]="i">
91 <eg-combobox-entry *ngFor="let value of attribute.valid_values()"
92 [entryId]="value.id()" [entryLabel]="value.valid_value()">
101 <ngb-tab id="display-settings">
102 <ng-template ngbTabTitle>
103 <span class="material-icons">settings</span>
104 <ng-container i18n>Schedule settings</ng-container>
106 <ng-template ngbTabContent>
107 <ul class="list-group list-group-flush">
108 <li class="list-group-item">
109 <span class="input-group">
110 <span class="input-group-prepend">
111 <label class="input-group-text" for="start-time" i18n>Start time</label>
113 <ngb-timepicker formControlName="startOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
116 <li class="list-group-item">
117 <span class="input-group">
118 <span class="input-group-prepend">
119 <label class="input-group-text" for="end-time" i18n>End time</label>
121 <ngb-timepicker formControlName="endOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
124 <li *ngIf="criteria.errors && criteria.errors.startOfDayNotBeforeEndOfDay" class="list-group-item">
125 <div role="alert" class="alert alert-danger">
126 <span class="material-icons" aria-hidden="true">error</span>
127 <span i18n>Start time must be before end time</span>
130 <li class="list-group-item">
131 <span class="input-group">
132 <span class="input-group-prepend">
133 <label class="input-group-text" for="granularity" i18n>Granularity</label>
135 <eg-combobox (onChange)="changeGranularity($event)" [startId]="granularity ? granularity : 30">
136 <eg-combobox-entry [entryId]="15" entryLabel="15 minutes"
137 i18n-entryLabel></eg-combobox-entry>
138 <eg-combobox-entry [entryId]="30" entryLabel="30 minutes"
139 i18n-entryLabel></eg-combobox-entry>
140 <eg-combobox-entry [entryId]="60" entryLabel="60 minutes"
141 i18n-entryLabel></eg-combobox-entry>
152 <ng-container *ngIf="resources.length">
154 <div class="row" *ngIf="idealDate && !multiday">
155 <button class="btn btn-info col-sm-2 offset-sm-3" (click)="addDays(-1)">
156 <span class="material-icons mat-icon-in-button">keyboard_arrow_left</span>
157 <span i18n>Previous day</span>
159 <h2 class="col-sm-2 text-center" i18n>{{idealDate | formatValue:'timestamp'}}</h2>
160 <button class="btn btn-info col-sm-2" (click)="addDays(1)">
161 <span i18n>Next day</span>
162 <span class="material-icons mat-icon-in-button">keyboard_arrow_right</span>
165 <eg-grid #scheduleGrid
166 [cellTextGenerator]="cellTextGenerator"
168 (onRowActivate)="openTheDialog([$event])"
169 [dataSource]="scheduleSource"
170 [rowFlairIsEnabled]="true"
171 [rowFlairCallback]="resourceAvailabilityIcon"
172 [disablePaging]="true"
173 persistKey="disabled">
174 <eg-grid-toolbar-button label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-button>
175 <eg-grid-toolbar-action label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-action>
176 <eg-grid-column path="time" [index]="true" name="Time" i18n-name [cellTemplate]="timeTemplate" ></eg-grid-column>
177 <eg-grid-column *ngFor="let resource of resources" path="{{resource.barcode()}}" [cellTemplate]="reservationsTemplate" [name]="resource.barcode()" [disableTooltip]="true"></eg-grid-column>
180 <div class="text-sm-center" *ngIf="this.resourceType.value && !resources.length" i18n>
181 There are no bookable resource that match your criteria.
182 Would you like to create <a [routerLink]="['/staff', 'admin', 'booking', 'splash']">some new resources</a>?
185 <eg-create-reservation-dialog #createDialog
186 (onComplete)="fetchData()"
187 [patronId]="patronId"
188 [targetResourceBarcode]="resourceBarcode"
189 [targetResource]="resourceId"
190 [targetResourceType]="resourceType.value"
191 [attributes]="flattenedSelectedAttributes"
192 [resources]="resources">
193 </eg-create-reservation-dialog>
195 <ng-template #reservationsTemplate let-row="row" let-col="col">
196 <ng-container *ngIf="row[col.name]">
197 <ul class="list-unstyled">
198 <li *ngFor="let reservation of row[col.name]">
199 <button class="btn btn-info" (click)="openReservationViewer(reservation['reservationId'])">
200 {{reservation['patronLabel']}}
206 <ng-template #timeTemplate let-row="row" let-col="col">
207 <ng-container *ngIf="!multiday">
208 {{row['time'].format('LT')}}
210 <ng-container *ngIf="multiday">
211 {{row['time'] | formatValue:'timestamp'}}
214 <eg-fm-record-editor #viewReservation
216 datetimeFields="start_time,end_time"
217 hiddenFields="xact_start,xact_finish,cancel_time,booking_interval">
218 </eg-fm-record-editor>
219 <eg-no-timezone-set-dialog #noTimezoneSetDialog>
220 </eg-no-timezone-set-dialog>