This bug will cover Flatpickr additions to these pages/files: - includes/filter-orders.inc - acqui/invoice.tt - acqui/invoices.tt - acqui/lateorders.tt - acqui/orderreceive.tt - acqui/parcels.tt
Created attachment 124453 [details] [review] Bug 28942: Use Flatpickr on acquisitions pages This patch modifies several acquisitions pages replacing jQuery datepickers with Flatpickr widgets. To test, apply the patch and test datepickers on the following Acquisitions pages: - Acquisitions -> Late orders (linked date fields in the sidebar) - Acquisitions -> Invoices (linked date fields in the sidebar) - Acquisitions -> Invoices -> Invoice details (shipment date and billing date) - Acquisitions -> Vendor -> Receive shipment (shipment date) - Acquisitions -> Vendor -> Receive shipment -> Receive (on order line) -> Date received field under "Accounting details - Acquisitions -> Orders search tab in the header -> Advanced search: Linked date fields in the search form."
Created attachment 124848 [details] [review] Bug 28942: Use Flatpickr on acquisitions pages This patch modifies several acquisitions pages replacing jQuery datepickers with Flatpickr widgets. To test, apply the patch and test datepickers on the following Acquisitions pages: - Acquisitions -> Late orders (linked date fields in the sidebar) - Acquisitions -> Invoices (linked date fields in the sidebar) - Acquisitions -> Invoices -> Invoice details (shipment date and billing date) - Acquisitions -> Vendor -> Receive shipment (shipment date) - Acquisitions -> Vendor -> Receive shipment -> Receive (on order line) -> Date received field under "Accounting details - Acquisitions -> Orders search tab in the header -> Advanced search: Linked date fields in the search form." Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 125493 [details] [review] Bug 28942: Use Flatpickr on acquisitions pages This patch modifies several acquisitions pages replacing jQuery datepickers with Flatpickr widgets. To test, apply the patch and test datepickers on the following Acquisitions pages: - Acquisitions -> Late orders (linked date fields in the sidebar) - Acquisitions -> Invoices (linked date fields in the sidebar) - Acquisitions -> Invoices -> Invoice details (shipment date and billing date) - Acquisitions -> Vendor -> Receive shipment (shipment date) - Acquisitions -> Vendor -> Receive shipment -> Receive (on order line) -> Date received field under "Accounting details - Acquisitions -> Orders search tab in the header -> Advanced search: Linked date fields in the search form." Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Great to see all these updates.. PQA
Question (not related only to this patch, but other flatpickr ones as well): Why don't you set the flatpickrto class when needed? For instance: + var billingdatefrom = $("#billingdatefrom").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + billingdateto.set('minDate', selectedDates[0]); + } + }); + var billingdateto = $("#billingdateto").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + }, + }); You need billingdatefrom, but you could use .flatpickrto for #billintdateto. Also I think we could improve it a bit more, .flatpickrfrom could have a data containing the name of its "to". We could only have: <input type="text" size="10" id="from" name="date_from" value="" class="flatpickrfrom" data-date_to="to" /> <input type="text" size="10" id="to" name="date_to" value="" class="flatpickrto" /> And a couple of line in calendar.inc to link them. I won't ofc block this patch series for that, but it would be great to have a follow-up bug on top to clean it.
Pushed to master for 21.11, thanks to everybody involved!