Bugzilla – Attachment 143211 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.00 KB, created by
Jonathan Druart
on 2022-11-04 14:10:20 UTC
(
hide
)
Description:
Bug 31262: Curbside pickup - Remove day without slots
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-11-04 14:10:20 UTC
Size:
3.00 KB
patch
obsolete
>From 8160f7ca461f8bee6da7f6306539dab18b64837d 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 >--- > .../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 00616359eee..8cf12f69b62 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 14b3ffc7a95..c24d1255ba2 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 >@@ -350,8 +350,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.25.1
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