* Complete add-player modal

* New player listing
* New player action layout
This commit is contained in:
MaxJa4
2024-01-15 21:26:46 +01:00
parent 04a2a2815d
commit 80d0489b41
16 changed files with 308 additions and 107 deletions

View File

@@ -9,21 +9,19 @@ function setupClanButtons(dropdownId, delBtnId, editBtnId) {
});
}
function setupPlayerButtons(dropdownId, listId, delBtnId, editBtnId, addBtnId) {
function getSelectedClanId(dropdownId) {
const dropdown = document.getElementById(dropdownId);
const selectedClanId = dropdown.options[dropdown.selectedIndex].value;
return parseInt(selectedClanId);
}
function setupPlayerButtons(dropdownId, listId, addBtnId) {
const dropdown = document.getElementById(dropdownId);
const deleteButton = document.getElementById(delBtnId);
const editButton = document.getElementById(editBtnId);
const addButton = document.getElementById(addBtnId);
dropdown.addEventListener('change', function () {
deleteButton.disabled = !this.value;
editButton.disabled = !this.value && (dropdown.selectedIndex !== -1);
addButton.disabled = !this.value && (dropdown.selectedIndex !== -1);
});
dropdown.addEventListener('change', function () {
deleteButton.disabled = (this.selectedIndex !== -1);
editButton.disabled = (this.selectedIndex !== -1);
addButton.classList.toggle("bg-secondary-subtle");
});
}