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

(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+12 lines)
Lines 871-876 $dayTrailBackground: #fcdcb3 !default; Link Here
871
    &.trailRangeEnd {
871
    &.trailRangeEnd {
872
        border-radius: 0 50px 50px 0;
872
        border-radius: 0 50px 50px 0;
873
    }
873
    }
874
875
    &.leadDisable {
876
        color: #aaa !important;  /* Gray out the text */
877
        background: #f5f5f5 !important;  /* Light background */
878
        cursor: not-allowed !important;
879
    }
880
881
    &.trailDisable {
882
        color: #aaa !important;  /* Gray out the text */
883
        background: #f5f5f5 !important;  /* Light background */
884
        cursor: not-allowed !important;
885
    }
874
}
886
}
875
887
876
.input-warning {
888
.input-warning {
(-)a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js (-4 / +49 lines)
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
                                            !periodPicker.selectedDates[0] &&
869
                                            elemDate.isSameOrAfter(leadStart) &&
870
                                            elemDate.isBefore(leadEnd)
871
                                        ) {
872
                                            leadDisable = true;
873
                                        }
874
                                        if (
875
                                            elemDate.isAfter(trailStart) &&
876
                                            elemDate.isSameOrBefore(trailEnd)
877
                                        ) {
878
                                            trailDisable = true;
879
                                        }
880
                                    }
881
                                    dayElem.classList.remove("leadDisable");
882
                                    dayElem.classList.remove("trailDisable");
883
                                    dayElem.removeEventListener(
884
                                        "click",
885
                                        disableClick,
886
                                        true
887
                                    );
860
                                });
888
                                });
889
890
                            if (leadDisable) {
891
                                target.classList.add("leadDisable");
892
                            }
893
                            if (trailDisable) {
894
                                target.classList.add("trailDisable");
895
                            }
896
                            if (trailDisable || leadDisable) {
897
                                target.addEventListener(
898
                                    "click",
899
                                    disableClick,
900
                                    true
901
                                );
902
                            }
861
                        }
903
                        }
862
                    }
904
                    }
863
                );
905
                );
864
906
907
                function disableClick(e) {
908
                    e.stopImmediatePropagation();
909
                }
910
865
                // Enable flatpickr now we have date function populated
911
                // Enable flatpickr now we have date function populated
866
                periodPicker.redraw();
912
                periodPicker.redraw();
867
913
868
- 

Return to bug 34440