Bug 40517: (QA follow-up): Fix 'group selected' button active with just 1 hold selected

This fixes the following bug:
1) Select 1 hold, notice the 'group selected' button is still disabled
2) Select a 2nd hold, notice the 'group selected' button becomes enabled
3) Unselect one of the holds, notice the 'group select' is kept enabled (this is wrong, it should become disabled)

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2025-08-07 10:55:52 +00:00 committed by Lucas Gass
parent 0a0ba6fea0
commit 90206ab4da
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 12 additions and 11 deletions

View File

@ -807,17 +807,18 @@ $(document).ready(function () {
$(".holds_table .select_hold:checked").length
);
if (patron_page) {
if ($(".holds_table .select_hold:checked").length == 0) {
$(".cancel_selected_holds").prop("disabled", true);
$(".suspend_selected_holds").prop("disabled", true);
$(".group_selected_holds").prop("disabled", true);
} else {
if ($(".holds_table .select_hold:checked").length >= 2) {
$(".group_selected_holds").prop("disabled", false);
}
$(".suspend_selected_holds").prop("disabled", false);
$(".cancel_selected_holds").prop("disabled", false);
}
var selectedHolds = $(".holds_table .select_hold:checked");
var hasSelectedHolds = selectedHolds.length > 0;
var hasMultipleSelectedHolds = selectedHolds.length >= 2;
$(".cancel_selected_holds, .suspend_selected_holds").prop(
"disabled",
!hasSelectedHolds
);
$(".group_selected_holds").prop(
"disabled",
!hasMultipleSelectedHolds
);
}
}