Skip to content
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

Feature/appeals 42187 rc #22522

Merged
merged 9 commits into from
Aug 16, 2024
5 changes: 4 additions & 1 deletion app/controllers/intakes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def intake_ui_hash
{ unread_messages: unread_messages? }
end

# rubocop:disable Metrics/AbcSize
def feature_toggle_ui_hash
{
useAmaActivationDate: FeatureToggle.enabled?(:use_ama_activation_date, user: current_user),
Expand All @@ -160,9 +161,11 @@ def feature_toggle_ui_hash
updatedAppealForm: FeatureToggle.enabled?(:updated_appeal_form, user: current_user),
hlrScUnrecognizedClaimants: FeatureToggle.enabled?(:hlr_sc_unrecognized_claimants, user: current_user),
vhaClaimReviewEstablishment: FeatureToggle.enabled?(:vha_claim_review_establishment, user: current_user),
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user),
removeCompAndPenIntake: FeatureToggle.enabled?(:remove_comp_and_pen_intake, user: current_user)
}
end
# rubocop:enable Metrics/AbcSize

def user_information_ui_hash
{
Expand Down
1 change: 1 addition & 0 deletions client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@
"INTAKE_EDIT_ISSUE_BENEFIT_TYPE": "Benefit type: ",
"INTAKE_EDIT_ISSUE_DECISION_DATE": "Decision date: ",
"INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT": "Only VHA team members can establish Higher Level Reviews and Supplemental Claims with VHA issues. If you have a VHA claim, please return the packet to the main “VHA” queue in the Centralized Mail Portal or send downloaded documents to %s.",
"INTAKE_REMOVE_COMP_AND_PEN": "Higher Level Reviews and Supplemental Claims with Compensation and Pension & Survivor's Benefits are now handled through VBMS and are no longer established through Caseflow",
"VHA_BENEFIT_EMAIL_ADDRESS": "VHABENEFITAPPEALS@va.gov",
"VHA_CAREGIVER_SUPPORT_EMAIL_ADDRESS": "VHA.CSPAppeals@va.gov",
"VHA_PAYMENT_OPERATIONS_EMAIL_ADDRESS": "VHA10D1B3R2Appeals@va.gov",
Expand Down
4 changes: 3 additions & 1 deletion client/app/intake/components/BenefitType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export default class BenefitType extends React.PureComponent {
// If the feature toggle is off then all users should be able to select vha
const canSelectVhaBenefit = featureToggles.vhaClaimReviewEstablishment ? userCanSelectVha : true;

const canSelectCompAndPen = !featureToggles.removeCompAndPenIntake;

return <div className="cf-benefit-type" style={{ marginTop: '10px' }} >
<RadioField
name="benefit-type-options"
label="What is the Benefit Type?"
strongLabel
vertical
options={formatBenefitTypeRadioOptions(BENEFIT_TYPES, canSelectVhaBenefit)}
options={formatBenefitTypeRadioOptions(BENEFIT_TYPES, canSelectVhaBenefit, canSelectCompAndPen)}
onChange={onChange}
value={value}
errorMessage={errorMessage}
Expand Down
41 changes: 33 additions & 8 deletions client/app/intake/pages/formGenerator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Redirect } from 'react-router-dom';
import { reject, map } from 'lodash';
import RadioField from '../../components/RadioField';
import ReceiptDateInput from './receiptDateInput';
import { setDocketType, setOriginalHearingRequestType, setHomelessnessType
import {
setDocketType, setOriginalHearingRequestType, setHomelessnessType
} from '../actions/appeal';
import { setReceiptDate, setOptionSelected } from '../actions/intake';
import { setAppealDocket, confirmIneligibleForm } from '../actions/rampRefiling';
Expand Down Expand Up @@ -117,14 +118,14 @@ const formFieldMapping = (props) => {
</div>
),
'original-hearing-request-type':
props.docketType === 'hearing' && props.featureToggles.updatedAppealForm ? hearingTypeDropdown : <></>,
props.docketType === 'hearing' && props.featureToggles.updatedAppealForm ? hearingTypeDropdown : <></>,
'legacy-opt-in': (
<LegacyOptInApproved
value={props.legacyOptInApproved}
onChange={props.setLegacyOptInApproved}
errorMessage={
props.legacyOptInApprovedError ||
props.errors?.['legacy-opt-in']?.message
props.errors?.['legacy-opt-in']?.message
}
register={props.register}
/>
Expand All @@ -142,7 +143,7 @@ const formFieldMapping = (props) => {
onChange={props.setBenefitType}
errorMessage={
props.benefitTypeError ||
props.errors?.['benefit-type-options']?.message
props.errors?.['benefit-type-options']?.message
}
register={props.register}
formName={props.formName}
Expand All @@ -162,7 +163,7 @@ const formFieldMapping = (props) => {
}}
errorMessage={
props.informalConferenceError ||
props.errors?.['informal-conference']?.message
props.errors?.['informal-conference']?.message
}
value={renderBooleanValue('informalConference')}
inputRef={props.register}
Expand Down Expand Up @@ -221,7 +222,7 @@ const formFieldMapping = (props) => {
onChange={props.setOptionSelected}
errorMessage={
props.optionSelectedError ||
props.errors?.['opt-in-election']?.message
props.errors?.['opt-in-election']?.message
}
value={props.optionSelected}
inputRef={props.register}
Expand All @@ -235,7 +236,7 @@ const formFieldMapping = (props) => {
onChange={props.setAppealDocket}
errorMessage={
props.appealDocketError ||
props.errors?.['appeal-docket']?.message
props.errors?.['appeal-docket']?.message
}
value={props.appealDocket}
inputRef={props.register}
Expand Down Expand Up @@ -286,20 +287,44 @@ const FormGenerator = (props) => {
</Button>
</Alert>
)}

{props.reviewIntakeError && <ErrorAlert {...props.reviewIntakeError} />}
{showInvalidVeteranError && (
<ErrorAlert
errorCode="veteran_not_valid"
errorData={props.veteranInvalidFields}
/>
)}
{!props.userIsVhaEmployee && isHlrOrScForm && props.featureToggles.vhaClaimReviewEstablishment && (

{isHlrOrScForm && !props.userIsVhaEmployee && props.featureToggles.vhaClaimReviewEstablishment && !props.featureToggles.removeCompAndPenIntake && (
<div style={{ marginBottom: '3rem' }}>
<Alert title={COPY.INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT_TITLE} type="info">
<span dangerouslySetInnerHTML={{ __html: buildVHAInfoBannerMessage() }} />
</Alert>
</div>
)}

{isHlrOrScForm && !props.userIsVhaEmployee && props.featureToggles.vhaClaimReviewEstablishment && props.featureToggles.removeCompAndPenIntake && (
<div style={{ marginBottom: '3rem' }}>
<Alert title={COPY.INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT_TITLE} type="info">
<ul>
<li dangerouslySetInnerHTML={{ __html: buildVHAInfoBannerMessage() }} />
<li>{COPY.INTAKE_REMOVE_COMP_AND_PEN}</li>
</ul>
</Alert>
</div>
)}

{isHlrOrScForm && props.featureToggles.removeCompAndPenIntake && ((props.featureToggles.vhaClaimReviewEstablishment && props.userIsVhaEmployee) || (!props.featureToggles.vhaClaimReviewEstablishment && !props.userIsVhaEmployee)) && (
<div style={{ marginBottom: '3rem' }}>
<Alert title={COPY.INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT_TITLE} type="info">
<ul>
<li>{COPY.INTAKE_REMOVE_COMP_AND_PEN}</li>
</ul>
</Alert>
</div>
)}

{Object.keys(props.schema.fields).map((field) => formFieldMapping(props)[field])}
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion client/app/intake/reducers/featureToggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const updateFromServerFeatures = (state, featureToggles) => {
},
vhaClaimReviewEstablishment: {
$set: Boolean(featureToggles.vhaClaimReviewEstablishment)
},
removeCompAndPenIntake: {
$set: Boolean(featureToggles.removeCompAndPenIntake)
}
});
};
Expand All @@ -58,7 +61,8 @@ export const mapDataToFeatureToggle = (data = { featureToggles: {} }) =>
justificationReason: false,
updatedAppealForm: false,
hlrScUnrecognizedClaimants: false,
vhaClaimReviewEstablishment: false
vhaClaimReviewEstablishment: false,
removeCompAndPenIntake: false
},
data.featureToggles
);
Expand Down
11 changes: 9 additions & 2 deletions client/app/intake/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { sprintf } from 'sprintf-js';
import { REVIEW_OPTIONS, REVIEW_DATA_FIELDS, CLAIMANT_ERRORS } from '../constants';
import {
INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT,
VHA_BENEFIT_EMAIL_ADDRESS
VHA_BENEFIT_EMAIL_ADDRESS,
INTAKE_REMOVE_COMP_AND_PEN
} from '../../../COPY';
import DATES from '../../../constants/DATES';
import { formatDateStr } from '../../util/DateUtil';
Expand Down Expand Up @@ -91,7 +92,7 @@ export const getDefaultPayeeCode = (state, claimant) => {
return null;
};

export const formatBenefitTypeRadioOptions = (options, userCanSelectVha) => {
export const formatBenefitTypeRadioOptions = (options, userCanSelectVha, userCanSelectCompAndPen) => {
return _.map(options, (value, key) => {
const radioData = { value: key, displayText: value };

Expand All @@ -101,6 +102,12 @@ export const formatBenefitTypeRadioOptions = (options, userCanSelectVha) => {
disabled: true,
tooltipText: sprintf(INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT, VHA_BENEFIT_EMAIL_ADDRESS)
};
} else if ((key === 'compensation' || key === 'pension') && !userCanSelectCompAndPen) {
return {
...radioData,
disabled: true,
tooltipText: sprintf(INTAKE_REMOVE_COMP_AND_PEN)
};
}

return radioData;
Expand Down
67 changes: 67 additions & 0 deletions client/test/app/intake/components/BenefitType.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ const defaultProps = {
};

const vhaTooltipText = sprintf(COPY.INTAKE_VHA_CLAIM_REVIEW_REQUIREMENT, COPY.VHA_BENEFIT_EMAIL_ADDRESS);
const penAndCompTooltipText = sprintf(COPY.INTAKE_REMOVE_COMP_AND_PEN);

const renderBenefitType = (props) => {
return render(<BenefitType {...props} />);
};

const getVhaRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.vha });
const getCompRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.compensation });
const getPenRadioOption = () => screen.getByRole('radio', { name: BENEFIT_TYPES.pension });

const getVhaOptionTooltip = () => {
return screen.getByRole(
Expand Down Expand Up @@ -73,6 +76,70 @@ describe('BenefitType', () => {
});
});

describe('when remove comp and pen intake is disabled', () => {
const props = {
...defaultProps,
featureToggles: { removeCompAndPenIntake: false }

};

beforeEach(() => {
renderBenefitType(props);
});

it('The "Veterans Health Administration" option is enabled', () => {
expect(getCompRadioOption()).not.toBeDisabled();
expect(getPenRadioOption()).not.toBeDisabled();
});

it('Tooltip does not appear whenever Compensation option is hovered over', () => {
hoverOverRadioOption(getCompRadioOption());

expect(
screen.queryByText(vhaTooltipText)
).not.toBeInTheDocument();
});

it('Tooltip does not appear whenever Pension option is hovered over', () => {
hoverOverRadioOption(getPenRadioOption());

expect(
screen.queryByText(vhaTooltipText)
).not.toBeInTheDocument();
});
});

describe('when remove comp and pen intake is enabled', () => {
const props = {
...defaultProps,
featureToggles: { removeCompAndPenIntake: true }

};

beforeEach(() => {
renderBenefitType(props);
});

it('The "Veterans Health Administration" option is enabled', () => {
expect(getCompRadioOption()).toBeDisabled();
expect(getPenRadioOption()).toBeDisabled();
});

it('Tooltip appear whenever Comp and Pen option is hovered over', async () => {

await waitFor(() => {
const toolTipElements = screen.getAllByRole('tooltip');

toolTipElements.forEach((toolTipElement) => {
if (toolTipElement.id === 'tooltip-pension' || toolTipElement.id === 'tooltip-compensation') {
expect(toolTipElement).toBeInTheDocument();
expect(toolTipElement).toHaveTextContent(penAndCompTooltipText);
}
});
});
});
});

describe('when the user is a VHA staff member with feature toggle disabled on Higher Level Review Form', () => {
const props = {
...defaultProps,
Expand Down
Loading
Loading