Feature/4 pilots add #20

Merged
noahspannbauer merged 64 commits from feature/4-pilots---add into main 2024-09-23 21:52:59 -04:00
3 changed files with 37 additions and 6 deletions
Showing only changes of commit 1e5f6a72d8 - Show all commits

View File

@@ -192,7 +192,18 @@ const PilotForm: React.FC<PilotFormProps> = ({
<Controller
name="medicalExpiration"
control={methods.control}
render={() => <DatePicker />}
render={({ field }) => {
return (
<DatePicker
handleDateChanged={(date: string) => {
methods.setValue('medicalExpiration', date);
}}
inputProps={{
value: field.value
}}
/>
);
}}
/>
</div>
</div>

View File

@@ -14,7 +14,8 @@ const PilotFormCertificates: React.FC<IPilotFormCertificates> = ({
}: IPilotFormCertificates) => {
const {
control,
formState: { errors }
formState: { errors },
setValue
} = useFormContext();
const { fields, append, remove } = useFieldArray({
@@ -69,7 +70,16 @@ const PilotFormCertificates: React.FC<IPilotFormCertificates> = ({
name={`certificates.${index}.dateOfIssue`}
control={control}
render={({ field }) => {
return <DatePicker />;
return (
<DatePicker
handleDateChanged={(date: string) => {
setValue(`certificates.${index}.dateOfIssue`, date);
}}
inputProps={{
value: field.value
}}
/>
);
}}
/>
</div>

View File

@@ -14,7 +14,8 @@ const PilotFormEndorsements: React.FC<IPilotFormEndorsements> = ({
}: IPilotFormEndorsements) => {
const {
control,
formState: { errors }
formState: { errors },
setValue
} = useFormContext();
const { fields, append, remove } = useFieldArray({
@@ -56,8 +57,17 @@ const PilotFormEndorsements: React.FC<IPilotFormEndorsements> = ({
<Controller
name={`endorsements.${index}.dateOfIssue`}
control={control}
render={() => {
return <DatePicker />;
render={({ field }) => {
return (
<DatePicker
handleDateChanged={(date: string) => {
setValue(`endorsements.${index}.dateOfIssue`, date);
}}
inputProps={{
value: field.value
}}
/>
);
}}
/>
</div>