From 00669be25017f687bdfb077e04531c1cf7be6863 Mon Sep 17 00:00:00 2001 From: Carsten Graf Date: Mon, 26 Jan 2026 10:48:39 +0100 Subject: [PATCH] Collabsable automations --- routes/verwaltung.js | 23 +++++++++++++ views/dashboard.ejs | 77 +++++++++++++++++++++++++++++--------------- views/verwaltung.ejs | 34 +++++++++++++++++++ 3 files changed, 108 insertions(+), 26 deletions(-) diff --git a/routes/verwaltung.js b/routes/verwaltung.js index c3a28e3..6b1379d 100644 --- a/routes/verwaltung.js +++ b/routes/verwaltung.js @@ -113,6 +113,29 @@ function registerVerwaltungRoutes(app) { }); }); + // API: Krankheitstage für einen User im aktuellen Jahr abrufen + app.get('/api/verwaltung/user/:id/sick-days', requireVerwaltung, (req, res) => { + const userId = req.params.id; + const currentYear = new Date().getFullYear(); + const yearStart = `${currentYear}-01-01`; + const yearEnd = `${currentYear}-12-31`; + + db.all(`SELECT DISTINCT date + FROM timesheet_entries + WHERE user_id = ? AND date >= ? AND date <= ? AND sick_status = 1 + ORDER BY date`, + [userId, yearStart, yearEnd], + (err, entries) => { + if (err) { + return res.status(500).json({ error: 'Fehler beim Abrufen der Krankheitstage' }); + } + + const sickDays = entries ? entries.length : 0; + res.json({ sickDays: sickDays, year: currentYear }); + } + ); + }); + // API: Überstunden- und Urlaubsstatistiken für einen User abrufen app.get('/api/verwaltung/user/:id/stats', requireVerwaltung, (req, res) => { const userId = req.params.id; diff --git a/views/dashboard.ejs b/views/dashboard.ejs index 234e45c..8884679 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -73,37 +73,46 @@
von - Tagen
- +
-

Zeiterfassung per URL

-
- -
- - +

+ + Automatische Zeiterfassung +

+ -
- -
- - + + +
+

IP-basierte Zeiterfassung

+
+ +
+ + +
+

Ihre IP-Adresse für automatische Zeiterfassung

+
- - -
-

IP-basierte Zeiterfassung

-
- -
- - -
-

Ihre IP-Adresse für automatische Zeiterfassung

-
-
@@ -126,6 +135,22 @@ } } + // Zeiterfassung ein-/ausklappen + function toggleTimeCapture() { + const content = document.getElementById('timeCaptureContent'); + const icon = document.querySelector('.toggle-icon-time-capture'); + + if (content && icon) { + if (content.style.display === 'none') { + content.style.display = 'block'; + icon.style.transform = 'rotate(90deg)'; + } else { + content.style.display = 'none'; + icon.style.transform = 'rotate(0deg)'; + } + } + } + // URL-Kopier-Funktion function copyToClipboard(inputId) { const input = document.getElementById(inputId); diff --git a/views/verwaltung.ejs b/views/verwaltung.ejs index 74af54e..bfa6327 100644 --- a/views/verwaltung.ejs +++ b/views/verwaltung.ejs @@ -113,6 +113,10 @@
Kalenderwochen: <%= employee.weeks.length %>
+
+ Krankheitstage (<%= new Date().getFullYear() %>): + - +