u
This commit is contained in:
@@ -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 (
|
||||
<AppDialog open={open} onClose={onClose} maxWidth="md" fullWidth>
|
||||
@@ -476,7 +497,8 @@ export default class ShipmentDetailDialog extends PureComponent {
|
||||
variant="outlined"
|
||||
startIcon={<AddIcon />}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user