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