Bug 11142 - Update Bootstrap theme's place hold form to match the new version in...
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-reserve.tt
1 [% USE Koha %]
2 [% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog ›  Placing a hold
3 [% INCLUDE 'doc-head-close.inc' %]
4 [% BLOCK cssinclude %][% END %]
5 </head>
6
7 <body id="opac-holds">
8 [% INCLUDE 'masthead.inc' %]
9
10 <div class="main">
11     <ul class="breadcrumb">
12         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
13         <li><a href="#">Placing a hold</a></li>
14     </ul>
15
16     <div class="container">
17
18                 <div id="holds">
19                     [% IF ( message ) %]
20                         [% IF ( GNA ) %]
21                             <div id="gna" class="alert">
22                                 <p><strong>Sorry</strong>, you cannot place holds because the library doesn't have up-to-date <a href="/cgi-bin/koha/opac-memberentry.pl">contact information</a> on file.</p>
23                                 <p>Please contact your librarian, or use the <a href="/cgi-bin/koha/opac-memberentry.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)</p>
24                             </div>
25                         [% END %]
26
27                         [% IF ( lost ) %]
28                             <div id="lost" class="alert">
29                                 <p><strong>Sorry</strong>, you cannot place holds because your library card has been marked as lost or stolen.</p>
30                                 <p>If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.</p>
31                             </div>
32                         [% END %]
33
34                         [% IF ( debarred ) %]
35                             <div id="debarred" class="alert">
36                                 <p><strong>Sorry</strong>, you cannot place holds because your account has been frozen.</p>
37                                 <p>Usually the reason for freezing an account is old overdues or damage fees.   If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please consult a librarian.</p>
38                             </div>
39                         [% END %]
40
41                         [% IF ( too_much_oweing ) %]
42                             <div id="too_much_oweing" class="alert">
43                                 Sorry, you cannot place holds because you owe [% too_much_oweing %].
44                             </div>
45                         [% END %]
46
47                         [% IF ( too_many_reserves ) %]
48                             <div id="too_many_reserves" class="alert">
49                                 Sorry, you cannot place more than [% too_many_reserves %] holds.
50                             </div>
51                         [% END %]
52
53                         [% IF ( bad_biblionumber ) %]
54                             <div id="bad_biblionumber" class="alert">
55                                 ERROR: No biblio record found for biblionumber [% bad_biblionumber %].</div>
56                         [% END %]
57
58                         [% IF ( no_items_selected ) %]
59                             <div id="no_items_selected" class="alert">
60                                 You must select at least one item.
61                             </div>
62                         [% END %]
63
64                         [% IF ( no_branch_selected ) %]
65                             <div id="no_branch_selected" class="alert">
66                                 You must select a library for pickup.
67                             </div>
68                         [% END %]
69
70                         [% IF ( no_biblionumber ) %]
71                             <div id="no_biblionumber" class="alert">ERROR: No biblionumber received.</div>
72                         [% END %]
73
74                         [% IF ( bad_data ) %]
75                             <div id="bad_data" class="alert">ERROR: Internal error: incomplete hold request.</div>
76                         [% END %]
77
78                     [% ELSE %]
79
80                         [% IF ( none_available ) %]
81                             <div id="none_available" class="alert"><strong>Sorry</strong>, none of these items can be placed on hold.
82                             </div>
83                         [% END %]
84
85                     [% END # / IF message %]
86
87                     [% UNLESS ( message ) %]
88                         [% UNLESS ( none_available ) %]
89                             <h3>Confirm holds for:
90                                 [% FOREACH USER_INF IN USER_INFO %]
91                                     [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
92                                 [% END %]
93                             </h3>
94                         [% END # / UNLESS none_available %]
95
96                         [% IF (RESERVE_CHARGE) %]
97                             <div class="alert" id="reserve_fee">
98                                 There is a charge of [% RESERVE_CHARGE %] for placing this hold
99                             </div>
100                         [% END %]
101
102                         <form action="/cgi-bin/koha/opac-reserve.pl" method="post" id="hold-request-form">
103                             <input type="hidden" name="place_reserve" value="1"/>
104                             <!-- These values are set dynamically by js -->
105                             <input type="hidden" name="biblionumbers" id="biblionumbers"/>
106                             <input type="hidden" name="selecteditems" id="selections"/>
107                             <div id="bigloop">
108
109                                 [% FOREACH bibitemloo IN bibitemloop %]
110                                     <div class="holdrow">
111                                         <p>
112                                             [% IF ( bibitemloo.holdable ) %]
113                                                 <input class="reserve_mode" name="reserve_mode" type="hidden" value="single"/>
114                                                 <input class="single_bib" name="single_bib" type="hidden" value="[% bibitemloo.biblionumber %]"/>
115                                                 <span class="confirmjs_hold" title="[% bibitemloo.biblionumber %]" style="padding:.3em"></span>
116                                                 <span class="confirm_nonjs">
117                                                     <input type="radio" class="confirmbox checkitem [% bibitemloo.biblionumber %]" name="[% bibitemloo.biblionumber %]" checked="checked" id="single_[% bibitemloo.biblionumber %]" value="any" />
118                                                     <label class="confirm_label" for="single_[% bibitemloo.biblionumber %]">Place a hold on </label>
119                                                 </span>
120                                             [% END # / bibitemloo.holdable %]
121
122                                             <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% bibitemloo.biblionumber %]">
123                                                 [% bibitemloo.title |html %]
124                                                 [% IF ( bibitemloo.subtitle ) %]
125                                                     [% FOREACH subtitl IN bibitemloo.subtitle %]
126                                                         [% subtitl.subfield %]
127                                                     [% END %]
128                                                 [% END %]
129                                             </a>
130                                             [% IF ( bibitemloo.author ) %],  by [% bibitemloo.author %][% END %]
131                                         </p>
132
133                                         [% UNLESS ( bibitemloo.holdable ) %]
134                                             [% IF ( bibitemloo.already_reserved ) %]
135                                                 <div class="alert">You have already requested this title.</div>
136                                             [% ELSE %]
137                                                 [% UNLESS ( bibitemloo.bib_available ) %]
138                                                     <div class="alert">No available items.</div>
139                                                 [% ELSE %]
140                                                     [% IF ( bibitemloo.already_patron_possession ) %]
141                                                         <div class="alert">This title cannot be requested because it's already in your possession.</div>
142                                                     [% ELSE %]
143                                                         <div class="alert">This title cannot be requested.</div>
144                                                     [% END %]
145                                                 [% END # / UNLESS bibitemloo.bib_available %]
146                                             [% END # / IF bibitemloo.already_reserved %]
147                                         [% END # / UNLESS bibitemloo.holdable %]
148
149                                         [% IF ( bibitemloo.holdable ) %]
150                                             <fieldset class="rows">
151                                                 <ul>
152                                                     <!-- HOLDABLE -->
153                                                     [% UNLESS ( item_level_itypes ) %]
154                                                         <li class="itype">
155                                                             <span class="label">Item type: </span>
156                                                             [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %]
157                                                             [% bibitemloo.description %]
158                                                         </li>
159                                                     [% END %]
160
161                                                     [% IF showholds || showpriority %]
162                                                         <li class="priority">
163                                                             <span class="label">Holds and priority: </span>
164                                                             [% IF showpriority %] [% bibitemloo.rank %] [% END %]
165                                                             [% IF showholds && showpriority %] out of [% END %]
166                                                             [% IF showholds %] [% bibitemloo.reservecount %] [% END %]
167                                                         </li>
168                                                     [% END %]
169
170
171                                                     [% UNLESS ( singleBranchMode ) %]
172                                                         [% IF ( bibitemloo.holdable && choose_branch ) %]
173                                                             <li class="branch">
174                                                                 <label for="branch_[% bibitemloo.biblionumber %]">Pick up location:</label>
175                                                                 [% UNLESS ( bibitemloo.holdable ) %]
176                                                                     <select name="branch" id="branch_[% bibitemloo.biblionumber %]" disabled="disabled">
177                                                                         [% FOREACH branchloo IN bibitemloo.branchloop %]
178                                                                             [% IF ( branchloo.selected ) %]
179                                                                                 <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
180                                                                             [% ELSE %]
181                                                                                 <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
182                                                                             [% END %]
183                                                                         [% END %]
184                                                                     </select>
185                                                                 [% ELSE %]
186                                                                     <select name="branch" id="branch_[% bibitemloo.biblionumber %]">
187                                                                         [% FOREACH branchloo IN bibitemloo.branchloop %]
188                                                                             [% IF ( branchloo.selected ) %]
189                                                                                 <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
190                                                                             [% ELSE %]
191                                                                                 <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
192                                                                             [% END %]
193                                                                         [% END %]
194                                                                     </select>
195                                                                 [% END # / UNLESS bibitemloo.holdable %]
196                                                             </li>
197                                                         [% END # / IF bibitemloo.holdable && choose_branch %]
198                                                     [% END # / UNLESS singleBranchMode %]
199                                                 </ul>
200
201                                                 <a class="toggle-hold-options" id="toggle-hold-options-[% bibitemloo.biblionumber %]" style="display:none;" href="#">Show more options</a>
202
203                                                 <div id="hold-options-[% bibitemloo.biblionumber %]" class="hold-options">
204
205                                                     <ul>
206                                                         [% IF ( reserve_in_future ) %]
207                                                             <li>
208                                                                 <label for="from[% bibitemloo.biblionumber %]">Hold starts on date:</label>
209                                                                 <input name="reserve_date_[% bibitemloo.biblionumber %]" id="from[% bibitemloo.biblionumber %]" size="10" class="holddatefrom"/>
210                                                                 <span class="date-format from" data-biblionumber="[% bibitemloo.biblionumber %]">[% INCLUDE 'date-format.inc' %]</span>
211                                                             </li>
212                                                         [% END %]
213
214                                                         <li>
215                                                             <label for="to[% bibitemloo.biblionumber %]">Hold not needed after:</label>
216                                                             <input name="expiration_date_[% bibitemloo.biblionumber %]" id="to[% bibitemloo.biblionumber %]" size="10" class="holddateto" />
217                                                             <span class="date-format to" data-biblionumber="[% bibitemloo.biblionumber %]">[% INCLUDE 'date-format.inc' %]</span>
218                                                         </li>
219
220                                                         [% IF ( OpacHoldNotes ) %]
221                                                             <li>
222                                                                 <div class="notesrow" id="notesrow_[% bibitemloo.biblionumber %]">
223                                                                     <label for="holdnotes[% bibitemloo.biblionumber %]">Hold notes:</label>
224                                                                     <span id="forcenotesreason_[% bibitemloo.biblionumber %]" class="forcenotesreason"></span>
225                                                                     <textarea id="holdnotes[% bibitemloo.biblionumber %]" rows="2" cols="30" name="notes_[% bibitemloo.biblionumber %]">[% bibitemloo.holdnotes %]</textarea>
226                                                                     <input type="hidden" id="notesmandatory_[% bibitemloo.biblionumber %]" value="[% bibitemloo.mandatorynotes %]"/>
227                                                                 </div>
228                                                             </li>
229                                                         [% END # / IF OpacHoldNotes %]
230
231                                                         [% IF ( OPACItemHolds ) %]
232                                                             <!-- ITEM HOLDS -->
233                                                             <li class="lradio">
234                                                                 <label class="radio inline" for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
235                                                                 [% UNLESS ( bibitemloo.holdable ) %]
236                                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqany_[% bibitemloo.biblionumber %]" class="selectany" value="Any" disabled="disabled" />
237                                                                 [% ELSE %]
238                                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqany_[% bibitemloo.biblionumber %]" class="selectany" value="Any" checked="checked" />
239                                                                 [% END %]
240
241                                                                 <label class="radio inline" for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
242                                                                 [% UNLESS ( bibitemloo.holdable ) %]
243                                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqspecific_[% bibitemloo.biblionumber %]" class="selectspecific" disabled="disabled" value="Specific" />
244                                                                 [% ELSE %]
245                                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" id="reqspecific_[% bibitemloo.biblionumber %]" class="selectspecific" value="Specific" />
246                                                                 [% END %]
247                                                             </li>
248                                                         [% END # / IF OPACItemHolds %]
249                                                     </ul>
250
251                                                     [% IF ( OPACItemHolds ) %]
252                                                         <table class="copiesrow table table-bordered table-striped" id="copiesrow_[% bibitemloo.biblionumber %]">
253                                                             <caption>Select a specific copy:</caption>
254                                                             <tr>
255                                                                 <th>Copy</th>
256                                                                 [% IF ( item_level_itypes ) %]
257                                                                     <th>Item type</th>
258                                                                 [% END %]
259                                                                 <th>Barcode</th>
260                                                                 [% UNLESS ( singleBranchMode ) %]
261                                                                     <th>Home library</th>
262                                                                     <th>Last location</th>
263                                                                 [% END %]
264                                                                 <th>Call number</th>
265                                                                 [% IF ( itemdata_enumchron ) %]
266                                                                     <th>Vol info</th>
267                                                                 [% END %]
268                                                                 <th>Information</th>
269                                                             </tr>
270
271                                                             [% FOREACH itemLoo IN bibitemloo.itemLoop %]
272                                                                 <tr class="[% itemLoo.backgroundcolor %]">
273                                                                     <td class="copy">
274                                                                         [% IF ( itemLoo.available ) %]
275                                                                             <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" value="[% itemLoo.itemnumber %]" />
276                                                                         [% ELSE %]
277                                                                             <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
278                                                                             <img src="[% interface %]/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
279                                                                         [% END %]
280
281                                                                         [% IF ( itemLoo.copynumber ) %]
282                                                                             [% itemLoo.copynumber %]
283                                                                         [% END %]
284                                                                     </td>
285
286                                                                     [% IF ( item_level_itypes ) %]
287                                                                         <td class="itype">
288                                                                             [% UNLESS ( noItemTypeImages ) %]
289                                                                                 [% IF ( itemLoo.imageurl ) %]
290                                                                                     <img src="[% itemLoo.imageurl %]" alt="" />
291                                                                                 [% END %]
292                                                                             [% END %]
293                                                                             [% itemLoo.description %]
294                                                                         </td>
295                                                                     [% END %]
296
297                                                                     <td class="barcode">[% itemLoo.barcode %]</td>
298                                                                     [% UNLESS ( singleBranchMode ) %]
299                                                                         <td class="homebranch">[% itemLoo.homeBranchName %]</td>
300                                                                         <td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
301                                                                     [% END %]
302                                                                     <td class="call_no">[% itemLoo.callNumber %]</td>
303                                                                     [% IF ( itemdata_enumchron ) %]
304                                                                         <td class="vol_info">[% itemLoo.enumchron %]</td>
305                                                                     [% END %]
306                                                                     <td class="information">
307                                                                         [% IF ( itemLoo.dateDue ) %]
308                                                                             <span class="checkedout">Due [% itemLoo.dateDue %]</span>
309                                                                         [% ELSIF ( itemLoo.transfertwhen ) %]
310                                                                             <span class="intransit">In transit from [% itemLoo.transfertfrom %] to [% itemLoo.transfertto %] since [% itemLoo.transfertwhen %]</span>
311                                                                         [% END %]
312
313                                                                         [% IF ( itemLoo.message ) %]
314                                                                             <span class="lost">Unavailable (lost or missing)</span>
315                                                                         [% END %]
316
317                                                                         [% IF ( itemLoo.notforloan ) %]
318                                                                             <span class="notforloan">Not for loan ([% itemLoo.notforloanvalue %])</span>
319                                                                         [% END %]
320
321                                                                         [% IF ( itemLoo.reservedate ) %]
322                                                                             <span class="waiting">
323                                                                                 [% IF ( itemLoo.waitingdate ) %]
324                                                                                     Waiting
325                                                                                 [% ELSE %]
326                                                                                     On hold
327                                                                                 [% END %]
328                                                                                 for patron
329                                                                                 [% IF ( itemLoo.waitingdate ) %]
330                                                                                     at
331                                                                                 [% ELSE %]
332                                                                                     expected at
333                                                                                 [% END %]
334                                                                                 [% itemLoo.ExpectedAtLibrary %] since
335                                                                                 [% IF ( itemLoo.waitingdate ) %]
336                                                                                     [% itemLoo.waitingdate %]
337                                                                                 [% ELSE %]
338                                                                                     [% IF ( itemLoo.reservedate ) %]
339                                                                                         [% itemLoo.reservedate %]
340                                                                                     [% END %]
341                                                                                 [% END %].
342                                                                             </span>
343                                                                         [% ELSE %]
344                                                                             <span class="notonhold">Not on hold</span>
345                                                                         [% END # / IF ( itemLoo.reservedate )%]
346                                                                     </td>
347                                                                 </tr>
348                                                             [% END # / FOREACH itemLoo IN bibitemloo.itemLoop%]
349                                                         </table> <!-- / #copiesrow_[% bibitemloo.biblionumber %] -->
350                                                     [% END # / IF ( OPACItemHolds )%]
351                                                 </div> <!-- / #hold-options-[% bibitemloo.biblionumber %] -->
352                                             </fieldset>
353                                         [% END # / IF ( bibitemloo.holdable ) %]
354                                     </div> <!-- / .holdrow -->
355                                 [% END # / FOREACH bibitemloo IN bibitemloop %]
356                             </div><!-- #bigloop -->
357
358                             [% UNLESS ( none_available ) %]
359                                 <input type="submit" value="Place hold" class="btn placehold" />
360                             [% END %]
361
362                         </form>
363                     [% END # / UNLESS message %]
364                 </div> <!-- / #holds -->
365     </div> <!-- / .container -->
366 </div> <!-- / .main -->
367 [% INCLUDE 'opac-bottom.inc' %]
368 [% BLOCK jsinclude %]
369 [% INCLUDE 'calendar.inc' %]
370 <script type="text/javascript">
371 // <![CDATA[
372     var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
373     var ForceHoldNotesReasons=new Array(
374        _("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific copy information may be helpful."),
375        "*** Add a new reason above this line ***" );
376        // NOTE: Do not renumber reasons; this will affect use of existing ones.
377
378         // Clear the contents of an input field
379         $(".clearfield").on("click",function(e){
380             $(this).closest("td").find("input").val("");
381             e.preventDefault();
382         });
383     $(document).ready(function() {
384         $("#hold-request-form").preventDoubleFormSubmit();
385         var copiesRowId = null;
386         var wasSpecific = false;
387         var lastCopiesRowId = null;
388         $(".checkitem").parent().click(function(e){
389             if(e.target.tagName.toLowerCase() == 'td'){
390                 $(this).find("input.checkitem").each( function() {
391                     $(this).attr('checked', !$(this).attr('checked'));
392                 });
393             }
394         });
395         // Hides all 'specific copy' table rows on load.
396         $(".copiesrow").hide();
397
398         // Insert reasons for forced hold notes
399         $(".forcenotesreason").each(function(){
400             biblioNum = suffixOf($(this).attr("id"), "_");
401             var j=$("#notesmandatory_"+biblioNum).val();
402             if(j>0) {
403                 $(this).html(ForceHoldNotesReasons[j-1]);
404             }
405         });
406
407         $("#place_on_hdr").show();
408         $(".place_on_type").show();
409         $("#place_on_hdr,.place_on_type,.toggle-hold-options").show();
410         $(".hold-options").hide();
411         $(".holddatefrom,.holddateto").prop("readOnly", true);
412
413         $(".date-format").each(function(){
414             if($(this).hasClass("to")){ var op = "to"; }
415             if($(this).hasClass("from")){ var op = "from"; }
416             var bibNum = $(this).data("biblionumber");
417             $(this).html("<a href=\"#\" class=\"clear-date\" data-op=\"" + op + "\" id=\"clear" + bibNum + "\">" + _("Clear date") + "</a>");
418         });
419
420         $(".clear-date").on("click",function(e){
421             e.preventDefault();
422             var fieldID = this.id.replace("clear","");
423             var op = $(this).data("op");
424             $("#" + op + fieldID).val("");
425         });
426
427         // Replace non-JS single-selection with multi-selection capability.
428         $(".reserve_mode").val("multi");
429         $(".confirm_nonjs").remove();
430         $(".confirmjs_hold").each(function(){
431             var bib = $(this).attr("title");
432             var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
433             html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> ";
434             $(this).html(html);
435         });
436         $(".confirmjs_nohold").each(function(){
437             var bib = $(this).attr("title");
438             var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
439             html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>";
440             $(this).html(html);
441         });
442
443         // Make sure a specific item was selected where specified
444         // before moving on to a new item.
445         function changeSelection (newCopiesRowId, isSpecific) {
446             if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) {
447                 var biblioNum = suffixOf(copiesRowId, "_");
448
449                 // If the 'specific copy' radio button was checked
450                   if (wasSpecific && (copiesRowId != newCopiesRowId)) {
451                     // Find the selected copy
452                     var item = $(".checkitem_" + biblioNum + ":checked");
453                     if ($(item).size() == 0) {
454                         alert(MSG_NO_COPY_SELECTED);
455                         return false;
456                     }
457                 }
458             }
459             copiesRowId = newCopiesRowId;
460             wasSpecific = isSpecific;
461             return true;
462         }
463
464         // When 'specific copy' radio button is clicked
465         $(".selectspecific").click(function() {
466
467             // Make sure all other specific copy table rows are hidden
468             biblioNum = suffixOf($(this).attr("id"), "_");
469             newCopiesRowId = "#copiesrow_" + biblioNum;
470
471             if (!changeSelection(newCopiesRowId, true)) {
472                 return false;
473             }
474
475             // Show the specific copy table for this radio button.
476             $(newCopiesRowId).show();
477         });
478
479         // When 'first available' radion button is clicked
480         $(".selectany").click(function() {
481             // Make sure all other specific copy table rows are hidden
482             biblioNum = suffixOf($(this).attr("id"), "_");
483             newCopiesRowId = "#copiesrow_" + biblioNum;
484
485             if (!changeSelection(newCopiesRowId, false)) {
486                 return false;
487             }
488
489             // Hide the copies table row
490             $(newCopiesRowId).hide();
491         });
492
493         // When 'Place Hold' button is clicked
494         $(".placehold").click(function(){
495             var biblionumbers = "";
496             var selections = "";
497
498             if ($(".confirmjs:checked").size() == 0) {
499                 alert(MSG_NO_RECORD_SELECTED);
500                 return false;
501             }
502
503             // Find the items with the 'Hold' box checked
504             var badBib = null;
505             $(".confirmjs:checked").each(function() {
506                 var biblioNum = $(this).val();
507                 biblionumbers += biblioNum + "/";
508                 selections += biblioNum + "/";
509
510                 // If the 'specific copy' radio button is checked
511                 if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
512                     // Find the selected copy
513                     var item = $(".checkitem_" + biblioNum + ":checked");
514                     if ($(item).size() == 0) {
515                         badBib = biblioNum;
516                         return false;
517                     } else {
518                       selections += $(item).val();
519                     }
520                 }
521                 selections += "/";
522
523                 // Add the pickup location
524                 var branchSel = $("#branch_" + biblioNum);
525                 if (branchSel.size() > 0) {
526                     selections += $(branchSel).val();
527                 }
528                 selections += "/";
529                 return true;
530             });
531
532             if (badBib) {
533                 alert(MSG_NO_COPY_SELECTED);
534                 return false;
535             }
536
537             $("#selections").val(selections);
538             $("#biblionumbers").val(biblionumbers);
539
540             return true;
541         });
542
543         $(".toggle-hold-options").on("click",function(e){
544             e.preventDefault();
545             toggleLink = $(this);
546             var optionsID = this.id.replace("toggle-hold-options-","");
547             $("#hold-options-"+optionsID).toggle(0, function() {
548                 toggleLink.text($(this).is(':visible') ? _("Hide options") : _("Show more options"));
549             });
550         });
551
552         [% FOREACH bibitemloo IN bibitemloop %]
553             [% IF ( bibitemloo.holdable ) %]
554                 // http://jqueryui.com/demos/datepicker/#date-range
555                 var dates[% bibitemloo.biblionumber %] = $( "#from[% bibitemloo.biblionumber %], #to[% bibitemloo.biblionumber %]" ).datepicker({
556                     minDate: 1,
557                     changeMonth: true,
558                     numberOfMonths: 1,
559                     onSelect: function( selectedDate ) {
560                         var option = this.id == "from[% bibitemloo.biblionumber %]" ? "minDate" : "maxDate",
561                             instance = $( this ).data( "datepicker" );
562                             date = $.datepicker.parseDate(
563                                 instance.settings.dateFormat ||
564                                 $.datepicker._defaults.dateFormat,
565                                 selectedDate, instance.settings );
566                         dates[% bibitemloo.biblionumber %].not( this ).datepicker( "option", option, date );
567                     }
568                 });
569             [% END %]
570         [% END %]
571
572  });
573 // ]]>
574 </script>
575 [% END %]