bouton tout-voir

This commit is contained in:
2025-06-09 02:28:39 +02:00
parent c084bf159f
commit 16193a5ea4
5 changed files with 43 additions and 8 deletions
+36
View File
@@ -396,6 +396,42 @@ document.addEventListener("DOMContentLoaded", function () {
});
////////////////// end boutons media ////////////////
////////////////// start bouton "Tout voir" ////////////////
document.addEventListener("DOMContentLoaded", function () {
const toutVoirButtons = document.querySelectorAll('.tout-voir');
toutVoirButtons.forEach(button => {
button.addEventListener('click', function () {
const tid = this.dataset.tid;
const select = document.getElementById('edit-field-type-de-ressource-target-id');
if (!select) return;
const optionExists = Array.from(select.options).some(o => o.value === tid);
if (!optionExists) {
alert("Le type de ressource sélectionné nest pas disponible.");
return;
}
select.value = tid;
select.dispatchEvent(new Event('change'));
const form = select.closest('form');
if (form) {
const submitButton = form.querySelector('input[type="submit"]');
if (submitButton) {
submitButton.click();
} else {
form.submit();
}
}
});
});
});
////////////////// end bouton "Tout voir" ////////////////
////////////// start croix clear input recherche ////////////