subnav
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user