u
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
import { Automat } from 'react-automat';
|
||||
import { article as articleApi, supplier as supplierApi } from '../api';
|
||||
import { todayInputValue } from '../components/manifest/manifestConfig';
|
||||
|
||||
/**
|
||||
* @typedef {Object} DeliveryLine
|
||||
@@ -155,7 +156,7 @@ export function buildSupplierArticlesMap(articles = [], existingMap = {}) {
|
||||
export const initialDelivery = {
|
||||
id: null,
|
||||
deliveryId: null,
|
||||
date: null,
|
||||
date: todayInputValue(),
|
||||
deliveryEntity: null,
|
||||
partyId: null,
|
||||
externalNumber: null,
|
||||
@@ -226,12 +227,14 @@ export function createDeliveryEditorAutomat(options = {}) {
|
||||
: delivery.notes ? [delivery.notes] : [];
|
||||
const rawAttachments = delivery.attachments ?? delivery.files ?? [];
|
||||
const attachments = Array.isArray(rawAttachments) ? rawAttachments : [];
|
||||
const date = delivery.date !== undefined ? delivery.date : (id != null ? null : (automat.state.date || todayInputValue()));
|
||||
|
||||
automat.setState({
|
||||
...initialDelivery,
|
||||
...delivery,
|
||||
id,
|
||||
deliveryId: id,
|
||||
date,
|
||||
partyId,
|
||||
deliveryEntity: partyId,
|
||||
externalNumber: extNum,
|
||||
@@ -670,6 +673,7 @@ export function createDeliveryEditorAutomat(options = {}) {
|
||||
resetDelivery() {
|
||||
automat.setState({
|
||||
...initialDelivery,
|
||||
date: todayInputValue(),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -677,6 +681,7 @@ export function createDeliveryEditorAutomat(options = {}) {
|
||||
resetDeliveryEditor() {
|
||||
automat.setState({
|
||||
...initialState,
|
||||
date: todayInputValue(),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -718,7 +723,7 @@ export function createDeliveryEditorAutomat(options = {}) {
|
||||
basedata.invoiceNumber ??
|
||||
basedata.invoice_number ??
|
||||
null;
|
||||
const date = basedata.date ?? null;
|
||||
const date = basedata.date ?? automat.state.date ?? todayInputValue();
|
||||
const type = basedata.manifestType ?? basedata.type ?? 'rechnung';
|
||||
|
||||
let matchedPartyId = partyId != null && partyId !== '' ? partyId : null;
|
||||
|
||||
Reference in New Issue
Block a user