From 6cdf7d024423b161827cdbdef3d184742ab1e85e 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. - --- .../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 50d4372385..f0b40d4f9f 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 3aae128261..15d1b895d9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -874,6 +874,38 @@ +[% # hold suspend modal form %] +
+ [% IF ( OverDriveCirculation ) %] [% INCLUDE 'overdrive-checkout.inc' %] [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %] @@ -950,6 +982,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.20.1