Kategorie wird jetzt in der Select Liste beim hinzufügen/entfernen hinzugefügt und entfernt

This commit is contained in:
Technoir committed 2026-10-07 19:32:39 +02:00
1 parent 45cc85b7b4
commit fd9a328478
1 file changed
+10 -1
@@ -22,7 +22,14 @@ export function addCategory(categoryAsJSON) {
const list = document.querySelector(".displayedList");
const category = ShoppingCategory.fromJSON(categoryAsJSON);
list.appendChild(category.render());
list.appendChild(category.render()); //fügt Kategorie der Liste hinzu
const categorySelect = document.querySelector(".addItemForm__categorySelect");
const newCategoryOption = document.createElement("option");
newCategoryOption.setAttribute("value", categoryAsJSON.id);
newCategoryOption.textContent = category.categoryName;
categorySelect.appendChild(newCategoryOption);
}
export function deleteCategory(deleteAllItems, categoryID) {
@@ -32,6 +39,8 @@ export function deleteCategory(deleteAllItems, categoryID) {
if (ul) document.querySelector(".displayedList").append(...ul.children);
}
category.remove()
document.querySelector(`option[value='${categoryID}']`).remove();
}
export function deleteAllDoneItems() {