Skip to content

Commit

Permalink
[96896] Appoint a Rep dynamic authorizations (#33248)
Browse files Browse the repository at this point in the history
* dynamic authorizations

* add unit tests for auth components

* cleanup use of props and redux
  • Loading branch information
jvcAdHoc authored Dec 12, 2024
1 parent ecc6a66 commit c3052a7
Show file tree
Hide file tree
Showing 26 changed files with 1,311 additions and 185 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const AddressAuthorizationDescription = ({ formData }) => {
return (
<>
<h3>Authorization to change your address</h3>
<p className="appoint-text">
This accredited {getRepType(formData['view:selectedRepresentative'])}{' '}
can help you change the address on your VA records. If the address on
your VA records is incorrect or outdated, it may take us longer to
contact you and process your benefit claims.
</p>
</>
);
};

AddressAuthorizationDescription.propTypes = {
formData: PropTypes.object,
};

export { AddressAuthorizationDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getFormNumber } from '../utilities/helpers';

const AddressAuthorizationPolicy = props => {
const { formData } = props;

return (
<div className="vads-u-margin-y--3">
<va-accordion uswds bordered open-single>
<va-accordion-item bordered header="Our address authorization policy">
{getFormNumber(formData) === '21-22' ? (
<p data-testid="address-authorization-policy-2122">
<strong>I authorize</strong> any official representative of the
organization named in Item 15 to act on my behalf to change my
address in my VA records. This authorization does not extend to
any other organization without my further written consent. This
authorization will remain in effect until the earlier of the
following events: (1) I revoke this authorization by filing a
written revocation with VA; or (2) I appoint another
representative, or (3) I have been determined unable to manage my
financial affairs and the individual or organization named in Item
16A is not my appointed fiduciary.
</p>
) : (
<p data-testid="address-authorization-policy-2122a">
<strong>I authorize</strong> the individual named in Item 16A to
act on my behalf to change my address in my VA records. This
authorization does not extend to any other individual without my
further written consent. This authorization will remain in effect
until the earlier of the following events: (1) I revoke this
authorization by filing a written revocation with VA; or (2) I
revoke the appointment of the individual named in Item 16A, either
by explicit revocation or the appointment of another
representative.
</p>
)}
</va-accordion-item>
</va-accordion>
</div>
);
};

AddressAuthorizationPolicy.propTypes = {
formData: PropTypes.object,
};

const mapStateToProps = state => ({
formData: state.form?.data || {},
});

export default connect(
mapStateToProps,
null,
)(AddressAuthorizationPolicy);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const InsideVAAuthorizationDescription = ({ formData }) => {
return (
<>
<h3>Authorization for access through VA’s systems</h3>
<p className="appoint-text">
This accredited {getRepType(formData['view:selectedRepresentative'])}{' '}
may work with their team to help you file a claim or request a decision
review. Some of their team members may need to access your records
through VA’s information technology systems.
</p>
</>
);
};

InsideVAAuthorizationDescription.propTypes = {
formData: PropTypes.object,
};

export { InsideVAAuthorizationDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const MedicalAuthorizationDescription = ({ formData }) => {
return (
<>
<h3>Authorization to access certain medical records</h3>
<p className="appoint-text">
This accredited {getRepType(formData['view:selectedRepresentative'])}{' '}
may need to access certain medical records to help you. You can
authorize them to access all or some of these types of records:
</p>
<ul className="appoint-text">
<li>Alcoholism and alcohol abuse records</li>
<li>Drug abuse records</li>
<li>HIV (human immunodeficiency virus) records</li>
<li>Sickle cell anemia records</li>
</ul>
</>
);
};

MedicalAuthorizationDescription.propTypes = {
formData: PropTypes.object,
};

export { MedicalAuthorizationDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getFormNumber } from '../utilities/helpers';

const MedicalAuthorizationPolicy = props => {
const { formData } = props;

return (
<div className="vads-u-margin-y--3">
<va-accordion uswds bordered open-single>
<va-accordion-item bordered header="Our records authorization policy">
{getFormNumber(formData) === '21-22' ? (
<p data-testid="medical-authorization-policy-2122">
<strong>I authorize</strong> the VA facility having custody of my
VA claimant records to disclose to the service organization named
in Item 15 all treatment records relating to drug abuse,
alcoholism or alcohol abuse, infection with the human
immunodeficiency virus (HIV), or sickle cell anemia. Redisclosure
of these records by my service organization representative, other
than to VA or the Court of Appeals for Veterans Claims, is not
authorized without my further written consent. This authorization
will remain in effect until the earlier of the following events:
(1) I revoke this authorization by filing a written revocation
with VA; or (2) I revoke the appointment of the service
organization named in Item 15, by explicit revocation or the
appointment of another representative.
</p>
) : (
<p data-testid="medical-authorization-policy-2122a">
<strong>I authorize</strong> the VA facility having custody of my
VA claimant records to disclose to the individual named in Item
16A, and the firm/organization/individual(s) named in Item 19 (if
approved by VA for affiliated access) all treatment records
relating to drug abuse, alcoholism or alcohol abuse, infection
with the human immunodeficiency virus (HIV), or sickle cell
anemia. Redisclosure of further written consent. This
authorization will remain in effect until the earlier of the
following events: (1) I revoke this authorization by filing a
written revocation with VA; or (2) I revoke the appointment of the
individual named in Item 16A, either by explicit revocation or the
appointment of another representative. representative.
</p>
)}
</va-accordion-item>
</va-accordion>
</div>
);
};

MedicalAuthorizationPolicy.propTypes = {
formData: PropTypes.object,
};

const mapStateToProps = state => ({
formData: state.form?.data || {},
});

export default connect(
mapStateToProps,
null,
)(MedicalAuthorizationPolicy);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const MedicalSelectAuthorizationDescription = ({ formData }) => {
return (
<>
<h3>Authorization to access certain medical records</h3>
<p className="vads-u-margin-bottom--3 appoint-text">
You’ve authorized this accredited{' '}
{getRepType(formData['view:selectedRepresentative'])} to access some of
your medical records.
</p>
</>
);
};

MedicalSelectAuthorizationDescription.propTypes = {
formData: PropTypes.object,
};

export { MedicalSelectAuthorizationDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const OutsideVAAuthorizationDescription = ({ formData }) => {
return (
<>
<h3>Authorization for access outside of VA’s systems</h3>
<p className="appoint-text">
This accredited {getRepType(formData['view:selectedRepresentative'])}{' '}
may work with their team to help you file a claim or request a decision
review. Some of their team members may need to access your records
outside of VA’s information technology systems.
</p>
</>
);
};

OutsideVAAuthorizationDescription.propTypes = {
formData: PropTypes.object,
};

export { OutsideVAAuthorizationDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import PropTypes from 'prop-types';
import { getRepType } from '../utilities/helpers';

const OutsideVAAuthorizationNameDescription = ({ formData }) => {
return (
<>
<h3>Authorization for access outside of VA’s systems</h3>
<p className="appoint-text">
You’ve authorized this accredited{' '}
{getRepType(formData['view:selectedRepresentative'])}
’s team to access your records outside of VA’s information technology
systems.
</p>
</>
);
};

OutsideVAAuthorizationNameDescription.propTypes = {
formData: PropTypes.object,
};

export { OutsideVAAuthorizationNameDescription };
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { getRepType } from '../utilities/helpers';

const OutsideVAAuthorizationUnsureNote = props => {
const { formData } = props;

return (
<>
<p className="appoint-text">
<strong>Note:</strong> If you’re not sure who to enter, ask the
accredited {getRepType(formData['view:selectedRepresentative'])} you’re
appointing.{' '}
</p>
</>
);
};

OutsideVAAuthorizationUnsureNote.propTypes = {
formData: PropTypes.object,
};

const mapStateToProps = state => ({
formData: state.form?.data || {},
});

export default connect(
mapStateToProps,
null,
)(OutsideVAAuthorizationUnsureNote);
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,25 @@ import {
radioSchema,
radioUI,
} from '~/platform/forms-system/src/js/web-component-patterns';
import AddressAuthorizationPolicy from '../../components/AddressAuthorizationPolicy';
import { AddressAuthorizationDescription } from '../../components/AddressAuthorizationDescription';
import { authorizationNote } from '../../content/authorizeMedical';
import { representativeTypeMap } from '../../utilities/helpers';
import { getRepType } from '../../utilities/helpers';

export const uiSchema = {
'ui:description': ({ formData }) => {
return (
<>
<h3>Authorization to change your address</h3>
<p className="appoint-text">
This accredited{' '}
{representativeTypeMap[formData.repTypeRadio] || 'representative'} can
help you change the address on your VA records. If the address on your
VA records is incorrect or outdated, it may take us longer to contact
you and process your benefit claims.
</p>
</>
);
},
'ui:description': ({ formData }) => (
<AddressAuthorizationDescription formData={formData} />
),
'view:addressAuthorizationPolicy': {
'ui:description': () => {
return (
<div className="vads-u-margin-y--3">
<va-accordion uswds bordered open-single>
<va-accordion-item
bordered
header="Our address authorization policy"
>
<p>
<strong>I authorize</strong> any official representative of the
organization named in Item 15 to act on my behalf to change my
address in my VA records. This authorization does not extend to
any other organization without my further written consent. This
authorization will remain in effect until the earlier of the
following events: (1) I revoke this authorization by filing a
written revocation with VA; or (2) I appoint another
representative, or (3) I have been determined unable to manage
my financial affairs and the individual or organization named in
Item 16A is not my appointed fiduciary.
</p>
</va-accordion-item>
</va-accordion>
</div>
);
},
'ui:description': <AddressAuthorizationPolicy />,
},
authorizeAddressRadio: radioUI({
title:
'Do you authorize this accredited representative to change your address on VA records?',
updateUiSchema: formData => {
const title = `Do you authorize this accredited ${representativeTypeMap[
(formData?.repTypeRadio)
] || 'representative'} to change your address on VA records?`;
const title = `Do you authorize this accredited ${getRepType(
formData['view:selectedRepresentative'],
)} to change your address on VA records?`;
return { 'ui:title': title };
},
}),
Expand All @@ -74,7 +41,7 @@ export const schema = {
},
authorizeAddressRadio: radioSchema([
`Yes, they can change my address if it’s incorrect or outdated`,
`No, they can't change my address`,
`No, they cant change my address`,
]),
'view:authorizationNote3': {
type: 'object',
Expand Down
Loading

0 comments on commit c3052a7

Please sign in to comment.