Overdue charges: show Confirm action and post dates as the legacy form does

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Samer Salameh 2026-11-16 15:02:04 +03:00
parent 0f1c6ab3eb
commit 95fe119bf9
2 changed files with 10 additions and 1 deletions

View File

@ -150,7 +150,14 @@ export function EntityView({ entity, id }: { entity: string; id: string }) {
meta: { loading: 'processing' }, meta: { loading: 'processing' },
mutationFn: async (v: { a: EntityAction; reason?: Record<string, string> }) => { mutationFn: async (v: { a: EntityAction; reason?: Record<string, string> }) => {
const values = { ...data, ...Object.fromEntries(Object.entries(layout?.alias ?? {}).map(([f, src]) => [f, data[aliasSource(src, lang)]])) }; 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) => { onSuccess: (res, v) => {
// the new password is shown in a box with a copy button, not in a toast that disappears // the new password is shown in a box with a copy button, not in a toast that disappears

View File

@ -19,6 +19,8 @@ const SIMPLE = new Set([
// permits: gate-in / gate-out, release, return to review, extend validity, free-zone exit, weighing slip // 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', 'GIN_EVENT', 'GOUT_EVENT', 'RELEASED', 'MFZ_TEMPORARY_EXIT', 'RETURN_TO_UNDER_REVIEW', 'MFZ_EXTEND_VALIDITY_PERIOD',
'MFZ_EXIT_INQUIRY', 'PRINT_WEIGHING_BRIDGE_DATA', '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); export const isSimpleAction = (a: EntityAction) => SIMPLE.has(a.ACTION_NAME);