-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VACMS-16917: DUW Result Page (#30684)
--------- Co-authored-by: Chris Kim
- Loading branch information
1 parent
872ddde
commit 6a8f9de
Showing
9 changed files
with
332 additions
and
24 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/applications/discharge-wizard/components/v2/ResultsPage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { pageSetup } from '../../utilities/page-setup'; | ||
import { ROUTES } from '../../constants'; | ||
|
||
import ResultsSummary from './resultsComponents/ResultsSummary'; | ||
|
||
const ResultsPage = ({ formResponses, router, viewedIntroPage }) => { | ||
const H1 = 'Your Steps for Upgrading Your Discharge'; | ||
|
||
useEffect( | ||
() => { | ||
pageSetup(H1); | ||
}, | ||
[H1], | ||
); | ||
|
||
useEffect( | ||
() => { | ||
if (!viewedIntroPage) { | ||
router.push(ROUTES.HOME); | ||
} | ||
}, | ||
[router, viewedIntroPage], | ||
); | ||
|
||
return ( | ||
<article className="dw-guidance" data-testId="duw-results"> | ||
<h1>{H1}</h1> | ||
<div className="medium-8"> | ||
<ResultsSummary formResponses={formResponses} /> | ||
</div> | ||
</article> | ||
); | ||
}; | ||
|
||
ResultsPage.propTypes = { | ||
formResponses: PropTypes.object.isRequired, | ||
router: PropTypes.shape({ | ||
push: PropTypes.func, | ||
}).isRequired, | ||
viewedIntroPage: PropTypes.bool.isRequired, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
formResponses: state?.dischargeUpgradeWizard?.duwForm?.form, | ||
viewedIntroPage: state?.dischargeUpgradeWizard?.duwForm?.viewedIntroPage, | ||
}); | ||
|
||
export default connect(mapStateToProps)(ResultsPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/applications/discharge-wizard/components/v2/resultsComponents/ResultsSummary.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
determineBoardObj, | ||
determineAirForceAFRBAPortal, | ||
determineFormData, | ||
} from '../../../helpers'; | ||
|
||
import { | ||
SHORT_NAME_MAP, | ||
RESPONSES, | ||
} from '../../../constants/question-data-map'; | ||
|
||
const ResultsSummary = ({ formResponses }) => { | ||
const forReconsideration = | ||
[ | ||
RESPONSES.PREV_APPLICATION_TYPE_3A, | ||
RESPONSES.PREV_APPLICATION_TYPE_3B, | ||
].includes(formResponses[SHORT_NAME_MAP.PREV_APPLICATION_TYPE]) && | ||
![ | ||
RESPONSES.FAILURE_TO_EXHAUST_1A, | ||
RESPONSES.FAILURE_TO_EXHAUST_1B, | ||
].includes(formResponses[SHORT_NAME_MAP.FAILURE_TO_EXHAUST]); | ||
|
||
const airForceAFRBAPortal = determineAirForceAFRBAPortal(formResponses); | ||
const formNumber = determineFormData(formResponses).num; | ||
const dischargeBoard = determineBoardObj(formResponses).name; | ||
const serviceBranch = formResponses[SHORT_NAME_MAP.SERVICE_BRANCH]; | ||
const isReconsideration = forReconsideration ? ' for reconsideration' : ''; | ||
|
||
let summary = `Based on your answers, you need to complete Department of Defense (DoD) Form ${formNumber} and send it to the ${dischargeBoard} for the ${serviceBranch} ${isReconsideration}.`; | ||
|
||
if (airForceAFRBAPortal) { | ||
summary = | ||
'Based on your answers, you need to complete an Application for Correction of Military Record (DD 149). You can download this form from the Air Force Review Boards Agency Website and Portal.'; | ||
} | ||
|
||
return ( | ||
<section className="va-introtext"> | ||
<p>{summary}</p> | ||
</section> | ||
); | ||
}; | ||
|
||
ResultsSummary.propTypes = { | ||
formResponses: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default ResultsSummary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.