legal person loan request part 2
This commit is contained in:
@@ -170,9 +170,13 @@
|
||||
"error_message_name": "لطفا نام خود را وارد کنید!",
|
||||
"error_message_company_name": "لطفا نام شرکت خود را وارد کنید!",
|
||||
"error_message_first_name": "لطفا نام خود را وارد کنید!",
|
||||
"error_message_boss_first_name": "لطفا نام مدیر عامل را وارد کنید!",
|
||||
"error_message_last_name": "لطفا نام خانوادگی خود را وارد کنید!",
|
||||
"error_message_boss_last_name": "لطفا نام خانوادگی مدیر عامل را وارد کنید!",
|
||||
"error_message_gender": "لطفا جنسیت خود را وارد کنید!",
|
||||
"error_message_boss_gender": "لطفا جنسیت مدیر عامل را وارد کنید!",
|
||||
"error_message_father_name": "لطفا نام پدر خود را وارد کنید!",
|
||||
"error_message_boss_father_name": "لطفا نام پدر مدیر عامل را وارد کنید!",
|
||||
"error_message_register_number": "لطفا شماره ثبت شرکت خود را وارد کنید!",
|
||||
"error_message_plate_number": "لطفا شماره پلاک را به درستی وارد کنید!",
|
||||
"error_message_occupation_id": "لطفا کد شغل را به درستی وارد کنید!",
|
||||
@@ -187,7 +191,9 @@
|
||||
"error_message_national_number": "لطفا شناسه ملی شرکت خود را وارد کنید!",
|
||||
"error_message_date_of_birth": "لطفا تاریخ تولد خود را وارد کنید!",
|
||||
"error_message_shenasname_serial": "لطفا سریال پشت کارت ملی خود را وارد کنید!",
|
||||
"error_message_boss_national_serial_number": "لطفا سریال پشت کارت ملی مدیر عامل را وارد کنید!",
|
||||
"error_message_tracking_code": "لطفا کد رهگیری کارت ملی خود را وارد کنید!",
|
||||
"error_message_boss_national_card_tracking_code": "لطفا کد رهگیری کارت ملی مدیر عامل را وارد کنید!",
|
||||
"error_message_postal_code": "لطفا کد پستی خود را وارد کنید!",
|
||||
"error_message_national_code": "لطفا کد ملی خود را وارد کنید!",
|
||||
"error_message_checkedBox": "لطفا کد صحت اطلاعات خود را تایید کنید!",
|
||||
@@ -203,10 +209,14 @@
|
||||
"text_field_name": "نام",
|
||||
"text_field_company_name": "نام شرکت",
|
||||
"text_field_first_name": "نام",
|
||||
"text_field_boss_first_name": "نام مدیر عامل",
|
||||
"text_field_last_name": "نام خانوادگی",
|
||||
"text_field_boss_last_name": "نام خانوادگی مدیر عامل",
|
||||
"text_field_gender": "جنسیت",
|
||||
"text_field_boss_gender": "جنسیت مدیر عامل",
|
||||
"text_field_register_number": "شماره ثبت شرکت",
|
||||
"text_field_father_name": "نام پدر",
|
||||
"text_field_boss_father_name": "نام پدر مدیر عامل",
|
||||
"text_field_plate_part4": "بخش چهارم",
|
||||
"text_field_plate_part3": "بخش سوم",
|
||||
"text_field_plate_part2": "بخش دوم",
|
||||
@@ -219,13 +229,16 @@
|
||||
"text_field_enter_your_plate_part3": "بخش سوم پلاک را وارد کنید",
|
||||
"text_field_enter_your_plate_part4": "بخش چهارم پلاک راوارد کنید",
|
||||
"text_field_enter_your_first_name": "نام خود راوارد کنید",
|
||||
"text_field_enter_your_boss_first_name": "نام مدیر عامل راوارد کنید",
|
||||
"text_field_enter_your_company_name": "نام شرکت خود راوارد کنید",
|
||||
"text_field_enter_your_last_name": "نام خانوادگی خود راوارد کنید",
|
||||
"text_field_enter_your_boss_last_name": "نام خانوادگی مدیر عامل راوارد کنید",
|
||||
"text_field_enter_your_address": "آدرس خود راوارد کنید",
|
||||
"text_field_enter_your_name": "نام خود را وارد کنید",
|
||||
"text_field_enter_your_company_postal_code": "کد پستی شرکت را وارد کنید",
|
||||
"text_field_enter_your_register_number": "شماره ثبت شرکت خود را وارد کنید",
|
||||
"text_field_enter_your_father_name": "نام پدر خود را وارد کنید",
|
||||
"text_field_enter_your_boss_father_name": "نام پدر مدیر عامل را وارد کنید",
|
||||
"text_field_enter_your_postal_code": "کد پستی خود را وارد کنید",
|
||||
"text_field_enter_your_company_tel_number": "تلفن ثابت شرکت خود را وارد کنید",
|
||||
"text_field_vehicle_type": "نوع وسیله نقلیه",
|
||||
@@ -243,9 +256,13 @@
|
||||
"text_field_enter_your_national_id": "کد ملی خود را وارد کنید",
|
||||
"text_field_enter_your_national_number": "شناسه ملی شرکت خود را وارد کنید",
|
||||
"text_field_shenasname_serial": "سریال پشت کارت ملی",
|
||||
"text_field_boss_national_serial_number": "سریال پشت کارت ملی مدیر عامل",
|
||||
"text_field_enter_your_shenasname_serial": "سریال پشت کارت ملی خود را وارد کنید",
|
||||
"text_field_enter_your_boss_national_serial_number": "سریال پشت کارت ملی مدیر عامل را وارد کنید",
|
||||
"text_field_national_trackin_code": "کد رهگیری کارت ملی",
|
||||
"text_field_boss_national_card_tracking_code": "کد رهگیری کارت ملی مدیر عامل",
|
||||
"text_field_enter_your_trackin_code": "کد رهگیری کارت ملی خود را وارد کنید",
|
||||
"text_field_enter_your_boss_national_card_tracking_code": "کد رهگیری کارت ملی مدیر عامل را وارد کنید",
|
||||
"text_field_plate_number": "شماره پلاک",
|
||||
"text_field_enter_your_plate_number": "شماره پلاک خود را وارد کنید",
|
||||
"button_submit": "ثبت درخواست",
|
||||
|
||||
@@ -29,7 +29,6 @@ import SvgDone from "@/core/components/svgs/SvgDone";
|
||||
import {SEND_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import {useRouter} from "next/router";
|
||||
import useLimitedProvince from "@/lib/app/hooks/useLimitedProvince";
|
||||
import {TransitionGroup} from 'react-transition-group';
|
||||
import RealPersonForm from "@/components/dashboard/navgan/add-request-loan/forms/RealPersonForm";
|
||||
import LegalPersonForm from "@/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm";
|
||||
|
||||
@@ -52,17 +51,22 @@ const AddFormComponent = () => {
|
||||
vehicle_type: "",
|
||||
province_id: "",
|
||||
father_name: "",
|
||||
boss_father_name: "",
|
||||
register_number: "",
|
||||
gender: "",
|
||||
first_name: "",
|
||||
boss_first_name: "",
|
||||
last_name: "",
|
||||
boss_last_name: "",
|
||||
city_id: "",
|
||||
navgan_id: "",
|
||||
national_code: "",
|
||||
national_number: "",
|
||||
company_name: "",
|
||||
national_serial_number: "",
|
||||
boss_national_serial_number: "",
|
||||
national_card_tracking_code: "",
|
||||
boss_national_card_tracking_code: "",
|
||||
national_serial_number_or_tracking_code: "national_serial_number",
|
||||
postal_code: "",
|
||||
postal_company_code: "",
|
||||
@@ -96,8 +100,10 @@ const AddFormComponent = () => {
|
||||
vehicle_type: Yup.string().required(t("LoanRequest.error_message_vehicle_type")),
|
||||
register_number: Yup.string().required(t("LoanRequest.error_message_register_number")),
|
||||
father_name: Yup.string().required(t("LoanRequest.error_message_father_name")),
|
||||
boss_father_name: Yup.string().required(t("LoanRequest.error_message_boss_father_name")),
|
||||
company_name: Yup.string().required(t("LoanRequest.error_message_company_name")),
|
||||
gender: Yup.string().required(t("LoanRequest.error_message_gender")),
|
||||
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")),
|
||||
@@ -122,7 +128,9 @@ const AddFormComponent = () => {
|
||||
province_id: Yup.string().required(t("LoanRequest.error_message_province_id")),
|
||||
city_id: Yup.string().required(t("LoanRequest.error_message_city_id")),
|
||||
first_name: Yup.string().required(t("LoanRequest.error_message_first_name")),
|
||||
boss_first_name: Yup.string().required(t("LoanRequest.error_message_boss_first_name")),
|
||||
last_name: Yup.string().required(t("LoanRequest.error_message_last_name")),
|
||||
boss_last_name: Yup.string().required(t("LoanRequest.error_message_boss_last_name")),
|
||||
national_code: Yup.mixed()
|
||||
.test("is-number", `${t("LoanRequest.national_code_number")}`, (value) => !isNaN(value))
|
||||
.test("positive", `${t("LoanRequest.national_code_positive")}`, (value) => value >= 0)
|
||||
@@ -138,8 +146,14 @@ const AddFormComponent = () => {
|
||||
national_serial_number: Yup.string().when('national_serial_number_or_tracking_code', ([national_serial_number_or_tracking_code], schema) => {
|
||||
return national_serial_number_or_tracking_code === 'national_serial_number' ? schema.required(t("LoanRequest.error_message_shenasname_serial")) : schema
|
||||
}),
|
||||
boss_national_serial_number: Yup.string().when('national_serial_number_or_tracking_code', ([national_serial_number_or_tracking_code], schema) => {
|
||||
return national_serial_number_or_tracking_code === 'national_serial_number' ? schema.required(t("LoanRequest.error_message_boss_national_serial_number")) : schema
|
||||
}),
|
||||
national_card_tracking_code: Yup.string().when('national_serial_number_or_tracking_code', ([national_serial_number_or_tracking_code], schema) => {
|
||||
return national_serial_number_or_tracking_code === 'national_card_tracking_code' ? schema.required(t("LoanRequest.error_message_tracking_code")) : schema
|
||||
}),
|
||||
boss_national_card_tracking_code: Yup.string().when('national_serial_number_or_tracking_code', ([national_serial_number_or_tracking_code], schema) => {
|
||||
return national_serial_number_or_tracking_code === 'national_card_tracking_code' ? schema.required(t("LoanRequest.error_message_boss_national_card_tracking_code")) : schema
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
import {FormControl, FormHelperText} from "@mui/material";
|
||||
import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import {AdapterDateFnsJalali} from "@mui/x-date-pickers/AdapterDateFnsJalali";
|
||||
import {faIR} from "@mui/x-date-pickers/locales";
|
||||
import moment from "jalali-moment";
|
||||
import * as React from "react";
|
||||
import {useTranslations} from "next-intl";
|
||||
import Button from "@mui/material/Button";
|
||||
import {useConfig} from "@witel/webapp-builder";
|
||||
import {useMemo, useState} from "react";
|
||||
import {DatePicker} from "@mui/x-date-pickers/DatePicker";
|
||||
|
||||
function ButtonField(props) {
|
||||
const t = useTranslations();
|
||||
const {
|
||||
setOpen,
|
||||
label,
|
||||
id,
|
||||
disabled,
|
||||
InputProps: { ref } = {},
|
||||
inputProps: { "aria-label": ariaLabel } = {},
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<Button
|
||||
sx={{ width: "100%", padding: 0.8 }}
|
||||
variant="outlined"
|
||||
color={
|
||||
props.slotProps.formik.touched.birthday &&
|
||||
Boolean(props.slotProps.formik.errors.birthday)
|
||||
? "error"
|
||||
: "primary"
|
||||
}
|
||||
id={id}
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
aria-label={ariaLabel}
|
||||
onClick={() => setOpen?.((prev) => !prev)}
|
||||
>
|
||||
{label ? `${t("birthday")}: ${label}` : `${t("birthday")}`}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
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 max = moment(
|
||||
`${config.add_request_loan_birthday_range.max}-${today.format(
|
||||
"jMM-jDD"
|
||||
)}`,
|
||||
"jYYYY-jMM-jDD"
|
||||
).toDate();
|
||||
return { min, max };
|
||||
}, [config.add_request_loan_birthday_range]);
|
||||
|
||||
return (
|
||||
<DatePicker
|
||||
slots={{ field: ButtonField, ...props.slots }}
|
||||
disabled={props.disabled}
|
||||
slotProps={{
|
||||
formik: props.formik,
|
||||
field: { setOpen },
|
||||
textField: {
|
||||
helperText: props.formik.errors.birthday
|
||||
? `${t("birthday_error")}`
|
||||
: null,
|
||||
},
|
||||
}}
|
||||
{...props}
|
||||
open={open}
|
||||
minDate={dateRange.min}
|
||||
maxDate={dateRange.max}
|
||||
onClose={() => setOpen(false)}
|
||||
onOpen={() => setOpen(true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const LegalPersonDatePicker = () => {
|
||||
return (
|
||||
<FormControl variant={"outlined"} fullWidth size="small" error={true}>
|
||||
<LocalizationProvider
|
||||
dateAdapter={AdapterDateFnsJalali}
|
||||
localeText={{
|
||||
...faIR.components.MuiLocalizationProvider.defaultProps.localeText,
|
||||
okButtonLabel: "تایید",
|
||||
}}
|
||||
>
|
||||
<ButtonDatePicker
|
||||
label={
|
||||
formik.values.birthday !== "" &&
|
||||
formik.values.birthday.locale("fa").format("YYYY/MM/DD")
|
||||
}
|
||||
value={
|
||||
formik.values.birthday !== ""
|
||||
? formik.values.birthday.toDate()
|
||||
: null
|
||||
}
|
||||
formik={formik}
|
||||
disabled={disabled}
|
||||
onChange={(newValue) => {
|
||||
formik.setFieldValue("birthday", moment(newValue));
|
||||
}}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
<FormHelperText>
|
||||
{formik.touched.birthday && formik.errors.birthday}
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
export default LegalPersonDatePicker
|
||||
@@ -1,15 +1,18 @@
|
||||
import {Collapse, Grid, TextField} from "@mui/material";
|
||||
import {Grid, TextField, ToggleButton, ToggleButtonGroup} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import useCities from "@/lib/app/hooks/useCities";
|
||||
import UseEducations from "@/lib/app/hooks/useEducations";
|
||||
import useOccupations from "@/lib/app/hooks/useOccupations";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import {DatePicker} from "@mui/x-date-pickers/DatePicker";
|
||||
import * as React from "react";
|
||||
import SelectBox from "@/core/components/SelectBox";
|
||||
import useLimitedProvince from "@/lib/app/hooks/useLimitedProvince";
|
||||
import PlateNumber from "@/core/components/PlateNumber";
|
||||
|
||||
const LegalPersonForm = ({formik}) => {
|
||||
const t = useTranslations();
|
||||
const {cityTextField, cityList, setProvinceID, isLoadingCityList} = useCities()
|
||||
const {provinceList, isLoadingProvinceList, errorProvinceList} = useLimitedProvince()
|
||||
const {educationsList, isLoadingEducationsList, errorEducationsList} = UseEducations()
|
||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
||||
return (
|
||||
@@ -152,24 +155,327 @@ const LegalPersonForm = ({formik}) => {
|
||||
helperText={formik.touched.company_date && formik.errors.company_date}
|
||||
onBlur={formik.handleBlur("company_date")}
|
||||
/>
|
||||
<DatePicker
|
||||
slots={{ field: ButtonField, ...props.slots }}
|
||||
disabled={props.disabled}
|
||||
slotProps={{
|
||||
formik: props.formik,
|
||||
field: { setOpen },
|
||||
textField: {
|
||||
helperText: props.formik.errors.birthday
|
||||
? `${t("birthday_error")}`
|
||||
: null,
|
||||
},
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="province_id"
|
||||
label={t("LoanRequest.text_field_province_id")}
|
||||
size="small"
|
||||
selectType="province_id"
|
||||
isLoading={isLoadingProvinceList}
|
||||
errorEcured={errorProvinceList}
|
||||
selectors={provinceList}
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
select={formik.values.province_id}
|
||||
value={formik.values.province_id}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue('province_id', event.target.value);
|
||||
setProvinceID(event.target.value)
|
||||
formik.setFieldTouched("city_id", false, false);
|
||||
formik.setFieldValue("city_id", "")
|
||||
}}
|
||||
{...props}
|
||||
open={open}
|
||||
minDate={dateRange.min}
|
||||
maxDate={dateRange.max}
|
||||
onClose={() => setOpen(false)}
|
||||
onOpen={() => setOpen(true)}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.province_id && Boolean(formik.errors.province_id)}
|
||||
helperText={formik.touched.province_id && formik.errors.province_id}
|
||||
onBlur={formik.handleBlur("province_id")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="city_id"
|
||||
label={isLoadingCityList ? `${t("LoanRequest.cityList_loading")}` : (cityList.length === 0 ? `${t("LoanRequest.cityList_empty")}` : cityTextField)}
|
||||
size="small"
|
||||
selectType="city_id"
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
disabled={cityList.length === 0}
|
||||
selectors={cityList}
|
||||
select={formik.values.city_id}
|
||||
value={formik.values.city_id}
|
||||
handleChange={(event) => formik.setFieldValue('city_id', event.target.value)}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.city_id && Boolean(formik.errors.city_id)}
|
||||
helperText={formik.touched.city_id && formik.errors.city_id}
|
||||
onBlur={formik.handleBlur("city_id")}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
fullWidth
|
||||
size={'small'}
|
||||
value={formik.values.national_serial_number_or_tracking_code}
|
||||
exclusive
|
||||
onChange={(e, value) => {
|
||||
if (value === null) return
|
||||
formik.handleChange({
|
||||
target: {
|
||||
name: "national_serial_number_or_tracking_code", value: value,
|
||||
},
|
||||
})
|
||||
}}
|
||||
>
|
||||
<ToggleButton value="national_serial_number">
|
||||
{t("LoanRequest.text_field_shenasname_serial")}
|
||||
</ToggleButton>
|
||||
<ToggleButton value="national_card_tracking_code">
|
||||
{t("LoanRequest.text_field_national_trackin_code")}
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</Grid>
|
||||
{formik.values.national_serial_number_or_tracking_code === 'national_serial_number' ? (
|
||||
<Grid item xs={12} sm={4}
|
||||
>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="boss_national_serial_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_serial_number}
|
||||
label={t("LoanRequest.text_field_boss_national_serial_number")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_boss_national_serial_number")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("boss_national_serial_number")}
|
||||
error={formik.touched.boss_national_serial_number && Boolean(formik.errors.boss_national_serial_number)}
|
||||
helperText={formik.touched.boss_national_serial_number && formik.errors.boss_national_serial_number}
|
||||
/>
|
||||
</Grid>) : (
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="boss_national_card_tracking_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_card_tracking_code}
|
||||
label={t("LoanRequest.text_field_boss_national_card_tracking_code")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_boss_national_card_tracking_code")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("boss_national_card_tracking_code")}
|
||||
error={formik.touched.boss_national_card_tracking_code && Boolean(formik.errors.boss_national_card_tracking_code)}
|
||||
helperText={formik.touched.boss_national_card_tracking_code && formik.errors.boss_national_card_tracking_code}
|
||||
/>
|
||||
</Grid>
|
||||
)}
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="boss_father_name"
|
||||
variant="outlined"
|
||||
value={formik.values.father_name}
|
||||
onChange={formik.handleChange}
|
||||
size="small"
|
||||
label={t("LoanRequest.text_field_boss_father_name")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_boss_father_name")}
|
||||
fullWidth
|
||||
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}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="national_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_code}
|
||||
inputProps={{inputMode: 'numeric', pattern: '[0-9]*'}}
|
||||
type={'tel'}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
if (isNaN(Number(inputValue))) {
|
||||
return;
|
||||
}
|
||||
formik.handleChange({
|
||||
target: {
|
||||
name: "national_code", value: inputValue,
|
||||
},
|
||||
});
|
||||
}}
|
||||
label={t("LoanRequest.text_field_national_code")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_national_code")}
|
||||
onBlur={formik.handleBlur("national_id")}
|
||||
error={formik.touched.national_id && Boolean(formik.errors.national_id)}
|
||||
helperText={formik.touched.national_id && formik.errors.national_id}
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="boss_gender"
|
||||
label={t("LoanRequest.text_field_boss_gender")}
|
||||
size="small"
|
||||
value={formik.values.gender}
|
||||
selectType="gender"
|
||||
selectors={[{
|
||||
id: 1, value: 1, name: "زن"
|
||||
}, {
|
||||
id: 2, value: 0, name: "مرد"
|
||||
}]}
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
select={formik.values.gender}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue('gender', event.target.value)
|
||||
}}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.boss_gender && Boolean(formik.errors.boss_gender)}
|
||||
helperText={formik.touched.boss_gender && formik.errors.boss_gender}
|
||||
onBlur={formik.handleBlur("boss_gender")}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="boss_first_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.first_name}
|
||||
label={t("LoanRequest.text_field_boss_first_name")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_boss_first_name")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("boss_first_name")}
|
||||
error={formik.touched.boss_first_name && Boolean(formik.errors.boss_first_name)}
|
||||
helperText={formik.touched.boss_first_name && formik.errors.boss_first_name}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="boss_last_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.last_name}
|
||||
label={t("LoanRequest.text_field_boss_last_name")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_boss_last_name")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("boss_last_name")}
|
||||
error={formik.touched.boss_last_name && Boolean(formik.errors.boss_last_name)}
|
||||
helperText={formik.touched.boss_last_name && formik.errors.boss_last_name}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="navgan_type"
|
||||
label={t("LoanRequest.text_field_navgan_type")}
|
||||
size="small"
|
||||
value={formik.values.navgan_type}
|
||||
selectType="navgan_type"
|
||||
selectors={[{
|
||||
id: 1, value: "روستایی", name: "روستایی"
|
||||
}, {
|
||||
id: 2, value: "عمومی", name: "عمومی"
|
||||
}, {
|
||||
id: 3, value: "منطقه آزاد", name: "منطقه آزاد"
|
||||
}]}
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
select={formik.values.navgan_type}
|
||||
handleChange={(event) => {
|
||||
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")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="navgan_id"
|
||||
variant="outlined"
|
||||
inputProps={{inputMode: 'numeric', pattern: '[0-9]*'}}
|
||||
type={'tel'}
|
||||
value={formik.values.navgan_id}
|
||||
onChange={formik.handleChange}
|
||||
size="small"
|
||||
label={t("LoanRequest.text_field_navgan_id")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_navgan_id")}
|
||||
fullWidth
|
||||
onBlur={formik.handleBlur("navgan_id")}
|
||||
error={formik.touched.navgan_id && Boolean(formik.errors.navgan_id)}
|
||||
helperText={formik.touched.navgan_id && formik.errors.navgan_id}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="vehicle_type"
|
||||
label={t("LoanRequest.text_field_vehicle_type")}
|
||||
size="small"
|
||||
value={formik.values.vehicle_type}
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
selectType="vehicle_type"
|
||||
selectors={[{
|
||||
id: 0, value: "اتوبوس", name: "اتوبوس"
|
||||
}, {
|
||||
id: 1, value: "مینی بوس", name: "مینی بوس"
|
||||
}]}
|
||||
select={formik.values.vehicle_type}
|
||||
handleChange={(event) => formik.setFieldValue('vehicle_type', event.target.value)}
|
||||
error={formik.touched.vehicle_type && Boolean(formik.errors.vehicle_type)}
|
||||
helperText={formik.touched.vehicle_type && formik.errors.vehicle_type}
|
||||
onBlur={formik.handleBlur("vehicle_type")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<PlateNumber formik={formik}/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="education_id"
|
||||
label={t("LoanRequest.text_field_education_id")}
|
||||
size="small"
|
||||
isLoading={isLoadingEducationsList}
|
||||
errorEcured={errorEducationsList}
|
||||
selectType="education_id"
|
||||
selectors={educationsList}
|
||||
select={formik.values.education_id}
|
||||
value={formik.values.education_id}
|
||||
schema={{value: 'id', name: 'title'}}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue('education_id', event.target.value)
|
||||
}}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.education_id && Boolean(formik.errors.education_id)}
|
||||
helperText={formik.touched.education_id && formik.errors.education_id}
|
||||
onBlur={formik.handleBlur("education_id")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="occupation_id"
|
||||
label={t("LoanRequest.text_field_occupation_id")}
|
||||
size="small"
|
||||
isLoading={isLoadingOccupationsList}
|
||||
errorEcured={errorOccupationsList}
|
||||
selectType="occupation_id"
|
||||
schema={{value: 'id', name: 'title'}}
|
||||
selectors={occupationsList}
|
||||
select={formik.values.occupation_id}
|
||||
value={formik.values.occupation_id}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue('occupation_id', event.target.value)
|
||||
}}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.occupation_id && Boolean(formik.errors.occupation_id)}
|
||||
helperText={formik.touched.occupation_id && formik.errors.occupation_id}
|
||||
onBlur={formik.handleBlur("occupation_id")}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -10,8 +10,9 @@ import useOccupations from "@/lib/app/hooks/useOccupations";
|
||||
const RealPersonForm = ({formik}) => {
|
||||
const t = useTranslations();
|
||||
const {provinceList, isLoadingProvinceList, errorProvinceList} = useLimitedProvince()
|
||||
const {cityTextField, cityList, setProvinceID, isLoadingCityList} = useCities()
|
||||
|
||||
return(
|
||||
return (
|
||||
<>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
@@ -313,6 +314,24 @@ const RealPersonForm = ({formik}) => {
|
||||
onBlur={formik.handleBlur("province_id")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="city_id"
|
||||
label={isLoadingCityList ? `${t("LoanRequest.cityList_loading")}` : (cityList.length === 0 ? `${t("LoanRequest.cityList_empty")}` : cityTextField)}
|
||||
size="small"
|
||||
selectType="city_id"
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
disabled={cityList.length === 0}
|
||||
selectors={cityList}
|
||||
select={formik.values.city_id}
|
||||
value={formik.values.city_id}
|
||||
handleChange={(event) => formik.setFieldValue('city_id', event.target.value)}
|
||||
setFieldTouched={formik.setFieldTouched}
|
||||
error={formik.touched.city_id && Boolean(formik.errors.city_id)}
|
||||
helperText={formik.touched.city_id && formik.errors.city_id}
|
||||
onBlur={formik.handleBlur("city_id")}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ const sidebarMenu = [
|
||||
key: "sidebar.add-request-loan",
|
||||
name: "sidebar.add-request-loan",
|
||||
type: "page",
|
||||
route: "/dashboard/navgan/past-past-add-request-loan",
|
||||
route: "/dashboard/navgan/add-request-loan",
|
||||
icon: <DataSaverOnIcon sx={{width: 'inherit', height: 'inherit'}}/>,
|
||||
selected: false,
|
||||
permission: "can_request_navgan_loan"
|
||||
|
||||
Reference in New Issue
Block a user