From 4253c10d627f76bc36df4744b8e28fbd9a054090 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Mon, 27 Jun 2022 14:54:42 +0100
Subject: [PATCH] Bug 28854: (follow-up) Make 'Manage bundle' button a 'toggle'

This patch adds and removes the 'active' class to the 'Manage bundle'
button such that it correctly reflects whether the manage area is
expanded or not for the bundle item.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
---
 .../intranet-tmpl/prog/en/modules/catalogue/detail.tt      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index de58c8896b9..3d9d33125e0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -1906,8 +1906,9 @@ Note that permanent location is a code, and location may be an authval.
                 [% IF bundlesEnabled %]
                 // Add event listener for opening and closing bundle details
                 $('#' + table_name + ' tbody').on('click', 'button.details-control', function () {
-                    var tr = $(this).closest('tr');
-                    var dTable = $(this).closest('table').DataTable({ 'retrieve': true });
+                    var button = $(this);
+                    var tr = button.closest('tr');
+                    var dTable = button.closest('table').DataTable({ 'retrieve': true });
 
                     var itemnumber = tr.data('itemnumber');
                     var duedate = tr.data('duedate');
@@ -1917,11 +1918,13 @@ Note that permanent location is a code, and location may be an authval.
                         // This row is already open - close it
                         row.child.hide();
                         tr.removeClass('shown');
+                        button.removeClass('active');
                     }
                     else {
                         // Open this row
                         createChild(row, itemnumber, duedate);
                         tr.addClass('shown');
+                        button.addClass('active');
                     }
                 } );
                 [% END %]
-- 
2.30.2