Lines 133-138
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
133 |
// Lead and Trail days syncing |
133 |
// Lead and Trail days syncing |
134 |
let leadDays = 0; |
134 |
let leadDays = 0; |
135 |
let trailDays = 0; |
135 |
let trailDays = 0; |
|
|
136 |
let lengthDays; |
136 |
function setBufferDays() { |
137 |
function setBufferDays() { |
137 |
let rules_url = "/api/v1/circulation_rules"; |
138 |
let rules_url = "/api/v1/circulation_rules"; |
138 |
$.ajax({ |
139 |
$.ajax({ |
Lines 143-152
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
143 |
patron_category_id: booking_patron.category_id, |
144 |
patron_category_id: booking_patron.category_id, |
144 |
item_type_id: booking_itemtype_id, |
145 |
item_type_id: booking_itemtype_id, |
145 |
library_id: pickup_library_id, |
146 |
library_id: pickup_library_id, |
146 |
rules: 'bookings_lead_period,bookings_trail_period' |
147 |
rules: 'bookings_lead_period,bookings_trail_period,issuelength,renewalsallowed,renewalperiod' |
147 |
}, |
148 |
}, |
148 |
success: function (response) { |
149 |
success: function (response) { |
149 |
let rules = response[0] |
150 |
let rules = response[0]; |
|
|
151 |
let renewalLength = rules.renewalsallowed * rules.renewalperiod; |
152 |
lengthDays = rules.issuelength + renewalLength; |
150 |
leadDays = rules.bookings_lead_period; |
153 |
leadDays = rules.bookings_lead_period; |
151 |
trailDays = rules.bookings_trail_period; |
154 |
trailDays = rules.bookings_trail_period; |
152 |
}, |
155 |
}, |
Lines 668-675
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
668 |
dateStr, |
671 |
dateStr, |
669 |
instance |
672 |
instance |
670 |
) { |
673 |
) { |
|
|
674 |
// Start date selected |
675 |
if (selectedDates[0] && !selectedDates[1]) { |
676 |
// Calculate the maximum date based on the selected start date |
677 |
const maxDate = new Date(selectedDates[0]); |
678 |
maxDate.setDate(maxDate.getDate() + lengthDays ); |
679 |
|
680 |
// Update the maxDate option of the flatpickr instance |
681 |
instance.set('maxDate', maxDate); |
682 |
} |
671 |
// Range set, update hidden fields and set available items |
683 |
// Range set, update hidden fields and set available items |
672 |
if (selectedDates[0] && selectedDates[1]) { |
684 |
else if (selectedDates[0] && selectedDates[1]) { |
673 |
// set form fields from picker |
685 |
// set form fields from picker |
674 |
let picker_start = dayjs(selectedDates[0]); |
686 |
let picker_start = dayjs(selectedDates[0]); |
675 |
let picker_end = dayjs(selectedDates[1]).endOf( |
687 |
let picker_end = dayjs(selectedDates[1]).endOf( |
676 |
- |
|
|