From ed30d2a26342e4a0a21803e914be8eb442dd0eb0 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Mon, 9 Feb 2026 15:24:21 -0600 Subject: [PATCH 01/16] Update StepNavigation to hide buttons on receipt step and last index --- .../StepNavigation/StepNavigation.test.tsx | 20 +++++++++++++++++++ .../StepNavigation/StepNavigation.tsx | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx index 4c993e7ef1..280f6de6df 100644 --- a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx +++ b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx @@ -36,6 +36,26 @@ describe('StepNavigation', () => { expect(queryByRole('button', { name: 'Continue' })).not.toBeInTheDocument(); expect(queryByRole('button', { name: 'Discard' })).not.toBeInTheDocument(); }); + + it('does not render buttons on the receipt step', async () => { + const { findByText, queryByRole } = render( + , + ); + + userEvent.click(await findByText('Continue')); + userEvent.click(await findByText('Continue')); + userEvent.click(await findByText('Continue')); + userEvent.click(await findByText('Submit')); + userEvent.click(await findByText('Yes, Continue')); + + await waitFor(() => { + expect(queryByRole('button', { name: 'Back' })).not.toBeInTheDocument(); + }); + + expect(queryByRole('button', { name: 'Continue' })).not.toBeInTheDocument(); + expect(queryByRole('button', { name: 'Submit' })).not.toBeInTheDocument(); + expect(queryByRole('button', { name: 'Discard' })).not.toBeInTheDocument(); + }); }); describe('DiscardButton', () => { diff --git a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx index b2ca7fb5fc..4b00870f8e 100644 --- a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx +++ b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx @@ -143,7 +143,8 @@ export const StepNavigation: React.FC = () => { const { currentIndex, steps, editing } = useSalaryCalculator(); const { allValid } = useAutosaveForm(); - if (!editing) { + // We don't want to render navigation if on view mode or the receipt step + if (!editing || currentIndex === steps.length - 1) { return null; } From fde7d75a6667de1847bee0fe9f9e5b5e6437f3e8 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Mon, 9 Feb 2026 16:55:21 -0600 Subject: [PATCH 02/16] Refactor StepNavigation to always render DiscardButton --- .../Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx index 4b00870f8e..e8b07734dd 100644 --- a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx +++ b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.tsx @@ -150,7 +150,7 @@ export const StepNavigation: React.FC = () => { return ( - {currentIndex < steps.length - 1 && } + From 778b28d2843d2428508d02dd975a3a58ebef89ca Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:02:37 -0600 Subject: [PATCH 03/16] Quick test refactor to use findByRole instead of findByText --- .../StepNavigation/StepNavigation.test.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx index 280f6de6df..ee902bee62 100644 --- a/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx +++ b/src/components/Reports/SalaryCalculator/StepNavigation/StepNavigation.test.tsx @@ -38,15 +38,15 @@ describe('StepNavigation', () => { }); it('does not render buttons on the receipt step', async () => { - const { findByText, queryByRole } = render( + const { findByRole, queryByRole } = render( , ); - userEvent.click(await findByText('Continue')); - userEvent.click(await findByText('Continue')); - userEvent.click(await findByText('Continue')); - userEvent.click(await findByText('Submit')); - userEvent.click(await findByText('Yes, Continue')); + userEvent.click(await findByRole('button', { name: 'Continue' })); + userEvent.click(await findByRole('button', { name: 'Continue' })); + userEvent.click(await findByRole('button', { name: 'Continue' })); + userEvent.click(await findByRole('button', { name: 'Submit' })); + userEvent.click(await findByRole('button', { name: 'Yes, Continue' })); await waitFor(() => { expect(queryByRole('button', { name: 'Back' })).not.toBeInTheDocument(); From a4c4ee7006cb42ed92cd1a4290f5bf6a225d1201 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Mon, 9 Feb 2026 20:54:16 -0600 Subject: [PATCH 04/16] Add NoRequestsDisplay component and update MinisterHousingAllowanceReport logic --- .../MainPages/IneligibleDisplay.tsx | 83 ++++++++++--------- .../MainPages/NoRequestsDisplay.tsx | 22 +++++ .../MinisterHousingAllowance.tsx | 12 ++- .../RequestPage/RequestPage.tsx | 3 +- .../MinisterHousingAllowanceContext.tsx | 8 ++ 5 files changed, 85 insertions(+), 43 deletions(-) create mode 100644 src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx index 55515dc0cd..83e9e77687 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx @@ -1,51 +1,56 @@ -import { Box, Typography } from '@mui/material'; -import { Trans, useTranslation } from 'react-i18next'; +import { Box } from '@mui/material'; +import { Trans } from 'react-i18next'; import { useMinisterHousingAllowance } from '../Shared/Context/MinisterHousingAllowanceContext'; export const IneligibleDisplay: React.FC = () => { - const { t } = useTranslation(); - const { isMarried, preferredName, spousePreferredName } = - useMinisterHousingAllowance(); + const { + preferredName, + spousePreferredName, + userEligibleForMHA, + spouseEligibleForMHA, + } = useMinisterHousingAllowance(); - // TODO - Add spouse to API and check eligibility - // We will get this from HCM data in the future - const spouseEligibleForMHA = false; + const bothIneligible = !userEligibleForMHA && !spouseEligibleForMHA; + + const eligibleUserName = userEligibleForMHA + ? preferredName + : spousePreferredName; + const ineligibleUserName = userEligibleForMHA + ? spousePreferredName + : preferredName; return ( - <> - - {t('Your MHA')} - - - + + {bothIneligible ? ( +

- Our records indicate that you have not applied for Minister's - Housing Allowance. If you would like information about applying for - one, contact Personnel Records at 407-826-2252 or{' '} + {preferredName} and {spousePreferredName} have not completed the + required IBS courses to meet eligibility criteria. +

+

+ Once approved, when you calculate your salary, you will see the + approved amount that can be applied to {preferredName} and{' '} + {spousePreferredName}'s salary. If you believe this is + incorrect, please contact Personnel Records at 407-826-2236 or{' '} + MHA@cru.org. +

+
+ ) : ( + +

+ Completing a Minister's Housing Allowance will submit the + request for {eligibleUserName}. {ineligibleUserName} has not + completed the required IBS courses to meet eligibility criteria. +

+

+ Once approved, when you calculate your salary, you will see the + approved amount that can be applied to {ineligibleUserName} + 's salary. If you believe this is incorrect, please contact + Personnel Records at 407-826-2252 or{' '} MHA@cru.org.

- {isMarried && spouseEligibleForMHA === false && ( - - -

- Completing a Minister's Housing Allowance will submit the - request for {preferredName}. {spousePreferredName} has not - completed the required IBS courses to meet eligibility criteria. -

-

- 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-2252 or{' '} - MHA@cru.org. -

-
-
- )} -
- + )} +
); }; diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx new file mode 100644 index 0000000000..709e3835ce --- /dev/null +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx @@ -0,0 +1,22 @@ +import { Box, Typography } from '@mui/material'; +import { useTranslation } from 'react-i18next'; + +export const NoRequestsDisplay: React.FC = () => { + const { t } = useTranslation(); + + return ( + <> + + {t('Your MHA')} + + +

+ {t( + "Our records indicate that you have not applied for Minister's Housing Allowance. If you would like information about applying for one, contact Personnel Records at 407-826-2252 or", + )}{' '} + MHA@cru.org. +

+
+ + ); +}; diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx index 18211325da..30bd3c602e 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx @@ -12,6 +12,7 @@ import { PanelLayout } from '../Shared/CalculationReports/PanelLayout/PanelLayou import { PanelTypeEnum } from '../Shared/CalculationReports/Shared/sharedTypes'; import { EligibleDisplay } from './MainPages/EligibleDisplay'; import { IneligibleDisplay } from './MainPages/IneligibleDisplay'; +import { NoRequestsDisplay } from './MainPages/NoRequestsDisplay'; import { useCreateHousingAllowanceRequestMutation, useMinistryHousingAllowanceRequestsQuery, @@ -40,6 +41,8 @@ export const MinisterHousingAllowanceReport = () => { isMarried, preferredName, spousePreferredName, + userEligibleForMHA, + spouseEligibleForMHA, userHcmData, spouseHcmData, } = useMinisterHousingAllowance(); @@ -48,6 +51,8 @@ export const MinisterHousingAllowanceReport = () => { const spousePersonNumber = spouseHcmData?.staffInfo?.personNumber ?? ''; const lastName = userHcmData?.staffInfo?.lastName ?? ''; const spouseLastName = spouseHcmData?.staffInfo?.lastName ?? ''; + const bothEligible = userEligibleForMHA && spouseEligibleForMHA; + const hasNoRequests = !requests.length; const names = isMarried ? `${preferredName} ${lastName} and ${spousePreferredName} ${spouseLastName}` @@ -94,8 +99,6 @@ export const MinisterHousingAllowanceReport = () => { }); }; - const hasNoRequests = !requests.length; - const currentRequest = requests[0] || {}; // It default to true when no availableDate as the request is likely still being processed const isCurrentRequestPending = @@ -130,7 +133,10 @@ export const MinisterHousingAllowanceReport = () => { <> {hasNoRequests ? ( - + <> + + {!bothEligible && } + ) : ( )} diff --git a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx index 513dc425b6..d52b09f3b4 100644 --- a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx +++ b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx @@ -52,6 +52,7 @@ export const RequestPage: React.FC = () => { requestData, loading, userEligibleForMHA, + spouseEligibleForMHA, } = useMinisterHousingAllowance(); const canEdit = @@ -116,7 +117,7 @@ export const RequestPage: React.FC = () => { } /> - ) : !userEligibleForMHA ? ( + ) : !userEligibleForMHA && !spouseEligibleForMHA ? ( Promise; requestData?: @@ -198,6 +199,11 @@ export const MinisterHousingAllowanceProvider: React.FC = ({ [userHcmData], ); + const spouseEligibleForMHA = useMemo( + () => spouseHcmData?.mhaEit?.mhaEligibility ?? false, + [spouseHcmData], + ); + const [isDrawerOpen, setIsDrawerOpen] = useState(true); const toggleDrawer = useCallback(() => { setIsDrawerOpen((prev) => !prev); @@ -227,6 +233,7 @@ export const MinisterHousingAllowanceProvider: React.FC = ({ preferredName, spousePreferredName, userEligibleForMHA, + spouseEligibleForMHA, handleDiscard, setIsComplete, requestData: requestData?.ministryHousingAllowanceRequest ?? null, @@ -256,6 +263,7 @@ export const MinisterHousingAllowanceProvider: React.FC = ({ preferredName, spousePreferredName, userEligibleForMHA, + spouseEligibleForMHA, handleDiscard, requestData, requestError, From 32192650d4b31b4757c68678fb9dbda492a61bea Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:03:42 -0600 Subject: [PATCH 05/16] Refactor IneligibleDisplay tests to improve eligibility message assertions --- .../MainPages/IneligibleDisplay.test.tsx | 39 ++++++------------- .../MinisterHousingAllowance.test.tsx | 3 -- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx index b0b8b9cb5b..be0ec504d6 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx @@ -6,7 +6,6 @@ import { render } from '@testing-library/react'; import theme from 'src/theme'; import { ContextType, - HcmData, MinisterHousingAllowanceContext, } from '../Shared/Context/MinisterHousingAllowanceContext'; import { IneligibleDisplay } from './IneligibleDisplay'; @@ -30,57 +29,41 @@ const TestComponent: React.FC = ({ contextValue }) => { }; describe('IneligibleDisplay', () => { - it('should render page with single staff', () => { - const { getByText, queryByText } = render( + it('should render both ineligible message when neither user is eligible', () => { + const { getByText } = render( , ); - expect(getByText('Your MHA')).toBeInTheDocument(); expect( getByText( - /our records indicate that you have not applied for minister's housing allowance/i, + /John and Jane have not completed the required IBS courses/i, ), ).toBeInTheDocument(); - expect( - queryByText(/Jane has not completed the required ibs courses/i), - ).not.toBeInTheDocument(); }); - it('should render page with married staff', () => { + it('should render spouse ineligible message when one user is eligible', () => { const { getByText } = render( , ); expect( - getByText(/Jane has not completed the required ibs courses/i), + getByText(/will submit the request for John. Jane has not/i), ).toBeInTheDocument(); }); }); diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx index 6f7f06cbfa..5379b1d77f 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx @@ -74,9 +74,6 @@ describe('MinisterHousingAllowanceReport', () => { expect( await findByText(/our records indicate that you have not applied for/i), ).toBeInTheDocument(); - expect( - await findByText(/will submit the request for john. jane has not/i), - ).toBeInTheDocument(); expect(await findByText('John Doe and Jane Doe')).toBeInTheDocument(); }); From 237bc357f4c6854991b2106f23884d5ffb0814ec Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:10:10 -0600 Subject: [PATCH 06/16] Move duplicated Your MHA title to higher level component, fix formatting --- .../MainPages/EligibleDisplay.test.tsx | 6 +-- .../MainPages/EligibleDisplay.tsx | 54 +++++++++---------- .../MainPages/IneligibleDisplay.test.tsx | 4 +- .../MainPages/NoRequestsDisplay.tsx | 24 ++++----- .../MinisterHousingAllowance.tsx | 5 +- 5 files changed, 41 insertions(+), 52 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.test.tsx index 379910247a..449dcdcd31 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.test.tsx @@ -19,17 +19,15 @@ const TestComponent: React.FC = ({ isPending }) => ( ); describe('EligibleDisplay', () => { - it('should render title and message when pending is true', () => { + it('should render message when pending is true', () => { const { getByText } = render(); - expect(getByText('Your MHA')).toBeInTheDocument(); expect(getByText(/waiting to be processed/i)).toBeInTheDocument(); }); - it('should render title and message when pending is false', () => { + it('should render message when pending is false', () => { const { getByText } = render(); - expect(getByText('Your MHA')).toBeInTheDocument(); expect( getByText(/our records indicate that you have an approved mha amount/i), ).toBeInTheDocument(); diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.tsx index 121ec8c478..8039e03cac 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/EligibleDisplay.tsx @@ -1,5 +1,5 @@ -import { Box, Typography } from '@mui/material'; -import { Trans, useTranslation } from 'react-i18next'; +import { Box } from '@mui/material'; +import { Trans } from 'react-i18next'; interface EligibleDisplayProps { isPending: boolean; @@ -8,34 +8,28 @@ interface EligibleDisplayProps { export const EligibleDisplay: React.FC = ({ isPending, }) => { - const { t } = useTranslation(); return ( - <> - - {t('Your MHA')} - - - {isPending ? ( - -

- Our records indicate that you have an MHA request{' '} - waiting to be processed. To view your MHA - request, click on the "View Current MHA" button below. - If you would like to make changes to your request, click on the - "Edit Request" button below. -

-
- ) : ( - -

- Our records indicate that you have an approved MHA amount. To view - your MHA amount, click on the "View Current MHA" button - below. If you would like to apply for a new MHA, click - "Update Current MHA". -

-
- )} -
- + + {isPending ? ( + +

+ Our records indicate that you have an MHA request{' '} + waiting to be processed. To view your MHA request, + click on the "View Current MHA" button below. If you would + like to make changes to your request, click on the "Edit + Request" button below. +

+
+ ) : ( + +

+ Our records indicate that you have an approved MHA amount. To view + your MHA amount, click on the "View Current MHA" button + below. If you would like to apply for a new MHA, click "Update + Current MHA". +

+
+ )} +
); }; diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx index be0ec504d6..bfe91798f1 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx @@ -43,9 +43,7 @@ describe('IneligibleDisplay', () => { ); expect( - getByText( - /John and Jane have not completed the required IBS courses/i, - ), + getByText(/John and Jane have not completed the required IBS courses/i), ).toBeInTheDocument(); }); diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx index 709e3835ce..6ab41a161d 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx @@ -1,22 +1,18 @@ -import { Box, Typography } from '@mui/material'; +import { Box } from '@mui/material'; import { useTranslation } from 'react-i18next'; export const NoRequestsDisplay: React.FC = () => { const { t } = useTranslation(); return ( - <> - - {t('Your MHA')} - - -

- {t( - "Our records indicate that you have not applied for Minister's Housing Allowance. If you would like information about applying for one, contact Personnel Records at 407-826-2252 or", - )}{' '} - MHA@cru.org. -

-
- + +

+ {t( + "Our records indicate that you have not applied for Minister's Housing Allowance." + + ' If you would like information about applying for one, contact Personnel Records at 407-826-2252 or', + )}{' '} + MHA@cru.org. +

+
); }; diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx index 30bd3c602e..66da7f9beb 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Button, Container, Stack } from '@mui/material'; +import { Box, Button, Container, Stack, Typography } from '@mui/material'; import { DateTime } from 'luxon'; import { useSnackbar } from 'notistack'; import { useTranslation } from 'react-i18next'; @@ -132,6 +132,9 @@ export const MinisterHousingAllowanceReport = () => { ) : ( <> + + {t('Your MHA')} + {hasNoRequests ? ( <> From 05af8b262ad62f595e0ff1651089cf6f52cdb9ef Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:30:11 -0600 Subject: [PATCH 07/16] Use Trans in NoRequestsDisplay to localize properly --- .../MainPages/NoRequestsDisplay.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx index 6ab41a161d..85649dadf4 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx @@ -1,18 +1,17 @@ import { Box } from '@mui/material'; -import { useTranslation } from 'react-i18next'; +import { Trans } from 'react-i18next'; export const NoRequestsDisplay: React.FC = () => { - const { t } = useTranslation(); - return ( -

- {t( - "Our records indicate that you have not applied for Minister's Housing Allowance." + - ' If you would like information about applying for one, contact Personnel Records at 407-826-2252 or', - )}{' '} - MHA@cru.org. -

+ +

+ Our records indicate that you have not applied for Minister's + Housing Allowance. If you would like information about applying for + one, contact Personnel Records at 407-826-2252 or{' '} + MHA@cru.org. +

+
); }; From 35efebdff80a2fec2be9aadef57fea86c9f166e8 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:30:35 -0600 Subject: [PATCH 08/16] Add tests for NoRequestsDisplay component to verify rendering and email link --- .../MainPages/NoRequestsDisplay.test.tsx | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx new file mode 100644 index 0000000000..bdbec88ce4 --- /dev/null +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx @@ -0,0 +1,34 @@ +import React from 'react'; +import { ThemeProvider } from '@mui/material/styles'; +import { LocalizationProvider } from '@mui/x-date-pickers'; +import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon'; +import { render } from '@testing-library/react'; +import theme from 'src/theme'; +import { NoRequestsDisplay } from './NoRequestsDisplay'; + +const TestComponent: React.FC = () => ( + + + + + +); + +describe('NoRequestsDisplay', () => { + it('should render no requests message', () => { + const { getByText } = render(); + + expect( + getByText(/our records indicate that you have not applied for/i), + ).toBeInTheDocument(); + }); + + it('should render contact email link', () => { + const { getByRole } = render(); + + expect(getByRole('link', { name: 'MHA@cru.org' })).toHaveAttribute( + 'href', + 'mailto:MHA@cru.org', + ); + }); +}); From 10593de35b8d413b4a8b4b3cd0e071a972fce929 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:39:23 -0600 Subject: [PATCH 09/16] Match phone number in form - actual phone number still not verified --- .../MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx index 83e9e77687..85be63b1d3 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx @@ -31,7 +31,7 @@ export const IneligibleDisplay: React.FC = () => { Once approved, when you calculate your salary, you will see the approved amount that can be applied to {preferredName} and{' '} {spousePreferredName}'s salary. If you believe this is - incorrect, please contact Personnel Records at 407-826-2236 or{' '} + incorrect, please contact Personnel Records at 407-826-2252 or{' '} MHA@cru.org.

From b313f77f18753f7f95e20bb5519d3c310cbdafba Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:39:42 -0600 Subject: [PATCH 10/16] Refactor IneligibleDisplay and tests --- .../MainPages/IneligibleDisplay.test.tsx | 40 +++++++++- .../MainPages/IneligibleDisplay.tsx | 76 ++++++++++++------- .../MinisterHousingAllowance.tsx | 5 +- 3 files changed, 93 insertions(+), 28 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx index bfe91798f1..96629ad6f2 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx @@ -29,6 +29,26 @@ const TestComponent: React.FC = ({ contextValue }) => { }; describe('IneligibleDisplay', () => { + it('should render single user ineligible message', () => { + const { getByText } = render( + , + ); + + expect( + getByText( + /You have not completed the required IBS courses to meet eligibility criteria/i, + ), + ).toBeInTheDocument(); + }); + it('should render both ineligible message when neither user is eligible', () => { const { getByText } = render( { ).toBeInTheDocument(); }); - it('should render spouse ineligible message when one user is eligible', () => { + it('should render user ineligible message when user ineligible', () => { + const { getByText } = render( + , + ); + + expect( + getByText(/will submit the request for Jane. John has not/i), + ).toBeInTheDocument(); + }); + + it('should render spouse ineligible message when spouse ineligible', () => { const { getByText } = render( { const { + isMarried, preferredName, spousePreferredName, userEligibleForMHA, spouseEligibleForMHA, } = useMinisterHousingAllowance(); - const bothIneligible = !userEligibleForMHA && !spouseEligibleForMHA; + if (!isMarried) { + return ( + + +

+ You have not completed the required IBS courses to meet eligibility + criteria. +

+

+ Once approved, when you calculate your salary, you will see the + approved amount that can be applied to your salary. If you believe + this is incorrect, please contact Personnel Records at 407-826-2252 + or MHA@cru.org. +

+
+
+ ); + } - const eligibleUserName = userEligibleForMHA - ? preferredName - : spousePreferredName; - const ineligibleUserName = userEligibleForMHA - ? spousePreferredName - : preferredName; + const bothIneligible = !userEligibleForMHA && !spouseEligibleForMHA; - return ( - - {bothIneligible ? ( + if (bothIneligible) { + return ( +

{preferredName} and {spousePreferredName} have not completed the @@ -35,22 +48,33 @@ export const IneligibleDisplay: React.FC = () => { MHA@cru.org.

- ) : ( - -

- Completing a Minister's Housing Allowance will submit the - request for {eligibleUserName}. {ineligibleUserName} has not - completed the required IBS courses to meet eligibility criteria. -

-

- Once approved, when you calculate your salary, you will see the - approved amount that can be applied to {ineligibleUserName} - 's salary. If you believe this is incorrect, please contact - Personnel Records at 407-826-2252 or{' '} - MHA@cru.org. -

-
- )} +
+ ); + } + + const eligibleUserName = userEligibleForMHA + ? preferredName + : spousePreferredName; + const ineligibleUserName = userEligibleForMHA + ? spousePreferredName + : preferredName; + + return ( + + +

+ Completing a Minister's Housing Allowance will submit the + request for {eligibleUserName}. {ineligibleUserName} has not + completed the required IBS courses to meet eligibility criteria. +

+

+ Once approved, when you calculate your salary, you will see the + approved amount that can be applied to {ineligibleUserName} + 's salary. If you believe this is incorrect, please contact + Personnel Records at 407-826-2252 or{' '} + MHA@cru.org. +

+
); }; diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx index 66da7f9beb..16a29f8992 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx @@ -54,6 +54,9 @@ export const MinisterHousingAllowanceReport = () => { const bothEligible = userEligibleForMHA && spouseEligibleForMHA; const hasNoRequests = !requests.length; + const showIneligibleDisplay = + !userEligibleForMHA || (isMarried && !bothEligible); + const names = isMarried ? `${preferredName} ${lastName} and ${spousePreferredName} ${spouseLastName}` : `${preferredName} ${lastName}`; @@ -138,7 +141,7 @@ export const MinisterHousingAllowanceReport = () => { {hasNoRequests ? ( <> - {!bothEligible && } + {showIneligibleDisplay && } ) : ( From b5cba76a9ad3fcb67333b7cfd93f9350d387aa6b Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:47:56 -0600 Subject: [PATCH 11/16] Fix formatting --- .../MainPages/IneligibleDisplay.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx index aaa9c610a9..90d732272a 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx @@ -63,9 +63,9 @@ export const IneligibleDisplay: React.FC = () => {

- Completing a Minister's Housing Allowance will submit the - request for {eligibleUserName}. {ineligibleUserName} has not - completed the required IBS courses to meet eligibility criteria. + Completing a Minister's Housing Allowance will submit the request + for {eligibleUserName}. {ineligibleUserName} has not completed the + required IBS courses to meet eligibility criteria.

Once approved, when you calculate your salary, you will see the From 5e8daeb79b44c61860c1ae7db008ca64ba31f3a2 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 20:53:02 -0600 Subject: [PATCH 12/16] Refactor IneligibleDisplay and NoRequestsDisplay to hyperlink phone number, and change Personnel Records number --- .../MainPages/IneligibleDisplay.test.tsx | 26 +++------- .../MainPages/IneligibleDisplay.tsx | 52 ++++++++++++------- .../MainPages/NoRequestsDisplay.test.tsx | 6 +-- .../MainPages/NoRequestsDisplay.tsx | 11 ++-- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx index 96629ad6f2..5cbd9e2da3 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.test.tsx @@ -30,7 +30,7 @@ const TestComponent: React.FC = ({ contextValue }) => { describe('IneligibleDisplay', () => { it('should render single user ineligible message', () => { - const { getByText } = render( + const { getByTestId } = render( { />, ); - expect( - getByText( - /You have not completed the required IBS courses to meet eligibility criteria/i, - ), - ).toBeInTheDocument(); + expect(getByTestId('single-ineligible')).toBeInTheDocument(); }); it('should render both ineligible message when neither user is eligible', () => { - const { getByText } = render( + const { getByTestId } = render( { />, ); - expect( - getByText(/John and Jane have not completed the required IBS courses/i), - ).toBeInTheDocument(); + expect(getByTestId('both-ineligible')).toBeInTheDocument(); }); it('should render user ineligible message when user ineligible', () => { - const { getByText } = render( + const { getByTestId } = render( { />, ); - expect( - getByText(/will submit the request for Jane. John has not/i), - ).toBeInTheDocument(); + expect(getByTestId('one-ineligible')).toBeInTheDocument(); }); it('should render spouse ineligible message when spouse ineligible', () => { - const { getByText } = render( + const { getByTestId } = render( { />, ); - expect( - getByText(/will submit the request for John. Jane has not/i), - ).toBeInTheDocument(); + expect(getByTestId('one-ineligible')).toBeInTheDocument(); }); }); diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx index 90d732272a..cd2acc2ef8 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/IneligibleDisplay.tsx @@ -1,5 +1,5 @@ import { Box } from '@mui/material'; -import { Trans } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; import { useMinisterHousingAllowance } from '../Shared/Context/MinisterHousingAllowanceContext'; export const IneligibleDisplay: React.FC = () => { @@ -11,10 +11,12 @@ export const IneligibleDisplay: React.FC = () => { spouseEligibleForMHA, } = useMinisterHousingAllowance(); + const { t } = useTranslation(); + if (!isMarried) { return ( - - + +

You have not completed the required IBS courses to meet eligibility criteria. @@ -22,8 +24,9 @@ export const IneligibleDisplay: React.FC = () => {

Once approved, when you calculate your salary, you will see the approved amount that can be applied to your salary. If you believe - this is incorrect, please contact Personnel Records at 407-826-2252 - or MHA@cru.org. + this is incorrect, please contact Personnel Records at{' '} + 407-826-2230 or{' '} + MHA@cru.org.

@@ -34,17 +37,24 @@ export const IneligibleDisplay: React.FC = () => { if (bothIneligible) { return ( - - + +

- {preferredName} and {spousePreferredName} have not completed the - required IBS courses to meet eligibility criteria. + {'{{preferredName}}'} and {'{{spousePreferredName}}'} have not + completed the required IBS courses to meet eligibility criteria.

Once approved, when you calculate your salary, you will see the - approved amount that can be applied to {preferredName} and{' '} - {spousePreferredName}'s salary. If you believe this is - incorrect, please contact Personnel Records at 407-826-2252 or{' '} + approved amount that can be applied to {'{{preferredName}}'} and{' '} + {'{{spousePreferredName}}'}'s salary. If you believe this is + incorrect, please contact Personnel Records at{' '} + 407-826-2230 or{' '} MHA@cru.org.

@@ -60,18 +70,24 @@ export const IneligibleDisplay: React.FC = () => { : preferredName; return ( - - + +

Completing a Minister's Housing Allowance will submit the request - for {eligibleUserName}. {ineligibleUserName} has not completed the - required IBS courses to meet eligibility criteria. + for {'{{eligibleUserName}}'}. {'{{ineligibleUserName}}'} has not + completed the required IBS courses to meet eligibility criteria.

Once approved, when you calculate your salary, you will see the - approved amount that can be applied to {ineligibleUserName} + approved amount that can be applied to {'{{ineligibleUserName}}'} 's salary. If you believe this is incorrect, please contact - Personnel Records at 407-826-2252 or{' '} + Personnel Records at 407-826-2230 or{' '} MHA@cru.org.

diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx index bdbec88ce4..76cf851f5e 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.test.tsx @@ -16,11 +16,9 @@ const TestComponent: React.FC = () => ( describe('NoRequestsDisplay', () => { it('should render no requests message', () => { - const { getByText } = render(); + const { getByTestId } = render(); - expect( - getByText(/our records indicate that you have not applied for/i), - ).toBeInTheDocument(); + expect(getByTestId('no-requests-display')).toBeInTheDocument(); }); it('should render contact email link', () => { diff --git a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx index 85649dadf4..239511379f 100644 --- a/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MainPages/NoRequestsDisplay.tsx @@ -1,14 +1,17 @@ import { Box } from '@mui/material'; -import { Trans } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; export const NoRequestsDisplay: React.FC = () => { + const { t } = useTranslation(); + return ( - - + +

Our records indicate that you have not applied for Minister's Housing Allowance. If you would like information about applying for - one, contact Personnel Records at 407-826-2252 or{' '} + one, contact Personnel Records at{' '} + 407-826-2230 or{' '} MHA@cru.org.

From 004604715db0c1cd131ce97e21eba66f10395afc Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Tue, 10 Feb 2026 21:00:20 -0600 Subject: [PATCH 13/16] Refactor MinisterHousingAllowance logic to both ineligible users with existing requests --- .../MinisterHousingAllowance.test.tsx | 52 +++++++++++++++++++ .../MinisterHousingAllowance.tsx | 27 +++++++--- .../RequestPage/RequestPage.tsx | 17 ------ .../NoRequestAccess/NoRequestAccess.test.tsx | 26 ---------- .../Steps/NoRequestAccess/NoRequestAccess.tsx | 41 --------------- .../Reports/Shared/HcmData/mockData.ts | 17 ++++++ 6 files changed, 88 insertions(+), 92 deletions(-) delete mode 100644 src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.test.tsx delete mode 100644 src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx index 5379b1d77f..dcb60e02a9 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.test.tsx @@ -8,8 +8,10 @@ import { MhaStatusEnum } from 'src/graphql/types.generated'; import theme from 'src/theme'; import { HcmDataQuery } from '../Shared/HcmData/HCMData.generated'; import { + marriedBothIneligible, marriedMhaAndNoException, marriedNoMhaNoException, + singleIneligible, singleMhaNoException, singleNoMhaNoException, } from '../Shared/HcmData/mockData'; @@ -124,6 +126,56 @@ describe('MinisterHousingAllowanceReport', () => { expect(getByText('Current Board Approved MHA')).toBeInTheDocument(); }); + it('renders fully ineligible single user with requests and hides request details', async () => { + const { findByText, queryByText } = render( + , + ); + + expect( + await findByText(/you have not completed the required ibs courses/i), + ).toBeInTheDocument(); + + expect( + queryByText(/our records indicate that you have an mha request/i), + ).not.toBeInTheDocument(); + }); + + it('renders fully ineligible married couple and hides request details', async () => { + const { findByText, queryByText } = render( + , + ); + + expect( + await findByText(/have not completed the required ibs courses/i), + ).toBeInTheDocument(); + + expect(queryByText('Current Board Approved MHA')).not.toBeInTheDocument(); + expect( + queryByText(/our records indicate that you have an approved/i), + ).not.toBeInTheDocument(); + }); + it('renders married, pending, no approved correctly', async () => { const { findByText } = render( { const spousePersonNumber = spouseHcmData?.staffInfo?.personNumber ?? ''; const lastName = userHcmData?.staffInfo?.lastName ?? ''; const spouseLastName = spouseHcmData?.staffInfo?.lastName ?? ''; - const bothEligible = userEligibleForMHA && spouseEligibleForMHA; - const hasNoRequests = !requests.length; - - const showIneligibleDisplay = - !userEligibleForMHA || (isMarried && !bothEligible); const names = isMarried ? `${preferredName} ${lastName} and ${spousePreferredName} ${spouseLastName}` @@ -119,6 +114,18 @@ export const MinisterHousingAllowanceReport = () => { isCurrentRequestPending, ); + const hasNoRequests = !requests.length; + + const bothEligible = userEligibleForMHA && spouseEligibleForMHA; + const eitherPersonEligible = userEligibleForMHA || spouseEligibleForMHA; + + const showIneligibleDisplay = + !userEligibleForMHA || (isMarried && !bothEligible); + const showNewRequestButton = + eitherPersonEligible && (!isCurrentRequestPending || hasNoRequests); + const showCurrentRequest = eitherPersonEligible && currentRequest; + const showPreviousRequests = eitherPersonEligible && previousApprovedRequest; + return ( { {t('Your MHA')} + {hasNoRequests ? ( <> {showIneligibleDisplay && } + ) : showIneligibleDisplay ? ( + ) : ( )} + - {currentRequest && + {showCurrentRequest && (isCurrentRequestPending ? ( ) : ( ))}
- {(!isCurrentRequestPending || hasNoRequests) && ( + {showNewRequestButton && ( )} - {previousApprovedRequest && ( + {showPreviousRequests && ( diff --git a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx index d52b09f3b4..50f560d4c6 100644 --- a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx +++ b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx @@ -19,7 +19,6 @@ import { mainContentWidth } from '../MinisterHousingAllowance'; import { useMinisterHousingAllowance } from '../Shared/Context/MinisterHousingAllowanceContext'; import { getRequestUrl } from '../Shared/Helper/getRequestUrl'; import { NoEditAccess } from '../Steps/NoEditAccess/NoEditAccess'; -import { NoRequestAccess } from '../Steps/NoRequestAccess/NoRequestAccess'; import { AboutForm } from '../Steps/StepOne/AboutForm'; import { Calculation } from '../Steps/StepThree/Calculation'; import { RentOwn } from '../Steps/StepTwo/RentOwn'; @@ -51,8 +50,6 @@ export const RequestPage: React.FC = () => { setIsComplete, requestData, loading, - userEligibleForMHA, - spouseEligibleForMHA, } = useMinisterHousingAllowance(); const canEdit = @@ -117,20 +114,6 @@ export const RequestPage: React.FC = () => { } /> - ) : !userEligibleForMHA && !spouseEligibleForMHA ? ( - - - - - - } - /> ) : ( ( - - - -); - -describe('NoRequestAccess', () => { - it('should render the NoRequestAccess component and support link', () => { - const { getByText, getByRole } = render(); - - expect( - getByRole('heading', { - name: 'You do not have permission to request a ministry housing allowance.', - }), - ).toBeInTheDocument(); - expect( - getByText(/our records show that you are not eligible to apply for/i), - ).toBeInTheDocument(); - expect(getByRole('link', { name: 'support@mpdx.org' })).toBeInTheDocument(); - }); -}); diff --git a/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx b/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx deleted file mode 100644 index 96e70f8556..0000000000 --- a/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import Link from 'next/link'; -import React from 'react'; -import { Box, Container, Typography } from '@mui/material'; -import { useTranslation } from 'react-i18next'; -import theme from 'src/theme'; - -export const NoRequestAccess: React.FC = () => { - const { t } = useTranslation(); - - return ( - - - - {t( - 'You do not have permission to request a ministry housing allowance.', - )} - - - - {t( - "Our records show that you are not eligible to apply for Minister's Housing Allowance. If you believe otherwise, please contact ", - )} - - support@mpdx.org - - - - - ); -}; diff --git a/src/components/Reports/Shared/HcmData/mockData.ts b/src/components/Reports/Shared/HcmData/mockData.ts index 3fb8bb3b09..45a249f5ca 100644 --- a/src/components/Reports/Shared/HcmData/mockData.ts +++ b/src/components/Reports/Shared/HcmData/mockData.ts @@ -58,6 +58,13 @@ const noMhaAndNoException: HcmDataQuery['hcm'][number] = { }, }; +const ineligibleAndNoException: HcmDataQuery['hcm'][number] = { + ...noMhaAndNoException, + mhaEit: { + mhaEligibility: false, + }, +}; + const mhaAndNoException: HcmDataQuery['hcm'][number] = { ...noMhaAndNoException, mhaRequest: { @@ -84,3 +91,13 @@ export const marriedNoMhaNoException: HcmDataQuery['hcm'] = [ staffInfo: janeDoe, }, ]; +export const singleIneligible: HcmDataQuery['hcm'] = [ + ineligibleAndNoException, +]; +export const marriedBothIneligible: HcmDataQuery['hcm'] = [ + ineligibleAndNoException, + { + ...ineligibleAndNoException, + staffInfo: janeDoe, + }, +]; From 3afcb65fe2b461159817c633677ee5b4116f8a93 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:32:55 -0600 Subject: [PATCH 14/16] Refactor to show EligibleDisplay if at least one person is eligible --- .../MinisterHousingAllowance.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx index 2cfe5c074c..d74a4f67be 100644 --- a/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx +++ b/src/components/Reports/MinisterHousingAllowance/MinisterHousingAllowance.tsx @@ -151,10 +151,13 @@ export const MinisterHousingAllowanceReport = () => { {showIneligibleDisplay && } - ) : showIneligibleDisplay ? ( - ) : ( - + <> + {showIneligibleDisplay && } + {eitherPersonEligible && ( + + )} + )} From d8fcae46f66f0512ccb03b3537b9452781e8db72 Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:36:38 -0600 Subject: [PATCH 15/16] Reformat mockData --- src/components/Reports/Shared/HcmData/mockData.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/Reports/Shared/HcmData/mockData.ts b/src/components/Reports/Shared/HcmData/mockData.ts index 45a249f5ca..a73d95e0c6 100644 --- a/src/components/Reports/Shared/HcmData/mockData.ts +++ b/src/components/Reports/Shared/HcmData/mockData.ts @@ -91,9 +91,7 @@ export const marriedNoMhaNoException: HcmDataQuery['hcm'] = [ staffInfo: janeDoe, }, ]; -export const singleIneligible: HcmDataQuery['hcm'] = [ - ineligibleAndNoException, -]; +export const singleIneligible: HcmDataQuery['hcm'] = [ineligibleAndNoException]; export const marriedBothIneligible: HcmDataQuery['hcm'] = [ ineligibleAndNoException, { From 64bef37be1f20edd64106fb84ee1475fedbad4cc Mon Sep 17 00:00:00 2001 From: zachery with an e <45150570+zweatshirt@users.noreply.github.com> Date: Fri, 13 Feb 2026 12:57:59 -0600 Subject: [PATCH 16/16] Restore NoRequestAccess component --- .../RequestPage/RequestPage.tsx | 17 ++++++++ .../NoRequestAccess/NoRequestAccess.test.tsx | 26 ++++++++++++ .../Steps/NoRequestAccess/NoRequestAccess.tsx | 41 +++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.test.tsx create mode 100644 src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx diff --git a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx index 50f560d4c6..d52b09f3b4 100644 --- a/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx +++ b/src/components/Reports/MinisterHousingAllowance/RequestPage/RequestPage.tsx @@ -19,6 +19,7 @@ import { mainContentWidth } from '../MinisterHousingAllowance'; import { useMinisterHousingAllowance } from '../Shared/Context/MinisterHousingAllowanceContext'; import { getRequestUrl } from '../Shared/Helper/getRequestUrl'; import { NoEditAccess } from '../Steps/NoEditAccess/NoEditAccess'; +import { NoRequestAccess } from '../Steps/NoRequestAccess/NoRequestAccess'; import { AboutForm } from '../Steps/StepOne/AboutForm'; import { Calculation } from '../Steps/StepThree/Calculation'; import { RentOwn } from '../Steps/StepTwo/RentOwn'; @@ -50,6 +51,8 @@ export const RequestPage: React.FC = () => { setIsComplete, requestData, loading, + userEligibleForMHA, + spouseEligibleForMHA, } = useMinisterHousingAllowance(); const canEdit = @@ -114,6 +117,20 @@ export const RequestPage: React.FC = () => { } /> + ) : !userEligibleForMHA && !spouseEligibleForMHA ? ( + + + + + + } + /> ) : ( ( + + + +); + +describe('NoRequestAccess', () => { + it('should render the NoRequestAccess component and support link', () => { + const { getByText, getByRole } = render(); + + expect( + getByRole('heading', { + name: 'You do not have permission to request a ministry housing allowance.', + }), + ).toBeInTheDocument(); + expect( + getByText(/our records show that you are not eligible to apply for/i), + ).toBeInTheDocument(); + expect(getByRole('link', { name: 'support@mpdx.org' })).toBeInTheDocument(); + }); +}); diff --git a/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx b/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx new file mode 100644 index 0000000000..96e70f8556 --- /dev/null +++ b/src/components/Reports/MinisterHousingAllowance/Steps/NoRequestAccess/NoRequestAccess.tsx @@ -0,0 +1,41 @@ +import Link from 'next/link'; +import React from 'react'; +import { Box, Container, Typography } from '@mui/material'; +import { useTranslation } from 'react-i18next'; +import theme from 'src/theme'; + +export const NoRequestAccess: React.FC = () => { + const { t } = useTranslation(); + + return ( + + + + {t( + 'You do not have permission to request a ministry housing allowance.', + )} + + + + {t( + "Our records show that you are not eligible to apply for Minister's Housing Allowance. If you believe otherwise, please contact ", + )} + + support@mpdx.org + + + + + ); +};