]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/myopac/holds_curbside.tt2
LP1895737: Add Curbside Appointments to Bootstrap OPAC
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / holds_curbside.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/hold_status.tt2";
4     PROCESS "opac/parts/hold_notify.tt2";
5     PROCESS "opac/parts/myopac/column_sort_support.tt2";
6     WRAPPER "opac/parts/myopac/base.tt2";
7
8     myopac_page = "holds_curbside";
9     parent="holds";
10     limit = (ctx.holds_limit.defined) ? ctx.holds_limit : 0;
11     offset = (ctx.holds_offset.defined) ? ctx.holds_offset : 0;
12     count = (ctx.holds_ids.size.defined) ? ctx.holds_ids.size : 0;
13 %]
14 <h3> [% l("Curbside Pickup Appointments") %]</h3>
15 <div>
16     <div id='holds_main'>
17           <div class="row">
18             <div class="col-8">
19              [% IF offset != 0 %]<a href='[% mkurl('holds', {limit => limit,offset => (offset - limit)}) %]'
20               ><span class="np_nav_link classic_link btn btn-action">&#9668;[% l('Previous') %]</span></a> [% END %]
21
22              [% IF offset > 0 || count > limit; curpage = 0; WHILE curpage * limit < count; IF curpage * limit == offset; %]
23                   <span class="np_nav_link classic_link btn btn-action disabled">[% curpage + 1 %]</span>
24
25                     [%- ELSE %]
26                 <a href='[% mkurl('holds', {limit => limit, offset => (curpage * limit)}) %]' class="np_nav_link classic_link btn btn-action">[% curpage + 1 %]</a>
27                     [%- END; curpage = curpage + 1; END; END %]
28                 <span style="padding-left:5px;" class='error'>
29                     [%  IF ctx.hold_suspend_post_capture; l('One or more holds could not be suspended because the item is at (or en route to) the pickup library.'); END; %]
30                 </span>
31
32                 [% IF count > limit + offset %]<a href='[% mkurl('holds', {limit => limit, offset => (offset + limit)}) %]'
33                   ><span class="np_nav_link classic_link btn btn-action">[% l('Next') %]&#9658;</span></a>[% END %]
34             </div>
35           </div>
36
37         [% IF ctx.holds.size && ctx.holds.size < 1 %]
38         <div class="warning_box">[% l('No holds found.') %]</div>
39         [% ELSE %]
40     <div class="w-100">
41     [% FOR lib IN ctx.curbside_pickup_libs;
42
43         cs_slot = '';
44         cs_slot_id = '';
45         cs_date = '';
46         cs_time = '';
47         cs_notes = '';
48
49         cs_org = ctx.cs_org;
50         IF cs_org == lib;
51             cs_slot = ctx.cs_slot;
52             cs_slot_id = ctx.cs_slot_id;
53             cs_date = ctx.cs_date;
54             cs_time = ctx.cs_time;
55             cs_notes = ctx.cs_notes;
56         END;
57
58         appointment = ctx.curbside_appointments.$lib;
59         IF appointment;
60             cs_slot = appointment;
61             cs_slot_id = appointment.id;
62             IF appointment.slot; cs_date = date.format(ctx.parse_datetime(appointment.slot),'%F'); END;
63             IF appointment.slot; cs_time = date.format(ctx.parse_datetime(appointment.slot),'%T'); END;
64             cs_notes = appointment.notes;
65         END %]
66         <form class="egtr" method="POST">
67             <input type="hidden" name="action" value="curbside"/>
68             <input type="hidden" name="cs_slot_id" value="[% appointment.id %]"/>
69             <table class="table table-bordered miniTable curbsideApptTable w-100 my-3">
70                 <thead>
71                     <th>[% l('Pickup Location') %]</th>
72                     <th>[% l('Date') %]</th>
73                     <th>[% l('Time') %]</th>
74                     <th>[% l('Arrival Notes') %]
75                         <a href="#" title="" data-toggle="tooltip" data-original-title="Vehicle Description, etc.">
76                             <i class="fas fa-question-circle" aria-hidden="true"></i>
77                         </a>
78                     </th>
79                     <th>[% l('Action') %]</th>
80                 </thead>
81                 <tbody><tr>
82             [% disable_me = 0 %]
83             [% no_patron_input = 0 %]
84             [% date_started_null = 0 %]
85             [% IF appointment && appointment.arrival; disable_me = 1; END %]
86             [% IF ctx.get_org_setting(lib, 'circ.curbside.disable_patron_input'); no_patron_input = 1; END %]
87             <td>
88                 [% ctx.get_aou(lib).name | html %]<br/>
89                 [% l('Phone:')%] [% ctx.get_aou(lib).phone | html %]
90                 <input type="hidden" name="cs_org" value="[% lib %]"/>
91             </td>
92             <td>
93                 [% IF !cs_date || ( date.format(cs_date _ ' 12:00:00', '%Y%m%d') < date.format(date.now, '%Y%m%d') ); cs_date = ''; tmp_cs_date = date.format(date.now, '%F'); date_started_null = 1; %]
94                 [% ELSE; tmp_cs_date = cs_date; END %]
95                 [% IF cs_date %]<input type="hidden" name="cs_date" value="[% cs_date | html %]"/>[% END %]
96                 [% IF no_patron_input && date_started_null; %]&nbsp;
97                 [% ELSE; %]<input type="date" name="cs_date" min="[% date.format(date.now, '%F') %]" value="[% tmp_cs_date | html %]" [% IF cs_date || no_patron_input %]disabled="disabled"[% END %]/>[% END %]
98             </td>
99             <td>
100                 [% IF appointment || cs_date; # checking times %]
101                   [% current_date = cs_date %]
102                   [% IF date_started_null && no_patron_input %]&nbsp;
103                   [% ELSIF appointment || ctx.cs_times.$lib.$current_date.size; # show a select %]
104                     <select name="cs_time" [% IF disable_me || no_patron_input %]disabled="disabled"[% END %]>
105                       [% found_time = 0 %]
106                       [% FOR t IN ctx.cs_times.$lib.$current_date %]
107                         <option value="[% t.0 | html %]"
108                           [% IF cs_time == t.0; found_time=1 %] selected="selected"[% END %]
109                           [% IF t.1 <= 0 && cs_time != t.0 %] disabled="disabled"[% END %]>
110                             [% date.format(current_date _ ' ' _ t.0,'%l:%M %p') | html %]
111                         </option>
112                       [% END %]
113                       [% IF cs_time && !found_time %]
114                         <option value="[% cs_time | html %]" selected="selected">
115                           [% date.format(current_date _ ' ' _ cs_time,'%l:%M %p') | html %]
116                         </option>
117                       [% END %]
118                     </select>
119                   [% ELSE %] 
120                     [% l('No times available for selected date') %]
121                   [% END %]
122                 [% ELSE %] 
123                   [% IF !no_patron_input; %][% l('Select a date') %][% END %]
124                 [% END %]
125             </td>
126             <td>
127                 [% IF cs_date; # show the notes box %]
128                 <input type="text" name="cs_notes" value="[% cs_notes | html %]" [% IF no_patron_input || disable_me %]disabled="disabled"[% END %]/>
129                 [% ELSE %] &nbsp;
130                 [% END %]
131             </td>
132             <td>[%
133                 disable_arrival_button = 1; # assume arrival is not yet allowed
134                 IF appointment && appointment.slot;
135                     stime = date.format(ctx.parse_datetime(appointment.slot), '%s');
136                     now_time = date.format(date.now, '%s');
137                     IF now_time >= stime;
138                         disable_arrival_button = 0; # if 'now' is after the slot time, allow arrival
139                     END;
140                 END %]
141                 [% IF no_patron_input %]
142                     [% l('Please contact the library to schedule, change, or cancel your appointment.') %]
143                 [% ELSIF appointment.staged && !appointment.arrival; # relevant submit action %]
144                     <button type="submit" name="cs_action" value="arrive" class="btn btn-sm btn-action" style="margin: .25em;" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
145                        <i class="fas fa-bell" aria-hidden="true"></i> [% l('Alert staff of your arrival') %]
146                     </button><br/>
147                     <button type="submit" name="cs_action" value="cancel" class="btn btn-sm btn-danger" style="margin: .25em;">
148                        <i class="fas fa-ban" aria-hidden="true"></i> [% l('Cancel') %]
149                     </button>
150                 [% ELSIF appointment.arrival %]
151                     [% l('Staff have been notified of your arrival.') %]<br/>
152                     <!--
153                     <button type="submit" name="cs_action" value="deliver" class="btn btn-" style="margin: .25em;">
154                         [% l('Confirm delivery of items') %]
155                     </button><br/>
156                     -->
157                     <button type="submit" name="cs_action" value="cancel" class="btn btn-sm btn-danger" style="margin: .25em;">
158                        <i class="fas fa-ban" aria-hidden="true"></i> [% l('Cancel') %]
159                     </button>
160                 [% ELSIF appointment.slot %]
161                     <button type="submit" name="cs_action" value="arrive" class="btn btn-sm btn-action" style="margin: .25em;" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
162                        <i class="fas fa-bell" aria-hidden="true"></i> [% l('Alert staff of your arrival') %]
163                     </button><br/>
164                     <button type="submit" name="cs_action" value="save" class="btn btn-sm btn-action" style="margin: .25em;">
165                        <i class="fas fa-edit" aria-hidden="true"></i> [% l('Update') %]
166                     </button><br/>
167                     <button type="submit" name="cs_action" value="cancel" class="btn btn-sm btn-danger" style="margin: .25em;">
168                        <i class="fas fa-ban" aria-hidden="true"></i> [% l('Cancel') %]
169                     </button>
170                 [% ELSIF cs_date %]
171                     <button type="submit" name="cs_action" value="save" class="btn btn-sm btn-action" style="margin: .25em;">
172                        <i class="fas fa-check" aria-hidden="true"></i> [% l('Request appointment') %]
173                     </button>
174                     <button type="submit" name="cs_action" value="reset" class="btn btn-sm btn-opac" style="margin: .25em;">
175                        <i class="fas fa-calendar" aria-hidden="true"></i> [% l('Select another date') %]
176                     </button><br/>
177                 [% ELSE %]
178                     <button type="submit" name="cs_action" value="next" class="btn btn-sm btn-opac" style="margin: .25em;">
179                        <i class="fas fa-clock" aria-hidden="true"></i> [% l('Check times') %]
180                     </button>
181                 [% END %]
182             </td>
183         </tr></tbody></table>
184         </form>
185     [% END %]
186     </div>
187
188         [% END %]
189     </div>
190 </div>
191 [% END %]