Compare commits
3
Commits
33cd0b0fad
...
8f5452c09f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f5452c09f | ||
|
|
fd9a328478 | ||
|
|
45cc85b7b4 |
No files matched your search
@@ -65,6 +65,7 @@ function init() {
|
||||
const checkbox = li.querySelector("input[type=checkbox]");
|
||||
deleteCategory(checkbox.checked, li.id);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector(".displayedList").addEventListener("change", (e) => {
|
||||
if (e.target.matches(".item__markAsDone")) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user