generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 222-update-fi-profile-phase2-mail-api-integr…
…ation
- Loading branch information
Showing
20 changed files
with
611 additions
and
69 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { request } from 'api/axiosService'; | ||
import type { SblAuthProperties } from 'api/useSblAuth'; | ||
import type { FormattedPointOfContactSchema } from 'types/formTypes'; | ||
|
||
const submitPointOfContact = async ( | ||
auth: SblAuthProperties, | ||
userProfileObject: FormattedPointOfContactSchema, | ||
): Promise<null> => { | ||
return request<null>({ | ||
// This will eventually be `/v1/filing/institutions/{lei}/filings/{period_name}/contact-info` | ||
// CURRENTLY HARDCODED | ||
url: `/v1/filing/institutions/123456789TESTBANK123/filings/2024/contact-info`, | ||
method: 'put', | ||
body: userProfileObject, | ||
headers: { Authorization: `Bearer ${auth.user?.access_token}` }, | ||
}); | ||
}; | ||
|
||
export default submitPointOfContact; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { ReactNode } from 'react'; | ||
|
||
interface FormProperties { | ||
children: ReactNode; | ||
} | ||
|
||
/** | ||
* | ||
* @returns FormParagraph | ||
*/ | ||
function FormMain({ | ||
children, | ||
className = '', | ||
}: FormProperties & React.ComponentPropsWithoutRef<'form'>): JSX.Element { | ||
return <form className={`mb-[3.75rem] w-full ${className}`}>{children}</form>; | ||
} | ||
|
||
export default FormMain; |
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
78 changes: 78 additions & 0 deletions
78
src/pages/Filing/UpdateFinancialProfile/TypesFinancialInstitutionSection.tsx
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,78 @@ | ||
import FieldGroup from 'components/FieldGroup'; | ||
import InputEntry from 'components/InputEntry'; | ||
import { Checkbox, Heading, List, ListItem } from 'design-system-react'; | ||
import type { | ||
Control, | ||
FieldErrors, | ||
UseFormRegister, | ||
UseFormSetValue, | ||
} from 'react-hook-form'; | ||
import { Controller as FormController } from 'react-hook-form'; | ||
import { Zero } from 'utils/constants'; | ||
import type { CheckboxOption, UFPSchema } from './types'; | ||
import { checkboxOptions } from './types'; | ||
|
||
interface TypesFinancialInstitutionSectionProperties { | ||
register: UseFormRegister<UFPSchema>; | ||
setValue: UseFormSetValue<UFPSchema>; | ||
formErrors: FieldErrors<UFPSchema>; | ||
control: Control<UFPSchema>; | ||
} | ||
|
||
function TypesFinancialInstitutionSection({ | ||
register, | ||
setValue, | ||
formErrors, | ||
control, | ||
}: TypesFinancialInstitutionSectionProperties): JSX.Element { | ||
// const typeOtherData = data.sbl_institution_types.find(item => { | ||
// return item.sbl_type.id === sblInstitutionTypeMap.other; | ||
// }); | ||
return ( | ||
<FieldGroup> | ||
<Heading type='4'>Type(s) of financial institution</Heading> | ||
<List isUnstyled> | ||
{checkboxOptions.map((option: CheckboxOption): JSX.Element => { | ||
const optionId = `sbl_institution_types.${option.id}`; | ||
|
||
const onCheckboxChange = ( | ||
event: React.ChangeEvent<HTMLInputElement>, | ||
): void => { | ||
setValue(optionId, event.target.checked); | ||
}; | ||
|
||
return ( | ||
<ListItem key={option.id}> | ||
<FormController | ||
render={({ field }) => { | ||
return ( | ||
<Checkbox | ||
id={option.id} | ||
label={option.label} | ||
{...register(optionId)} | ||
checked={field.value} | ||
onChange={onCheckboxChange} | ||
/> | ||
); | ||
}} | ||
control={control} | ||
name={optionId} | ||
/> | ||
</ListItem> | ||
); | ||
})} | ||
</List> | ||
<InputEntry | ||
label='' | ||
id='institutionTypeOther' | ||
{...register('sbl_institution_types_other', { | ||
// value: typeOtherData?.details, | ||
})} | ||
errorMessage={formErrors[Zero]} | ||
showError | ||
/> | ||
</FieldGroup> | ||
); | ||
} | ||
|
||
export default TypesFinancialInstitutionSection; |
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.