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