This commit is contained in:
seb
2026-10-18 20:21:27 +02:00
parent 328ba164ec
commit ac9034685f
4 changed files with 151 additions and 63 deletions

View File

@@ -868,6 +868,7 @@ class ManifestForm extends PureComponent {
handleRemoveAllLines() {
this.setState((prev) => {
let nextLines = [];
if (this.props.kind === 'order') {
const shippedSkus = new Set();
for (const sh of prev.shipments || []) {
@@ -876,7 +877,7 @@ class ManifestForm extends PureComponent {
}
}
if (shippedSkus.size > 0) {
const remaining = prev.lines.filter((l) => {
const remaining = (prev.lines || []).filter((l) => {
const raw = l.sku != null ? String(l.sku).trim().toLowerCase() : '';
return shippedSkus.has(raw);
});
@@ -885,10 +886,10 @@ class ManifestForm extends PureComponent {
return null;
}
enqueueSnackbar('Nicht ausgelieferte Positionen wurden entfernt.', { variant: 'info' });
return { lines: remaining, isDirty: true };
nextLines = remaining;
}
}
return { lines: [], isDirty: true };
return { lines: nextLines, isDirty: true };
});
}
@@ -1181,7 +1182,7 @@ class ManifestForm extends PureComponent {
{
kind: cfg.kind,
partyField: cfg.partyField,
requireAtLeastOne: true,
requireAtLeastOne: !isEdit,
externalNumber: cfg.externalNumber,
isUpdate: isEdit,
mode,
@@ -1334,7 +1335,7 @@ class ManifestForm extends PureComponent {
isDirty={this.state.isDirty}
dirtyFields={this.state.dirtyFields}
dirtySummary={this.state.dirtySummary}
onRestore={this.props.mode === 'edit' && this.state.isDirty ? this.handleRestore : undefined}
onRestore={this.props.mode === 'edit' ? this.handleRestore : undefined}
onPdfUpload={kind === 'delivery' ? this.handlePdfUpload : undefined}
onPdfDelete={this.handleAttachmentDelete}
onPdfCreate={kind === 'quote' || kind === 'order' ? this.handleCreatePdf : undefined}