From 9f9d8153223c0730152ebf99fe2728e361d7f569 Mon Sep 17 00:00:00 2001 From: Sampo Tawast Date: Mon, 18 Dec 2023 13:30:29 +0200 Subject: [PATCH] fix: use completed status when rejected applications are sent to archive --- .../batchFooter/BatchFooterCompletion.tsx | 90 +++++++++---------- .../batchFooter/BatchFooterInspection.tsx | 4 +- .../useBatchActionsInspected.ts | 2 +- .../src/components/table/TableExtras.sc.ts | 4 +- .../handler/src/hooks/useBatchInspected.ts | 7 +- .../handler/src/hooks/useBatchStatus.ts | 1 + 6 files changed, 55 insertions(+), 53 deletions(-) diff --git a/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterCompletion.tsx b/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterCompletion.tsx index 45727a5cbe..52f2c38e60 100644 --- a/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterCompletion.tsx +++ b/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterCompletion.tsx @@ -166,7 +166,7 @@ const BatchFooterCompletion: React.FC = ({

{t('common:batches.form.headings.decisionDetails')}

- <$GridCell $colSpan={3}> + <$GridCell $colSpan={3} $colStart={1}> <$ViewFieldBold> {t('common:batches.form.fields.decisionMakerName')} @@ -193,55 +193,55 @@ const BatchFooterCompletion: React.FC = ({ <$ViewField>{convertToUIDateFormat(decision_date)} + - {expert_inspector_name?.length && expert_inspector_title?.length ? ( - <> - <$GridCell $colSpan={3} $colStart={1}> - <$ViewFieldBold> - {t('common:batches.form.fields.expertInspectorName')} - - <$ViewField>{expert_inspector_name} - + {expert_inspector_name?.length && expert_inspector_title?.length ? ( + <$FormSection css="width: 100%"> + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t('common:batches.form.fields.expertInspectorName')} + + <$ViewField>{expert_inspector_name} + - <$GridCell $colSpan={3}> - <$ViewFieldBold> - {t('common:batches.form.fields.expertInspectorTitle')} - - <$ViewField>{expert_inspector_title} - + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t('common:batches.form.fields.expertInspectorTitle')} + + <$ViewField>{expert_inspector_title} + - <$GridCell $colSpan={3}> - <$ViewFieldBold> - {t('common:batches.form.fields.p2pCheckerName')} - - <$ViewField>{p2p_checker_name} - - - ) : ( - <> - <$GridCell $colSpan={3} $colStart={1}> - <$ViewFieldBold> - {t('common:batches.form.fields.p2pInspectorName')} - - <$ViewField>{p2p_inspector_name} - + <$GridCell $colSpan={6}> + <$ViewFieldBold> + {t('common:batches.form.fields.p2pCheckerName')} + + <$ViewField>{p2p_checker_name} + + + ) : ( + <$FormSection> + <$GridCell $colSpan={3} $colStart={1}> + <$ViewFieldBold> + {t('common:batches.form.fields.p2pInspectorName')} + + <$ViewField>{p2p_inspector_name} + - <$GridCell $colSpan={3}> - <$ViewFieldBold> - {t('common:batches.form.fields.p2pInspectorEmail')} - - <$ViewField>{p2p_inspector_email} - + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t('common:batches.form.fields.p2pInspectorEmail')} + + <$ViewField>{p2p_inspector_email} + - <$GridCell $colSpan={3}> - <$ViewFieldBold> - {t('common:batches.form.fields.p2pCheckerName')} - - <$ViewField>{p2p_checker_name} - - - )} - + <$GridCell $colSpan={3}> + <$ViewFieldBold> + {t('common:batches.form.fields.p2pCheckerName')} + + <$ViewField>{p2p_checker_name} + + + )}
{batchStatus === BATCH_STATUSES.DECIDED_ACCEPTED && ( diff --git a/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterInspection.tsx b/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterInspection.tsx index 3b0dc99b32..99a4da7202 100644 --- a/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterInspection.tsx +++ b/frontend/benefit/handler/src/components/batchProcessing/batchFooter/BatchFooterInspection.tsx @@ -61,7 +61,7 @@ BatchProps) => { setModalBatchToCompletion(false); }; - const handleBatchStatusChange = (): void => { + const handleSubmitToDraft = (): void => { changeBatchStatus({ id, status: BATCH_STATUSES.DRAFT, @@ -138,7 +138,7 @@ BatchProps) => { )} text={t('common:batches.dialog.fromInspectionToDraft.text')} onClose={handleModalClose} - onSubmit={handleBatchStatusChange} + onSubmit={handleSubmitToDraft} /> ) : null} {isModalBatchToCompletion ? ( diff --git a/frontend/benefit/handler/src/components/batchProcessing/useBatchActionsInspected.ts b/frontend/benefit/handler/src/components/batchProcessing/useBatchActionsInspected.ts index 4d2216d8f5..bf6c65d3bd 100644 --- a/frontend/benefit/handler/src/components/batchProcessing/useBatchActionsInspected.ts +++ b/frontend/benefit/handler/src/components/batchProcessing/useBatchActionsInspected.ts @@ -192,7 +192,7 @@ const useBatchActionsInspected = ( markBatchAs( proposalForDecision === PROPOSALS_FOR_DECISION.ACCEPTED ? BATCH_STATUSES.DECIDED_ACCEPTED - : BATCH_STATUSES.DECIDED_REJECTED, + : BATCH_STATUSES.COMPLETED, values ), }; diff --git a/frontend/benefit/handler/src/components/table/TableExtras.sc.ts b/frontend/benefit/handler/src/components/table/TableExtras.sc.ts index e0e6c97ea3..d6c9737057 100644 --- a/frontend/benefit/handler/src/components/table/TableExtras.sc.ts +++ b/frontend/benefit/handler/src/components/table/TableExtras.sc.ts @@ -88,6 +88,7 @@ export const $HintText = styled.p` export const $FormSection = styled(FormSection)` margin-bottom: var(--spacing-m); + width: 100%; + hr { display: none; @@ -108,7 +109,8 @@ export const $TableFooter = styled.footer<$TableFooterProps>` align-items: center; box-sizing: border-box; - form { + form, + > section { display: grid; width: 100%; } diff --git a/frontend/benefit/handler/src/hooks/useBatchInspected.ts b/frontend/benefit/handler/src/hooks/useBatchInspected.ts index 2389bcb0da..d82cd44b6a 100644 --- a/frontend/benefit/handler/src/hooks/useBatchInspected.ts +++ b/frontend/benefit/handler/src/hooks/useBatchInspected.ts @@ -81,10 +81,9 @@ const useBatchInspected = ( ); if ( - [ - BATCH_STATUSES.DECIDED_REJECTED, - BATCH_STATUSES.DECIDED_ACCEPTED, - ].includes(backendStatus) + [BATCH_STATUSES.COMPLETED, BATCH_STATUSES.DECIDED_ACCEPTED].includes( + backendStatus + ) ) { setBatchCloseAnimation(true); setTimeout(() => { diff --git a/frontend/benefit/handler/src/hooks/useBatchStatus.ts b/frontend/benefit/handler/src/hooks/useBatchStatus.ts index d4c79f0087..eb6f1fa3dd 100644 --- a/frontend/benefit/handler/src/hooks/useBatchStatus.ts +++ b/frontend/benefit/handler/src/hooks/useBatchStatus.ts @@ -80,6 +80,7 @@ const useBatchStatus = ( ); if ( previousStatus === BATCH_STATUSES.AWAITING_FOR_DECISION || + backendStatus === BATCH_STATUSES.COMPLETED || (previousStatus === BATCH_STATUSES.AHJO_REPORT_CREATED && backendStatus === BATCH_STATUSES.AWAITING_FOR_DECISION) ) {