Bug 34352 - It would be great to have a generic flatpickr based input for datatables column filters
Summary: It would be great to have a generic flatpickr based input for datatables colu...
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on: 34226
Blocks:
  Show dependency treegraph
 
Reported: 2023-07-24 11:36 UTC by Martin Renvoize
Modified: 2024-04-22 22:50 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 34352: Enable flatpickr on patron search (2.11 KB, patch)
2023-07-25 13:31 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 34352: Add allowyear to flatpickr options (3.02 KB, patch)
2023-07-25 13:31 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize 2023-07-24 11:36:01 UTC
In bug 34226 I attempted to add flatpickr inputs for the column filtering in ajax driven datatables.

It worked well in the case I experimented on, but wasn't quite enough for the more generic handling I was aiming for.

We need to support flatpickr without having to import calender.inc in a rather specific load order and we could do with still being able to search on year only rather than always having to specify a full date.
Comment 1 Martin Renvoize 2023-07-25 13:31:25 UTC
Created attachment 153873 [details] [review]
Bug 34352: Enable flatpickr on patron search
Comment 2 Martin Renvoize 2023-07-25 13:31:27 UTC
Created attachment 153874 [details] [review]
Bug 34352: Add allowyear to flatpickr options

An attempt at allowing four digit years to be entered into the flatpickr
bound date filter input.

However, we're triggering at the wrong stage and I'm not sure where else
to look right now :(.
Comment 3 Martin Renvoize 2023-07-25 13:35:26 UTC
The first patch here enables the flatpickr for `type: "date"` columns in our datatables wrapper (this can be tested on the patron search results page, where we already set date types for dateofbirth and expirationdate fields in bug 34226).

However, the caveat is this allows only fully formed dates to be input which prevents end users from filtering on year only (or day, or month for that matter). Jonathan raised this as a possible issue and so I tried to update flatpickr to allow 4 digit dates to be entered into the input box.. I failed however, but my attempt is attached in case anyone wants to give it a try.
Comment 4 Jonathan Druart 2023-07-27 08:49:56 UTC
I didn't manage to bypass the flatpickr validation step, which actually happens before onClose.

Btw it seems that this validate_date call is not needed.
Comment 5 Lucas Gass 2024-04-22 22:50:50 UTC
Doesn't apply. I'd be happy to revisit this myself if I can ever get Bug 33703 in. :P