Merge branch 'release/v2.2.0'
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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}) => {
|
||||
/>
|
||||
</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
|
||||
@@ -766,7 +709,25 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<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 item xs={12} sm={4}>
|
||||
<SelectBox
|
||||
name="education_id"
|
||||
label={t("LoanRequest.text_field_education_id")}
|
||||
@@ -787,7 +748,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
onBlur={formik.handleBlur("education_id")}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<SelectBox
|
||||
name="occupation_id"
|
||||
label={t("LoanRequest.text_field_occupation_id")}
|
||||
|
||||
@@ -58,10 +58,9 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
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}) => {
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<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 item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="postal_code"
|
||||
@@ -481,7 +497,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
helperText={formik.touched.postal_code && formik.errors.postal_code}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="telephone_number"
|
||||
@@ -511,61 +527,6 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</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
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import * as React from "react";
|
||||
import {useMemo, useState} from "react";
|
||||
import { FormControl, FormHelperText } from "@mui/material";
|
||||
import Button from "@mui/material/Button";
|
||||
import {AdapterDateFnsJalali} from "@mui/x-date-pickers/AdapterDateFnsJalali";
|
||||
import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import {DatePicker} from "@mui/x-date-pickers/DatePicker";
|
||||
import {faIR} from "@mui/x-date-pickers/locales";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { AdapterDateFnsJalali } from "@mui/x-date-pickers/AdapterDateFnsJalali";
|
||||
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
|
||||
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
||||
import { faIR } from "@mui/x-date-pickers/locales";
|
||||
import moment from "jalali-moment";
|
||||
import {FormControl, FormHelperText} from "@mui/material";
|
||||
import {useConfig} from "@witel/webapp-builder";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useMemo, useState } from "react";
|
||||
|
||||
function ButtonField(props) {
|
||||
const t = useTranslations();
|
||||
@@ -17,17 +15,16 @@ function ButtonField(props) {
|
||||
label,
|
||||
id,
|
||||
disabled,
|
||||
InputProps: {ref} = {},
|
||||
inputProps: {"aria-label": ariaLabel} = {},
|
||||
InputProps: { ref } = {},
|
||||
inputProps: { "aria-label": ariaLabel } = {},
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<Button
|
||||
sx={{width: "100%", padding: 0.8}}
|
||||
sx={{ width: "100%", padding: 0.8 }}
|
||||
variant="outlined"
|
||||
color={
|
||||
props.slotProps.formik.touched.birthday &&
|
||||
Boolean(props.slotProps.formik.errors.birthday)
|
||||
props.slotProps.formik.touched.birthday && Boolean(props.slotProps.formik.errors.birthday)
|
||||
? "error"
|
||||
: "primary"
|
||||
}
|
||||
@@ -37,42 +34,42 @@ function ButtonField(props) {
|
||||
aria-label={ariaLabel}
|
||||
onClick={() => 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" ? "مدیر عامل" : ""}`,
|
||||
})}`}
|
||||
</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 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 (
|
||||
<DatePicker
|
||||
slots={{field: ButtonField, ...props.slots}}
|
||||
slots={{ field: ButtonField, ...props.slots }}
|
||||
disabled={props.disabled}
|
||||
slotProps={{
|
||||
formik: props.formik,
|
||||
field: {setOpen},
|
||||
field: { setOpen },
|
||||
textField: {
|
||||
helperText: props.formik.errors.birthday
|
||||
? `${t("birthday_error", {value: `${props.formik.values.person_type === "legal" ? "مدیر عامل" : "خود"}`})}`
|
||||
? `${t("birthday_error", {
|
||||
value: `${props.formik.values.person_type === "legal" ? "مدیر عامل" : "خود"}`,
|
||||
})}`
|
||||
: null,
|
||||
},
|
||||
}}
|
||||
@@ -86,7 +83,7 @@ function ButtonDatePicker(props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default function PickerWithButtonField({formik, disabled}) {
|
||||
export default function PickerWithButtonField({ formik, disabled }) {
|
||||
return (
|
||||
<FormControl variant={"outlined"} fullWidth size="small" error={true}>
|
||||
<LocalizationProvider
|
||||
@@ -97,15 +94,8 @@ export default function PickerWithButtonField({formik, disabled}) {
|
||||
}}
|
||||
>
|
||||
<ButtonDatePicker
|
||||
label={
|
||||
formik.values.birthday !== "" &&
|
||||
formik.values.birthday.locale("fa").format("YYYY/MM/DD")
|
||||
}
|
||||
value={
|
||||
formik.values.birthday !== ""
|
||||
? formik.values.birthday.toDate()
|
||||
: null
|
||||
}
|
||||
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) => {
|
||||
@@ -113,9 +103,7 @@ export default function PickerWithButtonField({formik, disabled}) {
|
||||
}}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
<FormHelperText>
|
||||
{formik.touched.birthday && formik.errors.birthday}
|
||||
</FormHelperText>
|
||||
<FormHelperText>{formik.touched.birthday && formik.errors.birthday}</FormHelperText>
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user