adding pilots
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user