MPDX-9273: Add spouse request flows for ASR and MHA#1639
Conversation
Bundle sizes [mpdx-react]Compared against 9f34450 No significant changes found |
src/components/Reports/AdditionalSalaryRequest/MainPages/InProgress/InProgressDisplay.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/Shared/AdditionalSalaryRequestContext.tsx
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/Shared/useFormUserInfo.ts
Outdated
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/SharedComponents/SpouseComponent.tsx
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/SharedComponents/SpouseComponent.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/SharedComponents/SpouseComponent.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/AdditionalSalaryRequest/SharedComponents/SpouseComponent.tsx
Show resolved
Hide resolved
wjames111
left a comment
There was a problem hiding this comment.
This looks awesome, thanks for doing all this work!
There was a problem hiding this comment.
Praise: Thanks for renaming this!
|
|
||
| const showStatuses: AsrStatusEnum[] = [ | ||
| AsrStatusEnum.ActionRequired, | ||
| AsrStatusEnum.Pending, |
There was a problem hiding this comment.
Praise: Thanks for removing this!
| const name = isSpouse | ||
| ? (user?.staffInfo?.firstName ?? '') | ||
| : (spouse?.staffInfo?.firstName ?? ''); | ||
| const name = spouse?.staffInfo?.firstName ?? ''; |
There was a problem hiding this comment.
I'm getting a blank name, should we put a guard up for this component? If I click "Request additional salary for" I get Spouse information not available.
src/components/Reports/AdditionalSalaryRequest/SharedComponents/SpouseComponent.tsx
Outdated
Show resolved
Hide resolved
| } | ||
| spouseCalculations { | ||
| currentSalaryCap | ||
| pendingAsrAmount |
There was a problem hiding this comment.
Comment: I believe pendingAsrAmount checks for user and spouse in the back-end. So it's effectively the same number as the calculation's pendingAsrAmount. I might need to update the back-end to just check pendingAsrAmount for the current user rather then both.
There was a problem hiding this comment.
We may need to address this then, as we have the below code in the file src/components/Reports/AdditionalSalaryRequest/Shared/useSalaryCalculations.ts:
// Annual salary calculations
const additionalSalaryReceivedThisYear =
calculations?.pendingAsrAmount ?? 0;
const totalAnnualSalary =
grossAnnualSalary + additionalSalaryReceivedThisYear + total;
// Spouse annual salary calculations
const spouseTotalThisYear = spouse
? requestData?.latestAdditionalSalaryRequest?.spouseCalculations
?.pendingAsrAmount
: null;
const spouseTotalAnnualSalary =
spouseGrossAnnualSalary + (spouseTotalThisYear ?? 0);
// Exceeding cap calculations
const exceedsCap = totalAnnualSalary > individualCap;
const spouseExceedsCap =
spouse && spouseIndividualCap !== null
? (spouseTotalAnnualSalary ?? 0) > spouseIndividualCap
: undefined;
const exceedsCombinedCap =
(combinedCap ?? 0) < totalAnnualSalary + spouseTotalAnnualSalary;There was a problem hiding this comment.
The combined cap adds both the spouse pending ASR and user's pending ASR together
There was a problem hiding this comment.
I have a PR out for just calculating the current user's pending_asr_amount rather then using both user and spouse. This should hopefully fix the issue without having to do update combinedCap.
Pass isSpouse to latestAdditionalSalaryRequest query and both createAdditionalSalaryRequest and createMinistryHousingAllowanceRequest mutations to support spouse request flows from the backend.
Read isSpouse from router query params on the ASR page and pass it to AdditionalSalaryRequestProvider, which forwards it to the query and exposes it on the context for child components.
- SpouseComponent: create spouse ASR on click and navigate to spouse flow - StepList: fix receipt spouse link to use proper ?isSpouse=true URL - RequestPage: pass isSpouse to create mutation and use spouse HCM data
- MinisterHousingAllowance: add spouse MHA creation button with open request detection - IneligibleDisplay: replace hardcoded false with actual spouse eligibility from HCM data
- Add isSpouse: false to all mock context objects - Add SnackbarProvider to shared test utilities for SpouseComponent - Add spouse ASR creation and error handling tests - Add MHA spouse button and open request detection tests - Add real spouse eligibility tests for IneligibleDisplay Fixing PR fixing issues
small edits after Claude review
prettier
Reverting changes
19894bb to
2f2583b
Compare
🤖 Multi-Agent Code Review ReportPR #1639: MPDX-9273: Add spouse request flows for ASR and MHA 📊 Risk AssessmentRisk Score: 13 — CRITICAL Risk Factors:
Required Reviewer: Senior developer should review
|
Description
In this PR, I have implemented the changes from https://github.com/CruGlobal/mpdx_api/pull/3171 into the frontend.
isSpousevariable to ASR query/create mutation and MHA create mutation GraphQL operations?isSpouse=trueURL param through context to child componentsTesting
Checklist:
/pr-reviewcommand locally and fixed any relevant suggestions