u
This commit is contained in:
@@ -224,14 +224,21 @@ export const orderDraftAutomat = createManifestDraftAutomat({
|
||||
name: 'order-draft',
|
||||
});
|
||||
|
||||
/** Shared singleton automat for retoure draft. */
|
||||
export const retoureDraftAutomat = createManifestDraftAutomat({
|
||||
kind: 'retoure',
|
||||
name: 'retoure-draft',
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the draft automat for a given manifest kind.
|
||||
* @param {'quote'|'order'} kind
|
||||
* @param {'quote'|'order'|'retoure'} kind
|
||||
* @returns {Automat|null}
|
||||
*/
|
||||
export function getManifestDraftAutomat(kind) {
|
||||
if (kind === 'quote') return quoteDraftAutomat;
|
||||
if (kind === 'order') return orderDraftAutomat;
|
||||
if (kind === 'retoure') return retoureDraftAutomat;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -454,10 +461,10 @@ export function createManifestEditAutomat({ kind, name }) {
|
||||
shipments: doc.shipments || [],
|
||||
payments: doc.payments || [],
|
||||
shippings: doc.shippings || [],
|
||||
orderTotal: doc.orderTotal ?? null,
|
||||
paidTotal: doc.paidTotal ?? null,
|
||||
paid: Boolean(doc.paid),
|
||||
shipped: Boolean(doc.shipped),
|
||||
orderTotal: doc.orderTotal ?? doc.grossTotal ?? doc.gross_total ?? null,
|
||||
paidTotal: doc.paidTotal ?? doc.paid_total ?? null,
|
||||
paid: Boolean(doc.paid ?? doc.isPaid ?? doc.is_paid),
|
||||
shipped: Boolean(doc.shipped ?? doc.isShipped ?? doc.is_shipped),
|
||||
delivered: Boolean(doc.delivered),
|
||||
baseline,
|
||||
isDirty: false,
|
||||
@@ -605,13 +612,20 @@ export const orderEditAutomat = createManifestEditAutomat({
|
||||
name: 'order-edit',
|
||||
});
|
||||
|
||||
/** Shared singleton automat for the single last edited retoure. */
|
||||
export const retoureEditAutomat = createManifestEditAutomat({
|
||||
kind: 'retoure',
|
||||
name: 'retoure-edit',
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the edit automat for a given manifest kind.
|
||||
* @param {'quote'|'order'} kind
|
||||
* @param {'quote'|'order'|'retoure'} kind
|
||||
* @returns {Automat|null}
|
||||
*/
|
||||
export function getManifestEditAutomat(kind) {
|
||||
if (kind === 'quote') return quoteEditAutomat;
|
||||
if (kind === 'order') return orderEditAutomat;
|
||||
if (kind === 'retoure') return retoureEditAutomat;
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user