diff --git a/src/features/view/EntityView.tsx b/src/features/view/EntityView.tsx index 5b5dc52..d10b99e 100644 --- a/src/features/view/EntityView.tsx +++ b/src/features/view/EntityView.tsx @@ -150,7 +150,14 @@ export function EntityView({ entity, id }: { entity: string; id: string }) { meta: { loading: 'processing' }, mutationFn: async (v: { a: EntityAction; reason?: Record }) => { const values = { ...data, ...Object.fromEntries(Object.entries(layout?.alias ?? {}).map(([f, src]) => [f, data[aliasSource(src, lang)]])) }; - return runAction(entity, v.a.ACTION_NAME, toPayload(fields, values), id, [], v.reason); + const payload = toPayload(fields, values); + // overdue charges: the old form posted only the transaction date as shown (EVENT_DATE_GRID, dd/mm/yyyy hh:mm:ss) and no + // other date; the backend checks the pattern of every date it receives, so none of the others is sent + if (entity === 'FLEET_PENDING_FINANCIAL_TRANSACTIONS') { + for (const k of Object.keys(payload)) if (/DATE/.test(k)) delete payload[k]; + if (values.EVENT_DATE_GRID) payload.EVENT_DATE_GRID = values.EVENT_DATE_GRID; + } + return runAction(entity, v.a.ACTION_NAME, payload, id, [], v.reason); }, onSuccess: (res, v) => { // the new password is shown in a box with a copy button, not in a toast that disappears diff --git a/src/features/view/actions.ts b/src/features/view/actions.ts index 0a27064..ba1a6ad 100644 --- a/src/features/view/actions.ts +++ b/src/features/view/actions.ts @@ -19,6 +19,8 @@ const SIMPLE = new Set([ // permits: gate-in / gate-out, release, return to review, extend validity, free-zone exit, weighing slip 'GIN_EVENT', 'GOUT_EVENT', 'RELEASED', 'MFZ_TEMPORARY_EXIT', 'RETURN_TO_UNDER_REVIEW', 'MFZ_EXTEND_VALIDITY_PERIOD', 'MFZ_EXIT_INQUIRY', 'PRINT_WEIGHING_BRIDGE_DATA', + // overdue charges: confirm a charge that is under check + 'CONFIRM', ]); export const isSimpleAction = (a: EntityAction) => SIMPLE.has(a.ACTION_NAME);