diff --git a/Backend/static/script.js b/Backend/static/script.js index c702dcb..1aea78d 100644 --- a/Backend/static/script.js +++ b/Backend/static/script.js @@ -5,12 +5,19 @@ function clearEditState() { toggleAbsenceEdit(false); } +function clearButtonState() { + for (let b of document.querySelectorAll(".change-button-component")) { + b.type = "button"; + } +} + function editWorkday(element, event, id, isWorkDay) { - console.log("editWorkday called", isWorkDay); event.preventDefault(); let form = document.getElementById(id); if (form == null) { - form = element.closest(".grid-sub").querySelector(".all-booking-component > form"); + form = element + .closest(".grid-sub") + .querySelector(".all-booking-component > form"); } clearEditState(); @@ -19,10 +26,12 @@ function editWorkday(element, event, id, isWorkDay) { if (isWorkDay) { element.classList.add("edit"); - if (element.classList.contains("edit")) { + if (element.type == "button") { for (let input of form.querySelectorAll("input, select")) { input.disabled = false; } + clearButtonState(); + element.type = "submit"; } else { form.submit(); } @@ -30,10 +39,21 @@ function editWorkday(element, event, id, isWorkDay) { const absenceForm = document.getElementById("absence_form"); if (id == 0) { - absenceForm.querySelector("[name=date_from]").value = form.id.replace("time-", ""); - absenceForm.querySelector("[name=date_to]").value = form.id.replace("time-", ""); + absenceForm.querySelector("[name=date_from]").value = form.id.replace( + "time-", + "", + ); + absenceForm.querySelector("[name=date_to]").value = form.id.replace( + "time-", + "", + ); } else { - syncFields(form, absenceForm, ["date_from", "date_to", "aw_type", "aw_id"]); + syncFields(form, absenceForm, [ + "date_from", + "date_to", + "aw_type", + "aw_id", + ]); } } } diff --git a/Backend/templates/headerComponent_templ.go b/Backend/templates/headerComponent_templ.go index aeef6ec..8e59160 100644 --- a/Backend/templates/headerComponent_templ.go +++ b/Backend/templates/headerComponent_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/pages_templ.go b/Backend/templates/pages_templ.go index 6283fc4..14fae96 100644 --- a/Backend/templates/pages_templ.go +++ b/Backend/templates/pages_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/pdf_templ.go b/Backend/templates/pdf_templ.go index 3c73ded..321301b 100644 --- a/Backend/templates/pdf_templ.go +++ b/Backend/templates/pdf_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/teamComponents_templ.go b/Backend/templates/teamComponents_templ.go index ec539f2..c1d475e 100644 --- a/Backend/templates/teamComponents_templ.go +++ b/Backend/templates/teamComponents_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.3.924 +// templ: version: v0.3.943 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/Backend/templates/timeComponents.templ b/Backend/templates/timeComponents.templ index c2b5fab..912cf77 100644 --- a/Backend/templates/timeComponents.templ +++ b/Backend/templates/timeComponents.templ @@ -20,7 +20,7 @@ templ lineComponent() { } templ changeButtonComponent(id string, workDay bool) { -