From 9cc6193c829c914c84211507668240d3d22d4cdf Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 9 Apr 2025 11:10:21 +0000 Subject: [PATCH] Bug 39891: Use modal for report deletion confirmation This patch adds a confirmation modal to be shown when the user clicks Actions -> Delete from the saved reports page. To test, apply the patch and go to Reports -> Saved reports. - In the table of reports, pick one and click Actions -> Delete - A modal window should appear showing information about the report, including group, subgroup, author, and last run. - Clicking "Delete" should result in the correct report being deleted. - Clicking "Cancel," the "X" in the upper right corner of the modal, or anywhere outside of the modal should close it. - Test under a different group tab and from a subsequent page in the DataTable. Sponsored-by: Athens County Public Libraries --- .../modules/reports/guided_reports_start.tt | 86 +++++++++++++++++-- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 4d4e5f5fbc4..5fc3eee99a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -416,13 +416,15 @@ [% IF ( CAN_user_reports_delete_reports ) %]
  • Delete
  • @@ -1695,6 +1697,55 @@ +[% IF ( savedreports ) %] + +[% END %] + [% MACRO jsinclude BLOCK %] [% Asset.js("js/charts.js") | $raw %] [% Asset.js("lib/d3c3/d3.min.js") | $raw %] @@ -2200,6 +2251,29 @@ } }); + $("body").on("click", ".delete-report", function(e){ + e.preventDefault(); + const report = $(this)[0].dataset; + for( const key in report ){ + if( report[key] ){ + if( key == "id" ){ + $("#delete_modal_id").val( report[key] ); + } else { + $("#delete_modal_" + key ).html( report[key] ).show(); + } + } else { + $("#delete_modal_" + key ).parent().hide(); + } + } + $("#delete_report_id").html("id"); + $('#deleteModal').modal('show'); + }); + + $("#deleteModal").on("hidden.bs.modal", function(){ + $("#delete_modal_id").val(""); + $(".delete_modal_info").html(""); + }); + $("body").on("click", ".update_sql", function(e){ e.preventDefault(); var ltitle = $(this).text(); @@ -2611,7 +2685,7 @@ ' + _("Edit") + '\ ' + _("Duplicate") + '\ ' + _("Schedule") + '\ - ' + _("Delete") + '\ + ' + _("Delete") + '\ ' + _("Run report") + '\ ' + _("Close") + '\ \ -- 2.39.5