diff --git a/example.env.local b/example.env.local index fec226e..e2ab060 100644 --- a/example.env.local +++ b/example.env.local @@ -1,11 +1,14 @@ NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard" -NEXT_PUBLIC_API_VERSION = "2.1.3" +NEXT_PUBLIC_API_VERSION = "2.2.0" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl" NEXT_PUBLIC_PRIMARY_MAIN = "#084070" NEXT_PUBLIC_SECONDARY_MAIN = "#FF4E00" +NEXT_PUBLIC_MIN_BIRTHDAY = 1327 +NEXT_PUBLIC_MAX_BIRTHDAY = 1380 + NEXT_PUBLIC_BASE_URL = "https://loan-v2.witel.ir" NEXT_PUBLIC_POWERED_BY_URL = "https://witel.ir" 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 3ab69cd..b4d792e 100644 --- a/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx +++ b/src/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm.jsx @@ -61,9 +61,8 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { boss_national_serial_number: "", boss_national_card_tracking_code: "", national_serial_number_or_tracking_code: "national_serial_number", - navgan_type: "", plate_part1: "", - plate_part2: "الف", + plate_part2: "ع", plate_part3: "", plate_part4: "", address: "", @@ -88,7 +87,6 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { birthday: Yup.string().required(t("LoanRequest.error_message_boss_date_of_birth")), company_name: Yup.string().required(t("LoanRequest.error_message_company_name")), boss_gender: Yup.string().required(t("LoanRequest.error_message_boss_gender")), - navgan_type: Yup.string().required(t("LoanRequest.error_message_navgan_type")), occupation_id: Yup.string().required(t("LoanRequest.error_message_occupation_id")), education_id: Yup.string().required(t("LoanRequest.error_message_education_id")), address: Yup.string().required(t("LoanRequest.error_message_address")), @@ -187,7 +185,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { activity_type_id: values.activity_type, navgan_plan_id: values.navgan_plan_id, postal_code: values.company_postal_code, - navgan_type: values.navgan_type, + navgan_type: "عمومی", gender: values.boss_gender, plate_part1: values.plate_part1, plate_part2: values.plate_part2, @@ -198,7 +196,7 @@ 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, + father_name: values.boss_father_name, facility_usage_history: values.history_facilities === true ? 1 : 0, ..._national_card, ..._national_number, @@ -678,61 +676,6 @@ const LegalPersonForm = ({setFinishLoanRequest}) => { /> - - - { - formik.setFieldValue("navgan_type", event.target.value); - }} - setFieldTouched={formik.setFieldTouched} - error={formik.touched.navgan_type && Boolean(formik.errors.navgan_type)} - helperText={formik.touched.navgan_type && formik.errors.navgan_type} - onBlur={formik.handleBlur("navgan_type")} - /> - - - - - { - + + + + { onBlur={formik.handleBlur("education_id")} /> - + { national_card_tracking_code: "", national_serial_number_or_tracking_code: "national_serial_number", postal_code: "", - navgan_type: "", address: "", plate_part1: "", - plate_part2: "الف", + plate_part2: "ع", plate_part3: "", plate_part4: "", birthday: "", @@ -83,7 +82,6 @@ const RealPersonForm = ({setFinishLoanRequest}) => { 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")), address: Yup.string().required(t("LoanRequest.error_message_address")), birthday: Yup.string().required(t("LoanRequest.error_message_date_of_birth")), postal_code: Yup.mixed() @@ -156,7 +154,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => { last_name: values.last_name, navgan_id: values.navgan_id, postal_code: values.postal_code, - navgan_type: values.navgan_type, + navgan_type: "عمومی", gender: values.gender, address: values.address, education_id: values.education_id, @@ -452,7 +450,25 @@ const RealPersonForm = ({setFinishLoanRequest}) => { - + + + + { helperText={formik.touched.postal_code && formik.errors.postal_code} /> - + { /> - - - { - formik.setFieldValue("navgan_type", event.target.value); - }} - setFieldTouched={formik.setFieldTouched} - error={formik.touched.navgan_type && Boolean(formik.errors.navgan_type)} - helperText={formik.touched.navgan_type && formik.errors.navgan_type} - onBlur={formik.handleBlur("navgan_type")} - /> - - - - - setOpen?.((prev) => !prev)} > - {label ? `${t("birthday", - {value: `${props.slotProps.formik.values.person_type === "legal" ? "مدیر عامل" : ""}`})}: ${label}` : `${t("birthday", - {value: `${props.slotProps.formik.values.person_type === "legal" ? "مدیر عامل" : ""}`})}`} + {label + ? `${t("birthday", { + value: `${props.slotProps.formik.values.person_type === "legal" ? "مدیر عامل" : ""}`, + })}: ${label}` + : `${t("birthday", { + value: `${props.slotProps.formik.values.person_type === "legal" ? "مدیر عامل" : ""}`, + })}`} ); } function ButtonDatePicker(props) { - const {config} = useConfig(); const t = useTranslations(); const [open, setOpen] = useState(false); const dateRange = useMemo(() => { const today = moment(); - const min = moment( - `${config.add_request_loan_birthday_range.min}-01-01`, - "jYYYY-jMM-jDD" - ).toDate(); + const min = moment(`${process.env.NEXT_PUBLIC_MIN_BIRTHDAY}-01-01`, "jYYYY-jMM-jDD").toDate(); const max = moment( - `${config.add_request_loan_birthday_range.max}-${today.format( - "jMM-jDD" - )}`, + `${process.env.NEXT_PUBLIC_MAX_BIRTHDAY}-${today.format("jMM-jDD")}`, "jYYYY-jMM-jDD" ).toDate(); - return {min, max}; - }, [config.add_request_loan_birthday_range]); + return { min, max }; + }, []); return ( { @@ -113,9 +103,7 @@ export default function PickerWithButtonField({formik, disabled}) { }} /> - - {formik.touched.birthday && formik.errors.birthday} - + {formik.touched.birthday && formik.errors.birthday} ); -} \ No newline at end of file +}