Skip to content

Conversation

@zweatshirt
Copy link
Contributor

@zweatshirt zweatshirt commented Dec 11, 2025

Description

Determines MHA eligibility based on grahpql data.
Related API PR: https://github.com/CruGlobal/mpdx_api/pull/3090

Testing

  • Go to reports/housingAllowance
  • Test that the MHA EIT value is correctly pulled from the mock service on the backend
  • Check that the conditionals work as expected in the UI.
  • You may need to remove the current request that's set in the UI to check the New Request functionality.

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels (Add the label "Preview" to automatically create a preview environment)
  • I have run the Claude Code /pr-review command locally and fixed any relevant suggestions
  • I have requested a review from another person on the project
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

@zweatshirt zweatshirt self-assigned this Dec 11, 2025
@zweatshirt zweatshirt added the Preview Environment Add this label to create an Amplify Preview label Dec 11, 2025
@github-actions
Copy link
Contributor

Preview branch generated at https://MPDX-9129.d3dytjb8adxkk5.amplifyapp.com

@zweatshirt zweatshirt added the Staging API Run GraphQL codegen against the staging API label Dec 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2025

Bundle sizes [mpdx-react]

Compared against cfa6ff2

No significant changes found

@zweatshirt zweatshirt changed the title MPDX-9129 - MHA Eligibility check MPDX-9129 - MHA Eligibility check for new requests Dec 11, 2025
@kegrimes kegrimes mentioned this pull request Jan 8, 2026
6 tasks
@zweatshirt zweatshirt removed the Staging API Run GraphQL codegen against the staging API label Jan 12, 2026
Copy link

Copilot AI left a 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.mhaEligibility field 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

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{' '}
Copy link

Copilot AI Jan 12, 2026

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.

Suggested change
contact Personnel Records at 407-826-2236 or{' '}
contact Personnel Records at 407-826-2252 or{' '}

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@zweatshirt zweatshirt Jan 12, 2026

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.

Comment on lines +50 to +63
{!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}
&apos;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>
)}
Copy link

Copilot AI Jan 12, 2026

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.

Suggested change
{!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}
&apos;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}
&apos;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 uses AI. Check for mistakes.
Copy link
Contributor Author

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.

@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@CruGlobal CruGlobal deleted a comment from Copilot AI Jan 12, 2026
@zweatshirt zweatshirt marked this pull request as ready for review January 12, 2026 21:30
@zweatshirt zweatshirt requested a review from kegrimes January 12, 2026 21:31
@zweatshirt
Copy link
Contributor Author

zweatshirt commented Jan 12, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants