Bug 41439

Summary: Column filtering on the circ rules table
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: System AdministrationAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: ahernandez, carthur, clemens.tubach, david, dmeininger591, george, gmcharlt, jonathan.druart, kebliss, michaela.sieber, mteal
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33312
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41439: Add column visibility toggles to circulation rules table
Proof of concept
Bug 41439: Add column visibility toggles to circulation rules table
Bug 41439: Add column visibility toggles to circulation rules table
Bug 41439: Fix form submission for hidden column inputs

Description Martin Renvoize (ashimema) 2025-12-12 11:27:55 UTC
The Circulation Rules table is obscenely wide at this point. We've tried a number of approaches to a new UI in this area, and so far all have got stuck.

I'm proposing a smaller impact resolution of just having a set of column groups for display to allow limiting the width of the table to only those fields of interest at the moment you're working.
Comment 1 Martin Renvoize (ashimema) 2025-12-12 11:30:13 UTC Comment hidden (obsolete)
Comment 2 Martin Renvoize (ashimema) 2025-12-12 11:30:40 UTC
Created attachment 190456 [details]
Proof of concept
Comment 3 Martin Renvoize (ashimema) 2025-12-12 11:32:53 UTC
This is just a proof of concept for now and will need testing to ensure it fully works with form submission etc.. I've only quickly trials the 'look'.

Setting to Needs Signoff to trigger some feedback.. whilst I do want some feedback and any suggestions of other approaches, lets try to stick to simple solutions for now to limit the scope.. I still think longer term we'll want to re-write this page in Vue with a possibly very different overall UI but that's for another bug.
Comment 4 Martin Renvoize (ashimema) 2025-12-12 12:11:36 UTC
Created attachment 190459 [details] [review]
Bug 41439: Add column visibility toggles to circulation rules table

The circulation rules table has become excessively wide with 40+
columns, making it difficult to navigate and use. This patch adds
column visibility toggle buttons that allow users to focus on
specific rule categories.

Changes:
- Add data-colname attributes to all table headers and footers
  for robust column identification
- Add toggle buttons for: Checkouts, Due dates, Fines, Renewals,
  Holds, Article requests, Recalls, and Show all
- Group columns into logical categories based on their function
- Use column name selectors instead of fragile index-based
  selection for maintainability
- Default to showing only Checkout columns on page load for a
  cleaner initial view
- Highlight the active button to indicate current view
- Disable search functionality (not appropriate for this table)
- Handle dynamic column visibility based on system preferences
  (UnseenRenewals, ArticleRequests, UseRecalls)

Test plan:
1. Navigate to Administration > Circulation and fine rules
2. Observe the table now shows only checkout-related columns by
   default with the "Checkouts" button highlighted
3. Click different category buttons (Fines, Renewals, Holds, etc.)
   and verify only relevant columns are shown
4. Verify the active button is highlighted in blue
5. Click "Show all" to display all columns
6. Verify the layout works with different system preference
   combinations (enable/disable ArticleRequests, UseRecalls,
   UnseenRenewals)
7. Verify column visibility persists correctly when system
   preferences are changed
Comment 5 David Nind 2025-12-15 23:00:56 UTC
Just to say, I like it!

I've added George Williams to the bug - I recall seeing something similar done with JQuery on TTEOTV or koha-US special interest group videos over the last few years.
Comment 6 OpenFifth Sandboxes 2025-12-16 14:34:42 UTC
Created attachment 190546 [details] [review]
Bug 41439: Add column visibility toggles to circulation rules table

The circulation rules table has become excessively wide with 40+
columns, making it difficult to navigate and use. This patch adds
column visibility toggle buttons that allow users to focus on
specific rule categories.

Changes:
- Add data-colname attributes to all table headers and footers
  for robust column identification
- Add toggle buttons for: Checkouts, Due dates, Fines, Renewals,
  Holds, Article requests, Recalls, and Show all
- Group columns into logical categories based on their function
- Use column name selectors instead of fragile index-based
  selection for maintainability
- Default to showing only Checkout columns on page load for a
  cleaner initial view
- Highlight the active button to indicate current view
- Disable search functionality (not appropriate for this table)
- Handle dynamic column visibility based on system preferences
  (UnseenRenewals, ArticleRequests, UseRecalls)

Test plan:
1. Navigate to Administration > Circulation and fine rules
2. Observe the table now shows only checkout-related columns by
   default with the "Checkouts" button highlighted
3. Click different category buttons (Fines, Renewals, Holds, etc.)
   and verify only relevant columns are shown
4. Verify the active button is highlighted in blue
5. Click "Show all" to display all columns
6. Verify the layout works with different system preference
   combinations (enable/disable ArticleRequests, UseRecalls,
   UnseenRenewals)
7. Verify column visibility persists correctly when system
   preferences are changed

Signed-off-by: georgewilliams <george@nekls.org>
Comment 7 George Williams (NEKLS) 2025-12-16 14:35:55 UTC
Outstanding!  Thanks for this improvement.
Comment 8 Owen Leonard 2025-12-16 15:02:09 UTC
In my test I couldn't submit edits in two different tabs. If I add a value under "checkouts" and then one under "holds" and submit, only the active tab's changes are saved.
Comment 9 George Williams (NEKLS) 2025-12-16 15:38:35 UTC
Yes, I see what Owen is saying also.  In my first test, I only tested adding rules, not modifying an existing rule.
Comment 10 carthur@slolibrary.org 2025-12-18 18:48:45 UTC
+1
Comment 11 David Nind 2025-12-18 21:17:48 UTC
I quickly demoed this at the koha-US Customization Special Interest Group today.

Everyone was very positive about it, including a +100!
Comment 12 Martin Renvoize (ashimema) 2025-12-19 12:56:42 UTC
Created attachment 190646 [details] [review]
Bug 41439: Fix form submission for hidden column inputs

When using the column visibility toggles, only inputs in the
currently visible columns were being submitted with the form.
This meant that if a user edited a value in "Checkouts" view,
then switched to "Holds" view to edit another value, only the
holds values would be saved.

This patch adds a form submit handler that temporarily shows
all columns before form submission, ensuring all input values
are included regardless of which view is currently active.

Test plan:
1. Navigate to Administration > Circulation and fine rules
2. Click "Checkouts" button
3. Enter a value in "Current checkouts allowed" field
4. Click "Holds" button
5. Enter a value in "Holds allowed (total)" field
6. Click Save
7. Verify both values are saved (previously only the holds
   value would be saved)
Comment 13 David Nind 2025-12-23 23:20:10 UTC
Wasn't sure if this as ready for re-testing, but I had a go.

It is still not correctly saving things - for non-visible groups it is resetting to the empty value:

1. Enable UseRecalls and ArticleRequests.
2. For the checkouts section, edit the "All All" rule, change current checkouts allowed from unlimited to 50, click save.
3. Click the holds button, and edit the "All All" rule, change holds allowed (total) from unlimited to 50, click save.
4. Repeat steps 2 and 3, except this time don't save each time, save once both changes are made.
5. Up until now, everything works as expected and things are all updated correctly.
6. Edit the holds rule by itself, change 50 to 25, and click save.
7. In the checkouts section, current checkouts allowed is changed from 50 to unlimited. Presumably because the changed value for the filed is empty, so it resets to unlimted.