Lines 199-205
Link Here
|
199 |
<button id="pay-fine" class="submit">Pay fine</button> |
199 |
<button id="pay-fine" class="submit">Pay fine</button> |
200 |
|
200 |
|
201 |
<table id="session-payments" style="display: none;"> |
201 |
<table id="session-payments" style="display: none;"> |
202 |
<thead><tr><th>Amount</th><th>Timestamp</th></tr></thead> |
202 |
<thead><tr><th>Amount</th><th>Date</th></tr></thead> |
203 |
<tbody></tbody> |
203 |
<tbody></tbody> |
204 |
</table> |
204 |
</table> |
205 |
</fieldset> |
205 |
</fieldset> |
Lines 260-265
Link Here
|
260 |
var start; |
260 |
var start; |
261 |
|
261 |
|
262 |
var dateformat = '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]'; |
262 |
var dateformat = '[% IF ( dateformat_us ) %]mm/dd/yy[% ELSIF ( dateformat_metric ) %]dd/mm/yy[% ELSE %]yy-mm-dd[% END %]'; |
|
|
263 |
var flatpickr_dateformat_string = [% IF ( dateformat == "us" ) %]"m/d/Y"[% ELSIF ( dateformat == "metric" ) %]"d/m/Y"[% ELSIF ( dateformat == "dmydot" ) %]"d.m.Y"[% ELSE %]"Y-m-d"[% END %]; |
264 |
var flatpickr_timeformat_string = [% IF Koha.Preference('TimeFormat') == '12hr' %]"G:i K"[% ELSE %]"H:i"[% END %]; |
265 |
var flatpickr_timestamp_string = "Y-m-d H:i"; |
266 |
var flatpickr_datetime_string = flatpickr_dateformat_string + " " + flatpickr_timeformat_string; |
263 |
|
267 |
|
264 |
function checkin(barcode, item, error) { |
268 |
function checkin(barcode, item, error) { |
265 |
var alerts = checkAlerts(barcode, item); |
269 |
var alerts = checkAlerts(barcode, item); |
Lines 360-369
Link Here
|
360 |
|
364 |
|
361 |
} |
365 |
} |
362 |
|
366 |
|
|
|
367 |
function fPformatTimeStamp( timestamp ){ |
368 |
var datetimeObj = flatpickr.parseDate( timestamp, flatpickr_timestamp_string ); |
369 |
return flatpickr.formatDate( datetimeObj, flatpickr_datetime_string ); |
370 |
} |
371 |
|
363 |
function showTimestamp(key, value) { |
372 |
function showTimestamp(key, value) { |
364 |
if (typeof value !== 'undefined') { |
373 |
if (typeof value !== 'undefined') { |
365 |
var ts = new Date(value); |
374 |
var ts = new Date(value); |
366 |
$('#' + key).text($.datepicker.formatDate(dateformat, ts) + ' ' + ts.toTimeString()); |
375 |
$('#' + key).text( fPformatTimeStamp( ts ) + ' ' + ts.toTimeString()); |
367 |
} else { |
376 |
} else { |
368 |
$('#' + key).text(_("(never)")); |
377 |
$('#' + key).text(_("(never)")); |
369 |
} |
378 |
} |
Lines 473-479
Link Here
|
473 |
$('#oldissuest tbody').empty(); |
482 |
$('#oldissuest tbody').empty(); |
474 |
issuesidx.each(function (item) { |
483 |
issuesidx.each(function (item) { |
475 |
$('#oldissues').show(); |
484 |
$('#oldissues').show(); |
476 |
$('#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>"); |
485 |
$('#oldissuest tbody').append("<tr><td>" + fPformatTimeStamp( item.value.date_due ) + "</td><td>" + item.value.title + "</td><td>" + item.value.barcode + "</td><td>" + item.value.itype + "</td><td>" + fPformatTimeStamp( item.value.issuedate ) + "</td><td>" + item.value.issuebranch + "</td><td>" + item.value.callnumber + "</td><td>" + "" + "</td></tr>"); |
477 |
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); |
486 |
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); |
478 |
}, barcode); |
487 |
}, barcode); |
479 |
}); |
488 |
}); |
Lines 495-501
Link Here
|
495 |
setTimeout(function() { $('#duedatespec').trigger('focus'), 1 }); |
504 |
setTimeout(function() { $('#duedatespec').trigger('focus'), 1 }); |
496 |
return; |
505 |
return; |
497 |
} |
506 |
} |
498 |
var date_due = new Date($('#duedatespec').datepicker('getDate')); |
507 |
var date_due = flatpickr.parseDate( $('#duedatespec').val(), flatpickr_datetime_string ); |
499 |
var trans = { "timestamp" : new Date().toMySQLString(), |
508 |
var trans = { "timestamp" : new Date().toMySQLString(), |
500 |
"barcode" : barcode, |
509 |
"barcode" : barcode, |
501 |
"cardnumber" : curpatron.cardnumber, |
510 |
"cardnumber" : curpatron.cardnumber, |
Lines 505-511
Link Here
|
505 |
$('#alerts').empty(); |
514 |
$('#alerts').empty(); |
506 |
kohadb.recordTransaction(trans, function () { |
515 |
kohadb.recordTransaction(trans, function () { |
507 |
$('#session-issues').show(); |
516 |
$('#session-issues').show(); |
508 |
$('#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>'); |
517 |
$('#issuest tbody').prepend('<tr><td>' + flatpickr.formatDate( date_due, flatpickr_datetime_string ) + '</td><td>' + item.title + '</td><td>' + barcode + '</td><td>' + item.itemtype + '</td><td>' + flatpickr.formatDate( new Date(), flatpickr_datetime_string ) + '</td><td>' + kohadb.settings.branchcode + '</td><td>' + item.callnumber + '</td><td></td></tr>'); |
509 |
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); |
518 |
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); |
510 |
if (alerts.length > 0) { |
519 |
if (alerts.length > 0) { |
511 |
$('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); |
520 |
$('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); |
Lines 526-532
Link Here
|
526 |
}; |
535 |
}; |
527 |
kohadb.recordTransaction(trans, function () { |
536 |
kohadb.recordTransaction(trans, function () { |
528 |
$('#session-payments').show(); |
537 |
$('#session-payments').show(); |
529 |
$('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>'); |
538 |
$('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + fPformatTimeStamp( timestamp ) + '</td></tr>'); |
530 |
$('.fine-amount').text(parseInt($('.fine-amount').text()) - amount); |
539 |
$('.fine-amount').text(parseInt($('.fine-amount').text()) - amount); |
531 |
}); |
540 |
}); |
532 |
} |
541 |
} |
Lines 544-556
Link Here
|
544 |
} |
553 |
} |
545 |
if (patron.debarred !== null) { |
554 |
if (patron.debarred !== null) { |
546 |
if (patron.debarred != '9999-12-31') { |
555 |
if (patron.debarred != '9999-12-31') { |
547 |
alerts.push(ALERT_PATRON_BLOCKED_TEMPORARY.format($.datepicker.formatDate(dateformat, new Date(patron.debarred)))); |
556 |
alerts.push( ALERT_PATRON_BLOCKED_TEMPORARY.format( flatpickr.formatDate( new Date(patron.debarred), flatpickr_datetime_string ) ) ); |
548 |
} else { |
557 |
} else { |
549 |
alerts.push(ALERT_PATRON_RESTRICTED); |
558 |
alerts.push(ALERT_PATRON_RESTRICTED); |
550 |
} |
559 |
} |
551 |
} |
560 |
} |
552 |
if (new Date(patron.dateexpiry) < new Date()) { |
561 |
if (new Date(patron.dateexpiry) < new Date()) { |
553 |
alerts.push(ALERT_PATRON_EXPIRED.format($.datepicker.formatDate(dateformat, new Date(patron.dateexpiry)))); |
562 |
alerts.push( ALERT_PATRON_EXPIRED.format( flatpickr.formatDate( new Date(patron.dateexpiry), flatpickr_datetime_string ) ) ); |
554 |
} |
563 |
} |
555 |
if (parseInt(patron.fine) > [% maxoutstanding | html %]) { |
564 |
if (parseInt(patron.fine) > [% maxoutstanding | html %]) { |
556 |
alerts.push(ALERT_PATRON_FINE_OVER_LIMIT.format(patron.fine)); |
565 |
alerts.push(ALERT_PATRON_FINE_OVER_LIMIT.format(patron.fine)); |
Lines 766-787
Link Here
|
766 |
|
775 |
|
767 |
$('#patronlists').tabs(); |
776 |
$('#patronlists').tabs(); |
768 |
|
777 |
|
769 |
$("#newduedate").datetimepicker({ |
778 |
$("#duedatespec").flatpickr({ |
770 |
minDate: 1, // require that renewal date is after today |
779 |
enableTime: true, |
771 |
hour: 23, |
780 |
dateFormat: flatpickr_datetime_string, |
772 |
minute: 59 |
781 |
onClose: function() { |
773 |
}); |
782 |
$("#checkout-barcode").focus(); |
774 |
$("#duedatespec").datetimepicker({ |
783 |
} |
775 |
onClose: function(dateText, inst) { |
|
|
776 |
if (validate_date(dateText, inst) ) { |
777 |
setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); |
778 |
} |
779 |
}, |
780 |
hour: 23, |
781 |
minute: 59 |
782 |
}).on("change", function(e, value) { |
783 |
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} |
784 |
}); |
784 |
}); |
|
|
785 |
|
785 |
$('#mainform').submit(function (event) { |
786 |
$('#mainform').submit(function (event) { |
786 |
event.preventDefault(); |
787 |
event.preventDefault(); |
787 |
var barcode = $('#checkout-barcode').val(); |
788 |
var barcode = $('#checkout-barcode').val(); |
788 |
- |
|
|