Lines 254-259
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
254 |
false, |
254 |
false, |
255 |
false |
255 |
false |
256 |
); |
256 |
); |
|
|
257 |
newOption.setAttribute( |
258 |
"data-available", |
259 |
true |
260 |
); |
261 |
|
257 |
// Append it to the select |
262 |
// Append it to the select |
258 |
$("#booking_item_id").append(newOption); |
263 |
$("#booking_item_id").append(newOption); |
259 |
} |
264 |
} |
Lines 459-467
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
459 |
let option = $(this); |
464 |
let option = $(this); |
460 |
let item_id = option.val(); |
465 |
let item_id = option.val(); |
461 |
if (valid_items.includes(parseInt(item_id))) { |
466 |
if (valid_items.includes(parseInt(item_id))) { |
462 |
option.prop("disabled", false); |
467 |
option.attr("data-pickup", true); |
|
|
468 |
if (option.data("available")) { |
469 |
option.prop("disabled", false); |
470 |
} |
463 |
} else { |
471 |
} else { |
464 |
option.prop("disabled", true); |
472 |
option.prop("disabled", true); |
|
|
473 |
option.attr("data-pickup", false); |
465 |
} |
474 |
} |
466 |
}); |
475 |
}); |
467 |
$("#booking_item_id").trigger("change.select2"); |
476 |
$("#booking_item_id").trigger("change.select2"); |
Lines 526-534
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
526 |
); |
535 |
); |
527 |
}) |
536 |
}) |
528 |
) { |
537 |
) { |
|
|
538 |
option.attr("data-available", false); |
529 |
option.prop("disabled", true); |
539 |
option.prop("disabled", true); |
530 |
} else { |
540 |
} else { |
531 |
option.prop("disabled", false); |
541 |
option.attr("data-available", true); |
|
|
542 |
if (option.data("pickup")) { |
543 |
option.prop("disabled", false); |
544 |
} |
532 |
} |
545 |
} |
533 |
}); |
546 |
}); |
534 |
$("#booking_item_id").trigger("change.select2"); |
547 |
$("#booking_item_id").trigger("change.select2"); |
Lines 536-542
$("#placeBookingModal").on("show.bs.modal", function (e) {
Link Here
|
536 |
// Range not set, reset field options |
549 |
// Range not set, reset field options |
537 |
else { |
550 |
else { |
538 |
$("#booking_item_id > option").each(function () { |
551 |
$("#booking_item_id > option").each(function () { |
539 |
$(this).prop("disabled", false); |
552 |
let option = $(this); |
|
|
553 |
if (option.data("pickup")) { |
554 |
option.prop("disabled", false); |
555 |
} |
540 |
}); |
556 |
}); |
541 |
$("#booking_item_id").trigger("change.select2"); |
557 |
$("#booking_item_id").trigger("change.select2"); |
542 |
} |
558 |
} |
Lines 774-782
$("#placeBookingForm").on("submit", function (e) {
Link Here
|
774 |
$("#placeBookingModal").on("hidden.bs.modal", function (e) { |
790 |
$("#placeBookingModal").on("hidden.bs.modal", function (e) { |
775 |
$("#booking_patron_id").val(null).trigger("change"); |
791 |
$("#booking_patron_id").val(null).trigger("change"); |
776 |
$("#booking_patron_id").empty(); |
792 |
$("#booking_patron_id").empty(); |
|
|
793 |
booking_patron = undefined; |
777 |
$("#booking_item_id").val(0).trigger("change"); |
794 |
$("#booking_item_id").val(0).trigger("change"); |
778 |
$("#pickup_library_id").val(null).trigger("change"); |
795 |
$("#pickup_library_id").val(null).trigger("change"); |
779 |
$("#pickup_library_id").empty(); |
796 |
$("#pickup_library_id").empty(); |
|
|
797 |
$("#pickup_library_id").prop("disabled", true); |
780 |
$("#period").get(0)._flatpickr.clear(); |
798 |
$("#period").get(0)._flatpickr.clear(); |
781 |
$("#booking_start_date").val(""); |
799 |
$("#booking_start_date").val(""); |
782 |
$("#booking_end_date").val(""); |
800 |
$("#booking_end_date").val(""); |
783 |
- |
|
|