Bug 19532: Recalls on OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-recall.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% USE ItemTypes %]
5 [% USE AuthorisedValues %]
6 [% SET footerjs = 1 %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Recall &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% BLOCK cssinclude %][% END %]
11 </head>
12 <body id="opac-recall" class="scrollto">
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="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Details for: [% biblio.title | html %]</a> <span class="divider">&rsaquo;</span></li>
19         <li><a href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% biblio.biblionumber | uri %]">Place recall</a></li>
20     </ul>
21
22     <div class="container-fluid">
23         <div class="row-fluid">
24             <div class="span2">
25                 <div id="navigation">
26                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
27                 </div>
28             </div>
29             <div class="span10">
30                 <div id="recall" class="maincontent">
31                     <h1>Confirm recalls for: [% INCLUDE 'patron-title.inc' patron = logged_in_user %] ([% logged_in_user.cardnumber | html %])</h1>
32                     [% IF nosyspref %]
33                         Recalls have not been enabled. Please contact your library.
34                     [% ELSIF error == 'unavailable' %]
35                         There are no items available for recall.
36                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Return to [% biblio.title | html %]</a>
37                     [% ELSE %]
38                         [% IF error %]
39                             <div class="dialog alert">
40                                 [% IF error == 'duplicate' %]
41                                     You have reached the maximum number of recalls on this record.
42                                 [% ELSIF error == 'unavailable' %]
43                                     There are no items available for recall.
44                                 [% ELSIF error == 'cannot' %]
45                                     You cannot place a recall on this item.
46                                 [% ELSE %]
47                                     An error has occurred while attempting to place a recall. Please contact your library.
48                                 [% END %]
49                             </div>
50                         [% END %]
51
52                         [% IF success %]
53                             <p>Your recall has been placed. The patron the item is currently checked out to has been asked to return the item within [% due_interval | html %] days, by [% due_date | $KohaDates %].</p>
54                             <p>You will be notified when your item is waiting to be picked up at the library.</p>
55                         [% ELSIF not error %]
56                             <p>All borrowable material is subject to recall if checked out and needed by someone else. We will ask the person who has checked out this item to return it so you may use it.</p>
57                             [% IF logged_in_user %]
58                                 <div class="dialog">
59
60                                     <form id="recallform" action="/cgi-bin/koha/opac-recall.pl" method="get">
61                                         <fieldset class="rows" id="options">
62                                             <legend>Place a recall on <b>[% biblio.title | html %]</b> ([% biblio.author | html %])?</legend>
63                                             <ul>
64
65                                             [% UNLESS ( single_branch_mode ) %]<li>
66                                                 <label for="pickup">Pick up location:</label>
67                                                 <select name="pickup" id="pickup">
68                                                     [% FOREACH branch IN branches %]
69                                                         [% IF branch.branchcode == logged_in_user.branchcode %]
70                                                             <option value="[% branch.branchcode | html %]" selected>[% Branches.GetName( branch.branchcode ) | html %]</option>
71                                                         [% ELSE %]
72                                                             <option value="[% branch.branchcode | html %]">[% Branches.GetName( branch.branchcode ) | html %]</option>
73                                                         [% END %]
74                                                     [% END %]
75                                                 </select>
76                                             </li>[% END %]
77
78                                             <li><label for="expirationdate">Recall not needed after:</label> <input type="text" name="expirationdate" id="expirationdate" size="20"> <a id="cleartext" style="display:none;">Clear text</a><span id="expiration-hint">[% INCLUDE 'date-format.inc' %]</span></li>
79                                             <li class="level-option" style="display:none;"><label for="bibliolevel">Recall next available item</label> <input type="radio" name="type" id="bibliolevel" value="bibliolevel" checked></li>
80                                             <li class="level-option" style="display:none;"><label for="itemlevel">Recall a specific item</label> <input type="radio" name="type" id="itemlevel" value="itemlevel"></li>
81
82                                             <table class="table table-bordered table-striped" id="items">
83                                                 <caption>Select a specific item:</caption>
84                                                 <tr>
85                                                     <th>&nbsp;</th>
86                                                     <th>Item type</th>
87                                                     <th>Barcode</th>
88                                                     [% UNLESS ( single_branch_mode ) %]
89                                                         <th>Home library</th>
90                                                         <th>Last location</th>
91                                                     [% END %]
92                                                     <th>Collection</th>
93                                                     <th>Call number</th>
94                                                     <th>Copy number</th>
95                                                     <th>Vol info</th>
96                                                     <th>Information</th>
97                                                 </tr>
98                                                 [% FOREACH item IN items %]<tr>
99                                                 <td>
100                                                     [% IF item.can_be_recalled( patron => logged_in_user ) %]
101                                                         <input type="radio" class="itemnumber" name="itemnumber" value="[% item.itemnumber | html %]">
102                                                     [% ELSE %]
103                                                         <input disabled="disabled" type="radio" class="itemnumber" name="itemnumber" value="[% item.itemnumber | html %]" style="display:none;" />
104                                                         <img src="[% interface | html %]/lib/famfamfam/cross.png" alt="Cannot be recalled" title="Cannot be recalled" />
105                                                     [% END %]
106                                                     </td>
107                                                     <td>[% ItemTypes.GetDescription( item.effective_itemtype ) | html %]</td>
108                                                     <td>[% item.barcode | html %]</td>
109                                                     [% UNLESS ( single_branch_mode ) %]
110                                                         <td>[% Branches.GetName( item.homebranch ) | html %]</td>
111                                                         <td>[% Branches.GetName( item.holdingbranch) | html %]</td>
112                                                     [% END %]
113                                                     <td>[% AuthorisedValues.GetByCode( 'CCODE', item.ccode, 1 ) | html %]</td>
114                                                     <td>[% item.itemcallnumber | html %]</td>
115                                                     <td>[% item.copynumber | html %]</td>
116                                                     <td>[% item.enumchron | html %]</td>
117                                                     <td>
118                                                         [% IF ( item.checkout ) %]
119                                                             <span class="checkedout">Due [% item.checkout.date_due | $KohaDates %]</span>
120                                                         [% ELSIF ( item.get_transfer ) %]
121                                                             <span class="intransit">In transit from [% Branches.GetName( item.get_transfer.frombranch ) | html %] to [% Branches.GetName( item.get_transfer.tobranch ) | html %] since [% item.get_transfer.datesent | $KohaDates %]</span>
122                                                         [% END %]
123                                                         [% IF ( item.itemlost || item.withdrawn ) %]
124                                                             <span class="lost">Unavailable (lost or missing)</span>
125                                                         [% END %]
126                                                         [% IF ( item.notforloan ) %]
127                                                             <span class="notforloan">Not for loan ([% item.notforloan | html %])</span>
128                                                         [% END %]
129                                                         [% hold = item.current_holds.next %]
130                                                         [% IF ( item.recall ) %]
131                                                             <span class="waiting">
132                                                             [% IF ( item.recall.waitingdate ) %]
133                                                                 Waiting for patron at [% Branches.GetName( item.recall.branchcode ) | html %] since [% item.recall.waitingdate | $KohaDates %].
134                                                             [% ELSE %]
135                                                                 Recalled by patron expected at [% Branches.GetName( item.recall.branchcode ) | html %] since [% item.recall.recalldate | $KohaDates %].
136                                                             [% END %]
137                                                             </span>
138                                                         [% ELSIF ( hold.waitingdate ) %]
139                                                             <span class="waiting">
140                                                                 Waiting for patron at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %].
141                                                             </span>
142                                                         [% ELSIF ( hold.borrowernumber == logged_in_user.borrowernumber ) %]
143                                                             <span class="waiting">
144                                                                 You have already placed a <a href="/cgi-bin/koha/opac-user.pl#opac-user-holds">reserve</a> on this item.
145                                                             </span>
146                                                         [% END # / IF ( item.recall or hold ) %]
147                                                     </td>
148                                                 </tr>[% END %]
149                                             </table>
150                                         </fieldset>
151                                         <fieldset class="action">
152                                             <input type="hidden" name="op" value="request">
153                                             <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]">
154                                             <input type="submit" class="btn" value="Confirm">
155                                             <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]" class="cancel">Cancel</a>
156                                         </fieldset>
157                                     </form>
158
159                                 </div>
160                             [% ELSE %]
161                                 <div class="dialog alert">You must be logged in to place a recall.</div>
162                             [% END %]
163                         [% END %]
164                     [% END %] <!-- norecalls -->
165                 </div> <!-- / #recall -->
166             </div> <!-- / .span10 -->
167         </div> <!-- / .row-fluid -->
168     </div>  <!-- / .container-fluid -->
169 </div> <!-- / .main -->
170
171 [% INCLUDE 'opac-bottom.inc' %]
172 [% BLOCK jsinclude %]
173 [% INCLUDE 'calendar.inc' %]
174 <script>
175     $(document).ready(function(){
176         $(".level-option").show();
177         $("#cleartext").show();
178         $("#items").hide();
179         $("#expiration-hint").hide();
180         $("#cleartext").click(function(){
181             $(this).siblings("input").val("");
182         });
183         $("#itemlevel").click(function(){
184             if ( $("#itemlevel").is(':checked') ){
185                 $("#items").show();
186                 $("input:radio[name='itemnumber']:not(:disabled)").first().attr("checked", "checked"); // selects first item in table
187             }
188         });
189         $("#bibliolevel").click(function(){
190             if ( $("#bibliolevel").is(':checked') ){
191                 $("#items").hide();
192             }
193         });
194         $("#expirationdate").datepicker({
195             minDate: 0,
196         });
197     });
198 </script>
199 [% END %]