From 121a8a87ee657e98eac70b44041378671ee51246 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 --- .../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 9cdc8b8e0c..bdc724ac1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -127,7 +127,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(); @@ -140,10 +141,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 8a79685252..00616359ee 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 8d3f90d01a..14b3ffc7a9 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.30.2