-
Notifications
You must be signed in to change notification settings - Fork 1
MPDX-9129 - MHA Eligibility check for new requests #1546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Preview branch generated at https://MPDX-9129.d3dytjb8adxkk5.amplifyapp.com |
Bundle sizes [mpdx-react]Compared against cfa6ff2 No significant changes found |
0eab8a6 to
8343163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request implements MHA (Minister Housing Allowance) eligibility checking based on GraphQL data from the backend. The feature adds a new mhaEit field with mhaEligibility boolean to HCM data and enforces eligibility checks when users attempt to create or update MHA requests.
Changes:
- Added
mhaEit.mhaEligibilityfield to GraphQL schema and mock data - Implemented eligibility state management in the context provider
- Added eligibility checks to all MHA request mutations with user feedback via snackbar notifications
- Updated display logic to show appropriate messages for ineligible users and spouses
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/Reports/Shared/HcmData/HCMData.graphql | Added mhaEit field with mhaEligibility boolean to GraphQL query |
| src/components/Reports/Shared/HcmData/mockData.ts | Added mock data for various eligibility scenarios (single/married, eligible/ineligible combinations) |
| src/components/Reports/MinisterHousingAllowance/Shared/Context/MinisterHousingAllowanceContext.tsx | Added userEligibleForMHA, spouseEligibleForMHA, hcmLoading, and hcmError to context |
| src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx | Added eligibility check to new request creation with canAccessMHA logic |
| src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx | Updated to show conditional messages based on user and spouse eligibility status |
| src/components/Reports/MinisterHousingAllowance/Steps/StepTwo/RentOwn.tsx | Added eligibility check to block updates when user is ineligible |
| src/components/Reports/MinisterHousingAllowance/Steps/StepThree/Calculation.tsx | Added eligibility check to updateCheckbox function |
| src/components/Reports/MinisterHousingAllowance/Shared/AutoSave/useSaveField.ts | Added eligibility check to saveField callback |
| Multiple test files | Added SnackbarProvider wrapper and test cases for eligibility scenarios |
...components/Reports/MinisterHousingAllowance/Shared/AutoSave/AutosaveCustomTextField.test.tsx
Show resolved
Hide resolved
| Once approved, when you calculate your salary, you will see | ||
| the approved amount that can be applied to {preferredName} | ||
| 's salary. If you believe this is incorrect, please | ||
| contact Personnel Records at 407-826-2236 or{' '} |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phone number in this error message (407-826-2236) differs from the phone number used in the earlier message on line 28 (407-826-2252). This inconsistency could confuse users. Verify which phone number is correct for Personnel Records and ensure it's used consistently throughout the component.
| contact Personnel Records at 407-826-2236 or{' '} | |
| contact Personnel Records at 407-826-2252 or{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already reached out to Ryan to find out what the correct number is. Awaiting a response.
src/components/Reports/MinisterHousingAllowance/Shared/AutoSave/useSaveField.ts
Show resolved
Hide resolved
src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx
Outdated
Show resolved
Hide resolved
| {!hcmLoading && | ||
| ((isMarried && !spouseEligibleForMHA) || !userEligibleForMHA) && ( | ||
| <Box mt={2} data-testid="user-ineligible-message"> | ||
| <Trans i18nKey="userNotEligibleMha" values={{ preferredName }}> | ||
| <p style={{ lineHeight: 1.5 }}> | ||
| Once approved, when you calculate your salary, you will see | ||
| the approved amount that can be applied to {preferredName} | ||
| 's salary. If you believe this is incorrect, please | ||
| contact Personnel Records at 407-826-2236 or{' '} | ||
| <a href="mailto:MHA@cru.org">MHA@cru.org</a>. | ||
| </p> | ||
| </Trans> | ||
| </Box> | ||
| )} |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition for displaying the user-ineligible-message has a logic issue. The current condition ((isMarried && !spouseEligibleForMHA) || !userEligibleForMHA) will show the user-ineligible message even when the user IS eligible if they're married and the spouse is ineligible. This doesn't match the intended behavior based on the test cases and the message content.
The condition should be checking if the user is NOT eligible, or if both are married and both are ineligible. Consider simplifying to just !userEligibleForMHA since this message is specifically about the user's eligibility status and when they can see approved amounts.
| {!hcmLoading && | |
| ((isMarried && !spouseEligibleForMHA) || !userEligibleForMHA) && ( | |
| <Box mt={2} data-testid="user-ineligible-message"> | |
| <Trans i18nKey="userNotEligibleMha" values={{ preferredName }}> | |
| <p style={{ lineHeight: 1.5 }}> | |
| Once approved, when you calculate your salary, you will see | |
| the approved amount that can be applied to {preferredName} | |
| 's salary. If you believe this is incorrect, please | |
| contact Personnel Records at 407-826-2236 or{' '} | |
| <a href="mailto:MHA@cru.org">MHA@cru.org</a>. | |
| </p> | |
| </Trans> | |
| </Box> | |
| )} | |
| {!hcmLoading && !userEligibleForMHA && ( | |
| <Box mt={2} data-testid="user-ineligible-message"> | |
| <Trans i18nKey="userNotEligibleMha" values={{ preferredName }}> | |
| <p style={{ lineHeight: 1.5 }}> | |
| Once approved, when you calculate your salary, you will see | |
| the approved amount that can be applied to {preferredName} | |
| 's salary. If you believe this is incorrect, please | |
| contact Personnel Records at 407-826-2236 or{' '} | |
| <a href="mailto:MHA@cru.org">MHA@cru.org</a>. | |
| </p> | |
| </Trans> | |
| </Box> | |
| )} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping this as is to match the criteria of the Figma doc. Can change if needed.
|
@kegrimes You know MHA far more than I do. Before I ask Bizz for a review would you be up for looking through this quickly in case I missed something? Thanks Katelyn! I am mostly looking to know if I have applied if statements to all MHA mutations, and if the state for IneligibleDisplay.tsx is correct. I haven't actually been able to test this PR properly yet since we need to test an ineligible user. |
Description
Determines MHA eligibility based on grahpql data.
Related API PR: https://github.com/CruGlobal/mpdx_api/pull/3090
Testing
reports/housingAllowanceChecklist:
/pr-reviewcommand locally and fixed any relevant suggestions