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