bugfix device type list js bug

This commit is contained in:
2026-02-16 09:19:11 +01:00
parent 092811fda8
commit 63e60cbfcf
3 changed files with 140 additions and 113 deletions

View File

@@ -0,0 +1,30 @@
(() => {
function bindDeleteButtons() {
const buttons = document.querySelectorAll('.js-device-type-delete');
buttons.forEach((button) => {
if (button.dataset.deleteBound === '1') {
return;
}
button.addEventListener('click', () => {
const id = Number(button.dataset.deviceTypeId || '0');
if (id <= 0) {
return;
}
if (window.confirm('Diesen Geraetetyp wirklich loeschen?')) {
// TODO: AJAX-Delete implementieren
window.alert('Loeschen noch nicht implementiert');
}
});
button.dataset.deleteBound = '1';
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', bindDeleteButtons);
} else {
bindDeleteButtons();
}
})();