Skip to content

Commit

Permalink
feat: hide decisionSummary if details unreceived from ahjo (#3216)
Browse files Browse the repository at this point in the history
* feat: show decision details if details from ahjo

* feat: benefit amount in json if decision details

* fix: ahjoStatus to frontend application definition

* fix: ahjo details_received to frontend constants
  • Loading branch information
rikuke authored Aug 21, 2024
1 parent 03283ab commit ec07dd4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 20 deletions.
13 changes: 13 additions & 0 deletions backend/benefit/applications/api/v1/serializers/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,19 @@ class Meta:

ahjo_decision_date = serializers.SerializerMethodField("get_ahjo_decision_date")

calculated_benefit_amount = serializers.SerializerMethodField()

def get_calculated_benefit_amount(self, obj):
# Check if ahjo_status is None or does not have any related objects
if obj.ahjo_status is None or not obj.ahjo_status.exists():
return None

latest_status = obj.ahjo_status.latest().status

if latest_status != AhjoStatusEnum.DETAILS_RECEIVED_FROM_AHJO:
return None
return obj.calculated_benefit_amount

submitted_at = serializers.SerializerMethodField("get_submitted_at")

modified_at = serializers.SerializerMethodField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useAskem } from 'benefit/applicant/hooks/useAnalytics';
import DecisionSummary from 'benefit-shared/components/decisionSummary/DecisionSummary';
import StatusIcon from 'benefit-shared/components/statusIcon/StatusIcon';
import {
AHJO_STATUSES,
ALTERATION_STATE,
ALTERATION_TYPE,
APPLICATION_STATUSES,
Expand Down Expand Up @@ -225,26 +226,28 @@ const PageContent: React.FC = () => {
</$HeaderRightColumnItem>
)}
</$PageHeader>
<DecisionSummary
application={application}
actions={
application.status === APPLICATION_STATUSES.ACCEPTED ? (
<Button
theme="coat"
onClick={() =>
router.push(
`${ROUTES.APPLICATION_ALTERATION}?id=${application.id}`
)
}
disabled={hasHandledTermination}
>
{t('common:applications.decision.actions.reportAlteration')}
</Button>
) : null
}
itemComponent={AlterationAccordionItem}
detailList={decisionDetailList}
/>
{application.ahjoStatus === AHJO_STATUSES.DETAILS_RECEIVED && (
<DecisionSummary
application={application}
actions={
application.status === APPLICATION_STATUSES.ACCEPTED ? (
<Button
theme="coat"
onClick={() =>
router.push(
`${ROUTES.APPLICATION_ALTERATION}?id=${application.id}`
)
}
disabled={hasHandledTermination}
>
{t('common:applications.decision.actions.reportAlteration')}
</Button>
) : null
}
itemComponent={AlterationAccordionItem}
detailList={decisionDetailList}
/>
)}
<ApplicationFormStep5 isReadOnly data={application} />
</Container>
);
Expand Down
4 changes: 4 additions & 0 deletions frontend/benefit/shared/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,7 @@ export enum DECISION_TYPES {
export enum PAY_SUBSIDY_PERCENT {
DEFAULT = 65,
}

export enum AHJO_STATUSES {
DETAILS_RECEIVED = 'details_received',
}
1 change: 1 addition & 0 deletions frontend/benefit/shared/src/types/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export type Application = {
decisionProposalDraft?: DecisionProposalDraft;
applicationOrigin?: APPLICATION_ORIGINS;
handler?: User;
ahjoStatus?: string;
} & Step1 &
Step2;

Expand Down

0 comments on commit ec07dd4

Please sign in to comment.