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