From 0bd6f28707b857417b59879818f9e794460ace40 Mon Sep 17 00:00:00 2001 From: Colin <143013011+cosu419@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:23:32 -0800 Subject: [PATCH] pdf transform logic now matches backend shape (#33100) * pdf transform logic now matches backend shape * Updated action link titles * Open link in new tab * Opens link in new tab * Updated redirect --- .../components/ClaimantTypeForm.jsx | 2 +- .../components/ProfileNotUpdatedNote.jsx | 3 ++- .../SelectAccreditedRepresentative.jsx | 1 + .../containers/IntroductionPage.jsx | 2 +- .../containers/NextStepsPage.jsx | 8 ++++-- .../utilities/pdfTransform.js | 26 ++++++++++++++----- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/applications/representative-appoint/components/ClaimantTypeForm.jsx b/src/applications/representative-appoint/components/ClaimantTypeForm.jsx index 83dc684fb90e..82fcbb57d782 100644 --- a/src/applications/representative-appoint/components/ClaimantTypeForm.jsx +++ b/src/applications/representative-appoint/components/ClaimantTypeForm.jsx @@ -11,7 +11,7 @@ const ClaimantTypeForm = props => { return (

Tell us who you are

{' '} diff --git a/src/applications/representative-appoint/components/ProfileNotUpdatedNote.jsx b/src/applications/representative-appoint/components/ProfileNotUpdatedNote.jsx index 4a4c18ee9a2c..bfff460fe062 100644 --- a/src/applications/representative-appoint/components/ProfileNotUpdatedNote.jsx +++ b/src/applications/representative-appoint/components/ProfileNotUpdatedNote.jsx @@ -32,8 +32,9 @@ function ProfileNotUpdatedNote(props) { <> )} diff --git a/src/applications/representative-appoint/components/SelectAccreditedRepresentative.jsx b/src/applications/representative-appoint/components/SelectAccreditedRepresentative.jsx index 3aea4bba6ea5..796ee15b099f 100644 --- a/src/applications/representative-appoint/components/SelectAccreditedRepresentative.jsx +++ b/src/applications/representative-appoint/components/SelectAccreditedRepresentative.jsx @@ -198,6 +198,7 @@ const SelectAccreditedRepresentative = props => {
diff --git a/src/applications/representative-appoint/containers/IntroductionPage.jsx b/src/applications/representative-appoint/containers/IntroductionPage.jsx index 5e355e93c840..b8a2c93f5d69 100644 --- a/src/applications/representative-appoint/containers/IntroductionPage.jsx +++ b/src/applications/representative-appoint/containers/IntroductionPage.jsx @@ -29,7 +29,7 @@ const IntroductionPage = props => {

diff --git a/src/applications/representative-appoint/containers/NextStepsPage.jsx b/src/applications/representative-appoint/containers/NextStepsPage.jsx index 685324affa77..44f381cc00a4 100644 --- a/src/applications/representative-appoint/containers/NextStepsPage.jsx +++ b/src/applications/representative-appoint/containers/NextStepsPage.jsx @@ -24,7 +24,7 @@ export default function NextStepsPage() { return (

Your next steps

@@ -43,7 +43,11 @@ export default function NextStepsPage() { After your form is signed, you or the accredited {repType} can submit it online, by mail, or in person.

- +

After you submit your printed form

diff --git a/src/applications/representative-appoint/utilities/pdfTransform.js b/src/applications/representative-appoint/utilities/pdfTransform.js index b357e76d2627..e2679763b09e 100644 --- a/src/applications/representative-appoint/utilities/pdfTransform.js +++ b/src/applications/representative-appoint/utilities/pdfTransform.js @@ -1,7 +1,7 @@ import { getRepType } from './helpers'; function consentLimitsTransform(formData) { - const authorizeRecords = formData['view:authorizeRecordsCheckbox'] || {}; + const authorizeRecords = formData.authorizeMedicalSelectCheckbox || {}; const conditionsMap = { alcoholRecords: 'ALCOHOLISM', @@ -15,6 +15,13 @@ function consentLimitsTransform(formData) { .map(([, value]) => value); } +function yesNoToBoolean(field) { + if (typeof field !== 'string') { + return null; + } + return !!field.trim().startsWith('Yes'); +} + export function pdfTransform(formData) { const { veteranFullName, @@ -29,14 +36,17 @@ export function pdfTransform(formData) { applicantName, applicantDOB, claimantRelationship, + 'Branch of Service': serviceBranch, homeAddress: claimantAddress, authorizationRadio, authorizeAddressRadio, + authorizeInsideVARadio, + authorizeOutsideVARadio, + authorizeNamesTextArea, applicantPhone, applicantEmail, } = formData; - // extracts address information const createAddress = (address = {}) => ({ addressLine1: address.street || '', addressLine2: address.street2 || '', @@ -47,7 +57,6 @@ export function pdfTransform(formData) { zipCodeSuffix: address.zipCodeSuffix || '', }); - // construct veteran object const veteran = { name: { first: veteranFullName?.first || '', @@ -58,7 +67,7 @@ export function pdfTransform(formData) { vaFileNumber, dateOfBirth, serviceNumber, - insuranceNumbers: [], + serviceBranch, address: createAddress(homeAddress), phone, email, @@ -102,9 +111,14 @@ export function pdfTransform(formData) { return { veteran, - recordConsent: authorizationRadio || '', - consentAddressChange: authorizeAddressRadio || '', + recordConsent: yesNoToBoolean(authorizationRadio), + consentAddressChange: yesNoToBoolean(authorizeAddressRadio), consentLimits: consentLimitsTransform(formData), + consentInsideAccess: yesNoToBoolean(authorizeInsideVARadio), + consentOutsideAccess: yesNoToBoolean(authorizeOutsideVARadio), + consentTeamMembers: authorizeNamesTextArea + .split(',') + .map(item => item.trim()), representative, ...(formData['view:applicantIsVeteran'] === 'No' && { claimant }), };