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