From ea8e78fd9f71b8567e417506bbeac1689f031ff0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=20Tr=C3=B6ger?=
Date: Thu, 9 Oct 2025 16:42:49 +0200
Subject: [PATCH] fixed #56
---
Backend/models/workDay.go | 6 ++++--
Backend/static/script.js | 21 ++++-----------------
Backend/templates/headerComponent_templ.go | 2 +-
Backend/templates/pages_templ.go | 2 +-
Backend/templates/pdf_templ.go | 2 +-
Backend/templates/teamComponents_templ.go | 2 +-
Backend/templates/timeComponents.templ | 2 +-
Backend/templates/timeComponents_templ.go | 8 ++++----
Backend/templates/timePage_templ.go | 2 +-
9 files changed, 18 insertions(+), 29 deletions(-)
diff --git a/Backend/models/workDay.go b/Backend/models/workDay.go
index 6624296..9780ce7 100644
--- a/Backend/models/workDay.go
+++ b/Backend/models/workDay.go
@@ -53,8 +53,10 @@ func GetDays(user User, tsFrom, tsTo time.Time, orderedForward bool) []IWorkDay
}
if day.AbwesenheitTyp.WorkTime == 1 {
if workDay, ok := allDays[day.Date().Format("2006-01-02")].(*WorkDay); ok {
- workDay.kurzArbeit = true
- workDay.kurzArbeitAbsence = day
+ if len(workDay.Bookings) > 0 {
+ workDay.kurzArbeit = true
+ workDay.kurzArbeitAbsence = day
+ }
}
} else {
allDays[day.Date().Format("2006-01-02")] = &day
diff --git a/Backend/static/script.js b/Backend/static/script.js
index 1aea78d..2f3b643 100644
--- a/Backend/static/script.js
+++ b/Backend/static/script.js
@@ -15,9 +15,7 @@ function editWorkday(element, event, id, 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();
@@ -39,21 +37,10 @@ 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 8e59160..aeef6ec 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.943
+// templ: version: v0.3.924
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 ad17982..491784c 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.943
+// templ: version: v0.3.924
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 321301b..3c73ded 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.943
+// templ: version: v0.3.924
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 c1d475e..ec539f2 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.943
+// templ: version: v0.3.924
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 912cf77..799ebda 100644
--- a/Backend/templates/timeComponents.templ
+++ b/Backend/templates/timeComponents.templ
@@ -89,7 +89,7 @@ templ absenceComponent(a *models.Absence, isKurzarbeit bool) {
if isKurzarbeit {
-
+
}
}
diff --git a/Backend/templates/timeComponents_templ.go b/Backend/templates/timeComponents_templ.go
index 0f5c2c5..835b46a 100644
--- a/Backend/templates/timeComponents_templ.go
+++ b/Backend/templates/timeComponents_templ.go
@@ -1,6 +1,6 @@
// Code generated by templ - DO NOT EDIT.
-// templ: version: v0.3.943
+// templ: version: v0.3.924
package templates
//lint:file-ignore SA4006 This context is only used if a nested component is present.
@@ -394,15 +394,15 @@ func absenceComponent(a *models.Absence, isKurzarbeit bool) templ.Component {
return templ_7745c5c3_Err
}
if isKurzarbeit {
- templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, templ.JSFuncCall("editAbsence", templ.JSExpression("this"), templ.JSExpression("event"), "time-"+a.Date().Format("2006-01-02")))
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, templ.JSFuncCall("editWorkday", templ.JSExpression("this"), templ.JSExpression("event"), "time-"+a.Date().Format("2006-01-02"), false))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "