featuer change for calendar

This commit is contained in:
Matthias Hochmeister
2026-03-03 09:55:18 +01:00
parent 64b23bae5c
commit 232d8aa872
3 changed files with 4 additions and 65 deletions

View File

@@ -1,61 +0,0 @@
import React, { useEffect, useState } from 'react';
import {
Alert,
AlertTitle,
Box,
CircularProgress,
Divider,
Link,
Typography,
} from '@mui/material';
import { NotificationsActive as NotificationsActiveIcon } from '@mui/icons-material';
import { Link as RouterLink } from 'react-router-dom';
import { atemschutzApi } from '../../services/atemschutz';
import type { User } from '../../types/auth.types';
import type { AtemschutzUebersicht } from '../../types/atemschutz.types';
// ── Constants ─────────────────────────────────────────────────────────────────
/** Show a warning banner if a deadline is within this many days. */
const WARNING_THRESHOLD_DAYS = 60;
// ── Types ─────────────────────────────────────────────────────────────────────
interface PersonalWarning {
key: string;
/** Negative = overdue, 0 = today, positive = days remaining. */
tageRest: number;
label: string;
/** Short description of what the user should do */
action: string;
}
// ── Helpers ───────────────────────────────────────────────────────────────────
function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] {
const warnings: PersonalWarning[] = [];
if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) {
warnings.push({
key: 'untersuchung',
tageRest: record.untersuchung_tage_rest,
label: 'Atemschutz-Untersuchung',
action: 'Termin beim Betriebsarzt vereinbaren',
});
}
if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) {
warnings.push({
key: 'leistungstest',
tageRest: record.leistungstest_tage_rest,
label: 'Leistungstest',
action: 'Atemschutzwart kontaktieren',
});
}
return warnings;
}
function tageText(tage: number): string {
if (tage < 0) {
const abs = Math.abs(tage);

View File

@@ -35,7 +35,7 @@ interface PersonalWarning {
function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] { function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] {
const warnings: PersonalWarning[] = []; const warnings: PersonalWarning[] = [];
if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) { if (record.untersuchung_tage_rest !== null && record.untersuchung_tage_rest <= WARNING_THRESHOLD_DAYS) {
warnings.push({ warnings.push({
key: 'untersuchung', key: 'untersuchung',
tageRest: record.untersuchung_tage_rest, tageRest: record.untersuchung_tage_rest,
@@ -44,7 +44,7 @@ function buildWarnings(record: AtemschutzUebersicht): PersonalWarning[] {
}); });
} }
if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) { if (record.leistungstest_tage_rest !== null && record.leistungstest_tage_rest <= WARNING_THRESHOLD_DAYS) {
warnings.push({ warnings.push({
key: 'leistungstest', key: 'leistungstest',
tageRest: record.leistungstest_tage_rest, tageRest: record.leistungstest_tage_rest,

View File

@@ -41,8 +41,8 @@ function Header({ onMenuClick }: HeaderProps) {
if (\!record) return; if (\!record) return;
let count = 0; let count = 0;
const THRESHOLD = 60; const THRESHOLD = 60;
if (record.untersuchung_tage_rest \!== null && record.untersuchung_tage_rest <= THRESHOLD) count++; if (record.untersuchung_tage_rest !== null && record.untersuchung_tage_rest <= THRESHOLD) count++;
if (record.leistungstest_tage_rest \!== null && record.leistungstest_tage_rest <= THRESHOLD) count++; if (record.leistungstest_tage_rest !== null && record.leistungstest_tage_rest <= THRESHOLD) count++;
setWarningCount(count); setWarningCount(count);
}) })
.catch(() => { /* non-critical */ }); .catch(() => { /* non-critical */ });