Bug 10240: Offline circulation using HTML5 and IndexedDB
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / offline.tt
1 <!DOCTYPE html>
2 [% IF (AllowOfflineCirculation) %]
3 [% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %]
4 [% END %]
5 [% IF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]" [% manifestattr %]>[% ELSE %]<html lang="[% lang %]" [% manifestattr %]>[% END %]
6 <head>
7 <title>Koha &rsaquo; Circulation</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js"></script>
10 <script type="text/javascript" src="/intranet-tmpl/prog/en/js/offlinecirc.js"></script>
11 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
12 <script type="text/javascript">
13 //<![CDATA[
14 var ALERT_MATERIALS = _("Note about the accompanying materials: ");
15 var ALERT_RESTRICTED = _("Patron is RESTRICTED");
16 var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): ");
17 var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)");
18 var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)");
19 var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)");
20 var ALERT_ITEM_LOST = _("Item is has been lost (transaction recorded anyway)");
21 var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): ");
22 var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (transaction recorded anyway)");
23 var ALERT_PATRON_CARD_LOST = _("Patron's card is lost");
24 var ALERT_PATRON_EXPIRED = _("Patron's card is expired");
25 var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is restricted for: ");
26 var ALERT_PATRON_RESTRICTED = _("Patron is restricted");
27 var ALERT_PATRON_FINE = _("Patron has outstanding fines: ");
28 var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: ");
29
30 var start;
31
32 var dateformat = '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]';
33
34 function checkin(barcode, item, error) {
35     var alerts = checkAlerts(barcode, item);
36     if (typeof item === 'undefined') {
37         item = { };
38     }
39     item.title = item.title || _("(Unknown)");
40     item.author = item.author || _("(Unknown)");
41     item.homebranch = item.homebranch || "";
42     item.holdingbranch = item.holdingbranch || "";
43     item.callnumber = item.callnumber || "";
44     item.itemtype = item.itemtype || "";
45     item.barcode = item.barcode || barcode;
46     var trans = { "timestamp" : new Date().toMySQLString(),
47                   "barcode" : barcode,
48                   "action" : "return"
49                 };
50     $('#alerts').empty();
51     $('#offline-home').hide();
52     $('#offline-returns').show();
53     kohadb.recordTransaction(trans, function () {
54         $('#already-checked-in tbody').prepend('<tr><td>' + item.title + '</td><td>' + item.author + '</td><td>' + barcode + '</td><td>' + item.homebranch + '</td><td>' + item.holdingbranch + '</td><td></td><td>' + item.callnumber + '</td><td>' + item.itemtype + '</td></tr>');
55         if (alerts.length > 0) {
56             $('#alerts').append('<div class="dialog alert"><h3>' + _("Check in message") + '</h3></div>');
57             for (var msg in alerts) {
58                 $('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
59             }
60         }
61     });
62 }
63
64 function checkAlerts(barcode, item) {
65     var alerts = [];
66     if (typeof item === 'undefined') {
67         alerts.push(ALERT_NO_MATCHING_ITEM + barcode);
68     } else {
69         if (typeof item.materials !== 'undefined' && item.materials != null) {
70             alerts.push(ALERT_MATERIALS + item.materials);
71         }
72     }
73     return alerts;
74 }
75
76 function synchronize() {
77     kohadb.saveSetting("userid", "[% loggedinusername %]");
78     kohadb.saveSetting("branchcode", "[% LoginBranchcode %]");
79     kohadb.loadSetting("item-timestamp", showTimestamp);
80     kohadb.loadSetting("patron-timestamp", showTimestamp);
81     kohadb.loadSetting("issue-timestamp", showTimestamp);
82     [% UNLESS (AllowOfflineCirculation) %]
83         reloadRecords();
84     [% END %]
85     $('#download-records').click(reloadRecords);
86     $('#upload-transactions').click(function () {
87         $('.loading-overlay div').text(_("Uploading transactions, please wait..."));
88         $('.loading-overlay').show();
89         var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
90         uploadIter.done(function() {
91             $('.loading-overlay').hide();
92         });
93     });
94
95 }
96
97 function showTimestamp(key, value) {
98     if (typeof value !== 'undefined') {
99         var ts = new Date(value);
100         $('#' + key).text($.datepicker.formatDate(dateformat, ts) + ' ' + ts.toTimeString());
101     } else {
102         $('#' + key).text(_("(never)"));
103     }
104 }
105
106 function reloadRecords(ev) {
107     $(".loading-overlay div").text(_("Loading records, please wait..."));
108     $(".loading-overlay").show();
109     start = new Date();
110     $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){
111         loadRecords(0);
112     }, function(err, e){
113     }, function(transaction){
114         transaction.objectStore("patrons").clear();
115         transaction.objectStore("items").clear();
116         transaction.objectStore("issues").clear();
117     });
118     if (typeof ev !== 'undefined') {
119         ev.stopPropagation();
120     }
121 }
122
123 function uploadTransaction(transaction) {
124     $.ajax({
125         type: "GET",
126         url: "/cgi-bin/koha/offline_circ/service.pl",
127         data: { "userid" : kohadb.settings.userid,
128                 "branchcode" : kohadb.settings.branchcode,
129                 "timestamp" : transaction.value.timestamp,
130                 "action" : transaction.value.action,
131                 "barcode" : transaction.value.barcode,
132                 "cardnumber" : transaction.value.cardnumber,
133                 "pending" : true,
134               },
135     }).done(function () {
136         transaction.delete();
137     });
138 }
139
140 function finishedLoading() {
141     kohadb.saveSetting('item-timestamp', start.toISOString())
142     kohadb.saveSetting('patron-timestamp', start.toISOString())
143     kohadb.saveSetting('issue-timestamp', start.toISOString())
144     showTimestamp('item-timestamp', start.toISOString());
145     showTimestamp('patron-timestamp', start.toISOString());
146     showTimestamp('issue-timestamp', start.toISOString());
147     $(".loading-overlay").hide();
148 }
149
150 function loadRecords(page) {
151 [% IF (AllowOfflineCirculation) %]
152     $(".loading-overlay div").text(_("Loading page " + page + ", please wait..."));
153     $(".loading-overlay").show();
154     $.ajax({
155         type: "GET",
156         url: "/cgi-bin/koha/offline_circ/download.pl",
157         data: { "data": "all",
158                 "page": page
159               },
160         dataType: "json",
161     }).done(function (data) {
162         $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){
163             if ($.isEmptyObject(data.patrons) && $.isEmptyObject(data.items)) {
164                 finishedLoading();
165             } else {
166                 setTimeout(function () { loadRecords(page + 1); }, 200);
167             }
168         }, function(err, e){
169         }, function(transaction){
170             if (data.patrons) {
171                 var patrons = transaction.objectStore("patrons");
172                 $.each(data.patrons, function () {
173                     patrons.put(this);
174                 });
175             }
176             if (data.items) {
177                 var items = transaction.objectStore("items");
178                 $.each(data.items, function () {
179                     items.put(this);
180                 });
181             }
182             if (data.issues) {
183                 var issues = transaction.objectStore("issues");
184                 $.each(data.issues, function () {
185                     issues.put(this);
186                 });
187             }
188         });
189     });
190 [% END %]
191 }
192
193 function validate1(date) {
194     var today = new Date();
195     if ( date < today ) {
196         return true;
197      } else {
198         return false;
199      }
200 };
201
202 function loadPatron(barcode) {
203     $('#oldissues').hide();
204     $('#session-issues').hide();
205     $('#session-payments').hide();
206     $.indexedDB("koha").transaction(["patrons", "issues"]).then(function() {
207     }, function(err, e){
208     }, function(transaction){
209         var patrons = transaction.objectStore("patrons");
210         patrons.get(barcode).done(function (patron, error) {
211             showPatron(barcode, patron, error);
212         });
213         var issuesidx = transaction.objectStore("issues").index("cardnumber");
214         $('#oldissuest tbody').empty();
215         issuesidx.each(function (item) {
216             $('#oldissues').show();
217             $('#oldissuest tbody').append("<tr><td>" + item.value.date_due + "</td><td>" + item.value.barcode + "</td><td>" + item.value.title + "</td><td>" + item.value.itype + "</td><td>" + item.value.issuedate + "</td><td>" + item.value.issuebranch + "</td><td>" + item.value.callnumber + "</td><td>" + "" + "</td></tr>");
218         }, barcode);
219     });
220 }
221
222 function checkout(barcode, item, error) {
223     var alerts = checkAlerts(barcode, item);
224     if (typeof item === 'undefined') {
225         item = { };
226     }
227     item.title = item.title || "";
228     item.author = item.author || "";
229     item.homebranch = item.homebranch || "";
230     item.holdingbranch = item.holdingbranch || "";
231     item.callnumber = item.callnumber || "";
232     item.itemtype = item.itemtype || "";
233     if ($('#duedatespec').val().length === 0) {
234         alert(_("You must set a due date in order to use offline circulation!"));
235         $('#duedatespec').focus();
236         return;
237     }
238     var date_due = new Date($('#duedatespec').datepicker('getDate'));
239     var trans = { "timestamp" : new Date().toMySQLString(),
240                   "barcode" : barcode,
241                   "cardnumber" : curpatron.cardnumber,
242                   "date_due" : date_due.toMySQLString(),
243                   "action" : "issue"
244                 };
245     $('#alerts').empty();
246     kohadb.recordTransaction(trans, function () {
247         $('#session-issues').show();
248         $('#issuest tbody').prepend('<tr><td>' + $.datepicker.formatDate(dateformat, date_due) + date_due.toTimeString() + '</td><td>' + item.title + '</td><td>' + barcode + '</td><td>' + item.itemtype + '</td><td>' + $.datepicker.formatDate(dateformat, new Date()) + '</td><td>' + kohadb.settings.branchcode + '</td><td>' + item.callnumber + '</td><td></td></tr>');
249         if (alerts.length > 0) {
250             $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
251             for (var msg in alerts) {
252                 $('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
253             }
254         }
255     });
256 }
257
258 function recordFine(amount) {
259     var timestamp = new Date()
260     var trans = { "timestamp" : timestamp.toMySQLString(),
261                   "cardnumber" : curpatron.cardnumber,
262                   "amount" : amount,
263                   "action" : "payment",
264                 };
265     kohadb.recordTransaction(trans, function () {
266         $('#session-payments').show();
267         $('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>');
268     });
269 }
270
271 function checkPatronAlerts(cardnumber, patron) {
272     var alerts = [];
273     if (typeof patron === 'undefined') {
274         alerts.push(ALERT_NO_MATCHING_PATRON + cardnumber);
275     } else {
276         if (patron.gonenoaddress !== '0') {
277             alerts.push(ALERT_PATRON_GONE_NO_ADDRESS);
278         }
279         if (patron.lost !== '0') {
280             alerts.push(ALERT_PATRON_CARD_LOST);
281         }
282         if (patron.debarred !== null) {
283             if (patron.debarred != '9999-12-31') {
284                 alerts.push(ALERT_PATRON_BLOCKED_TEMPORARY + $.datepicker.formatDate(dateformat, patron.debarred));
285             } else {
286                 alerts.push(ALERT_PATRON_RESTRICTED);
287             }
288         }
289         if (parseInt(patron.fine) > [% maxoutstanding %]) {
290             alerts.push(ALERT_PATRON_FINE_OVER_LIMIT + patron.fine);
291         } else if (parseInt(patron.fine) > 0) {
292             alerts.push(ALERT_PATRON_FINE + patron.fine);
293         }
294     }
295     return alerts;
296 }
297
298 var curpatron;
299
300 function showPatron(barcode, patron, error) {
301     var alerts = checkPatronAlerts(barcode, patron);
302     if (typeof patron === 'undefined') {
303         patron = { };
304     }
305     patron.surname = patron.surname || "";
306     patron.firstname = patron.firstname || "";
307     patron.othernames = patron.othernames || "";
308     patron.address = patron.address || "";
309     patron.address2 = patron.address2 || "";
310     patron.city = patron.city || "";
311     patron.state = patron.state || "";
312     patron.country = patron.country || "";
313     patron.zipcode = patron.zipcode || "";
314     patron.phone = patron.phone || "";
315     patron.mobile = patron.mobile || "";
316     patron.phonepro = patron.phonepro || "";
317     patron.email = patron.email || "";
318     patron.emailpro = patron.emailpro || "";
319     patron.categorycode = patron.categorycode || "";
320     patron.branchcode = patron.branchcode || "";
321     patron.cardnumber = barcode;
322     patron.fine = patron.fine || "0";
323
324     patron.name = patron.firstname + (patron.othernames.length > 0 ? " (" + patron.othernames + ") " : " ") + patron.surname + " (" + barcode + ")";
325     if (patron.name.length > 0) {
326         $('.patron-title').text(patron.name);
327     } else {
328         $('.patron-title').text(_("Unrecognized patron") + " (" + barcode + ")");
329     }
330     if (patron.address.length > 0 || patron.address2.length > 0) {
331         $('#patron-address-1').text(patron.address);
332         $('#patron-address-2').text(patron.address2);
333     } else {
334         $('#patron-address-1').html('<span class="empty" id="noaddressstored">' + _("No address stored.") + '</span></li>');
335         $('#patron-address-2').text('');
336     }
337     if (patron.city.length > 0) {
338         $('#patron-address-parts').text(patron.city + (patron.state.length > 0 ? ", " + patron.state : "") + " " + patron.zipcode + (patron.country.length > 0 ? ", " + patron.country : ""));
339     } else {
340         $('#patron-address-parts').html('<span class="empty" id="nocitystored">' + _("No city stored.") + '</span></li>');
341     }
342     if (patron.phone.length > 0 || patron.mobile.length > 0 || patron.phonepro.length > 0) {
343         $('#patron-phone').text((patron.phone.length > 0 ? patron.phone : (patron.mobile.length > 0 ? patron.mobile : (patron.phonepro.length > 0 ? patron.phonepro : ''))));
344     } else {
345         $('#patron-phone').html('<span class="empty" id="nophonestored">' + _("No phone stored.") + '</span></li>');
346     }
347     if (patron.email.length > 0 || patron.emailpro.length > 0) {
348         $('#patron-email').text((patron.email.length > 0 ? patron.email : (patron.emailpro.length > 0 ? patron.emailpro : "")));
349     } else {
350         $('#patron-email').html('<span class="empty" id="noemailstored">' + _("No email stored.") + '</span></li>');
351     }
352     if (patron.categorycode.length > 0) {
353         $('#patron-category').text(_("Category: ") + patron.categorycode);
354     } else {
355         $('#patron-category').html('<span class="empty" id="unknowncategory">' + _("Category code unknown.") + '</span></li>');
356     }
357     if (patron.branchcode.length > 0) {
358         $('#patron-library').text(_("Home library: ") + patron.branchcode);
359     } else {
360         $('#patron-library').html('<span class="empty" id="unknowncategory">' + _("Home library unknown.") + '</span></li>');
361     }
362     $('.fine-amount').text(patron.fine);
363     $('#alerts').empty();
364     if (alerts.length > 0) {
365         $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
366         for (var msg in alerts) {
367             $('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
368         }
369     }
370     curpatron = patron;
371     $('#yui-main').show();
372     $('#barcode').focus();
373 }
374
375 // This next bit of code is to deal with the updated session issue
376 window.addEventListener('load', function(e) {
377     window.applicationCache.addEventListener('updateready', function(e) {
378         if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
379             // Browser downloaded a new app cache.
380             // Swap it in and reload the page to get the new hotness.
381             window.applicationCache.swapCache();
382             if (confirm(_("A new version of this site is available. Load it?"))) {
383                 window.location.reload();
384             }
385         } else {
386         // Manifest didn't changed. Nothing new to server.
387         }
388     }, false);
389 }, false);
390
391
392 $(document).ready(function () {
393     kohadb.initialize();
394
395     // Returns code
396     $('#checkin-form, #checkin_search form').submit(function (event) {
397         event.preventDefault();
398         var barcode = $('input[name="barcode"]', this).val();
399         $('input[name="barcode"]', this).val('');
400         $.indexedDB("koha").transaction(["items"]).then(function() {
401         }, function(err, e){
402         }, function(transaction){
403             var items = transaction.objectStore("items");
404             items.get(barcode).done(function (item, error) {
405                 checkin(barcode, item, error);
406             });
407         });
408     });
409
410     $('#go-to-home').click(function () {
411         $('.offline-sync').hide();
412         $('.offline-circulation').hide();
413         $('.offline-returns').hide();
414         $('.offline-home').show();
415     });
416
417     $('#go-to-returns').click(function () {
418         $('.offline-home').hide();
419         $('.offline-sync').hide();
420         $('.offline-circulation').hide();
421         $('.offline-returns').show();
422         $('#checkin-form input[name="barcode"]').focus();
423     });
424
425     $('#go-to-circ').click(function () {
426         $('.offline-home').hide();
427         $('.offline-sync').hide();
428         $('.offline-returns').hide();
429         $('.offline-circulation').hide();
430         $('#header_search').tabs("option", "active", 0);
431         $('#circ_search input[name="findborrower"]').focus();
432     });
433
434     $('#go-to-sync').click(function () {
435         $.ajax({
436             type: "GET",
437             url: "/cgi-bin/koha/offline_circ/list.pl",
438             success: function () {
439                 $('.offline-home').hide();
440                 $('.offline-returns').hide();
441                 $('.offline-circulation').hide();
442                 $('.offline-sync').show();
443                 synchronize();
444             },
445             error: function () {
446                 alert(_("You are offline and therefore cannot sync your database"));
447             }
448         });
449     });
450
451     $('#patronsearch').submit(function (event) {
452         event.preventDefault();
453         loadPatron($('#findborrower').val());
454         $('.offline-home').hide();
455         $('.offline-returns').hide();
456         $('.offline-sync').hide();
457         $('.offline-circulation').show();
458         $('#findborrower').val('');
459         $('#barcode').focus();
460     });
461
462     $('#pay-fine').click(function (event) {
463         event.preventDefault();
464         recordFine($('#pay-fine-amount').val());
465     });
466
467     $('#patronlists').tabs();
468
469     $("#newduedate").datetimepicker({
470         minDate: 1, // require that renewal date is after today
471         hour: 23,
472         minute: 59
473     });
474     $("#duedatespec").datetimepicker({
475         onClose: function(dateText, inst) { $("#barcode").focus(); },
476         hour: 23,
477         minute: 59
478     });
479     $('#mainform').submit(function (event) {
480         event.preventDefault();
481         var barcode = $('#barcode').val();
482         $.indexedDB("koha").transaction(["items"]).then(function() {
483         }, function(err, e){
484         }, function(transaction){
485             var items = transaction.objectStore("items");
486             items.get(barcode).done(function (item, error) {
487                 checkout(barcode, item, error);
488             });
489         });
490     });
491 });
492 //]]>
493 </script>
494 </head>
495 <body id="circ_offline" class="circ">
496 [% INCLUDE 'header.inc' %]
497 [% INCLUDE 'circ-search.inc' %]
498 <div class="loading-overlay" style="display: none;">
499     <div>Downloading records, please wait...</div>
500 </div>
501
502 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a id="go-to-home" href="#offline-home">Offline circulation</a></div>
503
504 <div id="doc3" class="yui-t2">
505
506     <div id="bd">
507         <div id="yui-main">
508             <audio id="alert_sound" src="/intranet-tmpl/prog/sound/critical.ogg" autobuffer="autobuffer"></audio>
509             <audio id="success_sound" src="/intranet-tmpl/prog/sound/beep.ogg" autobuffer="autobuffer"></audio>
510
511             <div id="alerts" class="yui-b">
512             </div>
513             [% UNLESS (AllowOfflineCirculation) %]
514                 <div id="noofflinecircwarning" class="dialog alert">
515                     <p><strong>Warning:</strong> Offline Circulation has been disabled. You may continue and record transactions, but patron and item information will not be available.</p>
516                 </div>
517             [% END %]
518
519             <div id="offline-home" class="yui-b offline-home">
520                 <div class="yui-g">
521                     <h1>Offline circulation</h1>
522                     <div class="yui-u first">
523                         <ul>
524                             <li><a id="go-to-circ" href="#offline-circulation">Check out</a></li>
525                             <li><a id="go-to-returns" href="#offline-returns">Check in</a></li>
526                             <li><a id="go-to-sync" href="#offline-sync">Synchronize (must be online)</a></li>
527                         </ul>
528                     </div>
529
530                     <div class="yui-u">
531                         <p><strong>Note:</strong> You must be online to use these options.</p>
532                         <ul>
533                             <li><a href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>
534                         </ul>
535                     </div>
536                 </div>
537             </div>
538
539             <div id="offline-sync" style="display: none;" class="yui-b offline-sync">
540                 <div id="toolbar" class="btn-toolbar">
541                     [% IF (AllowOfflineCirculation) %]
542                         <a href="#" id="download-records" class="btn btn-small"><i class="icon-arrow-down"></i>Download records</a>
543                     [% END %]
544                     <a href="#" id="upload-transactions" class="btn btn-small"><i class="icon-arrow-up"></i>Upload transactions</a>
545                 </div>
546                 <div class="yui-g">
547                     <h1>Offline circulation</h1>
548                     <div class="yui-u first">
549                         <div id="download-message">
550                             You have records in the offline circulation database on this
551                             computer, but they may not be current:
552                             <ul>
553                                 <li>Patron records were last synced on: <span id="patron-timestamp">(checking)</span></li>
554                                 <li>Item records were last synced on: <span id="item-timestamp">(checking)</span></li>
555                                 <li>Circulation records were last synced on: <span id="issue-timestamp">(checking)</span></li>
556                             </ul>
557                         </div>
558                     </div>
559
560                     <div class="yui-u">
561                         <div id="upload-message">You have transactions in the offline
562                             circulation database on this computer that have not been
563                             uploaded.
564                         </div>
565                     </div>
566                 </div>
567             </div>
568
569             <div id="offline-returns" style="display: none;" class="yui-b offline-returns">
570                 <div class="yui-g">
571                     <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
572                         <div class="yui-u first">
573                             <fieldset>
574                                 <legend>Check In</legend>
575                                 <label for="barcode">Enter item barcode: </label>
576                                 <input name="barcode" id="barcode" size="14" class="focus"/>
577                                 <input type="submit" class="submit" value="Submit" />
578                             </fieldset>
579                         </div>
580                     </form>
581                 </div>
582
583                 <div id="session-returned" style="display: none;">
584                     <h2>Checked-in items</h2>
585                     <table id="already-checked-in">
586                         <thead>
587                             <tr><th>Title</th><th>Author</th><th>Barcode</th><th>Home library</th><th>Holding library</th><th>Shelving location</th><th>Call number</th><th>Type</th></tr>
588                         </thead>
589                         <tbody>
590                         </tbody>
591                     </table>
592                 </div>
593             </div>
594
595             <div id="offline-circulation" style="display: none;" class="yui-b offline-circulation">
596                 <div class="yui-g">
597                     <form method="post" action="/cgi-bin/koha/circ/offline-circulation.pl" id="mainform" name="mainform" autocomplete="off">
598                         <fieldset id="circ_circulation_issue">
599                             <span id="clearscreen"><a href="/cgi-bin/koha/circ/offline-circulation.pl" title="Clear screen">x</a></span>
600                             <label for="barcode">Checking out to <span class="patron-title"></span></label>
601                             <div class="hint">Enter item barcode:</div>
602                             <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
603                             <input type="submit" value="Check Out" />
604
605                             <div class="date-select">
606                                 <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
607                                 <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" readonly="readonly" />
608                                 <label for="stickyduedate"> Remember for session:</label>
609                                 <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" checked="checked" />
610                                 <input type="button" class="action" id="cleardate" value="Clear" name="cleardate" onclick="this.checked = false; this.form.duedatespec.value = ''; this.form.stickyduedate.checked = false; this.form.barcode.focus(); return false;" />
611                             </div>
612                         </fieldset>
613                     </form>
614                 </div>
615
616                 <div class="yui-g"><div id="patronlists" class="toptabs">
617                     <ul>
618                         <li><a href="#checkouts"><span class="checkout-count">0</span> Checkouts</a></li>
619                         <li><a href="#fines"><span class="fine-amount">0</span> in fines</a></li>
620                     </ul>
621
622                     <!-- SUMMARY : TODAY & PREVIOUS ISSUES -->
623                     <div id="checkouts">
624                         <div id="session-issues">
625                             <table id="issuest">
626                                 <thead><tr>
627                                     <th scope="col">Due date</th>
628                                     <th scope="col">Title</th>
629                                     <th scope="col">Barcode</th>
630                                     <th scope="col">Item type</th>
631                                     <th scope="col">Checked out on</th>
632                                     <th scope="col">Checked out from</th>
633                                     <th scope="col">Call no</th>
634                                     <th scope="col">Charge</th>
635                                 </tr></thead>
636                                 <tbody>
637                                 </tbody>
638                             </table>
639                         </div>
640
641                         <div id="oldissues">
642                             <h5>Previous checkouts</h5>
643                             <table id="oldissuest">
644                                 <thead><tr>
645                                     <th scope="col">Due date</th>
646                                     <th scope="col">Title</th>
647                                     <th scope="col">Barcode</th>
648                                     <th scope="col">Item type</th>
649                                     <th scope="col">Checked out on</th>
650                                     <th scope="col">Checked out from</th>
651                                     <th scope="col">Call no</th>
652                                     <th scope="col">Charge</th>
653                                 </tr></thead>
654                                 <tbody>
655                                 </tbody>
656                             </table>
657                         </div>
658                     </div>
659
660                     <div id="fines">
661                         <span class="patron-title"></span> has <span class="fine-amount">0</span> in fines. If you would like you can record payments.
662                         <fieldset><legend>Pay fines</legend>
663                             <label for="pay-fine-amount">Fine amount: </label><input type="text" name="pay-fine-amount" id="pay-fine-amount"/>
664                             <button id="pay-fine" class="submit">Pay fine</button>
665
666                             <table id="session-payments" style="display: none;">
667                                 <thead><tr><th>Amount</th><th>Timestamp</th></tr></thead>
668                                 <tbody></tbody>
669                             </table>
670                         </fieldset>
671                     </div>
672                 </div>
673             </div>
674         </div>
675     </div>
676
677     <div class="yui-b offline-circulation" style="display: none;">
678         <div class="patroninfo"><h5 class="patron-title"></h5>
679             <ul>
680                 <li id="patron-address-1"></li>
681                 <li id="patron-address-2"></li>
682                 <li id="patron-address-parts"><!-- city, state, zipcode, country --></li>
683                 <li id="patron-phone"></li>
684                 <li id="patron-email"></li>
685                 <li id="patron-category"></li>
686                 <li id="patron-library"></li>
687             </ul>
688         </div>
689
690 [% INCLUDE 'intranet-bottom.inc' %]