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