From 3eb91e452111b0eadf933692b30f697f7882c894 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 29 Oct 2024 15:16:42 +0000 Subject: [PATCH] Bug 37912: Restore detail-trigger handling This patch converts our jQuery based click to native JS and restores the bootstrap modal button click trigger handling. Signed-off-by: Sam Sowanick Signed-off-by: Aleisha Amohia --- .../prog/js/modals/display_ticket.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js index 43d32fd83e0..faa19cef3a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js @@ -1,11 +1,20 @@ /* keep tidy */ $(document).ready(function () { - $("#table_concerns").on("click", ".detail-trigger", function () { - // Find the main trigger anchor within the same table row - var $mainTrigger = $(this).closest("tr").find(".main-trigger"); + document.addEventListener("click", function (event) { + const detailTrigger = event.target.closest(".detail-trigger"); + if (detailTrigger) { + event.preventDefault(); - // Trigger the click event of the main trigger anchor - $mainTrigger.trigger("click"); + // Find the main trigger button in the same row + const mainTrigger = detailTrigger + .closest("tr") + .querySelector(".main-trigger"); + + // Trigger a click on the main trigger if it exists + if (mainTrigger) { + mainTrigger.click(); + } + } }); $("#ticketDetailsModal").on("show.bs.modal", function (event) { -- 2.39.5