u
This commit is contained in:
@@ -24,8 +24,6 @@ import AddIcon from '@mui/icons-material/Add';
|
||||
import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined';
|
||||
import CheckCircleOutlineOutlinedIcon from '@mui/icons-material/CheckCircleOutlineOutlined';
|
||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
||||
import Inventory2Icon from '@mui/icons-material/Inventory2';
|
||||
import { enqueueSnackbar } from 'notistack';
|
||||
import AppDialog from '../AppDialog';
|
||||
import { shipment as shipmentApi, shipping as shippingApi } from '../../api';
|
||||
@@ -174,7 +172,6 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
this.handleDeletePackage = this.handleDeletePackage.bind(this);
|
||||
this.handleMarkPackageShipped = this.handleMarkPackageShipped.bind(this);
|
||||
this.handleStateChange = this.handleStateChange.bind(this);
|
||||
this.handleNavigateFull = this.handleNavigateFull.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -260,7 +257,7 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
this.setState((prev) => ({
|
||||
shipment: { ...prev.shipment, state: newState },
|
||||
}));
|
||||
const label = newState === 'delivered' ? 'Geliefert' : newState === 'returned' ? 'Retoure' : 'Neu';
|
||||
const label = newState === 'delivered' ? 'Versendet' : newState === 'returned' ? 'Retoure' : 'Neu';
|
||||
enqueueSnackbar(`Lieferstatus geändert: ${label}`, { variant: 'success' });
|
||||
await Promise.all([
|
||||
orderAutomat.actions.reload(),
|
||||
@@ -274,14 +271,6 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
handleNavigateFull() {
|
||||
const { shipment, onClose, onNavigate } = this.props;
|
||||
onClose?.();
|
||||
if (onNavigate && shipment?.id) {
|
||||
onNavigate(`/auftrag/ausliefern?shipmentId=${shipment.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { open, onClose } = this.props;
|
||||
const { shipment, loading, error, addPackageDialogOpen, busyAction } = this.state;
|
||||
@@ -290,7 +279,6 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
|
||||
const shLines = Array.isArray(shipment.lines) ? shipment.lines : [];
|
||||
const shPackages = Array.isArray(shipment.shippings) ? shipment.shippings : [];
|
||||
const hasShippedPackages = shPackages.some((p) => p.state === 'shipped');
|
||||
|
||||
return (
|
||||
<AppDialog open={open} onClose={onClose} maxWidth="md" fullWidth>
|
||||
@@ -298,46 +286,23 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
<Stack direction="row" spacing={1.5} sx={{ alignItems: 'center' }}>
|
||||
<LocalShippingIcon color="primary" sx={{ fontSize: 28 }} />
|
||||
<Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Typography variant="h6" sx={{ fontWeight: 700, lineHeight: 1.2 }}>
|
||||
{shipment.number || 'Lieferschein'}
|
||||
</Typography>
|
||||
<Chip
|
||||
size="small"
|
||||
color={hasShippedPackages ? 'success' : 'default'}
|
||||
label={hasShippedPackages ? 'Im Versand' : 'Bereitstellung'}
|
||||
sx={{ fontWeight: 600, height: 20, fontSize: '0.7rem' }}
|
||||
/>
|
||||
</Box>
|
||||
<Typography variant="h6" sx={{ fontWeight: 700, lineHeight: 1.2 }}>
|
||||
{shipment.number || 'Lieferschein'}
|
||||
</Typography>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
{shipment.date ? `Datum: ${formatDate(shipment.date)}` : ''}
|
||||
{shipment.externalNumber ? ` • Ref: ${shipment.externalNumber}` : ''}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Stack>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>
|
||||
<TextField
|
||||
select
|
||||
size="small"
|
||||
label="Lieferstatus"
|
||||
value={shipment.state || 'new'}
|
||||
onChange={(e) => this.handleStateChange(e.target.value)}
|
||||
disabled={busyAction}
|
||||
sx={{ minWidth: 130 }}
|
||||
>
|
||||
<MenuItem value="new">Neu</MenuItem>
|
||||
<MenuItem value="delivered">Geliefert</MenuItem>
|
||||
<MenuItem value="returned">Retoure</MenuItem>
|
||||
</TextField>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={onClose}
|
||||
size="small"
|
||||
sx={{ color: (theme) => theme.palette.grey[500] }}
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<IconButton
|
||||
aria-label="close"
|
||||
onClick={onClose}
|
||||
size="small"
|
||||
sx={{ color: (theme) => theme.palette.grey[500] }}
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</DialogTitle>
|
||||
|
||||
<DialogContent dividers sx={{ p: 2.5, display: 'flex', flexDirection: 'column', gap: 2.5 }}>
|
||||
@@ -349,9 +314,6 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
|
||||
{/* Shipped Article Positions */}
|
||||
<Box>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, mb: 1 }}>
|
||||
Gelieferte Artikel-Positionen ({shLines.length})
|
||||
</Typography>
|
||||
<TableContainer sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1.5, bgcolor: WHITE }}>
|
||||
<Table size="small">
|
||||
<TableHead sx={{ bgcolor: SURFACE_RAISED }}>
|
||||
@@ -386,10 +348,7 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
|
||||
{/* Shipping Packages / Tracking */}
|
||||
<Box>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 1 }}>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700 }}>
|
||||
Pakete & Sendungsverfolgung ({shPackages.length})
|
||||
</Typography>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', mb: shPackages.length > 0 ? 1 : 0 }}>
|
||||
<Button
|
||||
size="small"
|
||||
variant="outlined"
|
||||
@@ -402,14 +361,7 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
{shPackages.length === 0 ? (
|
||||
<Box sx={{ p: 2.5, textAlign: 'center', bgcolor: WHITE, borderRadius: 1.5, border: '1px dashed', borderColor: 'divider' }}>
|
||||
<Inventory2Icon sx={{ color: 'text.secondary', fontSize: 28, mb: 0.5 }} />
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Noch keine Pakete erfasst.
|
||||
</Typography>
|
||||
</Box>
|
||||
) : (
|
||||
{shPackages.length > 0 ? (
|
||||
<Stack spacing={1}>
|
||||
{shPackages.map((pkg) => {
|
||||
const isShipped = pkg.state === 'shipped';
|
||||
@@ -493,25 +445,41 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
);
|
||||
})}
|
||||
</Stack>
|
||||
)}
|
||||
) : null}
|
||||
</Box>
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions sx={{ p: 2, justifyContent: 'space-between' }}>
|
||||
<Button variant="outlined" onClick={onClose}>
|
||||
Schließen
|
||||
</Button>
|
||||
|
||||
{this.props.onNavigate && (
|
||||
<DialogActions sx={{ p: 2, justifyContent: 'flex-end' }}>
|
||||
{(!shipment.state || shipment.state === 'new') && (
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<OpenInNewIcon />}
|
||||
onClick={this.handleNavigateFull}
|
||||
sx={{ textTransform: 'none', fontWeight: 600 }}
|
||||
color="primary"
|
||||
disabled={busyAction}
|
||||
onClick={() => this.handleStateChange('delivered')}
|
||||
sx={{ textTransform: 'none', fontWeight: 700 }}
|
||||
>
|
||||
In Auslieferungen öffnen
|
||||
{busyAction ? 'Wird versendet…' : 'Versenden'}
|
||||
</Button>
|
||||
)}
|
||||
{shipment.state === 'delivered' && (
|
||||
<Button
|
||||
variant="contained"
|
||||
color="warning"
|
||||
disabled={busyAction}
|
||||
onClick={() => this.handleStateChange('returned')}
|
||||
sx={{ textTransform: 'none', fontWeight: 700 }}
|
||||
>
|
||||
{busyAction ? 'Wird gebucht…' : 'Retoure'}
|
||||
</Button>
|
||||
)}
|
||||
{shipment.state === 'returned' && (
|
||||
<Chip
|
||||
label="Retoure"
|
||||
color="error"
|
||||
variant="outlined"
|
||||
sx={{ fontWeight: 700, height: 28, fontSize: '0.8rem' }}
|
||||
/>
|
||||
)}
|
||||
</DialogActions>
|
||||
|
||||
{addPackageDialogOpen && (
|
||||
|
||||
Reference in New Issue
Block a user