Bug 5025: discrepancy between opac doc-head-open.inc and staff doc-head-open.inc
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
7 <link rel="shortcut icon" href="[% IF ( OpacFavicon  ) %][% OpacFavicon  %][% ELSE %][% interface %]/[% theme %]/images/favicon.ico[% END %]" type="image/x-icon" />
8 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/bootstrap/css/bootstrap.min.css" />
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/jquery/jquery-ui.css" />
10 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/sco.css" />
11 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
12 [% IF ( SCOUserCSS ) %]<style type="text/css">[% SCOUserCSS %]</style>[% END %]
13 <!--[if lt IE 9]>
14     <script src="[% interface %]/[% theme %]/lib/respond.min.js"></script>
15 <![endif]-->
16 <script type="text/javascript">
17     function _(s) { return s } // dummy function for gettext
18 </script>
19 <script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
20 </head>
21 <body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
22 [% INCLUDE 'masthead-sco.inc' %]
23
24     <div class="main">
25         <div class="container-fluid">
26             <div class="row-fluid">
27                 [% IF ( display_patron_image ) %]
28                     <div class="span10">
29                 [% ELSE %]
30                     <div class="span12">
31                 [% END %]
32
33                     <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
34
35                     [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
36                         <div class="alert">
37                             <h3>Item cannot be checked out.</h3>
38                             <p>Sorry, this item cannot be checked out at this station.</p>
39                             [% IF ( title ) %]
40                                 <p>Title: <em>[% title |html %]</em> </p>
41                             [% END %]
42
43                             <p>
44                                 [% IF ( circ_error_UNKNOWN_BARCODE ) %]
45                                     <em>MESSAGE 1:</em> The system does not recognize this barcode.
46                                 [% ELSIF ( circ_error_max_loans_allowed ) %]
47                                     <em>MESSAGE 2:</em> You have checked out too many items and can't check out any more.
48                                 [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
49                                 <em>MESSAGE 3:</em> This item is checked out to someone else.
50                                 [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
51                                     <em>MESSAGE 4:</em> You cannot renew this item again.
52                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
53                                     <em>MESSAGE 5:</em> This item is not for loan.
54                                 [% ELSIF ( circ_error_DEBT ) %]
55                                     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot check out.
56                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
57                                     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
58                                 [% ELSIF ( circ_error_RESTRICTED ) %]
59                                     <em>MESSAGE 8:</em>
60                                 [% ELSIF ( circ_error_RESERVED ) %]
61                                     <em>MESSAGE 9:</em> This item is on hold for another patron.
62                                 [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
63                                     <em>MESSAGE 10:</em>
64                                 [% ELSIF ( circ_error_EXPIRED ) %]
65                                     <em>MESSAGE 11:</em> Your account has expired.
66                                 [% ELSIF ( circ_error_DEBARRED ) %]
67                                     <em>MESSAGE 12:</em> Your account has been suspended.
68                                 [% ELSIF ( circ_error_CARD_LOST ) %]
69                                     <em>MESSAGE 13:</em> This card has been declared lost.
70                                 [% ELSIF ( circ_error_GNA ) %]
71                                     <em>MESSAGE 14:</em>
72                                 [% ELSIF ( circ_error_INVALID_DATE ) %]
73                                     <em>MESSAGE 15:</em>
74                                 [% END # / IF circ_error_UNKNOWN_BARCODE %]
75                                 Please see a member of the library staff.
76                             </p>
77
78                             [% IF ( returnitem && AllowSelfCheckReturns ) %]
79                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
80                                     <input type="hidden" name="op" value="returnbook" />
81                                     <input type="hidden" name="patronid" value="[% patronid %]" />
82                                     <input type="hidden" name="barcode" value="[% barcode %]" />
83                                     <button type="submit" name="returnbook" class="btn"><i class="return"></i> Return this item</button>
84                                 </form>
85                             [% END %]
86
87                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
88                                 <input type="hidden" name="op" value="" />
89                                 <input type="hidden" name="patronid" value="[% patronid %]" />
90                                 <input type="hidden" name="barcode" value="[% barcode %]" />
91                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn back focus" />
92                             </form>
93                         </div> <!-- / .alert -->
94                     [% END # / IF ( impossible %]
95
96                     [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
97                         <div class="alert"><h3>Please confirm the checkout:</h3>
98                             [% IF ( confirm_renew_issue ) %]
99                                 <p>This item is already checked out to you.</p>
100                             [% END %]
101
102                             [% IF ( renew && AllowSelfCheckReturns ) %]
103                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
104                                     <input type="hidden" name="op" value="returnbook" />
105                                     <input type="hidden" name="patronid" value="[% patronid %]" />
106                                     <input type="hidden" name="barcode" value="[% barcode %]" />
107                                     <input type="hidden" name="confirmed" value="" />
108                                     <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
109                                 </form>
110                             [% END %]
111
112                             [% UNLESS ( renew ) %]
113                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
114                                     <input type="hidden" name="op" value="checkout" />
115                                     <input type="hidden" name="patronid" value="[% patronid %]" />
116                                     <input type="hidden" name="barcode" value="[% barcode %]" />
117                                     <input type="hidden" name="confirmed" value="1" />
118                                     <button type="submit" name="confirm" class="btn"><i class="icon renew"></i> Renew item</button>
119                                   </form>
120                             [% ELSE %]
121                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
122                                     <input type="hidden" name="op" value="checkout" />
123                                     <input type="hidden" name="patronid" value="[% patronid %]" />
124                                     <input type="hidden" name="barcode" value="[% barcode %]" />
125                                     <input type="hidden" name="confirmed" value="1" />
126                                     <button type="submit" class="btn"><i class="icon renew"></i> Renew item</button>
127                                 </form>
128                             [% END %]
129
130                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
131                                 <input type="hidden" name="op" value="" />
132                                 <input type="hidden" name="patronid" value="[% patronid %]" />
133                                 <button type="submit" class="btn"><i class="icon cancel"></i> Cancel</button>
134                             </form>
135                         </div>
136                     [% END # / IF confirm %]
137
138                     [% IF ( nopermission ) %]
139                         <!-- This is what is displayed if user doesnt have permission -->
140                         <div class="alert">
141                             <h3>Access denied</h3>
142                             <p>Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem.</p>
143                         </div>
144                     [% END %]
145
146                     [% IF ( different_ip ) %]
147                         <!-- This is what is displayed if user doesnt have permission -->
148                         <div class="alert">
149                             <h3>Session lost</h3>
150                             <p>You are accessing self-checkout from a different IP address! please log in again.</p>
151                         </div>
152                     [% END %]
153
154                     [% IF ( invalid_username_or_password ) %]
155                         <!-- This is what is displayed if user doesnt have permission -->
156                         <div class="alert">
157                             <h3>Record not found</h3>
158                             <p>Your userid was not found in the database.  Please try again.</p>
159                         </div>
160                     [% END %]
161
162
163                     [% UNLESS ( hide_main ) %]
164
165                         [% IF ( patronid ) %]
166                             [% IF ( validuser ) %]
167                                 <div class="alert alert-info">You are logged in as [% borrowername %].</div>
168                             [% END %]
169
170                             [% IF ( nouser ) %]
171                                 <div class="alert">
172                                     <h4>Sorry</h4>
173                                     <p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p>
174                                 </div>
175                             [% END %]
176                         [% END # / IF patronid %]
177
178                         [% IF ( validuser ) %]
179                             <div id="newcheckout" class="sco_entry">
180                                 <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
181                                     <fieldset>
182                                         <legend>Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
183                                         <div class="input-append">
184                                             <label for="barcode">Scan a new item or enter its barcode:</label>
185                                             <input id="barcode" name="barcode" size="20" type="text" class="focus" autocomplete="off" />
186                                             <button type="submit" class="btn">Submit</button>
187                                         </div>
188                                         <input type="hidden" name="op" value="checkout" />
189                                         <input type="hidden" name="patronid" value="[% patronid %]" />
190                                     </fieldset>
191                                 </form>
192
193                                 <div>
194                                     <form method="post" action="#" id="logout_form">
195                                         <button type="submit" class="btn"><i class="icon finish"></i> Finish</button>
196                                     </form>
197                                 </div>
198                             </div> <!-- / #newcheckout -->
199                 </div> <!-- / .span12/12 -->
200                 [% IF ( display_patron_image ) %]
201                     <div class="span2">
202                         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?borrowernumber=[% borrowernumber %]" alt="" />
203                     </div>
204                 [% END %]
205             </div> <!-- / .row-fluid -->
206         </div> <!-- / .container-fluid -->
207
208         <div class="container-fluid">
209             <div class="row-fluid">
210                     <div class="span12">
211                         <div id="borrowerdetails">
212                             [% IF ( issues_count ) %]
213                                 <table id="loanTable" class="table table-bordered table-striped">
214                                     <caption>Checkouts for [% borrowername %] <span class="count">([%   issues_count %] total)</span></caption>
215                                     <!-- ISSUES TABLE ROWS -->
216                                     <thead>
217                                         <tr><th class="anti-the">Title</th><th>Call no.</th><th class="title-string">Due</th><th class="nosort">Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
218                                     </thead>
219                                     <tbody>
220                                         [% FOREACH ISSUE IN ISSUES %]
221                                             <tr>
222                                                 <td>
223                                                     [% UNLESS ( noitemlinks ) %]
224                                                         <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber %]">[% ISSUE.title |html %]</a>
225                                                     [% ELSE %]
226                                                         <strong>[% ISSUE.title |html %]</strong>
227                                                     [% END %]
228                                                     <span class="item-details">[% ISSUE.author %]</span>
229                                                     ([% ISSUE.barcode %])
230                                                 </td>
231                                                 <td>[% ISSUE.itemcallnumber %]</td>
232                                                 [% IF ( ISSUE.overdue ) %]
233                                                     <td class="overdue"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
234                                                 [% ELSE   %]
235                                                     <td><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
236                                                 [% END %]
237                                                 <td>
238                                                     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
239                                                         <input type="hidden" name="patronid" value="[% patronid %]" />
240                                                         <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
241                                                         [% IF ( ISSUE.norenew ) %]
242                                                             [% IF ( AllowSelfCheckReturns ) %]
243                                                                 <input type="submit" value="Check in item" name="confirm" class="btn return" />
244                                                                 <input type="hidden" name="op" value="returnbook" />
245                                                                 <input type="hidden" name="confirmed" value=""  />
246                                                             [% ELSE %]
247                                                                 <span>No renewals allowed</span>
248                                                             [% END %]
249                                                         [% ELSE %]
250                                                             <input type="hidden" name="op" value="checkout" />
251                                                             <input type="hidden" name="confirmed" value="1" />
252                                                             [% UNLESS ( ISSUE.renew ) %]
253                                                                 <input type="submit" value="Renew item"  name="confirm  " class="btn renew" />
254                                                             [% ELSE %]
255                                                                 <input type="submit" value="Renew item" class="btn renew" />
256                                                             [% END %]
257                                                         [% END %]
258                                                     </form>
259                                                 </td>
260                                                 [% UNLESS ( nofines ) %]
261                                                     <td>
262                                                         [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]
263                                                     </td>
264                                                 [% END %]
265                                             </tr>
266                                         [% END # / FOREACH ISSUE %]
267                                     </tbody>
268                                 </table>
269                             [% ELSE %]
270                                 <h3>You currently have nothing checked out.</h3>
271                             [% END # / IF issues_count %]
272                         </div> <!-- / #borrowerdetails -->
273                         [% ELSE # IF validuser %]
274                             <div class="sco_entry" >
275                                 <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
276                                     <fieldset class="checkout brief">
277                                         [% IF ( authbylogin ) %]
278                                             <legend>Log in to your account</legend>
279                                             <label for="patronlogin">Login:</label>
280                                             <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
281                                             <label for="patronpw">Password:</label>
282                                             <input type="password" id="patronpw" size="20" name="patronpw" />
283                                             <fieldset class="action">
284                                                 <button type="submit" class="btn">Log in</button>
285                                             </fieldset>
286                                         [% ELSE %]
287                                             <div class="input-append">
288                                                 <label for="patronid">Please enter your card number:</label>
289                                                 <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
290                                                 <button type="submit" class="btn">Submit</button>
291                                             </div>
292                                         [% END # / IF authbylogin %]
293
294                                         [% FOREACH INPUT IN INPUTS %]
295                                             <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">
296                                         [% END %]
297                                         <input type="hidden" name="op" value="login" />
298                                     </fieldset>
299                                 </form>
300                             </div> <!-- / .sco_entry -->
301                         [% END # / IF validuser %]
302                     [% END # / UNLESS ( hide_main %]
303
304                 </div> <!-- / .span12 -->
305             </div> <!-- / .row-fluid -->
306         </div> <!-- / .container-fluid -->
307     </div> <!-- / .main -->
308
309 [% INCLUDE 'opac-bottom.inc' %]
310 [% BLOCK jsinclude %]
311     [% INCLUDE 'datatables.inc' %]
312     <script type="text/javascript">
313         //<![CDATA[
314         function mungeHistory() {
315             // prevent back button from allowing form resubmission
316             if (history && history.pushState) {
317                 history.replaceState(null, document.title, window.location.href);
318             }
319         }
320         var mainTimeout;
321         function sco_init() {
322             mainTimeout = setTimeout(function() {
323                 location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
324             }, [% SelfCheckTimeout %]);
325         }
326         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
327             // alert("dofocus called");
328             $(".focus:last").select();
329         }
330         var slip_re = /slip/;
331         function printx_window(print_type) {
332           var handler = print_type.match(slip_re) ? "printslip" : "moremember";
333
334           return false;
335         }
336         function checkout_confirm(patronid) {
337             var   barcode = $("#barcode").val();
338             // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
339             if (! barcode) { dofocus(); return false; }    // no barcode
340             if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
341                 window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
342                 return false;
343             }
344             return true;
345         }
346
347         $(document).ready(function() {
348             dofocus();
349             [% IF ( patronid ) %]sco_init();[% END %]
350             $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
351                 "aaSorting": [ [2, "desc"], [0, "asc"] ],
352                 "aoColumnDefs": [
353                     { "aTargets": [ "nosort" ],"bSortable": false,"bSearchable": false },
354                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
355                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
356                 ]
357             }));
358
359             $("#logout_form").submit(function(){
360                 clearTimeout(mainTimeout);
361                 [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
362                     if(confirm(_("Would you like to print a receipt?"))){
363                         window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
364                     }
365                 [% END %]
366
367                 return true;
368             });
369     });
370     //]]>
371     </script>
372
373     [% IF ( SCOUserJS ) %]<script type="text/javascript">[% SCOUserJS %]</script>[% END %]
374 [% END %]