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