Skip to content

Commit

Permalink
fix confirmation page Email scenario logic, drive by fix for about ve…
Browse files Browse the repository at this point in the history
…teran ssn validation (#33915)
  • Loading branch information
hemeshvpatel authored Jan 6, 2025
1 parent fa3ccca commit 5b06ec8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,12 @@ const ssnServiceInfo = (
</span>
<span className="form-required-span">(*Required)</span>
</p>
<span className="vads-u-margin-y--0 vads-u-font-size--sm medium-screen:vads-u-font-size--root">
<p className="vads-u-font-size--sm vads-u-margin-bottom-1">
Please provide one of the following:
</span>
</p>
</div>
);

const validateSSandSNGroup = (errors, values, formData) => {
if (
!(
(formData.whoIsYourQuestionAbout === 'Someone else' &&
formData.relationshipToVeteran ===
"I'm connected to the Veteran through my work (for example, as a School Certifying Official or fiduciary)") ||
(formData.whoIsYourQuestionAbout === 'Someone else' &&
formData.relationshipToVeteran ===
"I'm a family member of a Veteran") ||
formData.whoIsYourQuestionAbout === "It's a general question"
) &&
!Object.keys(values).some(key => values[key])
) {
errors.addError(
`Please enter either the Veteran's Social Security number or Service number`,
);
}
};

const aboutTheVeteranPage = {
uiSchema: {
...titleUI(CHAPTER_3.ABOUT_THE_VET.TITLE),
Expand Down Expand Up @@ -101,10 +82,18 @@ const aboutTheVeteranPage = {
}),
socialOrServiceNum: {
'ui:title': ssnServiceInfo,
'ui:validations': [validateSSandSNGroup],
'ui:options': { showFieldLabel: true },
ssn: ssnUI(),
serviceNumber: serviceNumberUI('Service number'),
'ui:validations': [
(errors, field) => {
if (!Object.keys(field).some(key => field[key])) {
errors.addError(
"Please enter either the Veteran's Social Security number or Service number",
);
}
},
],
},
branchOfService: selectUI({
title: CHAPTER_3.VETERANS_BRANCH_OF_SERVICE.TITLE,
Expand Down
2 changes: 1 addition & 1 deletion src/applications/ask-va/containers/ResponseInboxPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ const ResponseInboxPage = ({ router }) => {
}`}
>
<va-link
href={`${URL.DOWNLOAD_ATTACHMENT}${
href={`${envUrl}${URL.DOWNLOAD_ATTACHMENT}${
attachment.id
}`}
text={`${attachment.name}
Expand Down
5 changes: 2 additions & 3 deletions src/applications/ask-va/containers/ReviewPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ const ReviewPage = props => {
setIsDisabled(false);
resolve(mockSubmitResponse);
const inquiryNumber = 'A-20230622-306458';
const contactPreference =
props.formData?.contactPreference || 'email';
const contactPreference = props.formData.contactPreference || 'Email';
localStorage.removeItem('askVAFiles');
props.router.push({
pathname: '/confirmation',
Expand All @@ -116,7 +115,7 @@ const ReviewPage = props => {
.then(response => {
setIsDisabled(false);
const { inquiryNumber } = response;
const contactPreference = props.formData?.contactPreference || 'email';
const contactPreference = props.formData.contactPreference || 'Email';
localStorage.removeItem('askVAFiles');
props.router.push({
pathname: '/confirmation',
Expand Down

0 comments on commit 5b06ec8

Please sign in to comment.