|
1 |
| -import React from 'react'; |
| 1 | +import React, { useEffect } from 'react'; |
2 | 2 | import PropTypes from 'prop-types';
|
3 | 3 |
|
4 |
| -const ReviewPage = ({ handlers }) => { |
| 4 | +import { |
| 5 | + VaCheckbox, |
| 6 | + VaButtonPair, |
| 7 | +} from '@department-of-veterans-affairs/component-library/dist/react-bindings'; |
| 8 | +import { focusElement, scrollToTop } from 'platform/utilities/ui'; |
| 9 | + |
| 10 | +import { formatDateTime } from '../../../util/dates'; |
| 11 | +import TravelAgreementContent from '../../TravelAgreementContent'; |
| 12 | + |
| 13 | +const ReviewPage = ({ |
| 14 | + appointment, |
| 15 | + address, |
| 16 | + onSubmit, |
| 17 | + setPageIndex, |
| 18 | + setYesNo, |
| 19 | + isAgreementChecked, |
| 20 | + setIsAgreementChecked, |
| 21 | +}) => { |
| 22 | + useEffect(() => { |
| 23 | + focusElement('h1'); |
| 24 | + scrollToTop('topScrollElement'); |
| 25 | + }, []); |
| 26 | + |
| 27 | + const [formattedDate, formattedTime] = formatDateTime( |
| 28 | + appointment.vaos.apiData.start, |
| 29 | + ); |
| 30 | + |
| 31 | + const onBack = () => { |
| 32 | + setYesNo({ |
| 33 | + mileage: '', |
| 34 | + vehicle: '', |
| 35 | + address: '', |
| 36 | + }); |
| 37 | + setPageIndex(1); |
| 38 | + }; |
| 39 | + |
5 | 40 | return (
|
6 | 41 | <div>
|
7 |
| - <h1 className="vad-u-margin-top--0">Review your travel claim</h1> |
| 42 | + <h1 tabIndex="-1">Review your travel claim</h1> |
8 | 43 | <p>Confirm the information is correct before you submit your claim.</p>
|
9 | 44 |
|
10 |
| - <div className="vads-u-margin-y--2"> |
11 |
| - <va-button text="Back" onClick={e => handlers.onBack(e)} /> |
12 |
| - <va-button text="Submit" onClick={e => handlers.onSubmit(e)} /> |
13 |
| - </div> |
| 45 | + <h2 className="vads-u-margin-bottom--0">Claims</h2> |
| 46 | + <hr className="vads-u-margin-y--1" /> |
| 47 | + <h3 className="vads-u-font-size--h4 vads-u-font-family--sans vads-u-margin-bottom--0 vads-u-margin-top--2"> |
| 48 | + What you’re claiming |
| 49 | + </h3> |
| 50 | + <p className="vads-u-margin-y--0"> |
| 51 | + Mileage-only reimbursement for your appointment at{' '} |
| 52 | + {appointment.vaos.apiData.location.attributes.name}{' '} |
| 53 | + {appointment.vaos?.apiData?.practitioners |
| 54 | + ? `with ${appointment.vaos.apiData.practitioners[0].name.given.join( |
| 55 | + ' ', |
| 56 | + )} ${appointment.vaos.apiData.practitioners[0].name.family}` |
| 57 | + : ''}{' '} |
| 58 | + on {formattedDate}, {formattedTime}. |
| 59 | + </p> |
| 60 | + |
| 61 | + <h2 className="vads-u-margin-bottom--0">Travel method</h2> |
| 62 | + <hr className="vads-u-margin-y--1" /> |
| 63 | + <h3 className="vads-u-font-size--h4 vads-u-font-family--sans vads-u-margin-bottom--0 vads-u-margin-top--2"> |
| 64 | + How you traveled |
| 65 | + </h3> |
| 66 | + <p className="vads-u-margin-y--0">In your own vehicle</p> |
| 67 | + |
| 68 | + <h2 className="vads-u-margin-bottom--0">Starting address</h2> |
| 69 | + <hr className="vads-u-margin-y--1" /> |
| 70 | + <h3 className="vads-u-font-size--h4 vads-u-font-family--sans vads-u-margin-bottom--0 vads-u-margin-top--2"> |
| 71 | + Where you traveled from |
| 72 | + </h3> |
| 73 | + <p className="vads-u-margin-bottom--3 vads-u-margin-top--0"> |
| 74 | + {address.addressLine1} |
| 75 | + <br /> |
| 76 | + {address.addressLine2 && ( |
| 77 | + <> |
| 78 | + {address.addressLine2} |
| 79 | + <br /> |
| 80 | + </> |
| 81 | + )} |
| 82 | + {address.addressLine3 && ( |
| 83 | + <> |
| 84 | + {address.addressLine3} |
| 85 | + <br /> |
| 86 | + </> |
| 87 | + )} |
| 88 | + {`${address.city}, ${address.stateCode} ${address.zipCode}`} |
| 89 | + <br /> |
| 90 | + </p> |
| 91 | + |
| 92 | + <va-card background> |
| 93 | + <h3 className="vad-u-margin-bottom--2 vads-u-margin-top--0"> |
| 94 | + Beneficiary travel agreement |
| 95 | + </h3> |
| 96 | + <p> |
| 97 | + <strong>Penalty statement:</strong> There are severe criminal and |
| 98 | + civil penalties, including a fine, imprisonment, or both, for |
| 99 | + knowingly submitting a false, fictitious, or fraudulent claim. |
| 100 | + </p> |
| 101 | + <p> |
| 102 | + By submitting this claim, you agree to the beneficiary travel |
| 103 | + agreement. |
| 104 | + </p> |
| 105 | + <TravelAgreementContent /> |
| 106 | + <VaCheckbox |
| 107 | + className="vads-u-margin-x--1 vads-u-margin-y--2" |
| 108 | + checked={isAgreementChecked} |
| 109 | + name="accept-agreement" |
| 110 | + description={null} |
| 111 | + error={ |
| 112 | + !isAgreementChecked |
| 113 | + ? 'You must accept the beneficiary travel agreement before continuing.' |
| 114 | + : null |
| 115 | + } |
| 116 | + hint={null} |
| 117 | + label="I confirm that the information is true and correct to the best of my knowledge and belief. I’ve read and I accept the beneficiary travel agreement." |
| 118 | + onVaChange={() => setIsAgreementChecked(!isAgreementChecked)} |
| 119 | + required |
| 120 | + /> |
| 121 | + </va-card> |
| 122 | + |
| 123 | + <VaButtonPair |
| 124 | + class="vads-u-margin-top--2" |
| 125 | + leftButtonText="File claim" |
| 126 | + rightButtonText="Start over" |
| 127 | + onPrimaryClick={onSubmit} |
| 128 | + onSecondaryClick={onBack} |
| 129 | + /> |
14 | 130 | </div>
|
15 | 131 | );
|
16 | 132 | };
|
17 | 133 |
|
18 | 134 | ReviewPage.propTypes = {
|
19 |
| - handlers: PropTypes.shape({ |
20 |
| - onBack: PropTypes.func, |
21 |
| - onSubmit: PropTypes.func, |
22 |
| - }), |
| 135 | + address: PropTypes.object, |
| 136 | + appointment: PropTypes.object, |
| 137 | + isAgreementChecked: PropTypes.bool, |
| 138 | + setIsAgreementChecked: PropTypes.func, |
| 139 | + setPageIndex: PropTypes.func, |
| 140 | + setYesNo: PropTypes.func, |
| 141 | + onSubmit: PropTypes.func, |
23 | 142 | };
|
24 | 143 |
|
25 | 144 | export default ReviewPage;
|
0 commit comments