diff --git a/src/main/resources/static/js/pages/list/frontend/categoryUI.js b/src/main/resources/static/js/pages/list/frontend/categoryUI.js index 46dd162..b016f74 100644 --- a/src/main/resources/static/js/pages/list/frontend/categoryUI.js +++ b/src/main/resources/static/js/pages/list/frontend/categoryUI.js @@ -1,5 +1,3 @@ - - export function addCategory(categoryAsJSON) { const list = document.querySelector(".displayedList"); const category = document.createElement("shopping-category"); @@ -29,36 +27,4 @@ export function deleteCategory(deleteAllItems, categoryID) { } category.remove() document.querySelector(`option[value='${categoryID}']`).remove(); - -} - -export function createEditCategoryForm(categoryName) { - const editForm = document.createElement("form"); - const inputName = document.createElement("input"); - const abortButton = document.createElement("button"); - const saveButton = document.createElement("button"); - - inputName.setAttribute("name", "newCategoryName"); - inputName.setAttribute("value", categoryName); - inputName.classList.add("editForm__name"); - - abortButton.setAttribute("type", "button"); - abortButton.classList.add("editForm__buttonAbort"); - abortButton.textContent = "Abbrechen"; - saveButton.textContent = "Speichern"; - - editForm.append(inputName, saveButton, abortButton); - - return editForm; -} - -export function editCategory(id, formElement, formData, categoryDiv) { - - let newName = formData.newCategoryName; - - categoryDiv.querySelector(".category__name").textContent = newName; - formElement.replaceWith(categoryDiv); - - document.querySelector(`option[value='${id}']`).textContent = newName; - }