https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134
--- Comment #21 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 191956 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191956&action=edit Bug 40134: Implement client-side improvements for bookings This patch implements client-side improvements for the bookings modal, including smart window maximization and hybrid submission logic that delegates optimal item selection to the server. Smart Window Maximization: - Implements "never re-add items to pool" algorithm - Dynamic item pool reduction based on availability - isDateDisabledForItemtype() calculates available dates - isDateInMaximumWindow() validates end dates against item pool - Provides real-time calendar feedback to users Hybrid Submission Logic: For "any item" bookings, the client now uses a smart hybrid approach: 1. Filters items by selected itemtype 2. Checks availability for the booking period 3. If 0 items available: Shows error (no suitable item) 4. If 1 item available: Sends item_id (optimization - skips server) 5. If 2+ items available: Sends itemtype_id (delegates to server) This minimizes server round-trips while delegating complex optimal selection logic to the server when multiple choices exist. Test plan: 1. Navigate to biblio detail page with bookable items 2. Click "Place booking" and select patron/pickup location 3. Select itemtype (not specific item) - "any item" mode 4. Select start date - verify end dates are maximized 5. Verify calendar disables dates when no items available 6. Submit booking - verify it succeeds 7. Check that optimal item was selected (server-side) 8. Test edit mode with "any item" selection 9. Verify both create and edit use same logic Signed-off-by: Kristi Krueger <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
