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