Skip to content

Commit

Permalink
fix: use completed status when rejected applications are sent to archive
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Dec 18, 2023
1 parent 04651a4 commit 9f9d815
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const BatchFooterCompletion: React.FC<BatchProps> = ({
<h3>{t('common:batches.form.headings.decisionDetails')}</h3>
</$GridCell>

<$GridCell $colSpan={3}>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t('common:batches.form.fields.decisionMakerName')}
</$ViewFieldBold>
Expand All @@ -193,55 +193,55 @@ const BatchFooterCompletion: React.FC<BatchProps> = ({
</$ViewFieldBold>
<$ViewField>{convertToUIDateFormat(decision_date)}</$ViewField>
</$GridCell>
</$FormSection>

{expert_inspector_name?.length && expert_inspector_title?.length ? (
<>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t('common:batches.form.fields.expertInspectorName')}
</$ViewFieldBold>
<$ViewField>{expert_inspector_name}</$ViewField>
</$GridCell>
{expert_inspector_name?.length && expert_inspector_title?.length ? (
<$FormSection css="width: 100%">
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t('common:batches.form.fields.expertInspectorName')}
</$ViewFieldBold>
<$ViewField>{expert_inspector_name}</$ViewField>
</$GridCell>

<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.expertInspectorTitle')}
</$ViewFieldBold>
<$ViewField>{expert_inspector_title}</$ViewField>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.expertInspectorTitle')}
</$ViewFieldBold>
<$ViewField>{expert_inspector_title}</$ViewField>
</$GridCell>

<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pCheckerName')}
</$ViewFieldBold>
<$ViewField>{p2p_checker_name}</$ViewField>
</$GridCell>
</>
) : (
<>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pInspectorName')}
</$ViewFieldBold>
<$ViewField>{p2p_inspector_name}</$ViewField>
</$GridCell>
<$GridCell $colSpan={6}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pCheckerName')}
</$ViewFieldBold>
<$ViewField>{p2p_checker_name}</$ViewField>
</$GridCell>
</$FormSection>
) : (
<$FormSection>
<$GridCell $colSpan={3} $colStart={1}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pInspectorName')}
</$ViewFieldBold>
<$ViewField>{p2p_inspector_name}</$ViewField>
</$GridCell>

<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pInspectorEmail')}
</$ViewFieldBold>
<$ViewField>{p2p_inspector_email}</$ViewField>
</$GridCell>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pInspectorEmail')}
</$ViewFieldBold>
<$ViewField>{p2p_inspector_email}</$ViewField>
</$GridCell>

<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pCheckerName')}
</$ViewFieldBold>
<$ViewField>{p2p_checker_name}</$ViewField>
</$GridCell>
</>
)}
</$FormSection>
<$GridCell $colSpan={3}>
<$ViewFieldBold>
{t('common:batches.form.fields.p2pCheckerName')}
</$ViewFieldBold>
<$ViewField>{p2p_checker_name}</$ViewField>
</$GridCell>
</$FormSection>
)}

<div style={{ display: 'flex', width: '100%' }}>
{batchStatus === BATCH_STATUSES.DECIDED_ACCEPTED && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ BatchProps) => {
setModalBatchToCompletion(false);
};

const handleBatchStatusChange = (): void => {
const handleSubmitToDraft = (): void => {
changeBatchStatus({
id,
status: BATCH_STATUSES.DRAFT,
Expand Down Expand Up @@ -138,7 +138,7 @@ BatchProps) => {
)}
text={t('common:batches.dialog.fromInspectionToDraft.text')}
onClose={handleModalClose}
onSubmit={handleBatchStatusChange}
onSubmit={handleSubmitToDraft}
/>
) : null}
{isModalBatchToCompletion ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const useBatchActionsInspected = (
markBatchAs(
proposalForDecision === PROPOSALS_FOR_DECISION.ACCEPTED
? BATCH_STATUSES.DECIDED_ACCEPTED
: BATCH_STATUSES.DECIDED_REJECTED,
: BATCH_STATUSES.COMPLETED,
values
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const $HintText = styled.p`

export const $FormSection = styled(FormSection)`
margin-bottom: var(--spacing-m);
width: 100%;
+ hr {
display: none;
Expand All @@ -108,7 +109,8 @@ export const $TableFooter = styled.footer<$TableFooterProps>`
align-items: center;
box-sizing: border-box;
form {
form,
> section {
display: grid;
width: 100%;
}
Expand Down
7 changes: 3 additions & 4 deletions frontend/benefit/handler/src/hooks/useBatchInspected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
1 change: 1 addition & 0 deletions frontend/benefit/handler/src/hooks/useBatchStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
) {
Expand Down

0 comments on commit 9f9d815

Please sign in to comment.