This commit is contained in:
seb
2026-09-18 06:44:12 +02:00
parent d5ade4923d
commit a537c2f72d
8 changed files with 308 additions and 31 deletions

View File

@@ -15,6 +15,7 @@ import ManifestLines from './ManifestLines';
import ManifestPdfDialog from './ManifestPdfDialog';
import {
buildManifestBody,
restoreAttachmentsFromApi,
dateInputValue,
emptyLine,
lineFromApi,
@@ -38,6 +39,7 @@ class ManifestForm extends PureComponent {
number: '',
externalNumber: '',
lines: [emptyLine()],
attachments: [],
saving: false,
pdfUploading: false,
pdfDialogOpen: false,
@@ -125,6 +127,10 @@ class ManifestForm extends PureComponent {
const lines =
apiLines.length > 0 ? apiLines.map(lineFromApi) : [emptyLine()];
// Restore attachments if available
const apiFiles = doc.files ?? [];
const attachments = await restoreAttachmentsFromApi(apiFiles);
this.setState({
status: 'ready',
parties,
@@ -135,6 +141,7 @@ class ManifestForm extends PureComponent {
externalNumber:
doc.externalNumber != null ? String(doc.externalNumber) : '',
lines,
attachments,
});
} catch (err) {
if (this._cancelled) return;
@@ -294,13 +301,14 @@ class ManifestForm extends PureComponent {
const requireAtLeastOne = mode === 'create';
let body;
try {
body = buildManifestBody(
body = await buildManifestBody(
{
number: this.state.number,
externalNumber: this.state.externalNumber,
date: this.state.date,
partyId: this.state.partyId,
lines: this.state.lines,
attachments: this.state.attachments,
},
{
partyField: cfg.partyField,