"use client"; import React from "react"; import { Box, MenuItem, Paper, TextField, Typography, Divider, Switch, FormControlLabel, Button, } from "@mui/material"; import { Form, type FormikProps } from "formik"; import type { SkillsFormProps, SkillsFormValues } from "./types"; import { certTypes, proficiencyOptions } from "./constant"; type Props = FormikProps & SkillsFormProps; export default function InnerSkillsForm(props: Props) { const { values, errors, touched, handleChange, setFieldValue, isSubmitting } = props; const handleBack = () => { props.update({ computerSkill: values.computerSkill, languageSkill: values.languageSkill, }); props.setStep(props.step - 1); }; const compFields = [ "pcUsage", "word", "excel", "powerPoint", "rahkaran", "kasra", "didgah", "his", ] as const; return (
{/* 1. Computer Skills Section */} مهارت‌های کامپیوتری {compFields.map((field) => { const hasError = !!errors.computerSkill?.[field] && !!touched.computerSkill?.[field]; return ( {proficiencyOptions.map((o) => ( {o.label} ))} ); })} {/* 2. Language Skills Section */} آشنایی با زبان‌های خارجه {/* English */} {proficiencyOptions.map((o) => ( {o.label} ))} { const checked = e.target.checked; setFieldValue("languageSkill.hasEnglishCertificate", checked); if (!checked) { // پاکسازی فیلد نوع مدرک در صورت غیرفعال شدن سوئیچ setFieldValue("languageSkill.englishCertificateType", ""); } }} /> } label="مدرک معتبر زبان انگلیسی دارد" /> {values.languageSkill.hasEnglishCertificate && ( انتخاب... {certTypes.map((t) => ( {t} ))} )} {/* Arabic */} {proficiencyOptions.map((o) => ( {o.label} ))} {/* Other Skills */} {/* Wizard Navigation Buttons */}
); }