fixed bug
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"@mui/lab": "^5.0.0-alpha.152",
|
||||
"@mui/material": "^5.12.0",
|
||||
"@mui/x-date-pickers": "^6.18.5",
|
||||
"@witel/webapp-builder": "^1.3.2",
|
||||
"@witel/webapp-builder": "^1.3.4",
|
||||
"axios": "^1.4.0",
|
||||
"colord": "^2.9.3",
|
||||
"date-fns-jalali": "^2.13.0-0",
|
||||
|
||||
@@ -152,13 +152,19 @@
|
||||
"cityList_loading": "درحال دریافت لیست شهر ها ...",
|
||||
"loan_request_page": "ثبت درخواست وام",
|
||||
"personal_info": "اطلاعات شخصی",
|
||||
"real_person": "شخص حقیقی",
|
||||
"legal_person": "شخص حقوقی",
|
||||
"national_code_number": "کد ملی می بایست شامل اعداد باشد",
|
||||
"national_number_number": "شناسه ملی می بایست شامل اعداد باشد",
|
||||
"national_code_max": "کد ملی می بایست 10 رقم باشد",
|
||||
"national_number_max": "شناسه ملی می بایست 11 رقم باشد",
|
||||
"shenasname_serial_max": "سریال پشت کارت ملی می بایست شامل 10 بخش باشد",
|
||||
"postal_code_max": "کد پستی می بایست 10 رقم باشد",
|
||||
"tel_number_max": "شماره ثابت می بایست 11 رقم باشد",
|
||||
"national_code_positive": "کد ملی می بایست مثبت باشد",
|
||||
"national_number_positive": "شناسه ملی می بایست مثبت باشد",
|
||||
"uploading_documents": "اسناد",
|
||||
"error_message_person_type": "نوع شخص خود را وارد کنید!",
|
||||
"error_message_name": "لطفا نام خود را وارد کنید!",
|
||||
"error_message_plate_number": "لطفا شماره پلاک را به درستی وارد کنید!",
|
||||
"error_message_occupation_id": "لطفا کد شغل را به درستی وارد کنید!",
|
||||
@@ -168,8 +174,10 @@
|
||||
"error_message_navgan_id": "لطفا کد هوشمند ناوگان خود را وارد کنید!",
|
||||
"error_message_province_id": "لطفا استان خود را وارد کنید!",
|
||||
"error_message_national_id": "لطفا کد ملی خود را وارد کنید!",
|
||||
"error_message_national_number": "لطفا شناسه ملی خود را وارد کنید!",
|
||||
"error_message_date_of_birth": "لطفا تاریخ تولد خود را وارد کنید!",
|
||||
"error_message_shenasname_serial": "لطفا سریال پشت کارت ملی خود را وارد کنید!",
|
||||
"error_message_tracking_code": "لطفا کد رهگیری کارت ملی خود را وارد کنید!",
|
||||
"error_message_postal_code": "لطفا کد پستی خود را وارد کنید!",
|
||||
"error_message_national_code": "لطفا کد ملی خود را وارد کنید!",
|
||||
"error_message_checkedBox": "لطفا کد صحت اطلاعات خود را تایید کنید!",
|
||||
@@ -205,9 +213,13 @@
|
||||
"text_field_navgan_id": "کد هوشمند ناوگان",
|
||||
"text_field_enter_your_navgan_id": "کد هوشمند ناوگان خود را وارد کنید",
|
||||
"text_field_national_code": "کد ملی",
|
||||
"text_field_national_number": "شناسه ملی",
|
||||
"text_field_enter_your_national_id": "کد ملی خود را وارد کنید",
|
||||
"text_field_enter_your_national_number": "شناسه ملی خود را وارد کنید",
|
||||
"text_field_shenasname_serial": "سریال پشت کارت ملی",
|
||||
"text_field_enter_your_shenasname_serial": "سریال پشت کارت ملی خود را وارد کنید",
|
||||
"text_field_national_trackin_code": "کد رهگیری کارت ملی",
|
||||
"text_field_enter_your_trackin_code": "کد رهگیری کارت ملی خود را وارد کنید",
|
||||
"text_field_plate_number": "شماره پلاک",
|
||||
"text_field_enter_your_plate_number": "شماره پلاک خود را وارد کنید",
|
||||
"button_submit": "ثبت درخواست",
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
import SelectBox from "@/core/components/SelectBox";
|
||||
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||
import {Box, Button, Checkbox, FormControlLabel, Grid, Stack, TextField, Typography} from "@mui/material";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Checkbox,
|
||||
Fade,
|
||||
FormControlLabel,
|
||||
Grid,
|
||||
Stack,
|
||||
TextField,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import {useFormik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import {CenterLayout, useRequest} from "@witel/webapp-builder";
|
||||
import {CenterLayout, useRequest, useUser} from "@witel/webapp-builder";
|
||||
import useProvince from "@/lib/app/hooks/useProvince";
|
||||
import useCities from "@/lib/app/hooks/useCities";
|
||||
import PlateNumber from "@/core/components/PlateNumber";
|
||||
@@ -16,8 +28,11 @@ import DoneIcon from '@mui/icons-material/Done';
|
||||
import {NextLinkComposed} from "@witel/webapp-builder/dist/utils/linkRouting";
|
||||
import SvgDone from "@/core/components/svgs/SvgDone";
|
||||
import {SEND_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import {useRouter} from "next/router";
|
||||
|
||||
const AddFormComponent = () => {
|
||||
const router = useRouter()
|
||||
const {getUser, changeUser} = useUser()
|
||||
const t = useTranslations();
|
||||
const [finishLoanRequest, setFinishLoanRequest] = useState(false)
|
||||
const [checked, setChecked] = useState(false);
|
||||
@@ -28,13 +43,17 @@ const AddFormComponent = () => {
|
||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
||||
|
||||
const initialValues = {
|
||||
person_type: "real",
|
||||
telephone_number: "",
|
||||
vehicle_type: "",
|
||||
province_id: "",
|
||||
city_id: "",
|
||||
navgan_id: "",
|
||||
national_id: "",
|
||||
national_number: "",
|
||||
national_serial_number: "",
|
||||
national_card_tracking_code: "",
|
||||
national_serial_number_or_tracking_code: "national_serial_number",
|
||||
postal_code: "",
|
||||
navgan_type: "",
|
||||
plate_part1: "",
|
||||
@@ -49,76 +68,74 @@ const AddFormComponent = () => {
|
||||
};
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
person_type: Yup.string().required(t("LoanRequest.error_message_person_type")),
|
||||
telephone_number: Yup.mixed()
|
||||
.test("max", `${t("LoanRequest.tel_number_max")}`, (value) => {
|
||||
const stringValue = String(value);
|
||||
return stringValue.length === 11
|
||||
})
|
||||
.required(t("LoanRequest.error_message_tel_number")),
|
||||
vehicle_type: Yup.string().required(
|
||||
t("LoanRequest.error_message_vehicle_type")
|
||||
),
|
||||
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")
|
||||
),
|
||||
birthday: Yup.string().required(
|
||||
t("LoanRequest.error_message_date_of_birth")
|
||||
),
|
||||
vehicle_type: Yup.string().required(t("LoanRequest.error_message_vehicle_type")),
|
||||
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")),
|
||||
birthday: Yup.string().required(t("LoanRequest.error_message_date_of_birth")),
|
||||
postal_code: Yup.mixed()
|
||||
.test("max", `${t("LoanRequest.postal_code_max")}`, (value) => value.toString().length === 10)
|
||||
.required(
|
||||
t("LoanRequest.error_message_postal_code")
|
||||
),
|
||||
.required(t("LoanRequest.error_message_postal_code")),
|
||||
plate_part1: Yup.mixed().test("max", `${t("LoanRequest.error_message_plate_number")}`, (value) => value.toString().length === 2)
|
||||
.required(
|
||||
t("LoanRequest.error_message_plate_number")
|
||||
),
|
||||
.required(t("LoanRequest.error_message_plate_number")),
|
||||
plate_part2: Yup.mixed()
|
||||
.required(
|
||||
t("LoanRequest.error_message_plate_number")
|
||||
),
|
||||
.required(t("LoanRequest.error_message_plate_number")),
|
||||
plate_part3: Yup.mixed().test("max", `${t("LoanRequest.error_message_plate_number")}`, (value) => value.toString().length === 3)
|
||||
.required(
|
||||
t("LoanRequest.error_message_plate_number")
|
||||
),
|
||||
.required(t("LoanRequest.error_message_plate_number")),
|
||||
plate_part4: Yup.mixed().test("max", `${t("LoanRequest.error_message_plate_number")}`, (value) => value.toString().length === 2)
|
||||
.required(
|
||||
t("LoanRequest.error_message_plate_number")
|
||||
),
|
||||
.required(t("LoanRequest.error_message_plate_number")),
|
||||
navgan_id: Yup.mixed().required(t("LoanRequest.error_message_navgan_id")),
|
||||
province_id: Yup.string().required(t("LoanRequest.error_message_province_id")),
|
||||
city_id: Yup.string().required(t("LoanRequest.error_message_city_id")),
|
||||
national_id: Yup.mixed()
|
||||
.test("is-number", `${t("LoanRequest.national_code_number")}`,
|
||||
(value) => !isNaN(value))
|
||||
.test("is-number", `${t("LoanRequest.national_code_number")}`, (value) => !isNaN(value))
|
||||
.test("positive", `${t("LoanRequest.national_code_positive")}`, (value) => value >= 0)
|
||||
.test("max", `${t("LoanRequest.national_code_max")}`, (value) => value.toString().length === 10)
|
||||
.required(t("LoanRequest.error_message_national_id")),
|
||||
national_serial_number: Yup.string().required(t("LoanRequest.error_message_shenasname_serial")),
|
||||
national_number: Yup.mixed().when('person_type', ([person_type], schema) => {
|
||||
return person_type === 'legal' ? schema
|
||||
.test("is-number", `${t("LoanRequest.national_number_number")}`, (value) => !isNaN(value))
|
||||
.test("positive", `${t("LoanRequest.national_number_positive")}`, (value) => value >= 0)
|
||||
.test("max", `${t("LoanRequest.national_number_max")}`, (value) => value && value.toString().length === 11)
|
||||
.required(t("LoanRequest.error_message_national_number")) : schema;
|
||||
}),
|
||||
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
|
||||
}),
|
||||
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
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
const handleSubmit = async (values, props) => {
|
||||
props.setSubmitting(true)
|
||||
let _national_number = values.person_type === "legal" ? {
|
||||
shenase_meli: values.national_number
|
||||
} : {}
|
||||
|
||||
await requestServer(SEND_LOAN_REQUEST_NAVGAN, "post", {
|
||||
auth: true, notification: true, data: {
|
||||
const _national_card = values.national_serial_number_or_tracking_code === "national_serial_number" ? {
|
||||
national_serial_number: values.national_serial_number
|
||||
} : {
|
||||
national_tracking_code: values.national_card_tracking_code
|
||||
}
|
||||
|
||||
let _data = {
|
||||
is_legal_person: values.person_type === 'legal' ? 1 : 0,
|
||||
telephone_number: values.telephone_number,
|
||||
national_id: values.national_id,
|
||||
vehicle_type: values.vehicle_type,
|
||||
province_id: values.province_id,
|
||||
city_id: values.city_id,
|
||||
navgan_id: values.navgan_id,
|
||||
national_id: values.national_id,
|
||||
national_serial_number: values.national_serial_number,
|
||||
postal_code: values.postal_code,
|
||||
navgan_type: values.navgan_type,
|
||||
plate_part1: values.plate_part1,
|
||||
@@ -128,10 +145,16 @@ const AddFormComponent = () => {
|
||||
address: values.address,
|
||||
birthday: values.birthday.locale('en').format("YYYY-MM-DD"),
|
||||
education_id: values.education_id,
|
||||
occupation_id: values.occupation_id,
|
||||
occupation_id: values.occupation_id, ..._national_card, ..._national_number
|
||||
}
|
||||
|
||||
await requestServer(SEND_LOAN_REQUEST_NAVGAN, "post", {
|
||||
auth: true, notification: true, data: _data
|
||||
}).then(() => {
|
||||
setFinishLoanRequest(true)
|
||||
router.replace('/dashboard/navgan/followUp-loan')
|
||||
getUser((data) => {
|
||||
changeUser(data);
|
||||
});
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
props.setSubmitting(false)
|
||||
@@ -142,11 +165,8 @@ const AddFormComponent = () => {
|
||||
initialValues, validationSchema, onSubmit: handleSubmit
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
{finishLoanRequest ?
|
||||
(
|
||||
<CenterLayout>
|
||||
return (<>
|
||||
{finishLoanRequest ? (<CenterLayout>
|
||||
<SvgDone width={200} height={200}/>
|
||||
<Stack direction={'row'} spacing={0.7} sx={{mb: 4}}>
|
||||
<Typography variant={'h5'}
|
||||
@@ -157,11 +177,31 @@ const AddFormComponent = () => {
|
||||
to={'/dashboard/navgan/followUp-loan'}>
|
||||
{t("LoanRequest.back_to_dashboard")}
|
||||
</Button>
|
||||
</CenterLayout>
|
||||
) : (
|
||||
<>
|
||||
</CenterLayout>) : (<>
|
||||
<Grid container spacing={2} sx={{padding: 2}}
|
||||
>
|
||||
<Grid item xs={12} sm={4}
|
||||
>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
fullWidth
|
||||
size={'small'}
|
||||
value={formik.values.person_type}
|
||||
exclusive
|
||||
onChange={(e, value) => formik.handleChange({
|
||||
target: {
|
||||
name: "person_type", value: value,
|
||||
},
|
||||
})}
|
||||
>
|
||||
<ToggleButton value="real">
|
||||
{t("LoanRequest.real_person")}
|
||||
</ToggleButton>
|
||||
<ToggleButton value="legal">
|
||||
{t("LoanRequest.legal_person")}
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}
|
||||
>
|
||||
<TextField
|
||||
@@ -179,21 +219,75 @@ const AddFormComponent = () => {
|
||||
}
|
||||
formik.handleChange({
|
||||
target: {
|
||||
name: "national_id",
|
||||
value: inputValue,
|
||||
name: "national_id", value: inputValue,
|
||||
},
|
||||
});
|
||||
}}
|
||||
label={t("LoanRequest.text_field_national_code")}
|
||||
placeholder={t(
|
||||
"LoanRequest.text_field_enter_your_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>
|
||||
<Fade in={formik.values.person_type === 'legal'}>
|
||||
<Grid item xs={12} sm={4}
|
||||
>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="national_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_number}
|
||||
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_number", value: inputValue,
|
||||
},
|
||||
});
|
||||
}}
|
||||
label={t("LoanRequest.text_field_national_number")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_national_number")}
|
||||
onBlur={formik.handleBlur("national_number")}
|
||||
error={formik.touched.national_number && Boolean(formik.errors.national_number)}
|
||||
helperText={formik.touched.national_number && formik.errors.national_number}
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
</Fade>
|
||||
</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) => 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
|
||||
@@ -203,15 +297,31 @@ const AddFormComponent = () => {
|
||||
size="small"
|
||||
value={formik.values.national_serial_number}
|
||||
label={t("LoanRequest.text_field_shenasname_serial")}
|
||||
placeholder={t(
|
||||
"LoanRequest.text_field_enter_your_shenasname_serial")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_shenasname_serial")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("national_serial_number")}
|
||||
error={formik.touched.national_serial_number && Boolean(formik.errors.national_serial_number)}
|
||||
helperText={formik.touched.national_serial_number && formik.errors.national_serial_number}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>) : (<Grid item xs={12} sm={4}
|
||||
>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
name="national_card_tracking_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_card_tracking_code}
|
||||
label={t("LoanRequest.text_field_national_trackin_code")}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_trackin_code")}
|
||||
fullWidth
|
||||
onChange={formik.handleChange}
|
||||
onBlur={formik.handleBlur("national_card_tracking_code")}
|
||||
error={formik.touched.national_card_tracking_code && Boolean(formik.errors.national_card_tracking_code)}
|
||||
helperText={formik.touched.national_card_tracking_code && formik.errors.national_card_tracking_code}
|
||||
/>
|
||||
</Grid>)}
|
||||
|
||||
<Grid item xs={12} sm={4}>
|
||||
<MuiDatePicker
|
||||
formik={formik}
|
||||
@@ -237,8 +347,7 @@ const AddFormComponent = () => {
|
||||
}
|
||||
formik.handleChange({
|
||||
target: {
|
||||
name: "postal_code",
|
||||
value: inputValue,
|
||||
name: "postal_code", value: inputValue,
|
||||
},
|
||||
});
|
||||
}}
|
||||
@@ -267,15 +376,12 @@ const AddFormComponent = () => {
|
||||
}
|
||||
formik.handleChange({
|
||||
target: {
|
||||
name: "telephone_number",
|
||||
value: inputValue,
|
||||
name: "telephone_number", value: inputValue,
|
||||
},
|
||||
});
|
||||
}}
|
||||
label={t("LoanRequest.text_field_tel_number")}
|
||||
placeholder={t(
|
||||
"LoanRequest.text_field_enter_your_tel_number"
|
||||
)}
|
||||
placeholder={t("LoanRequest.text_field_enter_your_tel_number")}
|
||||
fullWidth
|
||||
onBlur={formik.handleBlur("telephone_number")}
|
||||
error={formik.touched.telephone_number && Boolean(formik.errors.telephone_number)}
|
||||
@@ -291,23 +397,13 @@ const AddFormComponent = () => {
|
||||
size="small"
|
||||
value={formik.values.navgan_type}
|
||||
selectType="navgan_type"
|
||||
selectors={[
|
||||
{
|
||||
id: 1,
|
||||
value: "روستایی",
|
||||
name: "روستایی"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: "عمومی",
|
||||
name: "عمومی"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
value: "منطقه آزاد",
|
||||
name: "منطقه آزاد"
|
||||
}
|
||||
]}
|
||||
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) => {
|
||||
@@ -391,18 +487,11 @@ const AddFormComponent = () => {
|
||||
value={formik.values.vehicle_type}
|
||||
schema={{value: 'value', name: 'name'}}
|
||||
selectType="vehicle_type"
|
||||
selectors={[
|
||||
{
|
||||
id: 0,
|
||||
value: "اتوبوس",
|
||||
name: "اتوبوس"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
value: "مینی بوس",
|
||||
name: "مینی بوس"
|
||||
}
|
||||
]}
|
||||
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)}
|
||||
@@ -482,14 +571,12 @@ const AddFormComponent = () => {
|
||||
<Grid item xs={12}>
|
||||
<FormControlLabel
|
||||
color={'error.main'}
|
||||
control={
|
||||
<Checkbox
|
||||
control={<Checkbox
|
||||
checked={formik.values.checkedBox}
|
||||
onChange={(event) => {
|
||||
formik.setFieldValue("checkedBox", event.target.checked)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>}
|
||||
label={`${t("LoanRequest.checkbox")}`}/>
|
||||
|
||||
</Grid>
|
||||
@@ -513,16 +600,11 @@ const AddFormComponent = () => {
|
||||
endIcon={<DataSaverOnIcon/>}
|
||||
disabled={formik.values.checkedBox ? (formik.isSubmitting || !formik.dirty || !formik.isValid) : true}
|
||||
>
|
||||
{formik.isSubmitting
|
||||
? t("LoanRequest.button_while_submit")
|
||||
: t("LoanRequest.button_submit")}
|
||||
{formik.isSubmitting ? t("LoanRequest.button_while_submit") : t("LoanRequest.button_submit")}
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</>
|
||||
);
|
||||
</>)}
|
||||
</>);
|
||||
};
|
||||
|
||||
export default AddFormComponent;
|
||||
|
||||
@@ -3,11 +3,9 @@ import {globalServerProps} from "@/core/utils/globalServerProps";
|
||||
import DeadlineMiddleware from "@/middlewares/Deadline";
|
||||
|
||||
export default function AddLoanRequest() {
|
||||
return (
|
||||
<DeadlineMiddleware type={'register'} withMessage={true}>
|
||||
return (<DeadlineMiddleware type={'register'} withMessage={true}>
|
||||
<LoanRequestComponent/>
|
||||
</DeadlineMiddleware>
|
||||
);
|
||||
</DeadlineMiddleware>);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
@@ -15,7 +13,7 @@ export async function getServerSideProps({req, locale}) {
|
||||
props: {
|
||||
...await globalServerProps({req, locale}),
|
||||
title: "LoanRequest.loan_request_page",
|
||||
layout: {name: 'DashboardLayout', permissions: ["can_request_navgan_loan"]}
|
||||
layout: {name: 'DashboardLayout', props: {permissions: ["can_request_navgan_loan"]}}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user