31 von 45 = ca. 69 %
31 punkter der todo liste abgeabeitet
This commit is contained in:
@@ -2,6 +2,14 @@ import { useState } from 'react';
|
||||
import { isOverdue } from '../hooks/useAssets';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import LagerstandortManager from './LagerstandortManager';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
const STAT_CARDS = [
|
||||
{ key: 'offen', color: '#DC2626', label: 'Offen' },
|
||||
{ key: 'bearbeitung', color: '#F59E0B', label: 'In Bearbeitung' },
|
||||
{ key: 'entsorgt', color: '#6B7280', label: 'Entsorgt' },
|
||||
{ key: 'overdue', color: '#2563EB', label: 'Überfällig (>7 Tage)' },
|
||||
];
|
||||
|
||||
export default function Dashboard({ assets, lagerstandorte, onAddLagerstandort, onToggleLagerstandort, onDeleteLagerstandort }) {
|
||||
const { isAdmin, isFilialleiter } = useAuth();
|
||||
@@ -16,16 +24,27 @@ export default function Dashboard({ assets, lagerstandorte, onAddLagerstandort,
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="dashboard">
|
||||
<StatCard color="red" count={counts.offen} label="Offen" />
|
||||
<StatCard color="yellow" count={counts.bearbeitung} label="In Bearbeitung" />
|
||||
<StatCard color="gray" count={counts.entsorgt} label="Entsorgt" />
|
||||
<StatCard color="blue" count={counts.overdue} label="Überfällig (>7 Tage)" />
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-5">
|
||||
{STAT_CARDS.map(({ key, color, label }) => (
|
||||
<Card key={key} className="py-0" style={{ borderTop: `3px solid ${color}` }}>
|
||||
<CardContent className="py-5">
|
||||
<div className="text-3xl font-bold tracking-tight">{counts[key]}</div>
|
||||
<p className="text-sm text-muted-foreground mt-1">{label}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
|
||||
{(isAdmin || isFilialleiter) && (
|
||||
<div className="stat-card" style={{ borderColor: '#F57C00', cursor: 'pointer' }} onClick={() => setShowManager(true)}>
|
||||
<div className="stat-number" style={{ fontSize: '24px' }}>{lagerstandorte.length}</div>
|
||||
<div className="stat-label">Lagerstandorte verwalten</div>
|
||||
</div>
|
||||
<Card
|
||||
className="py-0 cursor-pointer transition-colors hover:bg-muted/50"
|
||||
style={{ borderTop: '3px solid #F57C00' }}
|
||||
onClick={() => setShowManager(true)}
|
||||
>
|
||||
<CardContent className="py-5">
|
||||
<div className="text-3xl font-bold tracking-tight">{lagerstandorte.length}</div>
|
||||
<p className="text-sm text-muted-foreground mt-1">Lagerstandorte verwalten</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -41,12 +60,3 @@ export default function Dashboard({ assets, lagerstandorte, onAddLagerstandort,
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function StatCard({ color, count, label }) {
|
||||
return (
|
||||
<div className={`stat-card ${color}`}>
|
||||
<div className="stat-number">{count}</div>
|
||||
<div className="stat-label">{label}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user