This commit is contained in:
Matthias Hochmeister
2026-03-13 19:23:39 +01:00
parent 02d9d808b2
commit bc6d09200a
15 changed files with 610 additions and 74 deletions

View File

@@ -4,7 +4,7 @@ import { z } from 'zod';
// Enums
// ---------------------------------------------------------------------------
export const BUCHUNGS_ARTEN = ['intern', 'extern', 'wartung', 'reservierung', 'sonstiges'] as const;
export const BUCHUNGS_ARTEN = ['intern', 'extern', 'wartung', 'reservierung', 'sonstiges', 'lehrgang'] as const;
export type BuchungsArt = (typeof BUCHUNGS_ARTEN)[number];
// ---------------------------------------------------------------------------

View File

@@ -8,14 +8,12 @@ export enum FahrzeugStatus {
Einsatzbereit = 'einsatzbereit',
AusserDienstWartung = 'ausser_dienst_wartung',
AusserDienstSchaden = 'ausser_dienst_schaden',
InLehrgang = 'in_lehrgang',
}
export const FahrzeugStatusLabel: Record<FahrzeugStatus, string> = {
[FahrzeugStatus.Einsatzbereit]: 'Einsatzbereit',
[FahrzeugStatus.AusserDienstWartung]: 'Außer Dienst (Wartung)',
[FahrzeugStatus.AusserDienstSchaden]: 'Außer Dienst (Schaden)',
[FahrzeugStatus.InLehrgang]: 'In Lehrgang',
};
export type WartungslogArt =
@@ -25,6 +23,12 @@ export type WartungslogArt =
// ── Core Entities ─────────────────────────────────────────────────────────────
export interface AktiverLehrgang {
titel: string;
beginn: Date;
ende: Date;
}
export interface Fahrzeug {
id: string;
bezeichnung: string;
@@ -37,12 +41,15 @@ export interface Fahrzeug {
besatzung_soll: string | null;
status: FahrzeugStatus;
status_bemerkung: string | null;
ausser_dienst_von: Date | null;
ausser_dienst_bis: Date | null;
standort: string;
bild_url: string | null;
paragraph57a_faellig_am: Date | null;
naechste_wartung_am: Date | null;
created_at: Date;
updated_at: Date;
aktiver_lehrgang?: AktiverLehrgang | null;
}
export interface FahrzeugWartungslog {
@@ -71,12 +78,15 @@ export interface FahrzeugListItem {
besatzung_soll: string | null;
status: FahrzeugStatus;
status_bemerkung: string | null;
ausser_dienst_von: Date | null;
ausser_dienst_bis: Date | null;
bild_url: string | null;
paragraph57a_faellig_am: Date | null;
paragraph57a_tage_bis_faelligkeit: number | null;
naechste_wartung_am: Date | null;
wartung_tage_bis_faelligkeit: number | null;
naechste_pruefung_tage: number | null;
aktiver_lehrgang?: AktiverLehrgang | null;
}
// ── Detail View ───────────────────────────────────────────────────────────────
@@ -94,11 +104,19 @@ export interface VehicleStats {
total: number;
einsatzbereit: number;
ausserDienst: number;
inLehrgang: number;
inLehrgang: number; // derived from active lehrgang bookings
inspectionsDue: number;
inspectionsOverdue: number;
}
export interface OverlappingBooking {
id: string;
titel: string;
beginn: Date;
ende: Date;
gebucht_von_name: string;
}
// ── Inspection Alert ──────────────────────────────────────────────────────────
export type InspectionAlertType = '57a' | 'wartung';