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