Skip to content

Commit

Permalink
feat(DL): made drivers license optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
crisner1978 committed Jun 12, 2024
1 parent c29eabd commit a889752
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 36 deletions.
17 changes: 2 additions & 15 deletions src/components/sections/DriverLicense/JointLicense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,21 @@ const JointLicense = () => {
<div className='px-5 py-6 sm:p-8'>
<div className='grid max-w-3xl grid-cols-1 gap-y-8 sm:grid-cols-6 sm:gap-x-6'>
<InputField
{...register('co_licenseNumber', { required: 'Required' })}
{...register('co_licenseNumber')}
errormsg={errors?.co_licenseNumber?.message!}
variant='sm:col-span-3 whitespace-nowrap'
placeholder='123456789'
label='License Number*'
/>

<SelectField
{...register('co_licenseState', { required: 'Required' })}
{...register('co_licenseState')}
variant='sm:col-span-3 whitespace-nowrap'
label='License State*'
placeholder='Select'
defaultValue=''
cats={states}
errormsg={errors?.co_licenseState?.message!}
/>
{/* <DateField
rules={{
required: 'Required',
}}
errormsg={errors?.co_licenseExp?.message!}
variant='col-span-1 sm:col-span-2'
label='License Expiration*'
name='co_licenseExp'
placeholder='Not more than 3mo expired'
minDate={moment().subtract(3, 'months').toDate()}
defaultValue={defaultValue}
/> */}
</div>
</div>
</div>
Expand Down
17 changes: 2 additions & 15 deletions src/components/sections/DriverLicense/PrimaryLicense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useFormContext } from 'react-hook-form'
const PrimaryLicense = () => {
const {
register,

formState: { errors },
} = useFormContext()

Expand All @@ -15,33 +14,21 @@ const PrimaryLicense = () => {
<div className='px-5 py-6 sm:p-8'>
<div className='grid max-w-3xl grid-cols-1 gap-y-8 sm:grid-cols-6 sm:gap-x-6'>
<InputField
{...register('licenseNumber', { required: 'Required' })}
{...register('licenseNumber')}
errormsg={errors?.licenseNumber?.message!}
variant='sm:col-span-3 whitespace-nowrap'
placeholder='123456789'
label='License Number*'
/>
<SelectField
{...register('licenseState', { required: 'Required' })}
{...register('licenseState')}
variant='sm:col-span-3 whitespace-nowrap'
label='License State*'
placeholder='Select'
defaultValue=''
cats={states}
errormsg={errors?.licenseState?.message!}
/>
{/* <DateField
rules={{
required: 'Required',
}}
errormsg={errors?.licenseExp?.message!}
variant='col-span-1 sm:col-span-2'
label='License Expiration*'
name='licenseExp'
placeholder='Not more than 3mo expired'
minDate={moment().subtract(3, 'months').toDate()}
defaultValue={defaultValue}
/> */}
</div>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/lib/actions/slack.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ export function formatSlackApplicant(applicant: CreditApplicant, role: 'Primary'
)
)
}
blocks.push(
createSlackSection(
`*Drivers License*\n*License number:* ${applicant.licenseNumber}\n*State:* ${applicant.licenseState}`
if (applicant.licenseNumber && applicant.licenseState) {
blocks.push(
createSlackSection(
`*Drivers License*\n*License number:* ${applicant.licenseNumber}\n*State:* ${applicant.licenseState}`
)
)
)
}
blocks.push(
createSlackSection(
`*Employment History*\n*Employer name:* ${applicant.employerName}\n*Employment Status:* ${
Expand Down
4 changes: 2 additions & 2 deletions typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export interface CreditApplicant {
addressYears: string
addressMonths: string
rentMortgagePaymentAmount: string
licenseNumber: string
licenseState: string
licenseNumber?: string
licenseState?: string
employerName: string
employmentStatusCode: string
employerPhone: string
Expand Down

0 comments on commit a889752

Please sign in to comment.