diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/_flatpickr.scss b/koha-tmpl/intranet-tmpl/prog/css/src/_flatpickr.scss
index 2883873a6d..19462121b3 100644
--- a/koha-tmpl/intranet-tmpl/prog/css/src/_flatpickr.scss
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/_flatpickr.scss
@@ -958,3 +958,7 @@ span.flatpickr-weekday {
.flatpickr-day {
border-radius: 0;
}
+
+.flatpickr_wrapper {
+ white-space: nowrap;
+}
diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
index 809e0a506b..5110580427 100644
--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
@@ -58,6 +58,10 @@ a {
&.clear_date {
color: #C33;
font-size: 130%;
+
+ &:hover {
+ color: #FF9090;
+ }
}
&.close {
@@ -219,7 +223,8 @@ aside {
width: 100%;
}
- .hasDatepicker {
+ .hasDatepicker,
+ .flatpickr-input {
margin-right: 3px;
width: calc(100% - 20px);
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc
index aa53fce167..b1aa6d1f61 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc
@@ -60,8 +60,10 @@
-
- -
- Clear date
+ -
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
index 5a61a3d058..bdb793ca67 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
@@ -31,7 +31,12 @@
},
onReady: function( selectedDates, dateStr, instance ){
/* When flatpickr instance is created, automatically append a "clear date" link */
+ if( $(instance.input).hasClass("futuredate") ){
+ instance.set("minDate", new Date().fp_incr(1));
+ }
$(instance.input)
+ /* Add a wrapper element so that we can prevent the clear button from wrapping */
+ .wrap("")
.after( $("")
.attr("href","#")
.addClass("clear_date")
@@ -48,5 +53,19 @@
validate_date( selectedDates, instance );
},
});
+ $(document).ready(function(){
+ $(".flatpickr").flatpickr();
+ var startPicker = $(".flatpickrfrom").flatpickr({
+ onClose: function( selectedDates, dateText, instance) {
+ validate_date( selectedDates, instance );
+ endPicker.set('minDate', selectedDates[0]);
+ }
+ });
+ var endPicker = $(".flatpickrto").flatpickr({
+ onClose: function( selectedDates, dateText, instance) {
+ validate_date( selectedDates, instance );
+ },
+ });
+ });
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc
index c48987677e..ef3ca48332 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc
@@ -106,12 +106,14 @@
[% hold.notes | html | html_line_break %] |
[% IF Koha.Preference('AllowHoldDateInFuture') %]
-
+
[% ELSE %]
[% hold.date | $KohaDates %]
[% END %]
|
- |
+
+
+ |
[%- IF ( hold.found ) -%]
[%- IF ( hold.atdestination ) -%]
@@ -196,8 +198,7 @@
[%- IF Koha.Preference('AutoResumeSuspendedHolds') -%]
-
- Clear date
+
[%- ELSE -%]
[%- END -%]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index ae83cd95a1..4a563b6c92 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -636,7 +636,6 @@
[% ELSE %]
[% END %]
-
[% END %]
[% END %]
@@ -884,7 +883,7 @@
[% IF Koha.Preference('AutoResumeSuspendedHolds') %]
-
+
Specify date on which to resume [% INCLUDE 'date-format.inc' %]:
[% END %]
@@ -1013,21 +1012,6 @@
function toggle_onsite_checkout(){
if ( $("#onsite_checkout").prop('checked') ) {
$("#duedatespec").val("[% todaysdate | $KohaDates with_hours => 1 %]")
- [% IF !Koha.Preference('SpecifyDueDate') %]
- $("#duedatespec").datetimepicker('destroy');
- [% END %]
- } else {
- $("#duedatespec").datetimepicker({
- onClose: function(dateText, inst) {
- if (validate_date(dateText, inst) ) {
- $("#barcode").focus();
- }
- },
- hour: 23,
- minute: 59
- }).on("change", function(e, value) {
- if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
- });
}
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
index c28e6dd3e2..41679237bc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
@@ -359,14 +359,10 @@
}));
[% IF Koha.Preference('SpecifyDueDate') %]
- $("#duedatespec").datetimepicker({
- onClose: function(dateText, inst) {
- validate_date(dateText, inst);
- },
- hour: 23,
- minute: 59
- }).on("change", function(e, value) {
- if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
+ $("#duedatespec").flatpickr({
+ enableTime: true,
+ dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
+ defaultDate: new Date().setHours(23, 59, 0, 0) /* Today a 11:59PM */
});
[% END %]
});
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt
index 6a6509f931..2a7c3fe174 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt
@@ -456,15 +456,6 @@
[% END %]
}
- function validate1(date) {
- var today = new Date();
- if ( date < today ) {
- return true;
- } else {
- return false;
- }
- };
-
function loadPatron(barcode) {
$('#oldissues').hide();
$('#session-issues').hide();
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
index febd0d66c9..d1ecdca234 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
@@ -156,11 +156,11 @@
-
+
-
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
index fb90eeacdd..d3e9c82764 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
@@ -271,12 +271,12 @@
-
+
-
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
index 9f88b39591..67082a4b75 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt
@@ -164,12 +164,12 @@
-
+
-
+
(inclusive)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
index 51488f2d59..634d24cdb7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt
@@ -217,11 +217,11 @@
[% IF ( visit ) %]
-
[% ELSE %]
-
[% END %]
Required
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index f303694234..451ffaeee5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -347,7 +347,7 @@ legend:hover {
[% END %]
Date of birth:
-
+
[% IF ( mandatorydateofbirth ) %]
Required
[% END %]
@@ -1055,7 +1055,7 @@ legend:hover {
[% END %]
Registration date:
-
+
[% IF ( mandatorydateenrolled ) %]
Required
[% END %]
@@ -1079,9 +1079,9 @@ legend:hover {
Expiry date (leave blank for auto calc):
[% UNLESS ( opadd ) %]
-
+
[% ELSE %]
-
+
[% END %]
[% IF ( mandatorydateexpiry ) %]
Required
@@ -1373,7 +1373,7 @@ legend:hover {
-
+
Clear date
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index c2590c6097..300d642bea 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -810,7 +810,7 @@
[% IF Koha.Preference('AutoResumeSuspendedHolds') %]
-
+
Specify date on which to resume [% INCLUDE 'date-format.inc' %]:
[% END %]
@@ -952,15 +952,6 @@
}
}
}
-
- function validate1(date) {
- var today = new Date();
- if ( date < today ) {
- return true;
- } else {
- return false;
- }
- };
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
index f54ac0d32a..e238ff2616 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -492,17 +492,15 @@
[% IF ( reserve_in_future ) %]
-
+
- Clear date
[% END %]
-
+
- Clear date
[% UNLESS ( multi_hold ) %]
@@ -1141,14 +1139,34 @@
[% END %]
[% IF AutoResumeSuspendedHolds %]
- $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
+ $(".suspend_until_datepicker").flatpickr({
+ minDate: new Date().fp_incr(1) /* Require that "until date" be in the future */
+ });
[% END %]
- $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
- $(".datepickerto").datepicker("option", "altFormat", "yy-mm-dd");
- $(".datepickerfrom").datepicker("option", "altField", ".datepickerfrom_hidden");
- $(".datepickerfrom").datepicker("option", "altFormat", "yy-mm-dd");
+ var startPicker = $("#reserve_date").flatpickr({
+ minDate: new Date().fp_incr(1), /* Require that "Hold starts on date" be in the future */
+ onChange: function(selectedDates, dateStr, instance) {
+ altFormat = instance.formatDate(selectedDates[0], "Y-m-d");
+ $(".datepickerfrom_hidden").val( altFormat ); /* Populate hidden field with ISO-formatted date */
+ },
+ onClose: function( selectedDates, dateText, instance) {
+ validate_date( selectedDates, instance );
+ endPicker.set('minDate', selectedDates[0]);
+ }
+ });
+
+ var endPicker = $("#expiration_date").flatpickr({
+ minDate: new Date().fp_incr(1), // Require that "Hold expires on date" be in the future
+ onChange: function(selectedDates, dateStr, instance) {
+ altFormat = instance.formatDate(selectedDates[0], "Y-m-d");
+ $(".datepickerto_hidden").val( altFormat ); /* Populate hidden field with ISO-formatted date */
+ },
+ onClose: function( selectedDates, dateText, instance) {
+ validate_date( selectedDates, instance );
+ },
+ });
var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
'bPaginate': false,
diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js b/koha-tmpl/intranet-tmpl/prog/js/calendar.js
index 1b1b31212b..b37fd327de 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js
@@ -186,14 +186,6 @@ $(document).ready(function () {
yearRange: "c-100:c+10"
});
- $("#dateofbirth").datepicker({
- yearRange: "c-100:c"
- });
-
- $(".futuredate").datepicker({
- minDate: 1, // require that hold suspended until date is after today
- });
-
$(".datepicker").datepicker({
onClose: function (dateText, inst) {
validate_date(dateText, inst);
diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
index 44a595173d..1ecd66002f 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
@@ -233,7 +233,7 @@ $(document).ready(function() {
return false;
});
- var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
+ var ymd = flatpickr.formatDate(new Date(), "Y-m-d");
$('#issues-table').hide();
$('#issues-table-actions').hide();
@@ -349,7 +349,7 @@ $(document).ready(function() {
if ( oObj.itemnotes ) {
var span_class = "text-muted";
- if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ if ( flatpickr.formatDate( new Date(oObj.issuedate), "Y-m-d" ) == ymd ){
span_class = "circ-hlt";
}
title += " - " + oObj.itemnotes.escapeHtml() + "";
@@ -357,7 +357,7 @@ $(document).ready(function() {
if ( oObj.itemnotes_nonpublic ) {
var span_class = "text-danger";
- if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ if ( flatpickr.formatDate( new Date(oObj.issuedate), "Y-m-d" ) == ymd ){
span_class = "circ-hlt";
}
title += " - " + oObj.itemnotes_nonpublic.escapeHtml() + "";
@@ -740,7 +740,7 @@ $(document).ready(function() {
if ( oObj.itemnotes ) {
var span_class = "";
- if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ if ( flatpickr.formatDate( new Date(oObj.issuedate), "Y-m-d" ) == ymd ){
span_class = "circ-hlt";
}
title += " - " + oObj.itemnotes.escapeHtml() + ""
@@ -748,7 +748,7 @@ $(document).ready(function() {
if ( oObj.itemnotes_nonpublic ) {
var span_class = "";
- if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ if ( flatpickr.formatDate( new Date(oObj.issuedate), "Y-m-d" ) == ymd ){
span_class = "circ-hlt";
}
title += " - " + oObj.itemnotes_nonpublic.escapeHtml() + ""
diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js
index f068dbd80e..13309533a9 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js
@@ -44,7 +44,7 @@ $(document).ready(function() {
if ( oObj.itemnotes ) {
var span_class = "";
- if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
+ if ( flatpickr.formatDate( new Date(oObj.issuedate), "Y-m-d" ) == ymd ){
span_class = "circ-hlt";
}
title += " - " + oObj.itemnotes.escapeHtml() + ""
@@ -335,7 +335,9 @@ $(document).ready(function() {
\
");
- $("#suspend-modal-until").datepicker({ minDate: 1 }); // Require that "until date" be in the future
+ $("#suspend-modal-until").flatpickr({
+ minDate: new Date().fp_incr(1) // Require that "until date" be in the future
+ });
$("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } );
$("#suspend-modal-submit").on( "click", function( e ) {
diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
index d282e4b22a..7a544ff2a4 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
@@ -1,3 +1,4 @@
+/* global flatpickr_dateformat_string flatpickr_timeformat_string */
$(document).ready(function() {
$("#CheckAllExports").on("click",function(){
$(".export:visible").prop("checked", true);
@@ -38,17 +39,19 @@ $(document).ready(function() {
}).on("change", function(e) {
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
});
- $("#duedatespec").datetimepicker({
- onClose: function(dateText, inst) {
- if ( validate_date(dateText, inst) ) {
- $("#barcode").focus();
- }
- },
- hour: 23,
- minute: 59
- }).on("change", function(e, value) {
- if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
+
+ $("#duedatespec").flatpickr({
+ enableTime: true,
+ dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
+ onClose: function() {
+ $("#barcode").focus();
+ }
});
+
+ $(".clear_date").on("click", function(){
+ $("#stickyduedate").prop( "checked", false );
+ });
+
$("#export_submit").on("click",function(){
export_checkouts($("#issues-table-output-format").val());
return false;
@@ -136,12 +139,3 @@ function export_checkouts(format) {
document.getElementById("output_format").value = format;
document.issues.submit();
}
-
-function validate1(date) {
- var today = new Date();
- if ( date < today ) {
- return true;
- } else {
- return false;
- }
-}
|