Bug 28376: Replace jQueryUI date/timepicker with Flatpickr
authorOwen Leonard <oleonard@myacpl.org>
Thu, 20 May 2021 15:48:58 +0000 (15:48 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 30 Aug 2021 16:08:04 +0000 (18:08 +0200)
commitf892ae8bf1f5e82b566ea0d22fc36b88fb33774a
tree07ed1f2a832992922801c7d707b26fdb4a404c08
parent1393e48d8e1bf036bc558b99b5a5bb9b9c13342a
Bug 28376: Replace jQueryUI date/timepicker with Flatpickr

This patch is a proof of concept demonstrating how jQueryUI date & time
pickers could be replaced using the Flatpickr library
(https://flatpickr.js.org/).

NEW: I've modified the default configuration of Flatpickr instances so
that a "Clear date" link is automatically appended. This eliminates the
need to add a button to the markup and event handling for each case.

NEW: Date/time formatting should be corrected in this revised patch.

The patch modifies three pages as test cases:
 - Circulation -> Renew (with SpecifyDueDates enabled), to demonstrate
   date and time selection.
   - NEW: You can also test the datepicker shown when you renew an
     on-hold item. This demonstrates a configuration which requires that
     the selection be after today.
 - Administration -> Patron categories -> New category, to demonstrate a
   calendar-only date picker enforcing a date after today.
 - NEW: Reports -> Patrons. The "Date of birth" fields are linked so
   that the second cannot be before the first.

I've made some customizations to the default Flatpickr library's CSS and
incorporated it into staff-global.scss, so you must rebuild the staff
client SCSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/lib/flatpickr/flatpickr.min.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/css/src/_flatpickr.scss [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/css/src/_vars.scss [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
koha-tmpl/intranet-tmpl/prog/js/calendar.js
koha-tmpl/intranet-tmpl/prog/js/categories.js