View | Details | Raw Unified | Return to bug 36120
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js (-4 / +16 lines)
Lines 459-467 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
459
                        let option = $(this);
459
                        let option = $(this);
460
                        let item_id = option.val();
460
                        let item_id = option.val();
461
                        if (valid_items.includes(parseInt(item_id))) {
461
                        if (valid_items.includes(parseInt(item_id))) {
462
                            option.prop("disabled", false);
462
                            option.attr("data-pickup", true);
463
                            if (option.data("available")) {
464
                                option.prop("disabled", false);
465
                            }
463
                        } else {
466
                        } else {
464
                            option.prop("disabled", true);
467
                            option.prop("disabled", true);
468
                            option.attr("data-pickup", false);
465
                        }
469
                        }
466
                    });
470
                    });
467
                    $("#booking_item_id").trigger("change.select2");
471
                    $("#booking_item_id").trigger("change.select2");
Lines 526-534 $("#placeBookingModal").on("show.bs.modal", function (e) { Link Here
526
                                        );
530
                                        );
527
                                    })
531
                                    })
528
                                ) {
532
                                ) {
533
                                    option.attr("data-available", false);
529
                                    option.prop("disabled", true);
534
                                    option.prop("disabled", true);
530
                                } else {
535
                                } else {
531
                                    option.prop("disabled", false);
536
                                    option.attr("data-available", true);
537
                                    if (option.data("pickup")) {
538
                                        option.prop("disabled", false);
539
                                    }
532
                                }
540
                                }
533
                            });
541
                            });
534
                            $("#booking_item_id").trigger("change.select2");
542
                            $("#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
544
                        // Range not set, reset field options
537
                        else {
545
                        else {
538
                            $("#booking_item_id > option").each(function () {
546
                            $("#booking_item_id > option").each(function () {
539
                                $(this).prop("disabled", false);
547
                                let option = $(this);
548
                                if (option.data("pickup")) {
549
                                    option.prop("disabled", false);
550
                                }
540
                            });
551
                            });
541
                            $("#booking_item_id").trigger("change.select2");
552
                            $("#booking_item_id").trigger("change.select2");
542
                        }
553
                        }
Lines 774-782 $("#placeBookingForm").on("submit", function (e) { Link Here
774
$("#placeBookingModal").on("hidden.bs.modal", function (e) {
785
$("#placeBookingModal").on("hidden.bs.modal", function (e) {
775
    $("#booking_patron_id").val(null).trigger("change");
786
    $("#booking_patron_id").val(null).trigger("change");
776
    $("#booking_patron_id").empty();
787
    $("#booking_patron_id").empty();
788
    booking_patron = undefined;
777
    $("#booking_item_id").val(0).trigger("change");
789
    $("#booking_item_id").val(0).trigger("change");
778
    $("#pickup_library_id").val(null).trigger("change");
790
    $("#pickup_library_id").val(null).trigger("change");
779
    $("#pickup_library_id").empty();
791
    $("#pickup_library_id").empty();
792
    $("#pickup_library_id").prop("disabled", true);
780
    $("#period").get(0)._flatpickr.clear();
793
    $("#period").get(0)._flatpickr.clear();
781
    $("#booking_start_date").val("");
794
    $("#booking_start_date").val("");
782
    $("#booking_end_date").val("");
795
    $("#booking_end_date").val("");
783
- 

Return to bug 36120