From c647068067a3f9278faec4a43335bd4e5836659b Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 19 Oct 2026 01:36:35 +0200 Subject: [PATCH] u --- .../manifest/ShipmentDetailDialog.jsx | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/components/manifest/ShipmentDetailDialog.jsx b/src/components/manifest/ShipmentDetailDialog.jsx index d93d913..5e78b85 100644 --- a/src/components/manifest/ShipmentDetailDialog.jsx +++ b/src/components/manifest/ShipmentDetailDialog.jsx @@ -71,7 +71,14 @@ class AddPackageDialog extends PureComponent { async handleSubmit() { const { shipment, onClose, onSuccess } = this.props; const { carriers, carrierId, trackingCode } = this.state; - if (!shipment?.id || !carrierId) return; + const isShipmentShipped = Boolean( + shipment?.state === 'delivered' || + shipment?.state === 'shipped' || + shipment?.state === 'returned' || + shipment?.shippedAt || + (shipment?.state && shipment?.state !== 'new') + ); + if (!shipment?.id || !carrierId || isShipmentShipped) return; const selectedCarrier = carriers.find((c) => String(c.id) === String(carrierId)); const hasPackages = Boolean(selectedCarrier?.hasPackages); @@ -111,7 +118,14 @@ class AddPackageDialog extends PureComponent { render() { const { open, onClose, shipment } = this.props; const { carriers, carrierId, trackingCode, saving } = this.state; - const canSubmit = Boolean(carrierId) && !saving; + const isShipmentShipped = Boolean( + shipment?.state === 'delivered' || + shipment?.state === 'shipped' || + shipment?.state === 'returned' || + shipment?.shippedAt || + (shipment?.state && shipment?.state !== 'new') + ); + const canSubmit = Boolean(carrierId) && !saving && !isShipmentShipped; const selectedCarrier = carriers.find((c) => String(c.id) === String(carrierId)); const hasPackages = Boolean(selectedCarrier?.hasPackages); @@ -401,6 +415,13 @@ export default class ShipmentDetailDialog extends PureComponent { const shLines = Array.isArray(shipment.lines) ? shipment.lines : []; const shPackages = Array.isArray(shipment.shippings) ? shipment.shippings : []; const carriers = carrierAutomat.state.carriers || []; + const isShipmentShipped = Boolean( + shipment.state === 'delivered' || + shipment.state === 'shipped' || + shipment.state === 'returned' || + shipment.shippedAt || + (shipment.state && shipment.state !== 'new') + ); return ( @@ -476,7 +497,8 @@ export default class ShipmentDetailDialog extends PureComponent { variant="outlined" startIcon={} onClick={() => this.setState({ addPackageDialogOpen: true })} - disabled={busyAction} + disabled={busyAction || isShipmentShipped} + title={isShipmentShipped ? 'Lieferschein ist bereits versendet' : undefined} sx={{ textTransform: 'none', fontWeight: 600, height: 28, fontSize: '0.75rem' }} > Versand hinzufügen