]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates-bootstrap/opac/parts/place_hold.tt2
LP1863252 Geosort - add dropped END tag
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / parts / place_hold.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2     PROCESS "opac/parts/hold_error_messages.tt2";
3     PROCESS "opac/parts/metarecord_hold_filters.tt2";
4 %]
5 <script>
6 // Toggle the activation date input and check the suspend checkbox.
7 // If JavaScript is disabled, the CSS will handle the former, but
8 // the latter will not happen.
9 function toggleActivationDate() {
10     var cb = document.getElementById("hold_suspend");
11     var block = document.getElementById("toggled-block-suspend");
12     var anchor = document.getElementById("actDateToggle");
13     var actText = "[%- l('Hide activation date') -%]";
14     var inActText = "[%- l('Set activation date') -%]";
15     // Check for not equal to block so it works on first click.
16     if (block.style.display != "block") {
17         block.style.display = "block";
18         anchor.innerHTML = "<i class='fas fa-calendar' aria-hidden='true'></i> " + actText;
19         if (cb.checked != true) cb.checked = true;
20     } else {
21         block.style.display = "none";
22         anchor.innerHTML = "<i class='fas fa-calendar' aria-hidden='true'></i> " + inActText;
23     }
24     // Prevent the href from being followed, thus overriding the CSS.
25     return false;
26 }
27
28 // Maybe enable or disable the num_copies select when the user selects
29 // or deselects a part.
30 function maybeToggleNumCopies(obj) {
31     var numCopies = document.getElementById("num_copies");
32     // Only if numCopies exists.
33     if (numCopies) {
34         var objValue;
35         if (obj.type == 'radio') {
36             if (obj.checked) objValue = obj.value;
37             else return;
38         } else {
39             objValue = obj.value;
40         }
41         if (objValue && objValue != '') {
42             if (numCopies.value != '1') numCopies.value = '1';
43             if (!numCopies.disabled) numCopies.disabled = true;
44         } else {
45             if (numCopies.disabled) numCopies.disabled = false;
46         }
47     }
48 }
49 </script>
50 <div class='container'>
51 <hr>
52    <h3>[% l('Place Hold') %]</h3>
53
54     [% some_holds_allowed = -1 %]
55
56     <!-- loop through the holds and display status of request where appropriate -->
57         [% FOR hdata IN ctx.hold_data;
58             attrs = {marc_xml => hdata.marc_xml};
59             PROCESS get_marc_attrs args=attrs;
60             this_hold_disallowed = 0;
61
62             IF CGI.param('hold_type') == 'M';
63               IF hdata.metarecord_filters.formats.size == 0;
64                 this_hold_disallowed = 1;
65                 # if this is the first hold and it's disallowed,
66                 # assume all holds are, until we proven otherwise
67                 SET some_holds_allowed = 0 IF some_holds_allowed == -1;
68               ELSE; some_holds_allowed = 1; END;
69             END %]
70
71        [% IF loop.first %]
72     <form method="post" name="PlaceHold" onsubmit="return validateHoldForm()" >
73         <input type="hidden" name="hold_type" value="[% CGI.param('hold_type') | html %]" />
74         [%
75             redirect = CGI.param('hold_source_page') || CGI.param('redirect_to') || CGI.referer;
76             # since we have to be logged in to get this far, return to a secure page
77             redirect = redirect.replace('^http:', 'https:')
78         %]
79         <input type="hidden" name="redirect_to" value="[% redirect | html %]" />
80         <input type="hidden" name="hold_source_page" value="[% CGI.param('hold_source_page') | html %]" />
81
82         <!-- Adding hidden fields so that parameters are maintained in
83         searchbar throughout the place hold process. -->
84         <input type="hidden" name="locg" value="[% CGI.param('locg') | html %]" />
85         <input type="hidden" name="qtype" value="[% CGI.param('qtype') | html %]" />
86         <input type="hidden" name="query" value="[% CGI.param('query') | html %]" />
87         [%
88             usr_barcode = CGI.param('usr_barcode') | html;
89             is_requestor = CGI.param('is_requestor');
90
91            IF is_requestor == '';
92                is_requestor = '0';
93            END;
94
95            IF is_requestor == '0' && usr_barcode == ctx.staff_recipient.card.barcode;
96                usr_barcode = '';
97            END;
98         %]
99
100         [% IF ctx.is_staff %]
101         <p class="staff-hold">
102             <input type="radio" id="hold_usr_is_requestor_not"
103                 onchange="staff_hold_usr_input_disabler(this);"
104                 name="hold_usr_is_requestor" value="0"
105                 />
106             <label for="hold_usr_is_requestor_not">
107                 [% l("Place hold for patron by barcode:") %]
108             </label>
109             <input type="text" name="hold_usr" id="hold_usr_input"
110               aria-label="[% l('Barcode') %]"
111               value="[% usr_barcode | html %]"
112               onpaste="return debounce_barcode_change(event)"
113               onkeydown="return debounce_barcode_change(event)" autofocus />
114             <span id="patron_name"></span>
115             <span id="patron_usr_barcode_not_found" style="display: none">
116               [% l('Patron barcode was not found') %]
117             </span>
118             [% IF ctx.is_browser_staff %]
119             <button id="hold_usr_search" type="button" class="opac-button" style="display: none;">[% l('Patron Search') %]</button>
120             [% END %]
121             <br />
122             <input type="hidden" id="staff_barcode"
123               value="[% ctx.staff_recipient.card.barcode | html %]"/>
124             <span>
125                 <input type="radio" id="hold_usr_is_requestor"
126                     onchange="staff_hold_usr_input_disabler(this);"
127                     name="hold_usr_is_requestor" value="1" />
128                 <label for="hold_usr_is_requestor">
129                     [% l("Place this hold for me ([_1] [_2])", ctx.user.first_given_name, ctx.user.family_name) | html %]
130                 </label>
131             </span>
132             [% IF CGI.param('hold_type') == 'T' AND ctx.hold_subscriptions.size > 0 AND NOT CGI.param('from_basket') %]
133               <br />
134               <!-- request for a reading group / subscription -->
135               <input type="radio" id="hold_usr_is_subscription"
136                   onchange="staff_hold_usr_input_disabler(this);"
137                   name="hold_usr_is_requestor" value="2"
138                   />
139               <label for="hold_usr_is_subscription">
140                   [% l("Place hold for patron Hold Group:") %]
141               </label>
142               <select id='select_hold_subscription' name='hold_subscription'>
143                   <option selected='selected' value=''>[% l('- Hold Groups -') %]</option>
144                   [% FOR sub IN ctx.hold_subscriptions %]
145                   <option value='[% sub.id %]'>[% sub.name | html %]</option>
146                   [% END %]
147               </select>
148             [% END %]
149             <br/>
150             <label>
151               <input id="override_blocks_subscription" name="override" type="checkbox" checked="checked"/>
152               [% l("Override all hold-blocking conditions possible?") %]
153             </label>
154         </p>
155         [% END %]
156         [% END %]
157
158         <table>
159             <tr>
160                 <td>
161                     [% IF !this_hold_disallowed %]
162                     <input type="hidden" name="hold_target" value="[% hdata.target.id | html %]" />
163                     [% END %]
164                     <div class='hold-items-list-title'>
165                         <!-- If hold is for grouped formats/editions (metarecord), show short title - else, show complete title -->
166                         [% IF CGI.param('hold_type') == 'M' %]
167                             [% attrs.title | html %]
168                         [% ELSE %]
169                             [% attrs.title_extended | html %]
170                         [% END %]
171                     </div>
172                     [% IF hdata.parts AND !this_hold_disallowed %]
173                         [% IF hdata.parts.size > 0 %]
174                         <div class='hold-div'>
175                             [% IF enable.radio.parts == 'true' %]
176                                 <span class='hold-span'><label for='select_hold_part'>[%
177                                l('Select a Part:')
178                                %]</label></span>
179                              <div class='radio-parts-selection'>
180                              [% IF !hdata.part_required %]
181                                 <span class='parts-radio-option'>
182                                  <input type='radio' name='part' value='' onchange='maybeToggleNumCopies(this);' required>[% l('All Parts') %]</span>
183                               [% END %]
184                                [% FOR part IN hdata.parts %]
185                                  <span class='parts-radio-option'><input type='radio' name='part' id=[% part.id %] value=[% part.id %] onchange='maybeToggleNumCopies(this);' required>
186                                   <label for=[% part.id %]>[% part.label | html %]</label></span>
187                               [% END %]
188                               </div>
189                           [% ELSE %]
190                             <span style='font-weight: bold;'><label for='select_hold_part'>[%
191                                 hdata.part_required ? l('Select a Part:') : l('Select a Part (optional):')
192                             %]</label></span>
193                             <select id='select_hold_part' name='part' onchange='maybeToggleNumCopies(this);'>
194                                 [% IF !hdata.part_required %]
195                                 <option selected='selected' value=''>[% l('- All Parts -') %]</option>
196                                 [% END %]
197                                 [% FOR part IN hdata.parts %]
198                                 <option value='[% part.id %]'>[% part.label | html %]</option>
199                                 [% END %]
200                             </select>
201                           [% END %]
202                         </div>
203                         [% ELSE %]
204                         <input type='hidden' name='part' value=''/>
205                         [% END %]
206                     [% END %]
207             [% INCLUDE "opac/parts/multi_hold_select.tt2" IF NOT (this_hold_disallowed AND hdata.part_required); %]
208
209                 </td>
210             </tr>
211
212             [% IF this_hold_disallowed %]
213               <tr><td>
214                 <div class="mr_holds_no_formats">
215                 [% l('This item does not have any formats available for holds placement') %]
216                 </div>
217               </td></tr>
218             [% END %]
219
220             [%  IF !loop.last AND ctx.hold_data.size > 1 %]
221             <tr class="holds_item_row_separator"><td> </td></tr>
222             [% END %]
223 </table>
224         [% END %]
225
226
227         [% IF some_holds_allowed %]
228
229         <p class="w-50">
230             [%- org_select_id = 'pickup_lib'; -%]
231             <label for="[% org_select_id %]" class="font-weight-bold">[%l('Pickup location:') %]</label>
232             [% PROCESS "opac/parts/org_selector.tt2";
233                 INCLUDE build_org_selector name='pickup_lib'
234                     value=ctx.default_pickup_lib id=org_select_id
235                     can_have_vols_only=1 hold_pickup_lib=1 %]
236         </p>
237
238             <span class="font-weight-bold">[% l('Notify when hold is ready for pickup?') %]</span>
239             <p>
240              <div class="form-check m-2">
241                 <input class="form-check-input" type="checkbox" value="t" id="email_notify" name="email_notify" [% IF !ctx.user.email %]disabled="true"[% ELSIF ctx.default_email_notify %]checked="checked"[% END %]>
242                 <label class="form-check-label" for="email_notify">
243                    [% l('Yes, by Email') %]
244
245                      [% IF !ctx.user.email and !ctx.is_staff; l('<br>No configured Email address. See "My Account" for setting your Email address.'); ELSE; %] : <span id="email_address"><b>[% ctx.user.email %]</b></span>[% END %]
246                 </label>
247             </div>
248
249
250                 <p>
251
252                 </p>
253                 [%- IF allow_phone_notifications == 'true' %]
254                 <div class="form-check m-2">
255                     <input class="form-check-input" type="checkbox" id="phone_notify_checkbox" name="phone_notify_checkbox" [% IF ctx.default_phone_notify %]checked="checked"[% END %]>
256                     <label class="form-check-label" for="phone_notify_checkbox">
257                     [% l('Yes, by Phone') %]
258                     </label>
259                 </div>
260
261                 <p>
262                     <label>[% l('Phone Number:') %]<input type="text" class="form-control" name="phone_notify" [% setting = 'opac.default_phone';
263                     IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]'
264                     [%- ELSIF ctx.user.day_phone; %] value='[% ctx.user.day_phone | html %]' [% END %]/></label>
265                 </p>
266                 [%- END -%]
267                 [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1 %]
268                 <input class="hold-alert-method" type="checkbox" id="sms_notify_checkbox" name="sms_notify_checkbox"
269                     [% IF ctx.default_sms_notify %]checked="checked"[% END %]/>
270                     <label for="sms_notify_checkbox">[% l('Yes, by Text Messaging') %]</label><br/>
271                 <p>
272                     [% INCLUDE "opac/parts/sms_carrier_selector.tt2" %]<br/>
273                     [% INCLUDE "opac/parts/sms_number_textbox.tt2" %]<br/>
274                 </p>
275                 [% END %]
276             </p>
277             <div>
278
279              [% IF ctx.hold_data.size > 0; %]
280             <div class="form-check m-2">
281                 <input class="form-check-input" type="checkbox" value="t" id="hold_suspend" name="hold_suspend">
282                 <label class="form-check-label" for="hold_suspend">
283                 [% IF ctx.hold_data.size == 1;
284                     l('Suspend this hold?');
285                 ELSE;
286                     l('Suspend these holds?');
287                 END %]
288                   <a href="#" aria-label="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" title="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" data-toggle="tooltip">
289                     <i class="fas fa-question-circle" aria-hidden="true"></i>
290                 </a>
291                 </label>
292             </div>
293                 [% END %]
294
295
296
297
298                 <a class="btn btn-sm btn-action m-2" id="actDateToggle" href="#toggled-block-suspend" onclick="return toggleActivationDate();"><i class="fas fa-calendar" aria-hidden="true"></i> [% l('Set activation date') %]</a>
299             </div>
300             <blockquote id="toggled-block-suspend">
301             <label for="thaw_date">[% l('Activate on') %]
302               <div class="input-group date" data-provide="datepicker">
303                 <input type="text" class="form-control" name="thaw_date" id="thaw_date" value="[% thaw_date | html %]" data-date-format="mm/dd/yyyy" />
304                 <div class="input-group-addon">
305                     <span class="glyphicon glyphicon-th"></span>
306                 </div>
307             </div>
308             </blockquote>
309
310          [% IF CGI.param('from_basket') %]
311
312            <div class="form-check m-2">
313                     <input class="form-check-input" type="checkbox" value="" id="clear_cart" />
314                     <label class="form-check-label" for="clear_cart">
315                         [% l('Clear basket after holds are requested?') %]
316                     </label>
317                 </div>
318         [% END %]
319                  [% IF NOT metarecords.disabled AND ctx.hold_data.size == 1 %]
320                         [% IF CGI.param('hold_type') == 'T' AND hdata.record.metarecord AND !hdata.part_required %]
321                         <!-- Grab the bre_id so that we can restore it if user accidentally clicks advanced options -->
322                            [% bre_id = hdata.target.id %]
323                             <a  id='advanced_hold_link' class="btn btn-sm btn-link"
324                                 href="[% mkurl('', {hold_type => 'M', hold_target => hdata.record.metarecord.id, bre_id => bre_id}) %]"><i class="fas fa-cog" aria-hidden="true"></i>
325                                 [% l('Advanced Hold Options') %]</a>
326                         [% END %]
327                         [% IF CGI.param('hold_type') == 'M' AND CGI.param('bre_id') %]
328                             <input type="hidden" name="bre_id" value="[% CGI.param('bre_id') %]" />
329                             <a id='basic_hold_link' class="btn btn-sm btn-link"
330                                href="[% mkurl('', {hold_target => CGI.param('bre_id'), hold_type => 'T'}) %]"><i class="fas fa-cog" aria-hidden="true"></i>
331                                 [% l('Basic Hold Options') %]</a>
332                         [% END %]
333                         [% IF hdata.metarecord_filters.formats.size OR # should this be size > 1
334                             (hdata.metarecord_filters.langs.size && hdata.metarecord_filters.langs.size > 1);
335                             PROCESS metarecord_hold_filters_selector hold_data=hdata;
336                         END;
337                     END %]
338         <div class="py-3">
339         <button id="place_hold_submit" type="submit" name="submit"  class="btn btn-confirm" ><i class="fas fa-check"></i> [% l('Submit') %]</button>
340         [% END # some_holds_allowed %]
341         <button type="reset" name="cancel" onclick="window.location='[% redirect | html %]'" id="holds_cancel" class="btn btn-deny"><i class="fas fa-ban" aria-hidden="true"></i> [% l('Cancel') %]</button>
342         </div>
343     </form>
344 </div>
345