Bug 43110: (bug 28308 follow-up) Disable checkboxes on the detail view
Checkboxes must be disabled on the detail page as we cannot submit the
changes.
Test plan:
1 - Edit a patron, set a value for advance notices, do not check any transports
2 - View the details for the patron:
http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=5
3 - Note the checkboxes are disabled
QA: The logic is a bit weird as messaging_form_inactive is not set if the
pref is off, but the table is not displayed in this case.
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
3fac313a53
commit
f2cca7c630
|
|
@ -338,21 +338,23 @@
|
|||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const selectElement = document.querySelector('select[name="2-DAYS"]');
|
||||
[% UNLESS messaging_form_inactive %]
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const selectElement = document.querySelector('select[name="2-DAYS"]');
|
||||
|
||||
const smsCheckbox = document.getElementById("sms2");
|
||||
const emailCheckbox = document.getElementById("email2");
|
||||
const digestCheckbox = document.getElementById("digest2");
|
||||
const smsCheckbox = document.getElementById("sms2");
|
||||
const emailCheckbox = document.getElementById("email2");
|
||||
const digestCheckbox = document.getElementById("digest2");
|
||||
|
||||
function updateCheckboxes() {
|
||||
const isDisabled = !selectElement.value;
|
||||
if (smsCheckbox) smsCheckbox.disabled = isDisabled;
|
||||
if (emailCheckbox) emailCheckbox.disabled = isDisabled;
|
||||
if (digestCheckbox) digestCheckbox.disabled = isDisabled;
|
||||
}
|
||||
updateCheckboxes();
|
||||
selectElement.addEventListener("change", updateCheckboxes);
|
||||
});
|
||||
</script>
|
||||
function updateCheckboxes() {
|
||||
const isDisabled = !selectElement.value;
|
||||
if (smsCheckbox) smsCheckbox.disabled = isDisabled;
|
||||
if (emailCheckbox) emailCheckbox.disabled = isDisabled;
|
||||
if (digestCheckbox) digestCheckbox.disabled = isDisabled;
|
||||
}
|
||||
updateCheckboxes();
|
||||
selectElement.addEventListener("change", updateCheckboxes);
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue