diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 64fac68..af0407a 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -202,6 +202,7 @@ "error_message_navgan_id": "لطفا کد هوشمند ناوگان خود را وارد کنید!", "error_message_province_id": "لطفا استان خود را وارد کنید!", "error_message_national_id": "لطفا کد ملی خود را وارد کنید!", + "error_message_boss_national_id": "لطفا کد ملی مدیر عامل را وارد کنید!", "error_message_national_number": "لطفا شناسه ملی شرکت خود را وارد کنید!", "error_message_date_of_birth": "لطفا تاریخ تولد خود را وارد کنید!", "error_message_boss_date_of_birth": "لطفا تاریخ تولد مدیر عامل را وارد کنید!", @@ -211,6 +212,8 @@ "error_message_tracking_code": "لطفا کد رهگیری کارت ملی خود را وارد کنید!", "error_message_boss_national_card_tracking_code": "لطفا کد رهگیری کارت ملی مدیر عامل را وارد کنید!", "error_message_postal_code": "لطفا کد پستی خود را وارد کنید!", + "error_message_father_name": "لطفا نام پدر خود را وارد کنید!", + "error_message_boss_father_name": "لطفا نام پدر مدیر عامل را وارد کنید!", "error_message_national_code": "لطفا کد ملی خود را وارد کنید!", "error_message_checkedBox": "لطفا کد صحت اطلاعات خود را تایید کنید!", "error_message_navgan_type": "لطفا نوع ناوگان خود را وارد کنید!", diff --git a/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx b/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx index 8ca6cdd..3ab69cd 100644 --- a/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx +++ b/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx @@ -110,12 +110,13 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { province_id: Yup.string().required(t("LoanRequest.error_message_province_id")), city_id: Yup.string().required(t("LoanRequest.error_message_city_id")), boss_first_name: Yup.string().required(t("LoanRequest.error_message_boss_first_name")), + boss_father_name: Yup.string().required(t("LoanRequest.error_message_boss_father_name")), boss_last_name: Yup.string().required(t("LoanRequest.error_message_boss_last_name")), boss_national_code: Yup.mixed() .test("is-number", `${t("LoanRequest.boss_national_code_number")}`, (value) => !isNaN(value)) .test("positive", `${t("LoanRequest.boss_national_code_positive")}`, (value) => value >= 0) .test("max", `${t("LoanRequest.boss_national_code_max")}`, (value) => value.toString().length === 10) - .required(t("LoanRequest.error_message_national_id")), + .required(t("LoanRequest.error_message_boss_national_id")), national_number: Yup.mixed().when("person_type", ([person_type], schema) => { return person_type === "legal" ? schema @@ -170,7 +171,6 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { : { national_tracking_code: values.boss_national_card_tracking_code, }; - const _father_name = values.boss_father_name !== "" ? {father_name: values.boss_father_name} : {} let _data = { is_legal_person: 1, @@ -198,10 +198,10 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { birthday: values.birthday.locale("en").format("YYYY-MM-DD"), education_id: values.education_id, occupation_id: values.occupation_id, + boss_father_name: values.boss_father_name, facility_usage_history: values.history_facilities === true ? 1 : 0, ..._national_card, ..._national_number, - ..._father_name }; await requestServer(SEND_LOAN_REQUEST_NAVGAN, "post", { @@ -671,6 +671,9 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { size="small" label={t("LoanRequest.text_field_boss_father_name")} placeholder={t("LoanRequest.text_field_enter_your_boss_father_name")} + onBlur={formik.handleBlur("boss_father_name")} + error={formik.touched.boss_father_name && Boolean(formik.errors.boss_father_name)} + helperText={formik.touched.boss_father_name && formik.errors.boss_father_name} fullWidth /> diff --git a/src/components/dashboard/navgan/add-request-loan/forms/RealPersonForm.jsx b/src/components/dashboard/navgan/add-request-loan/forms/RealPersonForm.jsx index 2295fc8..f8b6c96 100644 --- a/src/components/dashboard/navgan/add-request-loan/forms/RealPersonForm.jsx +++ b/src/components/dashboard/navgan/add-request-loan/forms/RealPersonForm.jsx @@ -80,6 +80,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => { activity_type: Yup.string().required(t("LoanRequest.error_message_activity_type")), navgan_plan_id: Yup.string().required(t("LoanRequest.error_message_navgan_plan_id")), gender: Yup.string().required(t("LoanRequest.error_message_gender")), + father_name: Yup.string().required(t("LoanRequest.error_message_father_name")), occupation_id: Yup.string().required(t("LoanRequest.error_message_occupation_id")), education_id: Yup.string().required(t("LoanRequest.error_message_education_id")), navgan_type: Yup.string().required(t("LoanRequest.error_message_navgan_type")), @@ -143,7 +144,6 @@ const RealPersonForm = ({setFinishLoanRequest}) => { : { national_tracking_code: values.national_card_tracking_code, }; - const _father_name = values.father_name !== "" ? {father_name: values.father_name} : {} let _data = { is_legal_person: 0, @@ -167,10 +167,10 @@ const RealPersonForm = ({setFinishLoanRequest}) => { plate_part2: values.plate_part2, plate_part3: values.plate_part3, plate_part4: values.plate_part4, + father_name: values.father_name, facility_usage_history: values.history_facilities === true ? 1 : 0, birthday: values.birthday.locale("en").format("YYYY-MM-DD"), ..._national_card, - ..._father_name }; await requestServer(SEND_LOAN_REQUEST_NAVGAN, "post", { @@ -406,6 +406,9 @@ const RealPersonForm = ({setFinishLoanRequest}) => { size="small" label={t("LoanRequest.text_field_father_name")} placeholder={t("LoanRequest.text_field_enter_your_father_name")} + onBlur={formik.handleBlur("father_name")} + error={formik.touched.father_name && Boolean(formik.errors.father_name)} + helperText={formik.touched.father_name && formik.errors.father_name} fullWidth />