|
Lines 26-32
function containsAny(integers1, integers2) {
Link Here
|
| 26 |
} |
26 |
} |
| 27 |
|
27 |
|
| 28 |
$("#placeBookingModal").on("show.bs.modal", function (e) { |
28 |
$("#placeBookingModal").on("show.bs.modal", function (e) { |
| 29 |
|
|
|
| 30 |
// Get context |
29 |
// Get context |
| 31 |
let button = $(e.relatedTarget); |
30 |
let button = $(e.relatedTarget); |
| 32 |
let biblionumber = button.data("biblionumber"); |
31 |
let biblionumber = button.data("biblionumber"); |
|
Lines 143-152
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
| 143 |
patron_category_id: booking_patron.category_id, |
142 |
patron_category_id: booking_patron.category_id, |
| 144 |
item_type_id: booking_itemtype_id, |
143 |
item_type_id: booking_itemtype_id, |
| 145 |
library_id: pickup_library_id, |
144 |
library_id: pickup_library_id, |
| 146 |
rules: 'bookings_lead_period,bookings_trail_period' |
145 |
rules: "bookings_lead_period,bookings_trail_period", |
| 147 |
}, |
146 |
}, |
| 148 |
success: function (response) { |
147 |
success: function (response) { |
| 149 |
let rules = response[0] |
148 |
let rules = response[0]; |
| 150 |
leadDays = rules.bookings_lead_period; |
149 |
leadDays = rules.bookings_lead_period; |
| 151 |
trailDays = rules.bookings_trail_period; |
150 |
trailDays = rules.bookings_trail_period; |
| 152 |
|
151 |
|
|
Lines 824-829
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
| 824 |
const trailStart = hoverDate; |
823 |
const trailStart = hoverDate; |
| 825 |
const trailEnd = hoverDate.add(trailDays, "day"); |
824 |
const trailEnd = hoverDate.add(trailDays, "day"); |
| 826 |
|
825 |
|
|
|
826 |
let leadDisable = false; |
| 827 |
let trailDisable = false; |
| 827 |
periodPicker.calendarContainer |
828 |
periodPicker.calendarContainer |
| 828 |
.querySelectorAll(".flatpickr-day") |
829 |
.querySelectorAll(".flatpickr-day") |
| 829 |
.forEach(function (dayElem) { |
830 |
.forEach(function (dayElem) { |
|
Lines 857-867
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
| 857 |
"trailRangeEnd", |
858 |
"trailRangeEnd", |
| 858 |
elemDate.isSame(trailEnd) |
859 |
elemDate.isSame(trailEnd) |
| 859 |
); |
860 |
); |
|
|
861 |
// If we're overlapping a disabled date, disable our hoverDate |
| 862 |
if ( |
| 863 |
dayElem.classList.contains( |
| 864 |
"flatpickr-disabled" |
| 865 |
) |
| 866 |
) { |
| 867 |
if ( |
| 868 |
elemDate.isSameOrAfter(leadStart) && |
| 869 |
elemDate.isBefore(leadEnd) |
| 870 |
) { |
| 871 |
leadDisable = true; |
| 872 |
} |
| 873 |
if ( |
| 874 |
elemDate.isAfter(trailStart) && |
| 875 |
elemDate.isSameOrBefore(trailEnd) |
| 876 |
) { |
| 877 |
trailDisable = true; |
| 878 |
} |
| 879 |
} |
| 880 |
dayElem.classList.remove("leadDisable"); |
| 881 |
dayElem.classList.remove("trailDisable"); |
| 882 |
dayElem.removeEventListener( |
| 883 |
"click", |
| 884 |
disableClick, |
| 885 |
true |
| 886 |
); |
| 860 |
}); |
887 |
}); |
|
|
888 |
|
| 889 |
if (leadDisable) { |
| 890 |
target.classList.add("leadDisable"); |
| 891 |
} |
| 892 |
if (trailDisable) { |
| 893 |
target.classList.add("trailDisable"); |
| 894 |
} |
| 895 |
if (trailDisable || leadDisable) { |
| 896 |
target.addEventListener( |
| 897 |
"click", |
| 898 |
disableClick, |
| 899 |
true |
| 900 |
); |
| 901 |
} |
| 861 |
} |
902 |
} |
| 862 |
} |
903 |
} |
| 863 |
); |
904 |
); |
| 864 |
|
905 |
|
|
|
906 |
function disableClick(e) { |
| 907 |
e.stopImmediatePropagation(); |
| 908 |
} |
| 909 |
|
| 865 |
// Enable flatpickr now we have date function populated |
910 |
// Enable flatpickr now we have date function populated |
| 866 |
periodPicker.redraw(); |
911 |
periodPicker.redraw(); |
| 867 |
|
912 |
|
| 868 |
- |
|
|