u
This commit is contained in:
@@ -98,6 +98,20 @@ export {
|
||||
subscribeChunkStats,
|
||||
} from './orderAutomat';
|
||||
export { default as entityAutomat } from './entityAutomat';
|
||||
export {
|
||||
default as retoureAutomat,
|
||||
selectRetoures,
|
||||
selectRetoureTotal,
|
||||
selectRetoureUnfilteredTotal,
|
||||
isRetourePaid,
|
||||
isRetoureShipped,
|
||||
isRetoureDelivered,
|
||||
getRetoureDate,
|
||||
getItems as getRetoureItems,
|
||||
requireChunk as requireRetoureChunk,
|
||||
getChunkStats as getRetoureChunkStats,
|
||||
subscribeChunkStats as subscribeRetoureChunkStats,
|
||||
} from './retoureAutomat';
|
||||
export { default as customergroupAutomat } from './customergroupAutomat';
|
||||
export { default as numberAutomat } from './numberAutomat';
|
||||
export { default as accountAutomat } from './accountAutomat';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
1005
src/automats/retoureAutomat.js
Normal file
1005
src/automats/retoureAutomat.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,7 @@ import supplierAutomat from './supplierAutomat';
|
||||
import deliveryAutomat from './deliveryAutomat';
|
||||
import orderAutomat from './orderAutomat';
|
||||
import quoteAutomat from './quoteAutomat';
|
||||
import retoureAutomat from './retoureAutomat';
|
||||
import shipmentAutomat from './shipmentAutomat';
|
||||
import carrierAutomat from './carrierAutomat';
|
||||
|
||||
@@ -282,6 +283,15 @@ function connect() {
|
||||
});
|
||||
});
|
||||
|
||||
addTrackedListener(es, 'retoure', () => {
|
||||
void retoureAutomat.actions.reload().catch((err) => {
|
||||
console.error('[sse] retoure refresh failed', err);
|
||||
});
|
||||
void shipmentAutomat.actions.reload().catch((err) => {
|
||||
console.error('[sse] shipment refresh failed', err);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user