rework vehicle handling
This commit is contained in:
@@ -140,7 +140,7 @@ function Dashboard() {
|
||||
title="Fahrzeuge einsatzbereit"
|
||||
value={
|
||||
vehicleStats
|
||||
? `${vehicleStats.einsatzbereit}/${vehicleStats.total}`
|
||||
? `${vehicleStats?.einsatzbereit}/${vehicleStats?.total}`
|
||||
: '—'
|
||||
}
|
||||
icon={DirectionsCar}
|
||||
|
||||
@@ -35,9 +35,11 @@ import {
|
||||
Edit,
|
||||
Error as ErrorIcon,
|
||||
LocalFireDepartment,
|
||||
MoreHoriz,
|
||||
PauseCircle,
|
||||
ReportProblem,
|
||||
School,
|
||||
Verified,
|
||||
Warning,
|
||||
} from '@mui/icons-material';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
@@ -303,10 +305,9 @@ interface WartungTabProps {
|
||||
}
|
||||
|
||||
const WARTUNG_ART_ICONS: Record<string, React.ReactElement> = {
|
||||
Kraftstoff: <LocalFireDepartment color="action" />,
|
||||
Reparatur: <Build color="warning" />,
|
||||
Inspektion: <Assignment color="primary" />,
|
||||
Hauptuntersuchung: <CheckCircle color="success" />,
|
||||
'§57a Prüfung': <Verified color="success" />,
|
||||
'Service': <Build color="warning" />,
|
||||
'Sonstiges': <MoreHoriz color="action" />,
|
||||
default: <Build color="action" />,
|
||||
};
|
||||
|
||||
@@ -417,7 +418,7 @@ const WartungTab: React.FC<WartungTabProps> = ({ fahrzeugId, wartungslog, onAdde
|
||||
onChange={(e) => setForm((f) => ({ ...f, art: (e.target.value || undefined) as WartungslogArt | undefined }))}
|
||||
>
|
||||
<MenuItem value="">— Bitte wählen —</MenuItem>
|
||||
{(['Inspektion', 'Reparatur', 'Kraftstoff', 'Reifenwechsel', 'Hauptuntersuchung', 'Reinigung', 'Sonstiges'] as WartungslogArt[]).map((a) => (
|
||||
{(['§57a Prüfung', 'Service', 'Sonstiges'] as WartungslogArt[]).map((a) => (
|
||||
<MenuItem key={a} value={a}>{a}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -387,7 +387,7 @@ function MitgliedDetail() {
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
{profile && profile.funktion.length > 0 && (
|
||||
{profile && Array.isArray(profile.funktion) && profile.funktion.length > 0 && (
|
||||
<Box sx={{ display: 'flex', gap: 0.5, mt: 1, flexWrap: 'wrap' }}>
|
||||
{profile.funktion.map((f) => (
|
||||
<Chip key={f} label={f} size="small" color="secondary" variant="outlined" />
|
||||
|
||||
@@ -354,7 +354,7 @@ function Mitglieder() {
|
||||
{/* Funktion(en) */}
|
||||
<TableCell>
|
||||
<Box sx={{ display: 'flex', gap: 0.5, flexWrap: 'wrap' }}>
|
||||
{member.funktion.length > 0
|
||||
{Array.isArray(member.funktion) && member.funktion.length > 0
|
||||
? member.funktion.map((f) => (
|
||||
<Chip key={f} label={f} size="small" variant="outlined" color="secondary" />
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user