|
Lines 408-413
Link Here
|
| 408 |
[% INCLUDE 'datatables.inc' %] |
408 |
[% INCLUDE 'datatables.inc' %] |
| 409 |
[% INCLUDE 'select2.inc' %] |
409 |
[% INCLUDE 'select2.inc' %] |
| 410 |
<script> |
410 |
<script> |
|
|
411 |
const opac_display = document.getElementById("opac_display"); |
| 412 |
const opac_editable = document.getElementById("opac_editable"); |
| 413 |
const opac_mandatory = document.getElementById("opac_mandatory"); |
| 414 |
|
| 415 |
function setDisabled(el, disabled) { |
| 416 |
const label = el.closest("label"); |
| 417 |
if (disabled) { |
| 418 |
el.checked = false; |
| 419 |
el.disabled = true; |
| 420 |
if (label) label.setAttribute("aria-disabled", "true"); |
| 421 |
} else { |
| 422 |
el.disabled = false; |
| 423 |
if (label) label.removeAttribute("aria-disabled"); |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
function updateCheckboxes() { |
| 428 |
if (!opac_display.checked) { |
| 429 |
setDisabled(opac_editable, true); |
| 430 |
} else { |
| 431 |
setDisabled(opac_editable, false); |
| 432 |
} |
| 433 |
if (opac_editable.checked) { |
| 434 |
setDisabled(opac_mandatory, false); |
| 435 |
} else { |
| 436 |
setDisabled(opac_mandatory, true); |
| 437 |
} |
| 438 |
} |
| 439 |
|
| 440 |
opac_display.addEventListener("change", updateCheckboxes); |
| 441 |
opac_editable.addEventListener("change", updateCheckboxes); |
| 442 |
|
| 443 |
updateCheckboxes(); |
| 444 |
|
| 411 |
$(document).ready(function () { |
445 |
$(document).ready(function () { |
| 412 |
function toggle_search_default() { |
446 |
function toggle_search_default() { |
| 413 |
if ($("#staff_searchable").is(":checked")) { |
447 |
if ($("#staff_searchable").is(":checked")) { |
|
Lines 426-443
Link Here
|
| 426 |
$("#branches option:first").attr("selected", "selected"); |
460 |
$("#branches option:first").attr("selected", "selected"); |
| 427 |
} |
461 |
} |
| 428 |
|
462 |
|
| 429 |
$("#opac_display") |
|
|
| 430 |
.change(function () { |
| 431 |
if (this.checked) { |
| 432 |
$("#opac_editable").removeAttr("disabled").parent().removeAttr("aria-disabled"); |
| 433 |
$("#opac_mandatory").removeAttr("disabled").parent().removeAttr("aria-disabled"); |
| 434 |
} else { |
| 435 |
$("#opac_editable").attr("disabled", true).parent().attr("aria-disabled", "true"); |
| 436 |
$("#opac_mandatory").attr("disabled", true).parent().attr("aria-disabled", "true"); |
| 437 |
} |
| 438 |
}) |
| 439 |
.change(); |
| 440 |
|
| 441 |
$("#is_date") |
463 |
$("#is_date") |
| 442 |
.change(function () { |
464 |
.change(function () { |
| 443 |
if (this.checked) { |
465 |
if (this.checked) { |
| 444 |
- |
|
|