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