diff --git a/frontend/src/components/intake/personal-info-form.tsx b/frontend/src/components/intake/personal-info-form.tsx index 22ac5609..0be88e31 100644 --- a/frontend/src/components/intake/personal-info-form.tsx +++ b/frontend/src/components/intake/personal-info-form.tsx @@ -6,9 +6,10 @@ import { InputGroup } from '@/components/ui/input-group'; import { FormField } from '@/components/ui/form-field'; import { ExperienceTypeSection } from '@/components/intake/experience-type-section'; import { COLORS, PROVINCES, VALIDATION, ExperienceData, PersonalData } from '@/constants/form'; -import { CustomRadio } from '@/components/CustomRadio'; +// import { CustomRadio } from '@/components/CustomRadio'; import { useRouter } from 'next/router'; import { SingleSelectDropdown } from '@/components/ui/single-select-dropdown'; +import { Checkbox } from '@/components/ui/checkbox'; interface PersonalInfoFormData { hasBloodCancer: 'yes' | 'no' | ''; @@ -20,7 +21,17 @@ interface PersonalInfoFormData { postalCode: string; city: string; province: string; - hasCriminalRecord: 'yes' | 'no' | ''; + eligibilityCriteria: { + age18OrOlder: boolean; + noCriminalRecord: boolean; + resideInCanada: boolean; + oneYearSinceTreatment: boolean; + hasBloodCancerOrCaregiver: boolean; + willingToParticipateIntake: boolean; + willingToAttendTraining: boolean; + accessToPhoneAndComputer: boolean; + comfortableSharingExperience: boolean; + }; } interface PersonalInfoFormProps { @@ -45,7 +56,17 @@ export function PersonalInfoForm({ formType, onSubmit }: PersonalInfoFormProps) postalCode: '', city: '', province: '', - hasCriminalRecord: '', + eligibilityCriteria: { + age18OrOlder: false, + noCriminalRecord: false, + resideInCanada: false, + oneYearSinceTreatment: false, + hasBloodCancerOrCaregiver: false, + willingToParticipateIntake: false, + willingToAttendTraining: false, + accessToPhoneAndComputer: false, + comfortableSharingExperience: false, + }, }, }); @@ -55,11 +76,14 @@ export function PersonalInfoForm({ formType, onSubmit }: PersonalInfoFormProps) return; // Form validation will show errors } - // Check if user has criminal record (only for volunteers) - if (formType === 'volunteer' && data.hasCriminalRecord === 'yes') { - // Redirect to rejection page - router.push('/rejection'); - return; + // Validate all eligibility criteria are checked (only for volunteers) + if (formType === 'volunteer') { + const allChecked = Object.values(data.eligibilityCriteria).every( + (checked) => checked === true, + ); + if (!allChecked) { + return; // Form validation will show errors + } } const experienceData: ExperienceData = { @@ -330,55 +354,186 @@ export function PersonalInfoForm({ formType, onSubmit }: PersonalInfoFormProps) - {/* Criminal Record Section */} + {/* Eligibility Criteria Section */} {formType === 'volunteer' && ( - + Eligibility Criteria + + + Our volunteers are a valuable part of our organization and vital to this program. Before + continuing, please ensure you meet the criteria below.{' '} + + - Do you have a criminal record? + Please review the criteria and check off all that apply. You must agree with all + statements to become a First Connections volunteer. { + if (formType === 'volunteer') { + const allChecked = Object.values(value).every((checked) => checked === true); + return allChecked || 'All eligibility criteria must be checked to continue'; + } + return true; + }, + }} render={({ field }) => ( - - field.onChange(value)} + + + field.onChange({ ...field.value, age18OrOlder: details.checked }) + } + > + + 18 years of age or older + + + + field.onChange({ ...field.value, noCriminalRecord: details.checked }) + } + > + + No criminal record + + + + field.onChange({ ...field.value, resideInCanada: details.checked }) + } + > + + Reside in Canada + + + + field.onChange({ ...field.value, oneYearSinceTreatment: details.checked }) + } + > + + It has been at least 1 year since yours or your loved one's blood cancer + treatment. For people and their caregivers who are on active surveillance or + daily medication, it has been at least 1 year since diagnosis. + + + + field.onChange({ ...field.value, hasBloodCancerOrCaregiver: details.checked }) + } + > + + Have had a blood cancer, or is a caregiver of a loved one with a blood cancer + + + + field.onChange({ ...field.value, willingToParticipateIntake: details.checked }) + } + > + + Willing to participate in a pre-screening intake + + + + field.onChange({ ...field.value, willingToAttendTraining: details.checked }) + } + > + + Willing to attend a virtual 3-hour peer support training + + + + field.onChange({ ...field.value, accessToPhoneAndComputer: details.checked }) + } > - Yes + Have access and comfortable using the phone and computer - - field.onChange(value)} + + + field.onChange({ + ...field.value, + comfortableSharingExperience: details.checked, + }) + } > - No + Comfortable sharing your personal blood cancer experience with others - - {errors.hasCriminalRecord && ( + + {errors.eligibilityCriteria && ( - {errors.hasCriminalRecord.message} + {errors.eligibilityCriteria.message} )}