LP#1879983: Allow different granularities for the same date
[Evergreen.git] / Open-ILS / src / templates / 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     myopac_page = "holds_curbside";
8 %]
9 <h3 class="sr-only">[% l('Curbside Pickup') %]</h3>
10 <div id='myopac_holds_div'>
11
12     <div id="acct_holds_tabs">
13         <div class="align">
14             <a href='[% mkurl('holds',{},['limit','offset']) %]'>[% l("Items on Hold") %]</a>
15         </div>
16         [% IF ctx.curbside_pickup_libs.size > 0 %]
17         <div class="align selected">
18             <a href='#'>[% l("Curbside Pickup") %]</a>
19         </div>
20         [% END %]
21         [% IF ebook_api.enabled == 'true' %]
22         <div class="align">
23             <a href='[% mkurl('ebook_holds', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("E-Items on Hold") %]</a>
24         </div>
25         <div class="align">
26             <a href='[% mkurl('ebook_holds_ready', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("E-Items Ready for Checkout") %]</a>
27         </div>
28         [% END %]
29         <div class="align">
30             <a href='[% mkurl('hold_history', {}, ['limit','offset','available','sort','sort_type']) %]'>[% l("Holds History") %]</a>
31         </div>
32     </div>
33
34     <div class="header_middle">
35         <span id="acct_holds_header" style="float:left;">
36             [%  l("Curbside Pickup Appointments") %]
37         </span>
38     </div>
39     <div class="clear-both"></div>
40     <div title="[% l('Curbside Pickup Appointments') %]" style="width:90%"
41         class="egtable table_no_border_space table_no_cell_pad">
42         <div class="egtr">
43             <span class="egth">[% l('Pickup Location') %]</span>
44             <span class="egth">[% l('Date') %]</span>
45             <span class="egth">[% l('Time') %]</span>
46             <span class="egth">[% l('Arrival Notes (vehicle description, etc)') %]</span>
47             <span class="egth">[% l('Action') %]</span>
48         </div>
49         <div class="egtr">
50             <span class="egtd"><hr/></span>
51             <span class="egtd"><hr/></span>
52             <span class="egtd"><hr/></span>
53             <span class="egtd"><hr/></span>
54             <span class="egtd"><hr/></span>
55         </div>
56     [% FOR lib IN ctx.curbside_pickup_libs;
57
58         cs_slot = '';
59         cs_slot_id = '';
60         cs_date = '';
61         cs_time = '';
62         cs_notes = '';
63
64         cs_org = ctx.cs_org;
65         IF cs_org == lib;
66             cs_slot = ctx.cs_slot;
67             cs_slot_id = ctx.cs_slot_id;
68             cs_date = ctx.cs_date;
69             cs_time = ctx.cs_time;
70             cs_notes = ctx.cs_notes;
71         END;
72
73         appointment = ctx.curbside_appointments.$lib;
74         IF appointment;
75             cs_slot = appointment;
76             cs_slot_id = appointment.id;
77             IF appointment.slot; cs_date = date.format(ctx.parse_datetime(appointment.slot),'%F'); END;
78             IF appointment.slot; cs_time = date.format(ctx.parse_datetime(appointment.slot),'%T'); END;
79             cs_notes = appointment.notes;
80         END %]
81         <form class="egtr" method="POST">
82             <input type="hidden" name="action" value="curbside"/>
83             <input type="hidden" name="cs_slot_id" value="[% appointment.id %]"/>
84             [% disable_me = 0 %]
85             [% no_patron_input = 0 %]
86             [% date_started_null = 0 %]
87             [% IF appointment && appointment.arrival; disable_me = 1; END %]
88             [% IF ctx.get_org_setting(lib, 'circ.curbside.disable_patron_input'); no_patron_input = 1; END %]
89             <span class="egtd">
90                 [% ctx.get_aou(lib).name | html %]<br/>
91                 [% l('Phone:')%] [% ctx.get_aou(lib).phone | html %]
92                 <input type="hidden" name="cs_org" value="[% lib %]"/>
93             </span>
94             <span class="egtd">
95                 [% IF !cs_date; tmp_cs_date = date.format(date.now, '%F'); date_started_null = 1; %]
96                 [% ELSE; tmp_cs_date = cs_date; END %]
97                 [% IF cs_date %]<input type="hidden" name="cs_date" value="[% cs_date | html %]"/>[% END %]
98                 [% IF no_patron_input && date_started_null; %]&nbsp;
99                 [% ELSE; %]<input type="date" name="cs_date" value="[% tmp_cs_date | html %]" [% IF cs_date || no_patron_input %]disabled="disabled"[% END %]/>[% END %]
100             </span>
101             <span class="egtd">
102                 [% IF appointment || cs_date; # checking times %]
103                   [% current_date = cs_date %]
104                   [% IF date_started_null && no_patron_input %]&nbsp;
105                   [% ELSIF appointment || ctx.cs_times.$lib.$current_date.size; # show a select %]
106                     <select name="cs_time" [% IF disable_me || no_patron_input %]disabled="disabled"[% END %]>
107                       [% found_time = 0 %]
108                       [% FOR t IN ctx.cs_times.$lib.$current_date %]
109                         <option value="[% t.0 | html %]"
110                           [% IF cs_time == t.0; found_time=1 %] selected="selected"[% END %]
111                           [% IF t.1 <= 0 && cs_time != t.0 %] disabled="disabled"[% END %]>
112                             [% date.format(current_date _ ' ' _ t.0,'%l:%M %p') | html %]
113                         </option>
114                       [% END %]
115                       [% IF cs_time && !found_time %]
116                         <option value="[% cs_time | html %]" selected="selected">
117                           [% date.format(current_date _ ' ' _ cs_time,'%l:%M %p') | html %]
118                         </option>
119                       [% END %]
120                     </select>
121                   [% ELSE %] 
122                     [% l('No times available') %]
123                     <button type="submit" name="cs_action" value="reset" class="opac-button">
124                         [% l('Select another date') %]
125                     </button><br/>
126                   [% END %]
127                 [% ELSE %] 
128                   [% IF !no_patron_input; %][% l('Select a date') %][% END %]
129                 [% END %]
130             </span>
131             <span class="egtd">
132                 [% IF cs_date; # show the notes box %]
133                 <input type="text" name="cs_notes" value="[% cs_notes | html %]" [% IF no_patron_input || disable_me %]disabled="disabled"[% END %]/>
134                 [% ELSE %] &nbsp;
135                 [% END %]
136             </span>
137             <span class="egtd">[%
138                 disable_arrival_button = 1; # assume arrival is not yet allowed
139                 IF appointment && appointment.slot;
140                     stime = date.format(ctx.parse_datetime(appointment.slot), '%s');
141                     now_time = date.format(date.now, '%s');
142                     IF now_time >= stime;
143                         disable_arrival_button = 0; # if 'now' is after the slot time, allow arrival
144                     END;
145                 END %]
146                 [% IF no_patron_input %]
147                     [% l('Please contact the library to schedule, change, or cancel your appointment.') %]
148                 [% ELSIF appointment.staged && !appointment.arrival; # relevant submit action %]
149                     <button type="submit" name="cs_action" value="arrive" class="opac-button" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
150                         [% l('Alert staff of your arrival') %]
151                     </button><br/>
152                     <button type="submit" name="cs_action" value="cancel" class="opac-button">
153                         [% l('Cancel appointment') %]
154                     </button>
155                 [% ELSIF appointment.arrival %]
156                     <!--
157                     <button type="submit" name="cs_action" value="deliver" class="opac-button">
158                         [% l('Confirm delivery of items') %]
159                     </button><br/>
160                     -->
161                     <button type="submit" name="cs_action" value="cancel" class="opac-button">
162                         [% l('Cancel appointment') %]
163                     </button>
164                 [% ELSIF appointment.slot %]
165                     <button type="submit" name="cs_action" value="arrive" class="opac-button" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
166                         [% l('Alert staff of your arrival') %]
167                     </button><br/>
168                     <button type="submit" name="cs_action" value="save" class="opac-button">
169                         [% l('Update appointment') %]
170                     </button><br/>
171                     <button type="submit" name="cs_action" value="cancel" class="opac-button">
172                         [% l('Cancel appointment') %]
173                     </button>
174                 [% ELSIF cs_date %]
175                     <button type="submit" name="cs_action" value="save" class="opac-button">
176                         [% l('Request appointment') %]
177                     </button>
178                     <button type="submit" name="cs_action" value="reset" class="opac-button">
179                         [% l('Select another date') %]
180                     </button><br/>
181                 [% ELSE %]
182                     <button type="submit" name="cs_action" value="next" class="opac-button">
183                         [% l('Check available times') %]
184                     </button>
185                 [% END %]
186             </span>
187         </form>
188         <div class="egtr">
189             <span class="egtd"><hr/></span>
190             <span class="egtd"><hr/></span>
191             <span class="egtd"><hr/></span>
192             <span class="egtd"><hr/></span>
193             <span class="egtd"><hr/></span>
194         </div>
195     [% END %]
196     </div>
197 </div>
198 [% END %]