rework internal order system
This commit is contained in:
@@ -518,39 +518,74 @@ function DetailModal({ requestId, onClose, showAdminActions, showEditButton, can
|
||||
) : (
|
||||
/* ── View Mode ── */
|
||||
<>
|
||||
{anfrage!.anfrager_name && (
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Anfrager: {anfrage!.anfrager_name}
|
||||
</Typography>
|
||||
)}
|
||||
{/* Meta info */}
|
||||
<Box sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5 }}>
|
||||
{anfrage!.anfrager_name && (
|
||||
<Box>
|
||||
<Typography variant="caption" color="text.secondary">Anfrager</Typography>
|
||||
<Typography variant="body2" fontWeight={500}>{anfrage!.anfrager_name}</Typography>
|
||||
</Box>
|
||||
)}
|
||||
<Box>
|
||||
<Typography variant="caption" color="text.secondary">Erstellt am</Typography>
|
||||
<Typography variant="body2" fontWeight={500}>{new Date(anfrage!.erstellt_am).toLocaleDateString('de-AT')}</Typography>
|
||||
</Box>
|
||||
{anfrage!.bearbeitet_von_name && (
|
||||
<Box>
|
||||
<Typography variant="caption" color="text.secondary">Bearbeitet von</Typography>
|
||||
<Typography variant="body2" fontWeight={500}>{anfrage!.bearbeitet_von_name}</Typography>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{anfrage!.notizen && (
|
||||
<Typography variant="body2">Notizen: {anfrage!.notizen}</Typography>
|
||||
<Paper variant="outlined" sx={{ p: 1.5, bgcolor: 'action.hover' }}>
|
||||
<Typography variant="caption" color="text.secondary" display="block" sx={{ mb: 0.5 }}>Notizen</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: 'pre-wrap' }}>{anfrage!.notizen}</Typography>
|
||||
</Paper>
|
||||
)}
|
||||
{anfrage!.admin_notizen && (
|
||||
<Typography variant="body2">Admin Notizen: {anfrage!.admin_notizen}</Typography>
|
||||
<Paper variant="outlined" sx={{ p: 1.5, bgcolor: 'warning.main', color: 'warning.contrastText', borderColor: 'warning.dark' }}>
|
||||
<Typography variant="caption" display="block" sx={{ mb: 0.5, opacity: 0.8 }}>Admin Notizen</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: 'pre-wrap' }}>{anfrage!.admin_notizen}</Typography>
|
||||
</Paper>
|
||||
)}
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Erstellt am: {new Date(anfrage!.erstellt_am).toLocaleDateString('de-AT')}
|
||||
</Typography>
|
||||
|
||||
<Divider />
|
||||
<Typography variant="subtitle2">Positionen</Typography>
|
||||
{detail.positionen.map(p => (
|
||||
<Box key={p.id}>
|
||||
<Typography variant="body2">
|
||||
- {p.menge}x {p.bezeichnung}{p.notizen ? ` (${p.notizen})` : ''}
|
||||
</Typography>
|
||||
{p.eigenschaften && p.eigenschaften.length > 0 && (
|
||||
<Box sx={{ ml: 2, mt: 0.25 }}>
|
||||
{p.eigenschaften.map(e => (
|
||||
<Typography key={e.eigenschaft_id} variant="caption" color="text.secondary" display="block">
|
||||
{e.eigenschaft_name}: {e.wert}
|
||||
</Typography>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
))}
|
||||
|
||||
{/* Positionen */}
|
||||
<Typography variant="subtitle2">Positionen ({detail.positionen.length})</Typography>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>Artikel</TableCell>
|
||||
<TableCell align="right">Menge</TableCell>
|
||||
<TableCell>Details</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{detail.positionen.map(p => (
|
||||
<TableRow key={p.id}>
|
||||
<TableCell>
|
||||
<Typography variant="body2" fontWeight={500}>{p.bezeichnung}</Typography>
|
||||
{p.eigenschaften && p.eigenschaften.length > 0 && (
|
||||
<Box sx={{ display: 'flex', gap: 0.5, flexWrap: 'wrap', mt: 0.5 }}>
|
||||
{p.eigenschaften.map(e => (
|
||||
<Chip key={e.eigenschaft_id} label={`${e.eigenschaft_name}: ${e.wert}`} size="small" variant="outlined" />
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="right">
|
||||
<Typography variant="body2" fontWeight={600}>{p.menge}x</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{p.notizen && <Typography variant="caption" color="text.secondary">{p.notizen}</Typography>}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
{detail.linked_bestellungen && detail.linked_bestellungen.length > 0 && (
|
||||
<>
|
||||
@@ -1252,14 +1287,14 @@ function MeineAnfragenTab() {
|
||||
function AlleAnfragenTab() {
|
||||
const { hasPermission } = usePermissionContext();
|
||||
const { user } = useAuth();
|
||||
const [statusFilter, setStatusFilter] = useState<string>('');
|
||||
const [statusFilter, setStatusFilter] = useState<string>('alle');
|
||||
const [detailId, setDetailId] = useState<number | null>(null);
|
||||
|
||||
const canEditAny = hasPermission('ausruestungsanfrage:edit');
|
||||
|
||||
const { data: requests = [], isLoading: requestsLoading, isError: requestsError } = useQuery({
|
||||
queryKey: ['ausruestungsanfrage', 'allRequests', statusFilter],
|
||||
queryFn: () => ausruestungsanfrageApi.getRequests(statusFilter ? { status: statusFilter } : undefined),
|
||||
queryFn: () => ausruestungsanfrageApi.getRequests(statusFilter !== 'alle' ? { status: statusFilter } : undefined),
|
||||
});
|
||||
|
||||
const { data: overview } = useQuery<AusruestungOverview>({
|
||||
@@ -1305,7 +1340,7 @@ function AlleAnfragenTab() {
|
||||
onChange={e => setStatusFilter(e.target.value)}
|
||||
sx={{ minWidth: 200, mb: 2 }}
|
||||
>
|
||||
<MenuItem value="">Alle</MenuItem>
|
||||
<MenuItem value="alle">Alle</MenuItem>
|
||||
{(Object.keys(AUSRUESTUNG_STATUS_LABELS) as AusruestungAnfrageStatus[]).map(s => (
|
||||
<MenuItem key={s} value={s}>{AUSRUESTUNG_STATUS_LABELS[s]}</MenuItem>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user