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