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 <label class="form-label input-group-text" for="ideal-reservation-type" i18n>Reservation type</label>
10 <select class="form-select" id="ideal-reservation-type" formControlName="reservationType">
11 <option *ngFor="let type of reservationTypes" [ngValue]="type" i18n>{{type.name}}</option>
16 <div class="input-group">
17 <label class="form-label input-group-text" for="ideal-reservation-date" i18n>Reservation date</label>
18 <eg-date-select *ngIf="!multiday" #dateLimiter domId="ideal-reservation-date" formControlName="idealDate"></eg-date-select>
19 <eg-daterange-select *ngIf="multiday" formControlName="idealDateRange"></eg-daterange-select>
24 <div class="card col-sm-6">
25 <h2 class="card-header" i18n>Reservation details</h2>
26 <ul ngbNav #details="ngbNav" [(activeId)]="detailsTab" [keyboard]="true" [roles]="false" role="tablist" class="nav-tabs">
27 <li role="presentation" [ngbNavItem]="'select-resource-type'">
28 <a ngbNavLink role="tab">
29 <span class="material-icons">dns</span>
30 <ng-container i18n>Choose resource by type</ng-container>
32 <ng-template ngbNavContent>
33 <div ngbPanelContent class="row">
35 <div class="input-group">
36 <label class="form-label input-group-text" for="ideal-resource-type" i18n>Search by resource type</label>
38 formControlName="resourceType"
39 domId="ideal-resource-type"
41 [asyncSupportsEmptyTermClick]="true">
45 <eg-org-family-select [hideAncestorSelector]="true" labelText="Owning library" i18n-labelText formControlName="owningLibrary">
46 </eg-org-family-select>
53 <li role="presentation" [ngbNavItem]="'select-resource'">
54 <a ngbNavLink role="tab">
55 <span class="material-icons">assignment</span>
56 <ng-container i18n>Choose resource by barcode</ng-container>
58 <ng-template ngbNavContent>
59 <div ngbPanelContent class="row">
61 <div class="input-group">
62 <label class="form-label input-group-text" for="ideal-resource-barcode" i18n>Search by resource barcode</label>
63 <input type="text" id="ideal-resource-barcode" class="form-control" formControlName="resourceBarcode">
70 <li role="presentation" [ngbNavItem]="'attributes'" [disabled]="0 === attributes.length">
71 <a ngbNavLink role="tab">
72 <span class="material-icons">filter_list</span>
73 <ng-container i18n>Limit by attributes</ng-container>
75 <ng-template ngbNavContent>
76 <ul class="list-group list-group-flush" formArrayName="selectedAttributes">
77 <li *ngFor="let attribute of attributes; let i = index" class="list-group-item">
78 <span class="input-group">
79 <label class="form-label input-group-text" for="attribute-{{attribute.id()}}" i18n>{{attribute.name()}}</label>
80 <eg-combobox [formControlName]="i">
81 <eg-combobox-entry *ngFor="let value of attribute.valid_values()"
82 [entryId]="value.id()" [entryLabel]="value.valid_value()">
91 <li role="presentation" [ngbNavItem]="'display-settings'">
92 <a ngbNavLink role="tab">
93 <span class="material-icons">settings</span>
94 <ng-container i18n>Schedule settings</ng-container>
96 <ng-template ngbNavContent>
97 <ul class="list-group list-group-flush">
98 <li class="list-group-item">
99 <span class="input-group">
100 <label class="form-label input-group-text" for="start-time" i18n>Start time</label>
101 <ngb-timepicker formControlName="startOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
104 <li class="list-group-item">
105 <span class="input-group">
106 <label class="form-label input-group-text" for="end-time" i18n>End time</label>
107 <ngb-timepicker formControlName="endOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
110 <li *ngIf="criteria.errors && criteria.errors.startOfDayNotBeforeEndOfDay" class="list-group-item">
111 <div role="alert" class="alert alert-danger">
112 <span class="material-icons" aria-hidden="true">error</span>
113 <span i18n>Start time must be before end time</span>
116 <li class="list-group-item">
117 <span class="input-group">
118 <label class="form-label input-group-text" for="granularity" i18n>Granularity</label>
119 <eg-combobox (onChange)="changeGranularity($event)" [startId]="granularity ? granularity : 30">
120 <eg-combobox-entry [entryId]="15" entryLabel="15 minutes"
121 i18n-entryLabel></eg-combobox-entry>
122 <eg-combobox-entry [entryId]="30" entryLabel="30 minutes"
123 i18n-entryLabel></eg-combobox-entry>
124 <eg-combobox-entry [entryId]="60" entryLabel="60 minutes"
125 i18n-entryLabel></eg-combobox-entry>
134 <div [ngbNavOutlet]="details" class="mt-2"></div>
138 <ng-container *ngIf="resources.length">
140 <div class="row" *ngIf="idealDate && !multiday">
141 <button class="btn btn-info col-sm-2 offset-sm-3" (click)="addDays(-1)">
142 <span class="material-icons mat-icon-in-button">keyboard_arrow_left</span>
143 <span i18n>Previous day</span>
145 <h2 class="col-sm-2 text-center" i18n>{{idealDate | formatValue:'timestamp'}}</h2>
146 <button class="btn btn-info col-sm-2" (click)="addDays(1)">
147 <span i18n>Next day</span>
148 <span class="material-icons mat-icon-in-button">keyboard_arrow_right</span>
151 <eg-grid #scheduleGrid
152 [cellTextGenerator]="cellTextGenerator"
154 (onRowActivate)="openTheDialog([$event])"
155 [dataSource]="scheduleSource"
156 [rowFlairIsEnabled]="true"
157 [rowFlairCallback]="resourceAvailabilityIcon"
158 [disablePaging]="true"
159 persistKey="disabled">
160 <eg-grid-toolbar-button label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-button>
161 <eg-grid-toolbar-action label="Create Reservation" i18n-label (onClick)="openTheDialog($event)"></eg-grid-toolbar-action>
162 <eg-grid-column path="time" [index]="true" name="Time" i18n-name [cellTemplate]="timeTemplate" ></eg-grid-column>
163 <eg-grid-column *ngFor="let resource of resources" path="{{resource.barcode()}}" [cellTemplate]="reservationsTemplate" [name]="resource.barcode()" [disableTooltip]="true"></eg-grid-column>
166 <div class="text-sm-center" *ngIf="this.resourceType.value && !resources.length" i18n>
167 There are no bookable resource that match your criteria.
168 Would you like to create <a [routerLink]="['/staff', 'admin', 'booking', 'splash']">some new resources</a>?
171 <eg-create-reservation-dialog #createDialog
172 (reservationRequestCompleted)="fetchData()"
173 [patronId]="patronId"
174 [targetResourceBarcode]="resourceBarcode"
175 [targetResource]="resourceId"
176 [targetResourceType]="resourceType.value"
177 [attributes]="flattenedSelectedAttributes"
178 [resources]="resources">
179 </eg-create-reservation-dialog>
181 <ng-template #reservationsTemplate let-row="row" let-col="col">
182 <ng-container *ngIf="row.patrons && row.patrons[col.name]">
183 <ul class="list-unstyled">
184 <li *ngFor="let reservation of row.patrons[col.name]">
185 <button class="btn btn-info" (click)="openReservationViewer(reservation['reservationId'])">
186 {{reservation['patronLabel']}}
192 <ng-template #timeTemplate let-row="row" let-col="col">
193 <ng-container *ngIf="!multiday">
194 {{row['time'].format('LT')}}
196 <ng-container *ngIf="multiday">
197 {{row['time'] | formatValue:'timestamp'}}
200 <eg-fm-record-editor #viewReservation
202 datetimeFields="start_time,end_time"
203 hiddenFields="xact_start,xact_finish,cancel_time,booking_interval">
204 </eg-fm-record-editor>
205 <eg-no-timezone-set-dialog #noTimezoneSetDialog>
206 </eg-no-timezone-set-dialog>