From 0f7a3ace598189949beff87cfe773c1b9f253ec6 Mon Sep 17 00:00:00 2001 From: Owen Date: Mon, 1 Nov 2021 14:39:14 +0000 Subject: [PATCH] Bug 29212: (follow-up) Fixes to suspend hold process This patch reworks the process of suspending an individual hold from the patron's hold list. Instead of repeating the modal markup in each line of the holds table, a single modal is re-used. A "focus: false" is added to the modal via a data-attribute in order to overcome problems with selecting months and using keyboard navigation in the calendar popup. To test, apply the patch and log into the OPAC as a user with holds. - View the holds tab under "Your summary." - Click the "Suspend" button next to one of the holds. - You should see a modal which shows the title of the item in question. - Test that the date picker works correctly: - Test selecting a month and year - Test selecting a date both with the mouse and by using arrow keys. - Test that you can clear the selected date both by clicking the X and by clicking the text link. - Select a date and close the modal without submitting the suspension. - Click the "Suspend" link on another title to confirm that the date picker still works correctly. - Submit a suspension and confirm that the it completes successfully. - Signed-off-by: Jonathan Druart --- .../bootstrap/en/includes/holds-table.inc | 33 +---------- .../bootstrap/en/modules/opac-user.tt | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc index 50d43723851..f0b40d4f9fa 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc @@ -138,38 +138,7 @@ [% ELSE %] [% IF AutoResumeSuspendedHolds %] - Suspend - [% # hold suspend modal form %] - + Suspend [% ELSE %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 9448a3a585c..8ef4dd18bbc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -865,6 +865,38 @@ +[% # hold suspend modal form %] +
+ [% IF ( OverDriveCirculation ) %] [% INCLUDE 'overdrive-checkout.inc' %] [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %] @@ -941,6 +973,31 @@ })($(this)) }); + /* We initiate this flatpickr instance here so that we can use the variable later */ + var suspend_until_date = $("#suspend_untilDate").flatpickr({ + minDate: "today" + }); + + $(".suspend_hold").on("click", function(e){ + e.preventDefault(); + var title = $(this).data("title"); + var reserve_id = $(this).data("reserve_id"); + $("#suspendHoldReserveId").val( reserve_id ); + $("#suspendHoldTitle").html( "" + title + "" ); + $("#suspendHoldModal").modal("show"); + }); + + $("#suspend-modal-clear-date").on( "click", function(e) { + e.preventDefault(); + suspend_until_date.clear(); + }); + + $("#suspendHoldModal").on("hidden.bs.modal", function(){ + $("#suspendHoldTitle").html(""); + $("#suspendHoldReserveId").val(""); + suspend_until_date.clear(); + }); + $("#suspend_all_submit").on("click", function(e){ e.preventDefault(); var title = _("Are you sure you want to suspend all holds?"); -- 2.25.1