Bug 32653: Fix curbside pickup if configured on more than 1 branch

If curbside pickup is configured on more than 1 branch, the calendar
will not display the correct day.

We are always selecting the days for the last branch.

Test plan:
Configure curbside pickup for
CPL Monday 8:12
FPL Tuesday 12:15

Login at the opac, select CPL, notice Tuesday are available

Apply the patch and confirm all is working correctly now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 64e14f90b5)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-01-17 17:25:39 +01:00 committed by Jacob O'Mara
parent 801081139f
commit e75067f8d7
1 changed files with 7 additions and 4 deletions

View File

@ -331,6 +331,8 @@
}
});
const pickupDate_fp = document.getElementById("pickup-date")._flatpickr;
$('#pickup-branch').on('change', function() {
let branchcode = $(this).val();
@ -348,12 +350,13 @@
$('#existing-pickup-warning').hide();
$("#pickup-date,#pickup_date_item").show();
}
pickupDate_fp.set('disable', [function(date) {
return !policies[branchcode].slots_per_day.hasOwnProperty(date.getDay());
}]);
});
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 */