Bugzilla – Attachment 143294 Details for
Bug 31262
Curbside pickups - disable dates without slots
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31262: Curbside pickup - Remove day without slots
Bug-31262-Curbside-pickup---Remove-day-without-slo.patch (text/plain), 3.10 KB, created by
David Nind
on 2022-11-04 22:49:40 UTC
(
hide
)
Description:
Bug 31262: Curbside pickup - Remove day without slots
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-11-04 22:49:40 UTC
Size:
3.10 KB
patch
obsolete
>From 6f8108852e54ba30670e64b3370c548f45d121b3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 4 Nov 2022 15:00:54 +0100 >Subject: [PATCH] Bug 31262: Curbside pickup - Remove day without slots > >We disable dates from the date picker that do not have slots defined in >the configuration. > >Note that dates that have slots configured but none are available will >still be displayed. To implement that we would need to calculate the >availability for all the dates displayed on the widget (1 month) and >that will (certainly) slow down considerabily the UI. > >Test plan: >Configure curbside pickup for a given library. Define slots for several >days of the week (not all). >Schedule a pickup and confirm that only the days with slots defined are >available in the date picker widget > >Sponsored-by: Association KohaLa - https://koha-fr.org/ > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/circ/curbside_pickups.tt | 8 ++++++++ > .../bootstrap/en/modules/opac-curbside-pickups.tt | 7 +++++-- > 2 files changed, 13 insertions(+), 2 deletions(-) > >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 62bb1c2b0e..e61afed1c6 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 >@@ -547,6 +547,14 @@ > $('#input-patron-cardnumber').focus(); > }); > >+ const pickup_date = document.querySelector("#pickup_date"); >+ if ( pickup_date ) { >+ const fp = pickup_date._flatpickr; >+ fp.set('disable', [function(date) { >+ return !slots_per_day.hasOwnProperty(date.getDay()); >+ }]); >+ } >+ > $("#pickup_date").on('change', function() { > > $('#pickup-times').empty(); >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 3760c79b30..ca1e1cd12e 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 >@@ -352,8 +352,11 @@ > } > }); > >- const pickupDate = document.getElementById("pickup-date"); >- pickupDate._flatpickr.config.onClose.push(function( selectedDates, dateStr, instance ){ >+ const pickupDate_fp = document.getElementById("pickup-date")._flatpickr; >+ pickupDate_fp.set('disable', [function(date) { >+ return !slots_per_day.hasOwnProperty(date.getDay()); >+ }]); >+ pickupDate_fp.config.onClose.push(function( selectedDates, dateStr, instance ){ > /* Here we add an onClose event to the existing flatpickr instance */ > /* It fires after the user has selected a date from the calendar popup */ > $('#pickup-times').html("<label>" + _("Select a time") + ":</label><div id=\"pickup-time-slots\"></div>"); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31262
:
138403
|
143211
|
143212
|
143294
|
143610