Bug 8955 [Follow-up] Self checkout should degrade gracefully w/o JavaScript
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / sco / sco-main.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
5 <link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
6 <!-- yui js -->
7 <script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
8 <script type="text/javascript" src="[% yuipath %]/container/container-min.js"></script>
9 <script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
10 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
11 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery-ui.js"></script>
12 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
13 <script type="text/javascript">//<![CDATA[
14 function sco_init() {
15     setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]);
16 }
17 function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
18     // alert("dofocus called");
19     $(".focus:last").select();
20 }
21 var slip_re = /slip/;
22 function printx_window(print_type) {
23   var handler = print_type.match(slip_re) ? "printslip" : "moremember";
24
25   return false;
26 }
27 function checkout_confirm(patronid) {
28     var   barcode = $("#barcode").val();
29     // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
30     if (! barcode) { dofocus(); return false; }    // no barcode
31     if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode 
32         window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
33         return false;
34     }
35     return true;
36 }
37
38 // build Change Language menus
39 YAHOO.util.Event.onContentReady("changelanguage", function () {
40   $(".sublangs").each(function(){
41     var menuid = $(this).attr("id");
42     var menuid = menuid.replace("show","");
43
44     var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
45     function positionoMenu() {
46       oMenu.align("bl", "tl");
47     }
48     oMenu.subscribe("beforeShow", function () {
49     if (this.getRoot() == this) {
50       positionoMenu();
51     }
52     });
53     oMenu.render();
54     oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
55     function onYahooClick(p_oEvent) {
56       // Position and display the menu
57       positionoMenu();
58       oMenu.show();
59       // Stop propagation and prevent the default "click" behavior
60       YAHOO.util.Event.stopEvent(p_oEvent);
61     }
62     YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
63     YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
64   });
65 });
66
67 $.tablesorter.addParser({
68     id: 'articles',
69     is: function(s) {return false;  },
70     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
71     type: 'text'
72 });
73
74 $(document).ready(function() {
75     dofocus();
76     [% IF ( patronid ) %]sco_init();[% END %]
77     $("#loanTable").tablesorter({
78         [% IF ( dateformat_metric ) %]
79             dateFormat: 'uk',
80         [% END %]
81         widgets:   ['zebra'],
82         sortList:  [[2, 1], [0, 0]],
83         headers: {
84             0: { sorter: 'articles' },
85             3: { sorter: false }
86             [% UNLESS ( nofines ) %], 4: { sorter: false }[% END %]
87         }
88     });
89 });
90 //]]>
91 $(document).ready(function(){
92     $("#logout_form").submit(function(){
93         if(confirm("Would you like to print a receipt?")){
94             window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
95         }
96         return true;
97     });
98 });
99 </script>
100 [% IF ( opacuserjs ) %]<script type="text/javascript">[% opacuserjs %]</script>[% END %]
101
102
103 <link rel="stylesheet" type="text/css" href="[% yuipath %]/reset-fonts-grids.css" />
104 <link rel="stylesheet" type="text/css" href="[% yuipath %]/skin.css" />
105 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/sco.css" />
106 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
107
108 </head>
109 <body onload="dofocus();">
110
111 <div id="doc" class="yui-t7">
112
113 <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
114 <div id="bd">
115
116 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
117 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, this item cannot be checked out at this station.  </p>
118 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
119 <p>
120    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
121     <em>MESSAGE 1:</em> The system does not recognize this barcode.
122    [% ELSIF ( circ_error_max_loans_allowed ) %]
123     <em>MESSAGE 2:</em> You have checked out too many items and can't check out any more.
124    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
125     <em>MESSAGE 3:</em> This item is checked out to someone else.
126    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
127     <em>MESSAGE 4:</em> You cannot renew this item again.
128    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
129     <em>MESSAGE 5:</em> This item is not for loan.
130    [% ELSIF ( circ_error_DEBT ) %]
131     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot check out.
132    [% ELSIF ( circ_error_WTHDRAWN ) %]
133     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
134    [% ELSIF ( circ_error_RESTRICTED ) %]
135     <em>MESSAGE 8:</em>
136    [% ELSIF ( circ_error_RESERVED ) %]
137     <em>MESSAGE 9:</em> This item is on hold for another patron.
138    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
139     <em>MESSAGE 10:</em>
140    [% ELSIF ( circ_error_EXPIRED ) %]
141     <em>MESSAGE 11:</em> Your account has expired.
142    [% ELSIF ( circ_error_DEBARRED ) %]
143     <em>MESSAGE 12:</em> Your account has been suspended.
144    [% ELSIF ( circ_error_CARD_LOST ) %]
145     <em>MESSAGE 13:</em> This card has been declared lost.
146    [% ELSIF ( circ_error_GNA ) %]
147     <em>MESSAGE 14:</em>
148    [% ELSIF ( circ_error_INVALID_DATE ) %]
149     <em>MESSAGE 15:</em>
150    [% END %]
151    Please see a member of the library staff.
152 </p>
153 [% IF ( returnitem ) %]
154 [% IF ( AllowSelfCheckReturns ) %]
155 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
156     <input type="hidden" name="op" value="returnbook" />
157     <input type="hidden" name="patronid" value="[% patronid %]" />
158     <input type="hidden" name="barcode" value="[% barcode %]" />
159     <input type="submit" name="returnbook" value="Return this item" class="return" />
160 </form>
161 [% END %]
162 [% END %]
163 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
164     <input type="hidden" name="op" value="" />
165     <input type="hidden" name="patronid" value="[% patronid %]" />
166     <input type="hidden" name="barcode" value="[% barcode %]" />
167     <input type="submit" name= "confirm" value="Return to account summary" class="back focus" />
168 </form>
169 [% END %]
170 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
171 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
172 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
173
174 [% IF ( renew ) %]
175 [% IF ( AllowSelfCheckReturns ) %]
176     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
177         <input type="hidden" name="op" value="returnbook" />
178         <input type="hidden" name="patronid" value="[% patronid %]" />
179         <input type="hidden" name="barcode" value="[% barcode %]" />
180         <input type="hidden" name="confirmed" value="" />
181         <input type="submit" value="Return item" name="confirm" class="return" />
182     </form>
183 [% END %]
184 [% END %]
185
186 [% UNLESS ( renew ) %]
187     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
188         <input type="hidden" name="op" value="checkout" />
189         <input type="hidden" name="patronid" value="[% patronid %]" />
190         <input type="hidden" name="barcode" value="[% barcode %]" />
191         <input type="hidden" name="confirmed" value="1" />
192         <input type="submit" value="Renew item" name="confirm" class="renew" />
193       </form>
194 [% ELSE %]
195     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
196         <input type="hidden" name="op" value="checkout" />
197         <input type="hidden" name="patronid" value="[% patronid %]" />
198         <input type="hidden" name="barcode" value="[% barcode %]" />
199         <input type="hidden" name="confirmed" value="1" />
200         <input type="submit" value="Renew item" class="renew" />
201     </form>
202 [% END %]
203     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
204       <input type="hidden" name="op" value="" />
205       <input type="hidden" name="patronid" value="[% patronid %]" />
206       <input type="submit" value="Cancel" class="cancel" />
207     </form>
208 </div>
209 [% END %]
210
211 [% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access denied</h3>
212 Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem. </div>
213 [% END %]
214 [% IF ( different_ip ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Session lost</h3>You are accessing self-checkout from a different IP address! please log in again.</div>[% END %]
215 [% IF ( invalid_username_or_password ) %]
216 <!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Record not found</h3><p>Your userid was not found in the database.  Please try again.</p></div>[% END %]
217
218
219 [% UNLESS ( hide_main ) %]
220         <div class="sco_head">
221         [% UNLESS ( validuser ) %] 
222     <h3>Self checkout</h3>
223         [% END %]
224
225         <div id="checkouthelp">
226                 <a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
227         </div>
228
229         [% IF ( patronid ) %]
230         [% IF ( validuser ) %]
231     <h3 class="warning">You are logged in as [% borrowername %].</h3>
232         [% END %]
233         </div>
234         [% IF ( nouser ) %]
235         <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
236         <br />
237         [% END %]
238         [% END %]
239
240         [% IF ( validuser ) %]
241   [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
242         <div id="newcheckout" class="sco_entry">
243         <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
244         <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
245         <label for="barcode">Scan a new item or enter its barcode:</label>
246     <input id="barcode" name="barcode" size="20" class="focus" autocomplete="off" />
247         <input type="hidden" name="op" value="checkout" />
248         <input type="hidden" name="patronid" value="[% patronid %]" />
249         <input type="submit" value="Submit" class="submit" /></fieldset>
250         </form>
251     <div><form method="post" action="#" id="logout_form"><input type="submit" value="Finish" class="finish" /></form></div>
252         </div> <!-- sco_entry --> <!-- newcheckout -->
253   [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
254   [% IF ( display_patron_image ) %]
255   <div class="yui-u">
256         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
257   </div>
258   [% END %]
259   </div> <!-- /yui-ge -->
260   <div class="yui-g">
261         <div id="borrowerdetails">
262         [% IF ( issues_count ) %]
263         <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
264         <!-- ISSUES TABLE ROWS -->
265     <thead>
266         <tr><th>Title</th><th>Call no.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
267     </thead>
268
269     <tbody>
270         [% FOREACH ISSUE IN ISSUES %]
271         [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
272     <!-- FIXME: yet another jacket image breakpoint -->
273         <td>[% UNLESS ( ISSUE.noitemlinks ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a>[% ELSE %]<strong>[% ISSUE.title |html %]</strong>[% END %]<span class="item-details">
274         [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
275         <td>[% ISSUE.itemcallnumber %]</td>
276         [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due | $KohaDates %]</td>[% ELSE %]<td>[% ISSUE.date_due | $KohaDates %]</td>[% END %]
277         <td>
278     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
279     <input type="hidden" name="patronid" value="[% patronid %]" />
280     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
281         [% IF ( ISSUE.norenew ) %]
282           [% IF ( AllowSelfCheckReturns ) %]
283             <input type="submit" value="Check in item" name="confirm" class="return" />
284             <input type="hidden" name="op" value="returnbook" />
285             <input type="hidden" name="confirmed" value=""  />
286           [% ELSE %]
287             <span>No renewals allowed</span>
288           [% END %]
289         [% ELSE %]
290             <input type="hidden" name="op" value="checkout" />
291             <input type="hidden" name="confirmed" value="1" />
292             [% UNLESS ( ISSUE.renew ) %]<input type="submit" value="Renew item"  name="confirm" class="renew" />
293             [% ELSE %]<input type="submit" value="Renew item" class="renew" />[% END %]
294         [% END %]
295     </form>
296         </td>
297         [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
298         [% END %]
299     </tbody>
300
301         </table>
302         [% ELSE %]
303         <h3>You currently have nothing checked out.</h3>
304         [% END %]
305 </div> <!-- /yui-g -->
306         [% ELSE %]<!-- not validuser -->
307         <div class="sco_entry" >
308         <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
309        [% IF ( authbylogin ) %]
310         <fieldset class="checkout">
311        <legend>Please login with your username and password</legend>
312        <label for="patronlogin">Username:</label>
313         <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
314        <label for="patronpw">Password:</label>
315         <input type="password" id="patronpw" size="20" name="patronpw" />
316        [% ELSE %]
317         <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
318     <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
319         [% END %]
320
321         [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
322         <input type="hidden" name="op" value="login" />
323         <input type="submit" value="Submit" class="submit" /></fieldset></form>
324         </div>
325         [% END %]
326 [% END %] <!-- ( / hide main) -->       
327         
328         </div>
329 </div>
330 [% INCLUDE 'opac-bottom.inc' %]