From 20294f52bf17847eebdf8e9a0179776beb6fa5e7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Nov 2022 13:03:53 +0100 Subject: [PATCH] Bug 31261: Introduce flatpickr-futureinclusive That let us use future + today, and it's working perfectly for our use case :) Sponsored-by: Association KohaLa - https://koha-fr.org/ Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/includes/calendar.inc | 15 ++++++++++++--- .../prog/en/modules/circ/curbside_pickups.tt | 2 +- .../opac-tmpl/bootstrap/en/includes/calendar.inc | 15 ++++++++++++--- .../bootstrap/en/modules/opac-curbside-pickups.tt | 6 +++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index eefc245d69..43e57168ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -130,7 +130,8 @@ let refresh_max_date = 0; let disable_buttons = []; - if( $(this).data("flatpickr-futuredate") === true ) { + if( $(this).data("flatpickr-futureinclusive") === true + || $(this).data("flatpickr-futuredate") === true ) { let original_date = $(this).val(); if ( original_date ) { original_date = Date_from_syspref( original_date ).getTime(); @@ -143,10 +144,18 @@ }]; } else { - options['minDate'] = new Date().fp_incr(1); + if( $(this).data("flatpickr-futureinclusive") === true ) { + options['minDate'] = new Date().setHours(00, 00, 00, 00); + } else { + options['minDate'] = new Date().fp_incr(1); + } } + disable_buttons.push(0); /* Yesterday */ - disable_buttons.push(1); /* Today */ + + if ( $(this).data("flatpickr-futuredate") === true ) { + disable_buttons.push(1); /* Today */ + } } if( $(this).data("flatpickr-pastinclusive") === true ) { options['maxDate'] = new Date(); /* Not today or hh:mm will be 00:00 */ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt index 07e0d7bc47..e2007122a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt @@ -476,7 +476,7 @@
  • - +
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc index 7059ef9b66..9e7a67520d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc @@ -141,7 +141,8 @@ let refresh_max_date = 0; let disable_buttons = []; - if( $(this).data("flatpickr-futuredate") === true ) { + if( $(this).data("flatpickr-futureinclusive") === true + || $(this).data("flatpickr-futuredate") === true ) { let original_date = $(this).val(); if ( original_date ) { original_date = Date_from_syspref( original_date ).getTime(); @@ -154,10 +155,18 @@ }]; } else { - options['minDate'] = new Date().fp_incr(1); + if( $(this).data("flatpickr-futureinclusive") === true ) { + options['minDate'] = new Date().setHours(00, 00, 00, 00); + } else { + options['minDate'] = new Date().fp_incr(1); + } } + disable_buttons.push(0); /* Yesterday */ - disable_buttons.push(1); /* Today */ + + if ( $(this).data("flatpickr-futuredate") === true ) { + disable_buttons.push(1); /* Today */ + } } if( $(this).data("flatpickr-pastinclusive") === true ) { options['maxDate'] = new Date(); /* Not today or hh:mm will be 00:00 */ diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt index fc897085ce..c24d1255ba 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt @@ -242,9 +242,9 @@
    Required
  • - - -
    Required
    + + + Required
  • -- 2.39.5