lp1735828 Copy Bucket multi show status
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / booking / create-reservation.component.html
1 <eg-staff-banner bannerText="Create Reservation" i18n-bannerText>
2 </eg-staff-banner>
3 <eg-title i18n-prefix i18n-suffix prefix="Booking" suffix="Create Reservation"></eg-title>
4 <form [formGroup]="criteria" class="row">
5   <div class="col-sm-6">
6     <div class="row">
7       <div class="col">
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>
11           </div>
12           <select class="form-control" id="ideal-reservation-type" formControlName="reservationType">
13             <option *ngFor="let type of reservationTypes" [ngValue]="type" i18n>{{type.name}}</option>
14           </select>
15         </div>
16       </div>
17       <div class="col">
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>
21           </div>
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>
24         </div>
25       </div>
26     </div>
27   </div>
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>
35         </ng-template>
36         <ng-template ngbTabContent>
37           <div ngbPanelContent class="row">
38             <div class="col">
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>
42                 </div>
43                 <eg-combobox
44                   formControlName="resourceType"
45                   domId="ideal-resource-type"
46                   idlClass="brt"
47                   [asyncSupportsEmptyTermClick]="true">
48                 </eg-combobox>
49               </div>
50               <div class="col">
51                 <eg-org-family-select [hideAncestorSelector]="true" labelText="Owning library" i18n-labelText formControlName="owningLibrary">
52                 </eg-org-family-select>
53               </div>
54             </div>
55           </div>
56         </ng-template>
57       </ngb-tab>
58
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>
63         </ng-template>
64         <ng-template ngbTabContent>
65           <div ngbPanelContent class="row">
66             <div class="col">
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>
70                 </div>
71                 <input type="text" id="ideal-resource-barcode" class="form-control" formControlName="resourceBarcode">
72               </div>
73             </div>
74           </div>
75         </ng-template>
76       </ngb-tab>
77
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>
82         </ng-template>
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>
89                 </span>
90                 <eg-combobox [formControlName]="i">
91                   <eg-combobox-entry *ngFor="let value of attribute.valid_values()"
92                     [entryId]="value.id()" [entryLabel]="value.valid_value()">
93                   </eg-combobox-entry>
94                 </eg-combobox>
95               </span>
96             </li>
97           </ul>
98         </ng-template>
99       </ngb-tab>
100
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>
105         </ng-template>
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>
112                 </span>
113                 <ngb-timepicker formControlName="startOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
114               </span>
115             </li>
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>
120                 </span>
121                 <ngb-timepicker formControlName="endOfDay" [minuteStep]="minuteStep()" [meridian]="true"></ngb-timepicker>
122               </span>
123             </li>
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>
128               </div>
129             </li>
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>
134                 </span>
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>
142                 </eg-combobox>
143               </span>
144             </li>
145           </ul>
146         </ng-template>
147       </ngb-tab>
148     </ngb-tabset>
149   </div>
150 </form>
151
152 <ng-container *ngIf="resources.length">
153   <hr>
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>
158     </button>
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>
163     </button>
164   </div>
165   <eg-grid #scheduleGrid
166     [cellTextGenerator]="cellTextGenerator"
167     [sortable]="false"
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>
178   </eg-grid>
179 </ng-container>
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>?
183 </div>
184
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>
194
195 <ng-template #reservationsTemplate let-row="row" let-col="col">
196   <ng-container *ngIf="row.patrons && row.patrons[col.name]">
197     <ul class="list-unstyled">
198       <li *ngFor="let reservation of row.patrons[col.name]">
199         <button class="btn btn-info" (click)="openReservationViewer(reservation['reservationId'])">
200           {{reservation['patronLabel']}}
201         </button>
202       </li>
203     </ul>
204   </ng-container>
205 </ng-template>
206 <ng-template #timeTemplate let-row="row" let-col="col">
207   <ng-container *ngIf="!multiday">
208     {{row['time'].format('LT')}}
209   </ng-container>
210   <ng-container *ngIf="multiday">
211     {{row['time'] | formatValue:'timestamp'}}
212   </ng-container>
213 </ng-template>
214 <eg-fm-record-editor #viewReservation
215   idlClass="bresv"
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>