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.
This commit is contained in:
@@ -391,8 +391,8 @@ const displayRows = computed(() => {
|
|||||||
|
|
||||||
// Füge andere Stats hinzu
|
// Füge andere Stats hinzu
|
||||||
const map = [
|
const map = [
|
||||||
['Überstunden (Woche)', 'overtime'],
|
['overtime', 'overtime'], // Label wird dynamisch gesetzt
|
||||||
['Überstunden (Gesamt)', 'totalOvertime'],
|
['totalOvertime', 'totalOvertime'], // Label wird dynamisch gesetzt
|
||||||
// ['Überstunden (Alt-Style)', 'totalOvertimeOldStyle'], // DEBUG: Versteckt, da getWeekOverview nicht korrekte Zeiten liefert
|
// ['Überstunden (Alt-Style)', 'totalOvertimeOldStyle'], // DEBUG: Versteckt, da getWeekOverview nicht korrekte Zeiten liefert
|
||||||
['Wochenarbeitszeit', 'weekWorktime'],
|
['Wochenarbeitszeit', 'weekWorktime'],
|
||||||
['Arbeitsfreie Stunden', 'nonWorkingHours'],
|
['Arbeitsfreie Stunden', 'nonWorkingHours'],
|
||||||
@@ -412,7 +412,23 @@ const displayRows = computed(() => {
|
|||||||
const val = stats.value?.[key]
|
const val = stats.value?.[key]
|
||||||
|
|
||||||
if (val !== undefined && val !== null && val !== '') {
|
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 {
|
} else {
|
||||||
rows[label] = '—'
|
rows[label] = '—'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user