Bug 37363

Summary: Booking dates should respect closed days
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: CirculationAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aude.charillon, gmcharlt, koha, kyle.m.hall, marie.hedbom
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 34440    
Bug Blocks: 36383    
Attachments: Bug 37363: Initial work on supporting closed days

Description Martin Renvoize (ashimema) 2024-07-15 15:01:38 UTC
The bookings datepicker is not aware of open/closed days at present and as such a booking may be made that would expect fulfilment or return on a closed day.

We should update the flatpickr to disable such dates for direct selection, but allow spanning them.
Comment 1 Martin Renvoize (ashimema) 2024-07-15 15:02:07 UTC
Flatpickr doesn't appear to support this spanning functionality natively.. there are a few idea's here though: https://github.com/flatpickr/flatpickr/issues/955
Comment 2 Martin Renvoize (ashimema) 2024-07-25 12:17:43 UTC
This works from onDayCreate:


```
    // Make closed days unclickable (while keeping them part of the range)
    if (date.getDay() === 0 || date.getDay() === 6) {
        dayElem.classList.add("closed-day");

        // Remove the click event to disable the day
        dayElem.addEventListener('click', function(event) {
            event.stopImmediatePropagation();
        }, true);
    }
```

I'll submit the patch once I've finished work on bug 34440
Comment 3 Martin Renvoize (ashimema) 2024-07-26 08:19:19 UTC
Created attachment 169687 [details] [review]
Bug 37363: Initial work on supporting closed days

This is just a proof of concept at this point.. we need api's for
fetching regular and irregular closed days before we can fully impliment
the functionality.
Comment 4 Aude Charillon 2024-08-12 08:32:39 UTC
This is of interest to a library we work with: they use the Tools > Calendar to mark closed days and would like to see those closed days greyed out when placing bookings.
Comment 5 Martin Renvoize (ashimema) 2024-08-23 20:41:47 UTC
The main blocker here is the lack of API's for fetching calendar open/closed days.

We need to work on that first and also consider how opening hours and days work together.