5 [% IF (AllowOfflineCirculation) %]
6 [% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %]
8 [% IF ( bidi && AllowOfflineCirculation ) %]<html lang="[% lang | html %]" dir="[% bidi | html %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">
9 [% ELSIF ( bidi ) %]<html lang="[% lang | html %]" dir="[% bidi | html %]">
10 [% ELSIF ( AllowOfflineCirculation ) %]<html lang="[% lang | html %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">
11 [% ELSE %]<html lang="[% lang | html %]">[% END %]
13 <title>Koha › Circulation</title>
14 [% INCLUDE 'doc-head-close.inc' %]
17 <body id="circ_offline" class="circ">
18 [% INCLUDE 'header.inc' %]
19 [% INCLUDE 'circ-search.inc' %]
20 <div class="loading-overlay" style="display: none;">
21 <div>Downloading records, please wait...</div>
24 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a id="go-to-home" href="#offline-home">Offline circulation</a></div>
26 <div id="doc3" class="yui-t2">
30 <audio id="alert_sound" src="[% interface | html %]/prog/sound/critical.ogg" preload="auto"></audio>
31 <audio id="success_sound" src="[% interface | html %]/prog/sound/beep.ogg" preload="auto"></audio>
33 <div id="alerts" class="yui-b">
35 [% UNLESS (AllowOfflineCirculation) %]
36 <div id="noofflinecircwarning" class="dialog alert">
37 <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>
41 <div id="offline-home" class="yui-b offline-home">
43 <h1>Offline circulation</h1>
44 <div class="yui-u first">
46 <li><a id="go-to-circ" href="#offline-circulation">Check out</a></li>
47 <li><a id="go-to-returns" href="#offline-returns">Check in</a></li>
52 <p><strong>Note:</strong> You must be online to use these options.</p>
54 <li><a id="go-to-sync" href="#offline-sync">Synchronize</a></li>
55 <li><a id="go-to-pending" href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>
61 <div id="offline-sync" style="display: none;" class="yui-b offline-sync">
62 <div id="toolbar" class="btn-toolbar">
63 [% IF (AllowOfflineCirculation) %]
64 <a href="#" id="download-records" class="btn btn-default btn-sm"><i class="fa fa-arrow-down"></i>Download records</a>
66 <a href="#" id="upload-transactions" class="btn btn-default btn-sm"><i class="fa fa-arrow-up"></i>Upload transactions</a>
69 <h1>Offline circulation</h1>
70 <div class="yui-u first">
71 <div id="download-message">
72 In order for offline circulation to work on this computer,
73 your library's records must be up-to-date on this computer:
75 <li>Patron records were last synced on: <span id="patron-timestamp">(checking)</span></li>
76 <li>Item records were last synced on: <span id="item-timestamp">(checking)</span></li>
77 <li>Circulation records were last synced on: <span id="issue-timestamp">(checking)</span></li>
83 <div id="upload-message">
85 <div>View <a href="/cgi-bin/koha/offline_circ/list.pl">pending offline circulation actions</a></div>
90 <div id="offline-returns" style="display: none;" class="yui-b offline-returns">
92 <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
93 <div class="yui-u first">
95 <legend>Check In</legend>
96 <label for="checkin-barcode">Enter item barcode: </label>
97 <input name="barcode" id="checkin-barcode" size="14" class="focus" type="text" />
98 <input type="submit" class="submit" value="Submit" />
104 <div id="session-returned" style="display: none;">
105 <h2>Checked-in items</h2>
106 <table id="already-checked-in">
108 <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>
116 <div style="display: none;" class="yui-b offline-circulation-instructions">
118 Scan a patron barcode to start.
122 <div id="offline-circulation" style="display: none;" class="yui-b offline-circulation">
124 <form method="post" action="/cgi-bin/koha/circ/offline.pl" id="mainform" name="mainform" autocomplete="off">
125 <fieldset id="circ_circulation_issue">
126 <span id="clearscreen"><a href="/cgi-bin/koha/circ/offline.pl" title="Clear screen">x</a></span>
127 <label for="checkout-barcode">Checking out to <span class="patron-title"></span></label>
128 <div class="hint">Enter item barcode:</div>
129 <input type="text" name="barcode" id="checkout-barcode" class="barcode focus" size="14" />
130 <input type="submit" value="Check Out" />
132 <div class="date-select">
133 <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
134 <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" />
135 <label for="stickyduedate"> Remember for session:</label>
136 <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" checked="checked" />
137 <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;" />
143 <div class="yui-g"><div id="patronlists" class="toptabs">
145 <li><a href="#checkouts"><span class="checkout-count">0</span> Checkouts</a></li>
146 <li><a href="#fines"><span class="fine-amount">0</span> in fines</a></li>
149 <!-- SUMMARY : TODAY & PREVIOUS ISSUES -->
151 <div id="session-issues">
154 <th scope="col">Due date</th>
155 <th scope="col">Title</th>
156 <th scope="col">Barcode</th>
157 <th scope="col">Item type</th>
158 <th scope="col">Checked out on</th>
159 <th scope="col">Checked out from</th>
160 <th scope="col">Call no</th>
161 <th scope="col">Charge</th>
169 <h5>Previous checkouts</h5>
170 <table id="oldissuest">
172 <th scope="col">Due date</th>
173 <th scope="col">Title</th>
174 <th scope="col">Barcode</th>
175 <th scope="col">Item type</th>
176 <th scope="col">Checked out on</th>
177 <th scope="col">Checked out from</th>
178 <th scope="col">Call no</th>
179 <th scope="col">Charge</th>
188 <span class="patron-title"></span> has <span class="fine-amount">0</span> in fines. If you would like you can record payments.
189 <fieldset><legend>Pay fines</legend>
190 <label for="pay-fine-amount">Fine amount: </label><input type="text" name="pay-fine-amount" id="pay-fine-amount"/>
191 <button id="pay-fine" class="submit">Pay fine</button>
193 <table id="session-payments" style="display: none;">
194 <thead><tr><th>Amount</th><th>Timestamp</th></tr></thead>
204 <div class="yui-b offline-circulation" style="display: none;">
205 <div class="patroninfo"><h5 class="patron-title"> </h5>
207 <li id="patron-address-1"></li>
208 <li id="patron-address-2"></li>
209 <li id="patron-address-parts"><!-- city, state, zipcode, country --></li>
210 <li id="patron-phone"></li>
211 <li id="patron-email"></li>
212 <li id="patron-category"></li>
213 <li id="patron-library"></li>
219 [% MACRO jsinclude BLOCK %]
220 [% INCLUDE 'calendar.inc' %]
221 [% Asset.js("lib/jquery/plugins/jquery.indexeddb.js") | $raw %]
222 [% Asset.js("js/offlinecirc.js") | $raw %]
223 [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
224 [% INCLUDE 'timepicker.inc' %]
225 <script type="text/javascript">
226 var ALERT_SUCCESSFUL_CHECKIN = _("Checked in item.");
227 var ALERT_MATERIALS = _("Note about the accompanying materials: %s");
228 var ALERT_RESTRICTED = _("Patron is RESTRICTED");
229 var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): %s");
230 var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)");
231 var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)");
232 var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)");
233 var ALERT_ITEM_LOST = _("Item has been lost (transaction recorded anyway)");
234 var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): %s");
235 var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (proceeding anyway)");
236 var ALERT_PATRON_CARD_LOST = _("Patron's card is lost");
237 var ALERT_PATRON_EXPIRED = _("Patron's card is expired (%s)");
238 var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is restricted until: %s");
239 var ALERT_PATRON_RESTRICTED = _("Patron is restricted");
240 var ALERT_PATRON_FINE = _("Patron has outstanding fines: %s");
241 var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: %s");
242 var UPLOAD_PENDING_MESSAGE = _("You have transactions in the offline circulation database on this computer that have not been uploaded.");
243 var NO_UPLOAD_PENDING_MESSAGE = _("You do not have any pending transactions in the offline circulation database on this computer.");
247 var dateformat = '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]';
249 function checkin(barcode, item, error) {
250 var alerts = checkAlerts(barcode, item);
251 if (typeof item === 'undefined') {
254 item.title = item.title || _("(Unknown)");
255 item.author = item.author || _("(Unknown)");
256 item.homebranch = item.homebranch || "";
257 item.holdingbranch = item.holdingbranch || "";
258 item.callnumber = item.callnumber || "";
259 item.itemtype = item.itemtype || "";
260 item.barcode = item.barcode || barcode;
261 var trans = { "timestamp" : new Date().toMySQLString(),
265 $('#alerts').empty();
266 $('.offline-home').hide();
267 $('.offline-sync').hide();
268 $('.offline-circulation').hide();
269 $('.offline-circulation-instructions').hide();
270 $('.offline-returns').show();
271 kohadb.recordTransaction(trans, function () {
272 $('#session-returned').show();
273 $('#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>');
274 if (alerts.length > 0) {
275 $('#alerts').append('<div class="dialog alert"><h3>' + _("Check in message") + '</h3></div>');
276 for (var msg in alerts) {
277 $('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
280 $('#alerts').append('<div class="dialog"><h3>' + ALERT_SUCCESSFUL_CHECKIN + '</h3></div>');
283 setTimeout(function() { $('#checkin-barcode').trigger('focus'), 1 });
286 function checkAlerts(barcode, item) {
288 if (typeof item === 'undefined') {
289 alerts.push(ALERT_NO_MATCHING_ITEM.format(barcode));
291 if (typeof item.materials !== 'undefined' && item.materials != null) {
292 alerts.push(ALERT_MATERIALS.format(item.materials));
298 function showSyncInfo() {
299 kohadb.loadSetting("item-timestamp", showTimestamp);
300 kohadb.loadSetting("patron-timestamp", showTimestamp);
301 kohadb.loadSetting("issue-timestamp", showTimestamp);
302 kohadb.loadSetting("dirty", function (key, val) {
304 $('#upload-message').text(UPLOAD_PENDING_MESSAGE);
306 $('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
311 function synchronize() {
312 kohadb.saveSetting("userid", "[% logged_in_user.userid | html %]");
313 kohadb.saveSetting("branchcode", "[% LoginBranchcode | html %]");
315 [% UNLESS (AllowOfflineCirculation) %]
319 $('#download-records').click(reloadRecords);
320 $('#upload-transactions').click(function () {
321 $('.loading-overlay div').text(_("Uploading transactions, please wait..."));
322 $('.loading-overlay').show();
325 url: "/cgi-bin/koha/offline_circ/service.pl",
326 }).done(function (data) {
328 $('.loading-overlay').hide();
329 alert(_("Please log in to Koha and try again. (Error: '%s')").format(data));
331 var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
332 uploadIter.done(function() {
333 $.indexedDB("koha").transaction(["transactions"]).then(function(){
335 }, function(transaction){
336 transaction.objectStore("transactions").clear();
338 $('.loading-overlay').hide();
339 kohadb.saveSetting("dirty", false);
340 $('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
348 function showTimestamp(key, value) {
349 if (typeof value !== 'undefined') {
350 var ts = new Date(value);
351 $('#' + key).text($.datepicker.formatDate(dateformat, ts) + ' ' + ts.toTimeString());
353 $('#' + key).text(_("(never)"));
357 function reloadRecords(ev) {
358 $(".loading-overlay div").text(_("Loading records, please wait..."));
359 $(".loading-overlay").show();
361 $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){
364 }, function(transaction){
365 transaction.objectStore("patrons").clear();
366 transaction.objectStore("items").clear();
367 transaction.objectStore("issues").clear();
369 if (typeof ev !== 'undefined') {
370 ev.stopPropagation();
374 function uploadTransaction(transaction) {
377 url: "/cgi-bin/koha/offline_circ/service.pl",
378 data: { "userid" : kohadb.settings.userid,
379 "branchcode" : kohadb.settings.branchcode,
380 "timestamp" : transaction.value.timestamp,
381 "action" : transaction.value.action,
382 "barcode" : transaction.value.barcode,
383 "cardnumber" : transaction.value.cardnumber,
384 "amount" : transaction.value.amount,
388 return undefined, true;
391 function finishedLoading() {
392 kohadb.saveSetting('item-timestamp', start.toISOString())
393 kohadb.saveSetting('patron-timestamp', start.toISOString())
394 kohadb.saveSetting('issue-timestamp', start.toISOString())
395 showTimestamp('item-timestamp', start.toISOString());
396 showTimestamp('patron-timestamp', start.toISOString());
397 showTimestamp('issue-timestamp', start.toISOString());
398 $(".loading-overlay").hide();
401 function loadRecords(page) {
402 [% IF (AllowOfflineCirculation) %]
403 $(".loading-overlay div").text(_("Loading page %s, please wait...").format(page));
404 $(".loading-overlay").show();
407 url: "/cgi-bin/koha/offline_circ/download.pl",
408 data: { "data": "all",
412 }).done(function (data) {
413 $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){
417 setTimeout(function () { loadRecords(page + 1); }, 200);
420 }, function(transaction){
422 var patrons = transaction.objectStore("patrons");
423 $.each(data.patrons, function () {
428 var items = transaction.objectStore("items");
429 $.each(data.items, function () {
434 var issues = transaction.objectStore("issues");
435 $.each(data.issues, function () {
444 function validate1(date) {
445 var today = new Date();
446 if ( date < today ) {
453 function loadPatron(barcode) {
454 $('#oldissues').hide();
455 $('#session-issues').hide();
456 $('#issuest tbody').empty();
457 $('#session-payments').hide();
458 $('.checkout-count').text(0);
459 $.indexedDB("koha").transaction(["patrons", "issues"]).then(function() {
461 }, function(transaction){
462 var patrons = transaction.objectStore("patrons");
463 patrons.get(barcode).done(function (patron, error) {
464 showPatron(barcode, patron, error);
466 var issuesidx = transaction.objectStore("issues").index("cardnumber");
467 $('#oldissuest tbody').empty();
468 issuesidx.each(function (item) {
469 $('#oldissues').show();
470 $('#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>");
471 $('.checkout-count').text(parseInt($('.checkout-count').text()) + 1);
476 function checkout(barcode, item, error) {
477 var alerts = checkAlerts(barcode, item);
478 if (typeof item === 'undefined') {
481 item.title = item.title || "";
482 item.author = item.author || "";
483 item.homebranch = item.homebranch || "";
484 item.holdingbranch = item.holdingbranch || "";
485 item.callnumber = item.callnumber || "";
486 item.itemtype = item.itemtype || "";
487 if ($('#duedatespec').val().length === 0) {
488 alert(_("You must set a due date in order to use offline circulation!"));
489 setTimeout(function() { $('#duedatespec').trigger('focus'), 1 });
492 var date_due = new Date($('#duedatespec').datepicker('getDate'));
493 var trans = { "timestamp" : new Date().toMySQLString(),
495 "cardnumber" : curpatron.cardnumber,
496 "date_due" : date_due.toMySQLString(),
499 $('#alerts').empty();
500 kohadb.recordTransaction(trans, function () {
501 $('#session-issues').show();
502 $('#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>');
503 $('.checkout-count').text(parseInt($('.checkout-count').text()) + 1);
504 if (alerts.length > 0) {
505 $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
506 for (var msg in alerts) {
507 $('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
510 $('#checkout-barcode').val('');
514 function recordFine(amount) {
515 var timestamp = new Date()
516 var trans = { "timestamp" : timestamp.toMySQLString(),
517 "cardnumber" : curpatron.cardnumber,
519 "action" : "payment",
521 kohadb.recordTransaction(trans, function () {
522 $('#session-payments').show();
523 $('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>');
524 $('.fine-amount').text(parseInt($('.fine-amount').text()) - amount);
528 function checkPatronAlerts(cardnumber, patron) {
530 if (typeof patron === 'undefined') {
531 alerts.push(ALERT_NO_MATCHING_PATRON.format(cardnumber));
533 if (patron.gonenoaddress !== '0') {
534 alerts.push(ALERT_PATRON_GONE_NO_ADDRESS);
536 if (patron.lost !== '0') {
537 alerts.push(ALERT_PATRON_CARD_LOST);
539 if (patron.debarred !== null) {
540 if (patron.debarred != '9999-12-31') {
541 alerts.push(ALERT_PATRON_BLOCKED_TEMPORARY.format($.datepicker.formatDate(dateformat, new Date(patron.debarred))));
543 alerts.push(ALERT_PATRON_RESTRICTED);
546 if (new Date(patron.dateexpiry) < new Date()) {
547 alerts.push(ALERT_PATRON_EXPIRED.format($.datepicker.formatDate(dateformat, new Date(patron.dateexpiry))));
549 if (parseInt(patron.fine) > [% maxoutstanding | html %]) {
550 alerts.push(ALERT_PATRON_FINE_OVER_LIMIT.format(patron.fine));
551 } else if (parseInt(patron.fine) > 0) {
552 alerts.push(ALERT_PATRON_FINE.format(patron.fine));
560 function showPatron(barcode, patron, error) {
561 var alerts = checkPatronAlerts(barcode, patron);
562 if (typeof patron === 'undefined') {
565 patron.surname = patron.surname || "";
566 patron.firstname = patron.firstname || "";
567 patron.othernames = patron.othernames || "";
568 patron.address = patron.address || "";
569 patron.address2 = patron.address2 || "";
570 patron.city = patron.city || "";
571 patron.state = patron.state || "";
572 patron.country = patron.country || "";
573 patron.zipcode = patron.zipcode || "";
574 patron.phone = patron.phone || "";
575 patron.mobile = patron.mobile || "";
576 patron.phonepro = patron.phonepro || "";
577 patron.email = patron.email || "";
578 patron.emailpro = patron.emailpro || "";
579 patron.categorycode = patron.categorycode || "";
580 patron.branchcode = patron.branchcode || "";
581 patron.cardnumber = barcode;
582 patron.fine = patron.fine || "0";
584 patron.name = patron.firstname + (patron.othernames.length > 0 ? " (" + patron.othernames + ") " : " ") + patron.surname + " (" + barcode + ")";
585 if (patron.name.length > 0) {
586 $('.patron-title').text(patron.name);
588 $('.patron-title').text(_("Unrecognized patron (%s)").format(barcode));
590 if (patron.address.length > 0 || patron.address2.length > 0) {
591 $('#patron-address-1').text(patron.address);
592 $('#patron-address-2').text(patron.address2);
594 $('#patron-address-1').html('<span class="empty" id="noaddressstored">' + _("No address stored.") + '</span></li>');
595 $('#patron-address-2').text('');
597 if (patron.city.length > 0) {
598 $('#patron-address-parts').text(patron.city + (patron.state.length > 0 ? ", " + patron.state : "") + " " + patron.zipcode + (patron.country.length > 0 ? ", " + patron.country : ""));
600 $('#patron-address-parts').html('<span class="empty" id="nocitystored">' + _("No city stored.") + '</span></li>');
602 if (patron.phone.length > 0 || patron.mobile.length > 0 || patron.phonepro.length > 0) {
603 $('#patron-phone').text((patron.phone.length > 0 ? patron.phone : (patron.mobile.length > 0 ? patron.mobile : (patron.phonepro.length > 0 ? patron.phonepro : ''))));
605 $('#patron-phone').html('<span class="empty" id="nophonestored">' + _("No phone stored.") + '</span></li>');
607 if (patron.email.length > 0 || patron.emailpro.length > 0) {
608 $('#patron-email').text((patron.email.length > 0 ? patron.email : (patron.emailpro.length > 0 ? patron.emailpro : "")));
610 $('#patron-email').html('<span class="empty" id="noemailstored">' + _("No email stored.") + '</span></li>');
612 if (patron.categorycode.length > 0) {
613 $('#patron-category').text(_("Category: %s").format(patron.categorycode));
615 $('#patron-category').html('<span class="empty" id="unknowncategory">' + _("Category code unknown.") + '</span></li>');
617 if (patron.branchcode.length > 0) {
618 $('#patron-library').text(_("Home library: %s").format(patron.branchcode));
620 $('#patron-library').html('<span class="empty" id="unknowncategory">' + _("Home library unknown.") + '</span></li>');
622 $('.fine-amount').text(patron.fine);
623 $('#alerts').empty();
624 if (alerts.length > 0) {
625 $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
626 for (var msg in alerts) {
627 $('#alerts .dialog').append('<p>' + alerts[msg] + '</p>');
631 $('#yui-main').show();
632 setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 });
635 // This next bit of code is to deal with the updated session issue
636 window.addEventListener('load', function(e) {
637 window.applicationCache.addEventListener('updateready', function(e) {
638 if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
639 // Browser downloaded a new app cache.
640 // Swap it in and reload the page to get the new hotness.
641 window.applicationCache.swapCache();
642 if (confirm(_("A new version of this site is available. Load it?"))) {
643 window.location.reload();
646 // Manifest didn't changed. Nothing new to server.
652 $(document).ready(function () {
654 $('#header_search #circ_search .tip').text(_("Enter patron card number:"));
656 $('ul[aria-labelledby="logged-in-menu"]').html('<li><a class="toplinks">' + _("You cannot change your branch or logout while using offline circulation") + '</a></li>');
659 $('#checkin-form, #checkin_search form').submit(function (event) {
660 event.preventDefault();
661 var barcode = $('input[name="barcode"]', this).val();
662 $('input[name="barcode"]', this).val('');
663 $.indexedDB("koha").transaction(["items"]).then(function() {
665 }, function(transaction){
666 var items = transaction.objectStore("items");
667 items.get(barcode).done(function (item, error) {
668 checkin(barcode, item, error);
673 $('#go-to-home').click(function () {
674 $('#alerts').empty();
675 $('.offline-sync').hide();
676 $('.offline-circulation').hide();
677 $('.offline-returns').hide();
678 $('.offline-circulation-instructions').hide();
679 $('.offline-home').show();
682 $('#go-to-returns').click(function () {
683 $('#alerts').empty();
684 $('.offline-home').hide();
685 $('.offline-sync').hide();
686 $('.offline-circulation').hide();
687 $('.offline-circulation-instructions').hide();
688 $('.offline-returns').show();
689 setTimeout(function() { $('#checkin-form input[name="barcode"]').trigger('focus'), 1 });
692 $('#go-to-circ').click(function () {
693 $('#alerts').empty();
694 $('.offline-home').hide();
695 $('.offline-sync').hide();
696 $('.offline-returns').hide();
697 $('.offline-circulation').hide();
698 $('.offline-circulation-instructions').show();
699 $('#header_search').tabs("option", "active", 0);
700 setTimeout(function() { $('#circ_search input[name="findborrower"]').trigger('focus'), 1 });
703 $('#go-to-sync').click(function () {
704 $('#alerts').empty();
708 url: "/cgi-bin/koha/offline_circ/list.pl",
709 success: function () {
710 $('.offline-home').hide();
711 $('.offline-returns').hide();
712 $('.offline-circulation').hide();
713 $('.offline-circulation-instructions').hide();
714 $('.offline-sync').show();
718 alert(_("You are offline and therefore cannot sync your database"));
723 $('#go-to-pending').click(function (ev) {
724 $('#alerts').empty();
728 url: "/cgi-bin/koha/offline_circ/list.pl",
729 success: function () {
730 window.location = '/cgi-bin/koha/offline_circ/list.pl';
733 alert(_("You are offline and therefore cannot process pending operations"));
738 $('#patronsearch').submit(function (event) {
739 event.preventDefault();
740 loadPatron($('#findborrower').val());
741 $('.offline-home').hide();
742 $('.offline-returns').hide();
743 $('.offline-sync').hide();
744 $('.offline-circulation-instructions').hide();
745 $('.offline-circulation').show();
746 $('#findborrower').val('');
747 setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 });
750 $('#pay-fine').click(function (event) {
751 event.preventDefault();
752 recordFine($('#pay-fine-amount').val());
755 $('#patronlists').tabs();
757 $("#newduedate").datetimepicker({
758 minDate: 1, // require that renewal date is after today
762 $("#duedatespec").datetimepicker({
763 onClose: function(dateText, inst) {
764 if (validate_date(dateText, inst) ) {
765 setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 });
770 }).on("change", function(e, value) {
771 if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
773 $('#mainform').submit(function (event) {
774 event.preventDefault();
775 var barcode = $('#checkout-barcode').val();
776 $.indexedDB("koha").transaction(["items"]).then(function() {
778 }, function(transaction){
779 var items = transaction.objectStore("items");
780 items.get(barcode).done(function (item, error) {
781 checkout(barcode, item, error);
789 [% INCLUDE 'intranet-bottom.inc' %]