Skip to content

Commit

Permalink
pre-zod schema addition work
Browse files Browse the repository at this point in the history
  • Loading branch information
shindigira committed Oct 23, 2024
1 parent f61a91e commit fed4e21
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/pages/Filing/FilingApp/FilingSubmit.helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function VoluntaryReportingStatus({
label='My financial institution is voluntarily reporting covered applications from small businesses, and I am not required to file.'
checked={value}
onChange={onChange}
disabled
// disabled
/>
</WellContainer>
</FormSectionWrapper>
Expand Down Expand Up @@ -192,7 +192,7 @@ export function SignCertify({
label={`I, ${name}, am an authorized representative of my financial institution with knowledge of the data and certify the accuracy and completeness of the data reported.`}
checked={value}
onChange={onChange}
disabled
// disabled
/>
</WellContainer>
</FormSectionWrapper>
Expand Down
31 changes: 17 additions & 14 deletions src/pages/Filing/FilingApp/FilingSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
import WrapperPageContent from 'WrapperPageContent';
import Links from 'components/CommonLinks';
import { LoadingContent } from 'components/Loading';
import {
Alert,
Checkbox,
Grid,
Link,
Paragraph,
TextIntroduction,
} from 'design-system-react';
import { Alert, Checkbox, Grid, TextIntroduction } from 'design-system-react';
import type { ChangeEvent } from 'react';
import { useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
Expand Down Expand Up @@ -61,6 +54,8 @@ export function FilingSubmit(): JSX.Element {
const [submitted, setSubmitted] = useState(false);
const navigate = useNavigate();

console.log('checkboxValues:', checkboxValues);

const {
isError: userError,
isLoading: userLoading,
Expand Down Expand Up @@ -206,13 +201,19 @@ export function FilingSubmit(): JSX.Element {
description={getDescriptionForSignAndSubmitSection()}
/>
<div className='u-mt30'>
{/* TODO: Combine Checkbox with InputErrorMessage into one component */}
<Checkbox
id='fi-details'
label='The details for my financial institution are accurate and complete.'
checked={checkboxValues.institution}
onChange={onCheckboxUpdate('institution')}
disabled
// disabled
/>
{/* {!initState.institution ? (
<div>
<InputErrorMessage>{'errorMessage - institution'}</InputErrorMessage>
</div>
) : null} */}
</div>

<IdentifyingInformation
Expand All @@ -226,7 +227,7 @@ export function FilingSubmit(): JSX.Element {
label='The identifying information for my financial institution is accurate and complete. '
checked={checkboxValues.identifying}
onChange={onCheckboxUpdate('identifying')}
disabled
// disabled
/>
</div>

Expand All @@ -241,7 +242,7 @@ export function FilingSubmit(): JSX.Element {
label='The parent entity information for my financial institution is accurate and complete, or my financial institution does not have a parent entity so this section is not applicable.'
checked={checkboxValues.affiliate}
onChange={onCheckboxUpdate('affiliate')}
disabled
// disabled
/>
</div>

Expand All @@ -253,7 +254,7 @@ export function FilingSubmit(): JSX.Element {
label='The point of contact information for my financial institution is accurate and complete.'
checked={checkboxValues.poc}
onChange={onCheckboxUpdate('poc')}
disabled
// disabled
/>
</div>

Expand Down Expand Up @@ -292,9 +293,11 @@ export function FilingSubmit(): JSX.Element {
/>
</Grid.Column>
</Grid.Row>

<Grid.Row>
<Grid.Column width={8} className='u-mt0 u-mb60'>
<Alert
{/* TODO: Make this dynamic */}
{/* <Alert
status='success'
message='Congratulations! You have reached the end of the beta filing process.'
>
Expand All @@ -310,7 +313,7 @@ export function FilingSubmit(): JSX.Element {
with your feedback or <Links.UploadANewFile /> to continue
testing.
</Paragraph>
</Alert>
</Alert> */}
</Grid.Column>
</Grid.Row>
</Grid.Wrapper>
Expand Down
17 changes: 17 additions & 0 deletions src/types/formTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,20 @@ export type FormattedPointOfContactSchema = Omit<
phone_number: string;
phone_ext: string | undefined;
};

// Sign and Submit - Checkboxes Schema

// Define the schema with Zod
// const schema = z.object({
// months: z
// .array(z.string())
// .refine((val) => val.length > 0, {
// message: "Please select at least one month.",
// })
// .refine((val) => {
// const missingMonths = allMonths.filter(month => !val.includes(month));
// return missingMonths.length === 0; // Ensure no months are missing
// }, {
// message: "Please select all months."
// }),
// });

0 comments on commit fed4e21

Please sign in to comment.