From 94f385e75304a208597bb75eddd0820277d62eb9 Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 18 Oct 2026 19:36:56 +0200 Subject: [PATCH] u --- src/components/manifest/ManifestForm.jsx | 7 +++++++ src/components/manifest/ManifestHeader.jsx | 10 ++++++---- src/components/manifest/manifestConfig.js | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/manifest/ManifestForm.jsx b/src/components/manifest/ManifestForm.jsx index 2bb28e0..283e7db 100644 --- a/src/components/manifest/ManifestForm.jsx +++ b/src/components/manifest/ManifestForm.jsx @@ -1148,6 +1148,13 @@ class ManifestForm extends PureComponent { if (this.state.saving) return false; if (mode === 'edit' && docId == null) return false; + if (cfg.kind === 'order' && (this.state.partyId == null || this.state.partyId === '')) { + this.setState({ partyError: true }); + notifyErrorMessage('Für eine Bestellung ist ein Kunde erforderlich.'); + this.headerRef.current?.focusPartyInput?.(); + return false; + } + const isEdit = mode === 'edit'; let body; try { diff --git a/src/components/manifest/ManifestHeader.jsx b/src/components/manifest/ManifestHeader.jsx index 2b60184..32a405f 100644 --- a/src/components/manifest/ManifestHeader.jsx +++ b/src/components/manifest/ManifestHeader.jsx @@ -274,9 +274,11 @@ class ManifestHeader extends PureComponent { const hasArticles = this.hasArticles(); const isEdit = docId != null; const hasAttachments = Array.isArray(attachments) && attachments.length > 0; - const canSave = isEdit - ? Boolean(isDirty) - : Boolean(hasArticles || hasAttachments); + const hasParty = partyId != null && partyId !== ''; + const partyValid = kind !== 'order' || hasParty; + const canSave = + partyValid && + (isEdit ? Boolean(isDirty) : Boolean(hasArticles || hasAttachments)); // Delivery: number is server-allocated/read-only; the caller reference // lives in the editable externalNumber field. @@ -375,8 +377,8 @@ class ManifestHeader extends PureComponent { {...params} inputRef={this.partyInputRef} label={dirtyFields?.partyId ? `${partyLabel} *` : partyLabel} + required={kind === 'order'} error={isPartyEmpty} - helperText={Boolean(partyError) && isPartyEmpty ? 'Kunde für Bestellung erforderlich' : undefined} onKeyDown={this.handlePartyKeyDown} slotProps={{ ...params.slotProps, diff --git a/src/components/manifest/manifestConfig.js b/src/components/manifest/manifestConfig.js index 916676c..2c0338d 100644 --- a/src/components/manifest/manifestConfig.js +++ b/src/components/manifest/manifestConfig.js @@ -527,6 +527,8 @@ export async function buildManifestBody( if (!Number.isNaN(pid)) { body[partyField] = pid; } + } else if (kind === 'order') { + throw new Error('Für eine Bestellung ist ein Kunde erforderlich.'); } else if (isEdit) { body[partyField] = null; }