From 9c31e6be71cbd80f6fda3fae474733c5447a5064 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 20 Oct 2025 09:44:58 +0200 Subject: [PATCH] Refactor StatusBox component to dynamically set labels for overtime and total overtime, handling negative values by displaying them as absence. Enhance display logic for adjusted end times by appending " Uhr" to time values for improved clarity. --- frontend/src/components/StatusBox.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/StatusBox.vue b/frontend/src/components/StatusBox.vue index 359dc22..aec59c3 100644 --- a/frontend/src/components/StatusBox.vue +++ b/frontend/src/components/StatusBox.vue @@ -391,8 +391,8 @@ const displayRows = computed(() => { // Füge andere Stats hinzu const map = [ - ['Überstunden (Woche)', 'overtime'], - ['Überstunden (Gesamt)', 'totalOvertime'], + ['overtime', 'overtime'], // Label wird dynamisch gesetzt + ['totalOvertime', 'totalOvertime'], // Label wird dynamisch gesetzt // ['Überstunden (Alt-Style)', 'totalOvertimeOldStyle'], // DEBUG: Versteckt, da getWeekOverview nicht korrekte Zeiten liefert ['Wochenarbeitszeit', 'weekWorktime'], ['Arbeitsfreie Stunden', 'nonWorkingHours'], @@ -412,7 +412,23 @@ const displayRows = computed(() => { const val = stats.value?.[key] if (val !== undefined && val !== null && val !== '') { - rows[label] = val + // Spezialbehandlung für Überstunden/Fehlzeit Labels + if (key === 'overtime') { + const isNegative = val.startsWith('-'); + const displayLabel = isNegative ? 'Fehlzeit (Woche)' : 'Überstunden (Woche)'; + const displayValue = isNegative ? val.substring(1) : val; // Entferne Minus-Zeichen + rows[displayLabel] = displayValue; + } else if (key === 'totalOvertime') { + const isNegative = val.startsWith('-'); + const displayLabel = isNegative ? 'Fehlzeit (Gesamt)' : 'Überstunden (Gesamt)'; + const displayValue = isNegative ? val.substring(1) : val; // Entferne Minus-Zeichen + rows[displayLabel] = displayValue; + } else if (key === 'adjustedEndTodayGeneral' || key === 'adjustedEndTodayWeek') { + // Füge " Uhr" zu Uhrzeiten hinzu + rows[label] = val + ' Uhr'; + } else { + rows[label] = val; + } } else { rows[label] = '—' }