Feature/update api
This commit is contained in:
@@ -1,46 +1,41 @@
|
||||
import {
|
||||
CenterLayout,
|
||||
FullPageLayout,
|
||||
NextLinkComposed,
|
||||
useUser,
|
||||
} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, NextLinkComposed, useUser } from "@witel/webapp-builder";
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
const FirstComponent = () => {
|
||||
const { user } = useUser();
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<FullPageLayout>
|
||||
<CenterLayout spacing={2}>
|
||||
{user.permissions.includes("can_request_navgan_loan") ? (
|
||||
<>
|
||||
<Typography>{t("Dashboard.go_to_add_request_loan")}</Typography>
|
||||
<Button
|
||||
component={NextLinkComposed}
|
||||
to={{ pathname: "/dashboard/navgan/add-request-loan" }}
|
||||
variant={"contained"}
|
||||
size={"large"}
|
||||
>
|
||||
{t("LoanRequest.loan_request_page")}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Typography>{t("Dashboard.go_to_followUp-loan")}</Typography>
|
||||
<Button
|
||||
component={NextLinkComposed}
|
||||
to={{ pathname: "/dashboard/navgan/followUp-loan" }}
|
||||
variant={"contained"}
|
||||
size={"large"}
|
||||
>
|
||||
{t("LoanFollowUp.loan_follow_up_page")}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</CenterLayout>
|
||||
</FullPageLayout>
|
||||
);
|
||||
const { user } = useUser();
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<FullPageLayout>
|
||||
<CenterLayout spacing={2}>
|
||||
{user.permissions.includes("can_request_navgan_loan") ? (
|
||||
<>
|
||||
<Typography>{t("Dashboard.go_to_add_request_loan")}</Typography>
|
||||
<Button
|
||||
component={NextLinkComposed}
|
||||
to={{ pathname: "/dashboard/navgan/add-request-loan" }}
|
||||
variant={"contained"}
|
||||
size={"large"}
|
||||
>
|
||||
{t("LoanRequest.loan_request_page")}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Typography>{t("Dashboard.go_to_followUp-loan")}</Typography>
|
||||
<Button
|
||||
component={NextLinkComposed}
|
||||
to={{ pathname: "/dashboard/navgan/followUp-loan" }}
|
||||
variant={"contained"}
|
||||
size={"large"}
|
||||
>
|
||||
{t("LoanFollowUp.loan_follow_up_page")}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</CenterLayout>
|
||||
</FullPageLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default FirstComponent;
|
||||
export default FirstComponent;
|
||||
|
||||
@@ -1,64 +1,58 @@
|
||||
import {
|
||||
Button,
|
||||
Grid,
|
||||
Stack,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography
|
||||
} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {CenterLayout} from "@witel/webapp-builder";
|
||||
import {useState} from "react";
|
||||
import DoneIcon from '@mui/icons-material/Done';
|
||||
import {NextLinkComposed} from "@witel/webapp-builder/dist/utils/linkRouting";
|
||||
import { Button, Grid, Stack, ToggleButton, ToggleButtonGroup, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CenterLayout } from "@witel/webapp-builder";
|
||||
import { useState } from "react";
|
||||
import DoneIcon from "@mui/icons-material/Done";
|
||||
import { NextLinkComposed } from "@witel/webapp-builder/dist/utils/linkRouting";
|
||||
import SvgDone from "@/core/components/svgs/SvgDone";
|
||||
import RealPersonForm from "@/components/dashboard/navgan/add-request-loan/forms/RealPersonForm";
|
||||
import LegalPersonForm from "@/components/dashboard/navgan/add-request-loan/forms/LegalPersonForm";
|
||||
|
||||
const AddFormComponent = () => {
|
||||
const t = useTranslations();
|
||||
const [finishLoanRequest, setFinishLoanRequest] = useState(false)
|
||||
const [personType, setPersonType] = useState("real")
|
||||
const [finishLoanRequest, setFinishLoanRequest] = useState(false);
|
||||
const [personType, setPersonType] = useState("real");
|
||||
|
||||
return (<>
|
||||
{finishLoanRequest ? (<CenterLayout>
|
||||
<SvgDone width={200} height={200}/>
|
||||
<Stack direction={'row'} spacing={0.7} sx={{mb: 4}}>
|
||||
<Typography variant={'h5'}
|
||||
align={'center'}>{t("LoanRequest.finish_loan_request")}</Typography>
|
||||
<DoneIcon color={'success'}/>
|
||||
</Stack>
|
||||
<Button variant={'contained'} component={NextLinkComposed}
|
||||
to={'/dashboard/navgan/followUp-loan'}>
|
||||
{t("LoanRequest.back_to_dashboard")}
|
||||
</Button>
|
||||
</CenterLayout>) : (
|
||||
<>
|
||||
<Stack sx={{width: "100%", my : 3}} justifyContent={'center'} alignItems={'center'}>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
value={personType}
|
||||
exclusive
|
||||
onChange={(e, value) => {
|
||||
if (value === null) return
|
||||
setPersonType(value)
|
||||
}}
|
||||
>
|
||||
<ToggleButton value="real">
|
||||
{t("LoanRequest.real_person")}
|
||||
</ToggleButton>
|
||||
<ToggleButton value="legal">
|
||||
{t("LoanRequest.legal_person")}
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</Stack>
|
||||
{
|
||||
personType === "real" ? <RealPersonForm setFinishLoanRequest={setFinishLoanRequest}/> :
|
||||
<LegalPersonForm setFinishLoanRequest={setFinishLoanRequest}/>
|
||||
}
|
||||
</>
|
||||
)}
|
||||
</>);
|
||||
return (
|
||||
<>
|
||||
{finishLoanRequest ? (
|
||||
<CenterLayout>
|
||||
<SvgDone width={200} height={200} />
|
||||
<Stack direction={"row"} spacing={0.7} sx={{ mb: 4 }}>
|
||||
<Typography variant={"h5"} align={"center"}>
|
||||
{t("LoanRequest.finish_loan_request")}
|
||||
</Typography>
|
||||
<DoneIcon color={"success"} />
|
||||
</Stack>
|
||||
<Button variant={"contained"} component={NextLinkComposed} to={"/dashboard/navgan/followUp-loan"}>
|
||||
{t("LoanRequest.back_to_dashboard")}
|
||||
</Button>
|
||||
</CenterLayout>
|
||||
) : (
|
||||
<>
|
||||
<Stack sx={{ width: "100%", my: 3 }} justifyContent={"center"} alignItems={"center"}>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
value={personType}
|
||||
exclusive
|
||||
onChange={(e, value) => {
|
||||
if (value === null) return;
|
||||
setPersonType(value);
|
||||
}}
|
||||
>
|
||||
<ToggleButton value="real">{t("LoanRequest.real_person")}</ToggleButton>
|
||||
<ToggleButton value="legal">{t("LoanRequest.legal_person")}</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</Stack>
|
||||
{personType === "real" ? (
|
||||
<RealPersonForm setFinishLoanRequest={setFinishLoanRequest} />
|
||||
) : (
|
||||
<LegalPersonForm setFinishLoanRequest={setFinishLoanRequest} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddFormComponent;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
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";
|
||||
@@ -16,28 +16,28 @@ import * as React from "react";
|
||||
import SelectBox from "@/core/components/SelectBox";
|
||||
import useLimitedProvince from "@/lib/app/hooks/useLimitedProvince";
|
||||
import PlateNumber from "@/core/components/PlateNumber";
|
||||
import {useRouter} from "next/router";
|
||||
import {useRequest, useUser} from "@witel/webapp-builder";
|
||||
import { useRouter } from "next/router";
|
||||
import { useRequest, useUser } from "@witel/webapp-builder";
|
||||
import * as Yup from "yup";
|
||||
import {SEND_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import { SEND_LOAN_REQUEST_NAVGAN } from "@/core/data/apiRoutes";
|
||||
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||
import {useFormik} from "formik";
|
||||
import { useFormik } from "formik";
|
||||
import useProjectTitle from "@/lib/app/hooks/useProjectTitle";
|
||||
import useActivityType from "@/lib/app/hooks/useActivityType";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import LegalPersonDatePicker from "@/core/components/LegalPersonDatePicker";
|
||||
|
||||
const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
const LegalPersonForm = ({ setFinishLoanRequest }) => {
|
||||
const t = useTranslations();
|
||||
const router = useRouter();
|
||||
const requestServer = useRequest();
|
||||
const {getUser, changeUser} = useUser();
|
||||
const {cityTextField, cityList, setProvinceID, isLoadingCityList} = useCities();
|
||||
const {provinceList, isLoadingProvinceList, errorProvinceList} = useLimitedProvince();
|
||||
const {educationsList, isLoadingEducationsList, errorEducationsList} = UseEducations();
|
||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations();
|
||||
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType();
|
||||
const {projectTitle, isLoadingProjectTitle, errorProjectTitle} = useProjectTitle();
|
||||
const { getUser, changeUser } = useUser();
|
||||
const { cityTextField, cityList, setProvinceID, isLoadingCityList } = useCities();
|
||||
const { provinceList, isLoadingProvinceList, errorProvinceList } = useLimitedProvince();
|
||||
const { educationsList, isLoadingEducationsList, errorEducationsList } = UseEducations();
|
||||
const { occupationsList, isLoadingOccupationsList, errorOccupationsList } = useOccupations();
|
||||
const { activityType, isLoadingActivityType, errorActivityType } = useActivityType();
|
||||
const { projectTitle, isLoadingProjectTitle, errorProjectTitle } = useProjectTitle();
|
||||
|
||||
const initialValues = {
|
||||
person_type: "legal",
|
||||
@@ -118,35 +118,41 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
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"))
|
||||
.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;
|
||||
}),
|
||||
boss_national_serial_number: Yup.string()
|
||||
.when("national_serial_number_or_tracking_code", ([national_serial_number_or_tracking_code], 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.test(
|
||||
"max",
|
||||
`${t("LoanRequest.boss_national_serial_number_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
).required(t("LoanRequest.error_message_boss_shenasname_serial"))
|
||||
? schema
|
||||
.test(
|
||||
"max",
|
||||
`${t("LoanRequest.boss_national_serial_number_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
)
|
||||
.required(t("LoanRequest.error_message_boss_shenasname_serial"))
|
||||
: 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.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_boss_tracking_code_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
).required(t("LoanRequest.error_message_boss_national_card_tracking_code"))
|
||||
? schema
|
||||
.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_boss_tracking_code_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
)
|
||||
.required(t("LoanRequest.error_message_boss_national_card_tracking_code"))
|
||||
: schema;
|
||||
}
|
||||
),
|
||||
@@ -157,18 +163,18 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
let _national_number =
|
||||
values.person_type === "legal"
|
||||
? {
|
||||
shenase_meli: values.national_number,
|
||||
}
|
||||
shenase_meli: values.national_number,
|
||||
}
|
||||
: {};
|
||||
|
||||
const _national_card =
|
||||
values.national_serial_number_or_tracking_code === "national_serial_number"
|
||||
? {
|
||||
national_serial_number: values.boss_national_serial_number,
|
||||
}
|
||||
national_serial_number: values.boss_national_serial_number,
|
||||
}
|
||||
: {
|
||||
national_tracking_code: values.boss_national_card_tracking_code,
|
||||
};
|
||||
national_tracking_code: values.boss_national_card_tracking_code,
|
||||
};
|
||||
|
||||
let _data = {
|
||||
is_legal_person: 1,
|
||||
@@ -213,8 +219,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
changeUser(data);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
@@ -227,7 +232,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Grid container spacing={2} sx={{p: 2}}>
|
||||
<Grid container spacing={2} sx={{ p: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="navgan_plan_id"
|
||||
@@ -237,7 +242,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingProjectTitle}
|
||||
errorEcured={errorProjectTitle}
|
||||
selectors={projectTitle}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.navgan_plan_id}
|
||||
value={formik.values.navgan_plan_id}
|
||||
handleChange={(event) => {
|
||||
@@ -258,7 +263,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingActivityType}
|
||||
errorEcured={errorActivityType}
|
||||
selectors={activityType}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.activity_type}
|
||||
value={formik.values.activity_type}
|
||||
handleChange={(event) => {
|
||||
@@ -271,15 +276,15 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{p: 2}}>
|
||||
<Grid container spacing={2} sx={{ p: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="national_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_number}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -303,7 +308,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="company_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -319,12 +324,12 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="register_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.register_number}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -347,14 +352,14 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="company_postal_code"
|
||||
variant="outlined"
|
||||
value={formik.values.company_postal_code}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -379,11 +384,11 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="company_tel_number"
|
||||
variant="outlined"
|
||||
value={formik.values.company_tel_number}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
size="small"
|
||||
onChange={(event) => {
|
||||
@@ -415,7 +420,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="province_id"
|
||||
@@ -425,7 +430,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingProvinceList}
|
||||
errorEcured={errorProvinceList}
|
||||
selectors={provinceList}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.province_id}
|
||||
value={formik.values.province_id}
|
||||
handleChange={(event) => {
|
||||
@@ -447,12 +452,12 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoadingCityList
|
||||
? `${t("LoanRequest.cityList_loading")}`
|
||||
: cityList.length === 0
|
||||
? `${t("LoanRequest.cityList_empty")}`
|
||||
: cityTextField
|
||||
? `${t("LoanRequest.cityList_empty")}`
|
||||
: cityTextField
|
||||
}
|
||||
size="small"
|
||||
selectType="city_id"
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
disabled={cityList.length === 0}
|
||||
selectors={cityList}
|
||||
select={formik.values.city_id}
|
||||
@@ -465,15 +470,15 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_national_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.boss_national_code}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -514,7 +519,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
name: "مرد",
|
||||
},
|
||||
]}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.boss_gender}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue("boss_gender", event.target.value);
|
||||
@@ -526,10 +531,10 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_first_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -545,7 +550,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_last_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -568,7 +573,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
@@ -597,7 +602,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
{formik.values.national_serial_number_or_tracking_code === "national_serial_number" ? (
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_national_serial_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -625,11 +630,11 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
) : (
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_national_card_tracking_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
value={formik.values.boss_national_card_tracking_code}
|
||||
label={t("LoanRequest.text_field_boss_national_card_tracking_code")}
|
||||
@@ -661,7 +666,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
)}
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="boss_father_name"
|
||||
variant="outlined"
|
||||
value={formik.values.boss_father_name}
|
||||
@@ -676,14 +681,14 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<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"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
selectType="vehicle_type"
|
||||
selectors={[
|
||||
{
|
||||
@@ -705,16 +710,16 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<PlateNumber formik={formik}/>
|
||||
<PlateNumber formik={formik} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="navgan_id"
|
||||
variant="outlined"
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
value={formik.values.navgan_id}
|
||||
onChange={formik.handleChange}
|
||||
@@ -738,7 +743,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
selectors={educationsList}
|
||||
select={formik.values.education_id}
|
||||
value={formik.values.education_id}
|
||||
schema={{value: "id", name: "title"}}
|
||||
schema={{ value: "id", name: "title" }}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue("education_id", event.target.value);
|
||||
}}
|
||||
@@ -756,7 +761,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingOccupationsList}
|
||||
errorEcured={errorOccupationsList}
|
||||
selectType="occupation_id"
|
||||
schema={{value: "id", name: "title"}}
|
||||
schema={{ value: "id", name: "title" }}
|
||||
selectors={occupationsList}
|
||||
select={formik.values.occupation_id}
|
||||
value={formik.values.occupation_id}
|
||||
@@ -770,12 +775,12 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<TextField
|
||||
multiline
|
||||
rows={4}
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="address"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -790,7 +795,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container sx={{padding: 2}}>
|
||||
<Grid container sx={{ padding: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<FormControlLabel
|
||||
color={"error.main"}
|
||||
@@ -806,7 +811,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<FormControlLabel
|
||||
color={"error.main"}
|
||||
@@ -825,10 +830,10 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: {xs: "column", sm: "row"},
|
||||
flexDirection: { xs: "column", sm: "row" },
|
||||
alignItems: "center",
|
||||
mx: "auto",
|
||||
width: {xs: "100%", sm: "30%", md: "25%"},
|
||||
width: { xs: "100%", sm: "30%", md: "25%" },
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
@@ -837,8 +842,8 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
||||
type="submit"
|
||||
variant="contained"
|
||||
size="large"
|
||||
sx={{my: 4}}
|
||||
endIcon={<DataSaverOnIcon/>}
|
||||
sx={{ my: 4 }}
|
||||
endIcon={<DataSaverOnIcon />}
|
||||
disabled={formik.values.checkedBox ? formik.isSubmitting || !formik.dirty || !formik.isValid : true}
|
||||
>
|
||||
{formik.isSubmitting ? t("LoanRequest.button_while_submit") : t("LoanRequest.button_submit")}
|
||||
|
||||
@@ -10,15 +10,15 @@ import {
|
||||
} from "@mui/material";
|
||||
import SelectBox from "@/core/components/SelectBox";
|
||||
import MuiDatePicker from "@/core/components/MuiDatePicker";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { useTranslations } from "next-intl";
|
||||
import useLimitedProvince from "@/lib/app/hooks/useLimitedProvince";
|
||||
import useCities from "@/lib/app/hooks/useCities";
|
||||
import {useFormik} from "formik";
|
||||
import { useFormik } from "formik";
|
||||
import * as Yup from "yup";
|
||||
import DataSaverOnIcon from "@mui/icons-material/DataSaverOn";
|
||||
import {SEND_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import {useRequest, useUser} from "@witel/webapp-builder";
|
||||
import {useRouter} from "next/router";
|
||||
import { SEND_LOAN_REQUEST_NAVGAN } from "@/core/data/apiRoutes";
|
||||
import { useRequest, useUser } from "@witel/webapp-builder";
|
||||
import { useRouter } from "next/router";
|
||||
import PlateNumber from "@/core/components/PlateNumber";
|
||||
import * as React from "react";
|
||||
import UseEducations from "@/lib/app/hooks/useEducations";
|
||||
@@ -26,16 +26,16 @@ import useOccupations from "@/lib/app/hooks/useOccupations";
|
||||
import useActivityType from "@/lib/app/hooks/useActivityType";
|
||||
import useProjectTitle from "@/lib/app/hooks/useProjectTitle";
|
||||
|
||||
const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
const RealPersonForm = ({ setFinishLoanRequest }) => {
|
||||
const t = useTranslations();
|
||||
const {provinceList, isLoadingProvinceList, errorProvinceList} = useLimitedProvince();
|
||||
const {cityTextField, cityList, setProvinceID, isLoadingCityList} = useCities();
|
||||
const {educationsList, isLoadingEducationsList, errorEducationsList} = UseEducations();
|
||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations();
|
||||
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType();
|
||||
const {projectTitle, isLoadingProjectTitle, errorProjectTitle} = useProjectTitle();
|
||||
const { provinceList, isLoadingProvinceList, errorProvinceList } = useLimitedProvince();
|
||||
const { cityTextField, cityList, setProvinceID, isLoadingCityList } = useCities();
|
||||
const { educationsList, isLoadingEducationsList, errorEducationsList } = UseEducations();
|
||||
const { occupationsList, isLoadingOccupationsList, errorOccupationsList } = useOccupations();
|
||||
const { activityType, isLoadingActivityType, errorActivityType } = useActivityType();
|
||||
const { projectTitle, isLoadingProjectTitle, errorProjectTitle } = useProjectTitle();
|
||||
const requestServer = useRequest();
|
||||
const {getUser, changeUser} = useUser();
|
||||
const { getUser, changeUser } = useUser();
|
||||
const router = useRouter();
|
||||
|
||||
const initialValues = {
|
||||
@@ -107,25 +107,31 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
.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()
|
||||
.when("national_serial_number_or_tracking_code", ([national_serial_number_or_tracking_code], 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.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_serial_number_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
).required(t("LoanRequest.error_message_shenasname_serial"))
|
||||
? schema
|
||||
.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_serial_number_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
)
|
||||
.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.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_tracking_code_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
).required(t("LoanRequest.error_message_tracking_code"))
|
||||
? schema
|
||||
.test(
|
||||
"max",
|
||||
`${t("LoanRequest.national_tracking_code_max")}`,
|
||||
(value) => value && value.toString().length === 10
|
||||
)
|
||||
.required(t("LoanRequest.error_message_tracking_code"))
|
||||
: schema;
|
||||
}
|
||||
),
|
||||
@@ -137,11 +143,11 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
const _national_card =
|
||||
values.national_serial_number_or_tracking_code === "national_serial_number"
|
||||
? {
|
||||
national_serial_number: values.national_serial_number,
|
||||
}
|
||||
national_serial_number: values.national_serial_number,
|
||||
}
|
||||
: {
|
||||
national_tracking_code: values.national_card_tracking_code,
|
||||
};
|
||||
national_tracking_code: values.national_card_tracking_code,
|
||||
};
|
||||
|
||||
let _data = {
|
||||
is_legal_person: 0,
|
||||
@@ -182,8 +188,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
changeUser(data);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
@@ -197,7 +202,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid container spacing={2} sx={{p: 2}}>
|
||||
<Grid container spacing={2} sx={{ p: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="navgan_plan_id"
|
||||
@@ -207,7 +212,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingProjectTitle}
|
||||
errorEcured={errorProjectTitle}
|
||||
selectors={projectTitle}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.navgan_plan_id}
|
||||
value={formik.values.navgan_plan_id}
|
||||
handleChange={(event) => {
|
||||
@@ -228,7 +233,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingActivityType}
|
||||
errorEcured={errorActivityType}
|
||||
selectors={activityType}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.activity_type}
|
||||
value={formik.values.activity_type}
|
||||
handleChange={(event) => {
|
||||
@@ -241,7 +246,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<ToggleButtonGroup
|
||||
color="primary"
|
||||
@@ -270,7 +275,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
{formik.values.national_serial_number_or_tracking_code === "national_serial_number" ? (
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="national_serial_number"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -291,16 +296,15 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
}
|
||||
helperText={formik.touched.national_serial_number && formik.errors.national_serial_number}
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
) : (
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="national_card_tracking_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
value={formik.values.national_card_tracking_code}
|
||||
label={t("LoanRequest.text_field_national_trackin_code")}
|
||||
@@ -331,12 +335,12 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
)}
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="national_code"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
value={formik.values.national_code}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -359,10 +363,10 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="first_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -378,7 +382,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="last_name"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -393,10 +397,10 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="father_name"
|
||||
variant="outlined"
|
||||
value={formik.values.father_name}
|
||||
@@ -429,7 +433,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
name: "مرد",
|
||||
},
|
||||
]}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.gender}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue("gender", event.target.value);
|
||||
@@ -449,13 +453,13 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="navgan_id"
|
||||
variant="outlined"
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
value={formik.values.navgan_id}
|
||||
onChange={formik.handleChange}
|
||||
@@ -470,11 +474,11 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="postal_code"
|
||||
variant="outlined"
|
||||
value={formik.values.postal_code}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
const inputValue = event.target.value;
|
||||
@@ -499,11 +503,11 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4}>
|
||||
<TextField
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="telephone_number"
|
||||
variant="outlined"
|
||||
value={formik.values.telephone_number}
|
||||
inputProps={{inputMode: "numeric", pattern: "[0-9]*"}}
|
||||
inputProps={{ inputMode: "numeric", pattern: "[0-9]*" }}
|
||||
type={"tel"}
|
||||
size="small"
|
||||
onChange={(event) => {
|
||||
@@ -527,7 +531,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="province_id"
|
||||
@@ -537,7 +541,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingProvinceList}
|
||||
errorEcured={errorProvinceList}
|
||||
selectors={provinceList}
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
select={formik.values.province_id}
|
||||
value={formik.values.province_id}
|
||||
handleChange={(event) => {
|
||||
@@ -559,12 +563,12 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoadingCityList
|
||||
? `${t("LoanRequest.cityList_loading")}`
|
||||
: cityList.length === 0
|
||||
? `${t("LoanRequest.cityList_empty")}`
|
||||
: cityTextField
|
||||
? `${t("LoanRequest.cityList_empty")}`
|
||||
: cityTextField
|
||||
}
|
||||
size="small"
|
||||
selectType="city_id"
|
||||
schema={{value: "value", name: "name"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
disabled={cityList.length === 0}
|
||||
selectors={cityList}
|
||||
select={formik.values.city_id}
|
||||
@@ -577,14 +581,14 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<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"}}
|
||||
schema={{ value: "value", name: "name" }}
|
||||
selectType="vehicle_type"
|
||||
selectors={[
|
||||
{
|
||||
@@ -606,10 +610,10 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<PlateNumber formik={formik}/>
|
||||
<PlateNumber formik={formik} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12} sm={6}>
|
||||
<SelectBox
|
||||
name="education_id"
|
||||
@@ -621,7 +625,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
selectors={educationsList}
|
||||
select={formik.values.education_id}
|
||||
value={formik.values.education_id}
|
||||
schema={{value: "id", name: "title"}}
|
||||
schema={{ value: "id", name: "title" }}
|
||||
handleChange={(event) => {
|
||||
formik.setFieldValue("education_id", event.target.value);
|
||||
}}
|
||||
@@ -639,7 +643,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
isLoading={isLoadingOccupationsList}
|
||||
errorEcured={errorOccupationsList}
|
||||
selectType="occupation_id"
|
||||
schema={{value: "id", name: "title"}}
|
||||
schema={{ value: "id", name: "title" }}
|
||||
selectors={occupationsList}
|
||||
select={formik.values.occupation_id}
|
||||
value={formik.values.occupation_id}
|
||||
@@ -653,12 +657,12 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={2} sx={{padding: 2}}>
|
||||
<Grid container spacing={2} sx={{ padding: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<TextField
|
||||
multiline
|
||||
rows={4}
|
||||
sx={{width: "100%"}}
|
||||
sx={{ width: "100%" }}
|
||||
name="address"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
@@ -673,7 +677,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container sx={{padding: 2}}>
|
||||
<Grid container sx={{ padding: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<FormControlLabel
|
||||
color={"error.main"}
|
||||
@@ -689,7 +693,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container sx={{px: 2}}>
|
||||
<Grid container sx={{ px: 2 }}>
|
||||
<Grid item xs={12}>
|
||||
<FormControlLabel
|
||||
color={"error.main"}
|
||||
@@ -708,10 +712,10 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: {xs: "column", sm: "row"},
|
||||
flexDirection: { xs: "column", sm: "row" },
|
||||
alignItems: "center",
|
||||
mx: "auto",
|
||||
width: {xs: "100%", sm: "30%", md: "25%"},
|
||||
width: { xs: "100%", sm: "30%", md: "25%" },
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
@@ -720,8 +724,8 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||
type="submit"
|
||||
variant="contained"
|
||||
size="large"
|
||||
sx={{my: 4}}
|
||||
endIcon={<DataSaverOnIcon/>}
|
||||
sx={{ my: 4 }}
|
||||
endIcon={<DataSaverOnIcon />}
|
||||
disabled={formik.values.checkedBox ? formik.isSubmitting || !formik.dirty || !formik.isValid : true}
|
||||
>
|
||||
{formik.isSubmitting ? t("LoanRequest.button_while_submit") : t("LoanRequest.button_submit")}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import { useTranslations } from "next-intl";
|
||||
import AddFormComponent from "@/components/dashboard/navgan/add-request-loan/forms/AddForm";
|
||||
|
||||
const LoanRequestComponent = () => {
|
||||
@@ -6,7 +6,7 @@ const LoanRequestComponent = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<AddFormComponent/>
|
||||
<AddFormComponent />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,117 +1,127 @@
|
||||
import {Box, Button, Card, CardContent, Grid, Stack, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Box, Button, Card, CardContent, Grid, Stack, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import moment from "jalali-moment";
|
||||
import {LinkRouting} from "@witel/webapp-builder";
|
||||
import AccessTimeFilledIcon from '@mui/icons-material/AccessTimeFilled';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import EditIcon from '@mui/icons-material/Edit';
|
||||
import PendingIcon from '@mui/icons-material/Pending';
|
||||
import { LinkRouting } from "@witel/webapp-builder";
|
||||
import AccessTimeFilledIcon from "@mui/icons-material/AccessTimeFilled";
|
||||
import CancelIcon from "@mui/icons-material/Cancel";
|
||||
import EditIcon from "@mui/icons-material/Edit";
|
||||
import PendingIcon from "@mui/icons-material/Pending";
|
||||
|
||||
const RequestCard = ({item}) => {
|
||||
const RequestCard = ({ item }) => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Grid item xs={12} lg={6} xl={4}>
|
||||
<Card sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
boxShadow: "rgba(0, 0, 0, 0.15) 0px 5px 15px 0px"
|
||||
}}>
|
||||
<CardContent sx={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: '100%',
|
||||
justifyContent: "space-between"
|
||||
}}>
|
||||
<Card
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
boxShadow: "rgba(0, 0, 0, 0.15) 0px 5px 15px 0px",
|
||||
}}
|
||||
>
|
||||
<CardContent
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
height: "100%",
|
||||
justifyContent: "space-between",
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Box
|
||||
sx={{
|
||||
borderLeft: '6px solid',
|
||||
borderColor: 'primary.main',
|
||||
borderRadius: '6px 0px 0px 6px',
|
||||
paddingLeft: '10px',
|
||||
borderLeft: "6px solid",
|
||||
borderColor: "primary.main",
|
||||
borderRadius: "6px 0px 0px 6px",
|
||||
paddingLeft: "10px",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6" sx={{lineHeight: 2, fontWeight: 'bold'}}>
|
||||
<Typography variant="h6" sx={{ lineHeight: 2, fontWeight: "bold" }}>
|
||||
{`${t("LoanFollowUp.loan_unique_code")}: ${item.id}`}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Typography variant="body1" sx={{lineHeight: 2, paddingLeft: '20px'}}>
|
||||
<Typography variant="body1" sx={{ lineHeight: 2, paddingLeft: "20px" }}>
|
||||
{`${t("LoanFollowUp.loan_date")}: ${moment(item.created_at).locale("fa").format("HH:mm | YYYY/MM/DD")}`}
|
||||
</Typography>
|
||||
<Typography variant="body1" sx={{lineHeight: 2, paddingLeft: '20px'}}>
|
||||
{`${t("LoanFollowUp.loan_bank_branch")}: ${item.branch_info === null ? '-' : item.branch_info}`}
|
||||
<Typography variant="body1" sx={{ lineHeight: 2, paddingLeft: "20px" }}>
|
||||
{`${t("LoanFollowUp.loan_bank_branch")}: ${item.branch_info === null ? "-" : item.branch_info}`}
|
||||
</Typography>
|
||||
<Typography variant="body1" sx={{lineHeight: 2, paddingLeft: '20px'}}>
|
||||
<Typography variant="body1" sx={{ lineHeight: 2, paddingLeft: "20px" }}>
|
||||
{`${t("LoanFollowUp.loan_status")}: `}
|
||||
{item.state_id === 9 &&
|
||||
{item.state_id === 9 && (
|
||||
<>
|
||||
{t("LoanFollowUp.loan_reserve")}
|
||||
<PendingIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: '#48a4df'}}/>
|
||||
<PendingIcon
|
||||
sx={{ verticalAlign: "middle", marginLeft: "4px", color: "#48a4df" }}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
{item.state_id === 17 &&
|
||||
)}
|
||||
{item.state_id === 17 && (
|
||||
<>
|
||||
{t("LoanFollowUp.loan_edit_info")}
|
||||
<EditIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: '#ed6c02'}}/>
|
||||
<EditIcon sx={{ verticalAlign: "middle", marginLeft: "4px", color: "#ed6c02" }} />
|
||||
</>
|
||||
}
|
||||
{item.state_id === 7 &&
|
||||
)}
|
||||
{item.state_id === 7 && (
|
||||
<>
|
||||
{t("LoanFollowUp.loan_cancel")}
|
||||
<CancelIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: 'red'}}/>
|
||||
<CancelIcon sx={{ verticalAlign: "middle", marginLeft: "4px", color: "red" }} />
|
||||
</>
|
||||
}
|
||||
{item.state_id !== 7 && item.state_id !== 17 && item.state_id !== 9 &&
|
||||
)}
|
||||
{item.state_id !== 7 && item.state_id !== 17 && item.state_id !== 9 && (
|
||||
<>
|
||||
{t("LoanFollowUp.loan_review")}
|
||||
<AccessTimeFilledIcon sx={{verticalAlign: 'middle', marginLeft: '4px', color: '#084070'}}/>
|
||||
<AccessTimeFilledIcon
|
||||
sx={{ verticalAlign: "middle", marginLeft: "4px", color: "#084070" }}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
)}
|
||||
</Typography>
|
||||
{item.state_id === 17 && (
|
||||
<Typography variant="body1" sx={{
|
||||
lineHeight: 2,
|
||||
paddingLeft: '20px',
|
||||
wordWrap: 'break-word',
|
||||
overflowWrap: 'break-word',
|
||||
wordBreak: 'break-word'
|
||||
}}>
|
||||
<Typography
|
||||
variant="body1"
|
||||
sx={{
|
||||
lineHeight: 2,
|
||||
paddingLeft: "20px",
|
||||
wordWrap: "break-word",
|
||||
overflowWrap: "break-word",
|
||||
wordBreak: "break-word",
|
||||
}}
|
||||
>
|
||||
{`${t("LoanFollowUp.loan_description")}: ${item.latestHistory.expert_description}`}
|
||||
</Typography>
|
||||
)}
|
||||
{item.state_id === 7 && (
|
||||
<Typography variant="body1" sx={{
|
||||
lineHeight: 2,
|
||||
paddingLeft: '20px',
|
||||
wordWrap: 'break-word',
|
||||
overflowWrap: 'break-word',
|
||||
wordBreak: 'break-word'
|
||||
}}>
|
||||
<Typography
|
||||
variant="body1"
|
||||
sx={{
|
||||
lineHeight: 2,
|
||||
paddingLeft: "20px",
|
||||
wordWrap: "break-word",
|
||||
overflowWrap: "break-word",
|
||||
wordBreak: "break-word",
|
||||
}}
|
||||
>
|
||||
{`${t("LoanFollowUp.loan_description")}: درخواست وام توسط بانک تایید نشد (نیاز به اصلاح اطلاعات) `}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
{
|
||||
item.state_id === 17 ? (
|
||||
<Button variant="contained" color="warning" sx={{alignSelf: 'flex-end', mt: 2}}>
|
||||
<LinkRouting underline="none" color="inherit"
|
||||
href={`/dashboard/navgan/${item.id}/show`}>
|
||||
{t("LoanFollowUp.loan_edit")}
|
||||
</LinkRouting>
|
||||
</Button>
|
||||
) : (
|
||||
<Button variant="contained" color="primary" sx={{alignSelf: 'flex-end', mt: 2}}>
|
||||
<LinkRouting underline="none" color="inherit"
|
||||
href={`/dashboard/navgan/${item.id}/show`}>
|
||||
{t("LoanFollowUp.loan_details")}
|
||||
</LinkRouting>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
{item.state_id === 17 ? (
|
||||
<Button variant="contained" color="warning" sx={{ alignSelf: "flex-end", mt: 2 }}>
|
||||
<LinkRouting underline="none" color="inherit" href={`/dashboard/navgan/${item.id}/show`}>
|
||||
{t("LoanFollowUp.loan_edit")}
|
||||
</LinkRouting>
|
||||
</Button>
|
||||
) : (
|
||||
<Button variant="contained" color="primary" sx={{ alignSelf: "flex-end", mt: 2 }}>
|
||||
<LinkRouting underline="none" color="inherit" href={`/dashboard/navgan/${item.id}/show`}>
|
||||
{t("LoanFollowUp.loan_details")}
|
||||
</LinkRouting>
|
||||
</Button>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
export default RequestCard;
|
||||
export default RequestCard;
|
||||
|
||||
@@ -1,55 +1,53 @@
|
||||
import {Grid} from "@mui/material";
|
||||
import {useEffect, useState} from "react";
|
||||
import {SHOW_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes";
|
||||
import { Grid } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SHOW_LOAN_REQUEST_NAVGAN } from "@/core/data/apiRoutes";
|
||||
import RequestCard from "@/components/dashboard/navgan/followUp-loan/RequestCard";
|
||||
import {FullPageLayout, LoadingHardPage, useRequest} from "@witel/webapp-builder";
|
||||
import { FullPageLayout, LoadingHardPage, useRequest } from "@witel/webapp-builder";
|
||||
import sidebarMenu from "@/core/data/sidebarMenu";
|
||||
import BookmarkAddedIcon from "@mui/icons-material/BookmarkAdded";
|
||||
|
||||
const LoanFollowUpComponent = () => {
|
||||
const requestServer = useRequest();
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [requestsList, setRequestsList] = useState([]);
|
||||
useEffect(() => {
|
||||
setIsLoading(true)
|
||||
setIsLoading(true);
|
||||
requestServer(SHOW_LOAN_REQUEST_NAVGAN, "get", {
|
||||
auth: true,
|
||||
pending: false,
|
||||
success: {notification: {show: false}}
|
||||
success: { notification: { show: false } },
|
||||
})
|
||||
.then(function ({data}) {
|
||||
.then(function ({ data }) {
|
||||
const items = data.data;
|
||||
setRequestsList(items);
|
||||
setIsLoading(false)
|
||||
})
|
||||
.catch(function (error) {
|
||||
setIsLoading(false);
|
||||
})
|
||||
.catch(function (error) {});
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<FullPageLayout>
|
||||
<Grid
|
||||
container
|
||||
columnSpacing={2}
|
||||
rowSpacing={2}
|
||||
sx={{alignItems: "start", justifyContent: "center", padding: "24px"}}
|
||||
sx={{ alignItems: "start", justifyContent: "center", padding: "24px" }}
|
||||
>
|
||||
<LoadingHardPage
|
||||
loading={isLoading} width={100} height={100}
|
||||
sx={{position: "absolute", bgcolor: "#fffc"}}
|
||||
icon={<BookmarkAddedIcon sx={{width: 'inherit', height: 'inherit'}}/>}
|
||||
loading={isLoading}
|
||||
width={100}
|
||||
height={100}
|
||||
sx={{ position: "absolute", bgcolor: "#fffc" }}
|
||||
icon={<BookmarkAddedIcon sx={{ width: "inherit", height: "inherit" }} />}
|
||||
>
|
||||
<Grid container sx={{justifyContent : "center"}} spacing={2}>
|
||||
<Grid container sx={{ justifyContent: "center" }} spacing={2}>
|
||||
{requestsList.map((item) => (
|
||||
<RequestCard item={item} key={item.id}/>
|
||||
<RequestCard item={item} key={item.id} />
|
||||
))}
|
||||
</Grid>
|
||||
</LoadingHardPage>
|
||||
</Grid>
|
||||
</FullPageLayout>
|
||||
|
||||
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,37 +1,38 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {GET_LOAN_DETAILS} from "@/core/data/apiRoutes";
|
||||
import {useRouter} from "next/router";
|
||||
import {SvgLoading, useRequest} from "@witel/webapp-builder";
|
||||
import {Stack, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { useEffect, useState } from "react";
|
||||
import { GET_LOAN_DETAILS } from "@/core/data/apiRoutes";
|
||||
import { useRouter } from "next/router";
|
||||
import { SvgLoading, useRequest } from "@witel/webapp-builder";
|
||||
import { Stack, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import UpdateFormReal from "@/components/dashboard/navgan/show/form/UpdateFormReal";
|
||||
import UpdateFormLegal from "@/components/dashboard/navgan/show/form/UpdateFormLegal";
|
||||
|
||||
const ShowLoanForm = () => {
|
||||
const t = useTranslations();
|
||||
const {query} = useRouter();
|
||||
const requestServer = useRequest({auth: true, notification: false});
|
||||
const { query } = useRouter();
|
||||
const requestServer = useRequest({ auth: true, notification: false });
|
||||
const [LoanDetails, setLoanDetails] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
requestServer(GET_LOAN_DETAILS + query.id, 'get', {auth: true, notification: false}).then(({data}) => {
|
||||
setLoanDetails(data.data);
|
||||
}).catch(() => {
|
||||
})
|
||||
requestServer(GET_LOAN_DETAILS + query.id, "get", { auth: true, notification: false })
|
||||
.then(({ data }) => {
|
||||
setLoanDetails(data.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
if (Object.keys(LoanDetails).length === 0) {
|
||||
return (
|
||||
<Stack sx={{alignItems: "center", justifyContent: "center"}} spacing={3}>
|
||||
<SvgLoading height={150} width={150}/>
|
||||
<Stack sx={{ alignItems: "center", justifyContent: "center" }} spacing={3}>
|
||||
<SvgLoading height={150} width={150} />
|
||||
<Typography>{t("ShowLoan.loading_show_component")}</Typography>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
return LoanDetails.is_legal_person === 1 ? (
|
||||
<UpdateFormLegal LoanDetails={LoanDetails} LoanId={query.id}/>
|
||||
<UpdateFormLegal LoanDetails={LoanDetails} LoanId={query.id} />
|
||||
) : (
|
||||
<UpdateFormReal LoanDetails={LoanDetails} LoanId={query.id}/>
|
||||
)
|
||||
<UpdateFormReal LoanDetails={LoanDetails} LoanId={query.id} />
|
||||
);
|
||||
};
|
||||
export default ShowLoanForm;
|
||||
export default ShowLoanForm;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {useTranslations} from "next-intl";
|
||||
import {CenterLayout, useUser} from "@witel/webapp-builder";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { CenterLayout, useUser } from "@witel/webapp-builder";
|
||||
import ShowLoanForm from "@/components/dashboard/navgan/show/form";
|
||||
|
||||
const ShowLoan = () => {
|
||||
const t = useTranslations();
|
||||
const {user} = useUser();
|
||||
const { user } = useUser();
|
||||
|
||||
return (
|
||||
<CenterLayout>
|
||||
<ShowLoanForm/>
|
||||
<ShowLoanForm />
|
||||
</CenterLayout>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {Button, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import Svg403 from "@/core/components/svgs/Svg403";
|
||||
import {CenterLayout, FullPageLayout, NextLinkComposed} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, NextLinkComposed } from "@witel/webapp-builder";
|
||||
|
||||
const UnAuthorizedComponent = () => {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<>
|
||||
<TitlePage text="Titles.title_custom_403"/>
|
||||
<FullPageLayout sx={{p: 1}}>
|
||||
<TitlePage text="Titles.title_custom_403" />
|
||||
<FullPageLayout sx={{ p: 1 }}>
|
||||
<CenterLayout spacing={3}>
|
||||
<Svg403 width={300} height={200}/>
|
||||
<Svg403 width={300} height={200} />
|
||||
<Typography margin={2} variant="h6" textAlign="center">
|
||||
{t("ErrorPage.custom_403")}
|
||||
</Typography>
|
||||
@@ -23,8 +23,7 @@ const UnAuthorizedComponent = () => {
|
||||
pathname: "/",
|
||||
}}
|
||||
>
|
||||
{t("ErrorPage.link_routing_back_to")}{" "}
|
||||
{t("ErrorPage.link_routing_main_page")}
|
||||
{t("ErrorPage.link_routing_back_to")} {t("ErrorPage.link_routing_main_page")}
|
||||
</Button>
|
||||
</CenterLayout>
|
||||
</FullPageLayout>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {Button, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import Svg404 from "@/core/components/svgs/Svg404";
|
||||
import {CenterLayout, FullPageLayout, NextLinkComposed} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, NextLinkComposed } from "@witel/webapp-builder";
|
||||
|
||||
const NotFoundComponent = () => {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<>
|
||||
<TitlePage text="Titles.title_custom_404"/>
|
||||
<FullPageLayout sx={{p: 1}}>
|
||||
<TitlePage text="Titles.title_custom_404" />
|
||||
<FullPageLayout sx={{ p: 1 }}>
|
||||
<CenterLayout spacing={3}>
|
||||
<Svg404 width={300} height={200}/>
|
||||
<Svg404 width={300} height={200} />
|
||||
<Typography margin={2} variant="h6" textAlign="center">
|
||||
{t("ErrorPage.custom_404")}
|
||||
</Typography>
|
||||
@@ -23,8 +23,7 @@ const NotFoundComponent = () => {
|
||||
pathname: "/",
|
||||
}}
|
||||
>
|
||||
{t("ErrorPage.link_routing_back_to")}{" "}
|
||||
{t("ErrorPage.link_routing_main_page")}
|
||||
{t("ErrorPage.link_routing_back_to")} {t("ErrorPage.link_routing_main_page")}
|
||||
</Button>
|
||||
</CenterLayout>
|
||||
</FullPageLayout>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {Button, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Button, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import Svg500 from "@/core/components/svgs/Svg500";
|
||||
import {CenterLayout, FullPageLayout, NextLinkComposed} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, NextLinkComposed } from "@witel/webapp-builder";
|
||||
|
||||
const ServerErrorComponent = () => {
|
||||
const t = useTranslations();
|
||||
|
||||
return (
|
||||
<>
|
||||
<TitlePage text="Titles.title_custom_500"/>
|
||||
<FullPageLayout sx={{p: 1}}>
|
||||
<TitlePage text="Titles.title_custom_500" />
|
||||
<FullPageLayout sx={{ p: 1 }}>
|
||||
<CenterLayout spacing={3}>
|
||||
<Svg500 width={300} height={200}/>
|
||||
<Svg500 width={300} height={200} />
|
||||
<Typography margin={2} variant="h6" textAlign="center">
|
||||
{t("ErrorPage.custom_500")}
|
||||
</Typography>
|
||||
@@ -23,8 +23,7 @@ const ServerErrorComponent = () => {
|
||||
pathname: "/",
|
||||
}}
|
||||
>
|
||||
{t("ErrorPage.link_routing_back_to")}{" "}
|
||||
{t("ErrorPage.link_routing_main_page")}
|
||||
{t("ErrorPage.link_routing_back_to")} {t("ErrorPage.link_routing_main_page")}
|
||||
</Button>
|
||||
</CenterLayout>
|
||||
</FullPageLayout>
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import {Box, Container} from "@mui/material";
|
||||
import {useConfig} from "@witel/webapp-builder";
|
||||
import { Box, Container } from "@mui/material";
|
||||
import { useConfig } from "@witel/webapp-builder";
|
||||
|
||||
const Banner = () => {
|
||||
const {config} = useConfig();
|
||||
const { config } = useConfig();
|
||||
const bannerHTML = config.banner;
|
||||
return (<Box sx={{backgroundColor: "primary.light"}}>
|
||||
{config.banner && config.banner !== "" && (<Container sx={{py: 0.7}} maxWidth="xl">
|
||||
<div dangerouslySetInnerHTML={{__html: bannerHTML}}/>
|
||||
</Container>)}
|
||||
</Box>);
|
||||
return (
|
||||
<Box sx={{ backgroundColor: "primary.light" }}>
|
||||
{config.banner && config.banner !== "" && (
|
||||
<Container sx={{ py: 0.7 }} maxWidth="xl">
|
||||
<div dangerouslySetInnerHTML={{ __html: bannerHTML }} />
|
||||
</Container>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default Banner;
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
import {Box, Button, Container, Grid, Stack, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {LinkRouting} from "@witel/webapp-builder";
|
||||
import { Box, Button, Container, Grid, Stack, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { LinkRouting } from "@witel/webapp-builder";
|
||||
|
||||
const FooterDetails = () => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Box sx={{backgroundColor: 'black', color: 'white'}}>
|
||||
<Container sx={{py: 2}} maxWidth="xl">
|
||||
<Grid container sx={{py: 2}}>
|
||||
<Box sx={{ backgroundColor: "black", color: "white" }}>
|
||||
<Container sx={{ py: 2 }} maxWidth="xl">
|
||||
<Grid container sx={{ py: 2 }}>
|
||||
<Grid item xs={12} md={8}>
|
||||
<Button disabled>
|
||||
<Typography color={'white'}>کلیه حقوق محفوظ و متعلق به سازمان راهداری و حمل و نقل جاده ای می
|
||||
باشد</Typography>
|
||||
<Typography color={"white"}>
|
||||
کلیه حقوق محفوظ و متعلق به سازمان راهداری و حمل و نقل جاده ای می باشد
|
||||
</Typography>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid item xs={12} md={4}>
|
||||
<Stack direction="row" alignItems="center" justifyContent="center">
|
||||
<img src='/icons/bpms.png' width={50} alt={t("powered_by_witel")}/>
|
||||
<img src="/icons/bpms.png" width={50} alt={t("powered_by_witel")} />
|
||||
<LinkRouting
|
||||
sx={{margin: 0.5, fontSize: "16px", color: "white"}}
|
||||
href={'#'}
|
||||
sx={{ margin: 0.5, fontSize: "16px", color: "white" }}
|
||||
href={"#"}
|
||||
underline="hover"
|
||||
>
|
||||
{t("powered_by_witel")}
|
||||
</LinkRouting>
|
||||
</Stack>
|
||||
<Stack direction="row" alignItems="center" justifyContent="center">
|
||||
<Typography variant={"caption"}
|
||||
sx={{
|
||||
color: 'white',
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
<Typography
|
||||
variant={"caption"}
|
||||
sx={{
|
||||
color: "white",
|
||||
fontFamily: "Arial",
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
v{process.env.NEXT_PUBLIC_API_VERSION}
|
||||
</Typography>
|
||||
@@ -40,6 +42,6 @@ const FooterDetails = () => {
|
||||
</Grid>
|
||||
</Container>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export default FooterDetails
|
||||
);
|
||||
};
|
||||
export default FooterDetails;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {Box, Button, Container, Grid} from "@mui/material";
|
||||
import { Box, Button, Container, Grid } from "@mui/material";
|
||||
|
||||
const HeaderDetails = () => {
|
||||
return (
|
||||
<Box>
|
||||
<Container sx={{py: 3}} maxWidth="xl">
|
||||
<Container sx={{ py: 3 }} maxWidth="xl">
|
||||
<Grid container>
|
||||
<Grid item xs={12} md={8}>
|
||||
<Button startIcon={<img src='/icons/headerLogo.png' alt='icon'/>}/>
|
||||
<Button startIcon={<img src="/icons/headerLogo.png" alt="icon" />} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export default HeaderDetails
|
||||
);
|
||||
};
|
||||
export default HeaderDetails;
|
||||
|
||||
@@ -1,48 +1,59 @@
|
||||
import {Box, Button, Chip, Container, Grid, Link, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import DownloadIcon from '@mui/icons-material/Download';
|
||||
import { Box, Button, Chip, Container, Grid, Link, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import DownloadIcon from "@mui/icons-material/Download";
|
||||
|
||||
const LoanCondition = () => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Box>
|
||||
<Container sx={{py: 3}} maxWidth="xl">
|
||||
<Container sx={{ py: 3 }} maxWidth="xl">
|
||||
<Grid container>
|
||||
<Grid item xs={12} md={8}>
|
||||
<Box sx={{padding: 3}}>
|
||||
<Typography variant={'h5'}>
|
||||
قوانین دریافت وام
|
||||
</Typography>
|
||||
<Grid item sx={{my: 2}}>
|
||||
<Chip sx={{m: 1}}
|
||||
label="1. ارایه کارت هوشمند ناوگان فعال توسط مالک ناوگان (صاحب سند و پلاک)"/>
|
||||
<Chip sx={{m: 1}} label="2. ارایه حداقل 120 صورت وضعیت در سال 1400 و 1401"/>
|
||||
<Chip sx={{m: 1}} label="3. نداشتن بدهی جاری"/>
|
||||
<Box sx={{ padding: 3 }}>
|
||||
<Typography variant={"h5"}>قوانین دریافت وام</Typography>
|
||||
<Grid item sx={{ my: 2 }}>
|
||||
<Chip
|
||||
sx={{ m: 1 }}
|
||||
label="1. ارایه کارت هوشمند ناوگان فعال توسط مالک ناوگان (صاحب سند و پلاک)"
|
||||
/>
|
||||
<Chip sx={{ m: 1 }} label="2. ارایه حداقل 120 صورت وضعیت در سال 1400 و 1401" />
|
||||
<Chip sx={{ m: 1 }} label="3. نداشتن بدهی جاری" />
|
||||
</Grid>
|
||||
<Typography sx={{lineHeight: 2.4}} textAlign={'justify'}>
|
||||
این وام برای اتوبوس تا سقف <Typography sx={{color: "secondary.main"}}
|
||||
variant={'h6'}
|
||||
fontWeight={'bold'}
|
||||
component={'span'}>700</Typography> میلیون تومان
|
||||
و برای مینی بوس تا سقف <Typography sx={{color: "secondary.main"}}
|
||||
variant={'h6'}
|
||||
fontWeight={'bold'}
|
||||
component={'span'}>200</Typography> میلیون تومان در
|
||||
نظر گرفته شده است. مبلغ نهایی با توجه به امتیاز و روند کارشناسی در ادارات مربوطه مشخص
|
||||
میشود. برای اطلاع از شرایط کامل این وام فایل پیوست را مطالعه بفرمایید.
|
||||
<Typography sx={{ lineHeight: 2.4 }} textAlign={"justify"}>
|
||||
این وام برای اتوبوس تا سقف{" "}
|
||||
<Typography
|
||||
sx={{ color: "secondary.main" }}
|
||||
variant={"h6"}
|
||||
fontWeight={"bold"}
|
||||
component={"span"}
|
||||
>
|
||||
700
|
||||
</Typography>{" "}
|
||||
میلیون تومان و برای مینی بوس تا سقف{" "}
|
||||
<Typography
|
||||
sx={{ color: "secondary.main" }}
|
||||
variant={"h6"}
|
||||
fontWeight={"bold"}
|
||||
component={"span"}
|
||||
>
|
||||
200
|
||||
</Typography>{" "}
|
||||
میلیون تومان در نظر گرفته شده است. مبلغ نهایی با توجه به امتیاز و روند کارشناسی در
|
||||
ادارات مربوطه مشخص میشود. برای اطلاع از شرایط کامل این وام فایل پیوست را مطالعه
|
||||
بفرمایید.
|
||||
</Typography>
|
||||
</Box>
|
||||
</Grid>
|
||||
<Grid sx={{display: 'flex', alignItems: "center", justifyContent: "center"}} item xs={12} md={4}>
|
||||
<Grid sx={{ display: "flex", alignItems: "center", justifyContent: "center" }} item xs={12} md={4}>
|
||||
<Box>
|
||||
<Button variant="contained" startIcon={<DownloadIcon/>}>
|
||||
<Button variant="contained" startIcon={<DownloadIcon />}>
|
||||
<Link
|
||||
variant="subtitle1"
|
||||
sx={{padding: 1}}
|
||||
color={'white'}
|
||||
sx={{ padding: 1 }}
|
||||
color={"white"}
|
||||
download
|
||||
underline="none"
|
||||
href={'/files/راهنما.pdf'}
|
||||
href={"/files/راهنما.pdf"}
|
||||
>
|
||||
دریافت فایل های راهنما
|
||||
</Link>
|
||||
@@ -52,6 +63,6 @@ const LoanCondition = () => {
|
||||
</Grid>
|
||||
</Container>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export default LoanCondition
|
||||
);
|
||||
};
|
||||
export default LoanCondition;
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import TimelineManager from "@/core/components/timelines/timelineManager";
|
||||
import moment from "jalali-moment";
|
||||
import {Timeline} from "@mui/lab";
|
||||
import {useConfig} from "@witel/webapp-builder";
|
||||
import { Timeline } from "@mui/lab";
|
||||
import { useConfig } from "@witel/webapp-builder";
|
||||
|
||||
const TimeLineDetails = () => {
|
||||
const {config} = useConfig()
|
||||
const [timeLineList, setTimeLineList] = useState([])
|
||||
const { config } = useConfig();
|
||||
const [timeLineList, setTimeLineList] = useState([]);
|
||||
|
||||
const deadlines = Object.keys(config.deadlines).map(key => ({
|
||||
const deadlines = Object.keys(config.deadlines).map((key) => ({
|
||||
type: key,
|
||||
...config.deadlines[key]
|
||||
...config.deadlines[key],
|
||||
}));
|
||||
|
||||
useEffect(() => {
|
||||
let tempArr = []
|
||||
let tempArr = [];
|
||||
for (const timeLine of deadlines) {
|
||||
let temp = {}
|
||||
temp['label'] = timeLine.timeline_label
|
||||
temp['date'] = moment(timeLine.date.from, 'jYYYY/jMM/jDD').locale('fa').format('jD jMMMM')
|
||||
const fromDate = moment(timeLine.date.from, 'jYYYY/jMM/jDD')
|
||||
const toDate = moment(timeLine.date.to, 'jYYYY/jMM/jDD')
|
||||
const today = moment()
|
||||
if (today.isBetween(fromDate, toDate, null, '[]')) {
|
||||
temp['status'] = 'in progress'
|
||||
let temp = {};
|
||||
temp["label"] = timeLine.timeline_label;
|
||||
temp["date"] = moment(timeLine.date.from, "jYYYY/jMM/jDD").locale("fa").format("jD jMMMM");
|
||||
const fromDate = moment(timeLine.date.from, "jYYYY/jMM/jDD");
|
||||
const toDate = moment(timeLine.date.to, "jYYYY/jMM/jDD");
|
||||
const today = moment();
|
||||
if (today.isBetween(fromDate, toDate, null, "[]")) {
|
||||
temp["status"] = "in progress";
|
||||
} else if (today.isAfter(toDate, null)) {
|
||||
temp['status'] = 'done'
|
||||
temp["status"] = "done";
|
||||
} else if (today.isBefore(fromDate, null)) {
|
||||
temp['status'] = 'open'
|
||||
temp["status"] = "open";
|
||||
}
|
||||
tempArr.push(temp)
|
||||
tempArr.push(temp);
|
||||
}
|
||||
setTimeLineList(tempArr)
|
||||
setTimeLineList(tempArr);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -43,11 +43,10 @@ const TimeLineDetails = () => {
|
||||
date={timeLine.date}
|
||||
primaryLabel={timeLine.label.primary}
|
||||
secondaryLabel={timeLine.label.secondary}
|
||||
position={index === (timeLineList.length - 1) ? 'end' : ''}
|
||||
position={index === timeLineList.length - 1 ? "end" : ""}
|
||||
/>
|
||||
))
|
||||
}
|
||||
))}
|
||||
</Timeline>
|
||||
)
|
||||
}
|
||||
export default TimeLineDetails
|
||||
);
|
||||
};
|
||||
export default TimeLineDetails;
|
||||
|
||||
@@ -1,46 +1,55 @@
|
||||
import {Box, Container, Grid, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Box, Container, Grid, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import TimeLineDetails from "@/components/first/LoanDescription/TimeLineDetails";
|
||||
|
||||
const LoanDescription = () => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Box>
|
||||
<Container sx={{py: 3}} maxWidth="xl">
|
||||
<Typography sx={{my: 3}} variant={'h3'}>
|
||||
<Container sx={{ py: 3 }} maxWidth="xl">
|
||||
<Typography sx={{ my: 3 }} variant={"h3"}>
|
||||
وام نوسازی ناوگان
|
||||
</Typography>
|
||||
<Grid sx={{py: 2}} container spacing={2}>
|
||||
<Grid sx={{ py: 2 }} container spacing={2}>
|
||||
<Grid item xs={12} md={7}>
|
||||
<Typography sx={{lineHeight: 2.4}} variant={'subtitle1'} textAlign={'justify'}>
|
||||
این وام براساس <Typography sx={{color: "secondary.main"}} variant={'h5'}
|
||||
fontWeight={'bold'}
|
||||
component={'span'}>تبصره 18</Typography> قانون بودجه می باشد. در
|
||||
قانون
|
||||
بودجه این تبصره اینگونه بیان شده است:
|
||||
به منظور رشد و پیشرفت استان های کشور از طریق ارتقای بهره وری و توسعه، سرمایه گذاری ها،
|
||||
تکمیل واحدهای نیمه تمام و ظرفیت های خالی بنگاه های تولیدی بر پایه آمایش سرزمین و همچنین
|
||||
حمایت از طرح(پروژهای) دانش بنیان و پیشران و بسط و عدالت سرزمینی منابع زیر جهت ایجاد و افزایش
|
||||
تولید، اشتغال و کارآفرینی و ارتقای رشد اقتصادی اختصاص می یابد.
|
||||
<Typography sx={{ lineHeight: 2.4 }} variant={"subtitle1"} textAlign={"justify"}>
|
||||
این وام براساس{" "}
|
||||
<Typography
|
||||
sx={{ color: "secondary.main" }}
|
||||
variant={"h5"}
|
||||
fontWeight={"bold"}
|
||||
component={"span"}
|
||||
>
|
||||
تبصره 18
|
||||
</Typography>{" "}
|
||||
قانون بودجه می باشد. در قانون بودجه این تبصره اینگونه بیان شده است: به منظور رشد و پیشرفت
|
||||
استان های کشور از طریق ارتقای بهره وری و توسعه، سرمایه گذاری ها، تکمیل واحدهای نیمه تمام و
|
||||
ظرفیت های خالی بنگاه های تولیدی بر پایه آمایش سرزمین و همچنین حمایت از طرح(پروژهای) دانش
|
||||
بنیان و پیشران و بسط و عدالت سرزمینی منابع زیر جهت ایجاد و افزایش تولید، اشتغال و کارآفرینی
|
||||
و ارتقای رشد اقتصادی اختصاص می یابد.
|
||||
</Typography>
|
||||
<Typography sx={{lineHeight: 2.4}} variant={'subtitle1'} textAlign={'justify'}>
|
||||
<Typography sx={{ lineHeight: 2.4 }} variant={"subtitle1"} textAlign={"justify"}>
|
||||
در این راستا سازمان راهداری و حمل و نقل جاده ای به منظور بهبود کیفیت حمل و نقل بین شهری و
|
||||
افزایش ظرفیت ترابری اقدام به اعطای وام به <Typography sx={{color: "secondary.main"}}
|
||||
variant={'h5'}
|
||||
fontWeight={'bold'}
|
||||
component={'span'}>ناوگان های
|
||||
مسافربری</Typography> برای
|
||||
بازسازی و تعمیرات میکند.
|
||||
افزایش ظرفیت ترابری اقدام به اعطای وام به{" "}
|
||||
<Typography
|
||||
sx={{ color: "secondary.main" }}
|
||||
variant={"h5"}
|
||||
fontWeight={"bold"}
|
||||
component={"span"}
|
||||
>
|
||||
ناوگان های مسافربری
|
||||
</Typography>{" "}
|
||||
برای بازسازی و تعمیرات میکند.
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} md={5}>
|
||||
<Box>
|
||||
<TimeLineDetails/>
|
||||
<TimeLineDetails />
|
||||
</Box>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export default LoanDescription
|
||||
);
|
||||
};
|
||||
export default LoanDescription;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import {Box, Container, Grid, Stack, Typography} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {LinkRouting} from "@witel/webapp-builder";
|
||||
import { Box, Container, Grid, Stack, Typography } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { LinkRouting } from "@witel/webapp-builder";
|
||||
|
||||
const LoanRegister = () => {
|
||||
const t = useTranslations();
|
||||
return (
|
||||
<Box sx={{backgroundSize: 'cover', backgroundImage: `url(/images/bg-firstpage-bus.png)`}}>
|
||||
<Container sx={{padding: 3, color: "white"}} maxWidth="xl">
|
||||
<Typography sx={{my: 3, textShadow: '1px 1px 2px #555555'}} variant={'h3'}>
|
||||
<Box sx={{ backgroundSize: "cover", backgroundImage: `url(/images/bg-firstpage-bus.png)` }}>
|
||||
<Container sx={{ padding: 3, color: "white" }} maxWidth="xl">
|
||||
<Typography sx={{ my: 3, textShadow: "1px 1px 2px #555555" }} variant={"h3"}>
|
||||
{t("app_name")}
|
||||
</Typography>
|
||||
<Stack sx={{color: "white"}}>
|
||||
<Grid sx={{py: 4}} container spacing={2}>
|
||||
<Stack sx={{ color: "white" }}>
|
||||
<Grid sx={{ py: 4 }} container spacing={2}>
|
||||
<Grid item xs={12} md={6}>
|
||||
<Box sx={{paddingBottom: 4}}>
|
||||
<Typography sx={{lineHeight: 2.7, textShadow: '1px 1px 2px black'}}>
|
||||
<Box sx={{ paddingBottom: 4 }}>
|
||||
<Typography sx={{ lineHeight: 2.7, textShadow: "1px 1px 2px black" }}>
|
||||
وام نوسازی ناوگان به هدف رشد و پیشرفت استان های کشور از طریق ارتقای بهره وری و توسعه
|
||||
اعطا میشود. برای استفاده از تسهیلات این سامانه و درخواست وام می بایست ابتدا وارد
|
||||
سامانه شوید.
|
||||
@@ -22,17 +22,18 @@ const LoanRegister = () => {
|
||||
</Box>
|
||||
</Grid>
|
||||
<Grid item xs={12} md={6}>
|
||||
<Stack spacing={3} alignItems={'center'} justifyContent={'center'}>
|
||||
<Container maxWidth={'xs'} sx={{
|
||||
backgroundColor: "primary.main",
|
||||
textAlign: "center",
|
||||
borderRadius: 2,
|
||||
padding: 1
|
||||
}}>
|
||||
<LinkRouting underline="none" color="inherit" href={'/login'}>
|
||||
<Typography variant="h6">
|
||||
{t("firstPage.register_button")}
|
||||
</Typography>
|
||||
<Stack spacing={3} alignItems={"center"} justifyContent={"center"}>
|
||||
<Container
|
||||
maxWidth={"xs"}
|
||||
sx={{
|
||||
backgroundColor: "primary.main",
|
||||
textAlign: "center",
|
||||
borderRadius: 2,
|
||||
padding: 1,
|
||||
}}
|
||||
>
|
||||
<LinkRouting underline="none" color="inherit" href={"/login"}>
|
||||
<Typography variant="h6">{t("firstPage.register_button")}</Typography>
|
||||
</LinkRouting>
|
||||
</Container>
|
||||
</Stack>
|
||||
@@ -41,6 +42,6 @@ const LoanRegister = () => {
|
||||
</Stack>
|
||||
</Container>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export default LoanRegister
|
||||
);
|
||||
};
|
||||
export default LoanRegister;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {Stack} from "@mui/material";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Stack } from "@mui/material";
|
||||
import { useTranslations } from "next-intl";
|
||||
import LoanRegister from "@/components/first/LoanRegister";
|
||||
import LoanCondition from "@/components/first/LoanCondition";
|
||||
import FooterDetails from "@/components/first/FooterDetails";
|
||||
import HeaderDetails from "@/components/first/HeaderDetails";
|
||||
import LoanDescription from "@/components/first/LoanDescription";
|
||||
import {FullPageLayout} from "@witel/webapp-builder";
|
||||
import { FullPageLayout } from "@witel/webapp-builder";
|
||||
import Banner from "@/components/first/Banner";
|
||||
|
||||
const FirstComponent = () => {
|
||||
@@ -14,12 +14,12 @@ const FirstComponent = () => {
|
||||
return (
|
||||
<FullPageLayout>
|
||||
<Stack>
|
||||
<HeaderDetails/>
|
||||
<Banner/>
|
||||
<LoanRegister/>
|
||||
<LoanDescription/>
|
||||
<LoanCondition/>
|
||||
<FooterDetails/>
|
||||
<HeaderDetails />
|
||||
<Banner />
|
||||
<LoanRegister />
|
||||
<LoanDescription />
|
||||
<LoanCondition />
|
||||
<FooterDetails />
|
||||
</Stack>
|
||||
</FullPageLayout>
|
||||
);
|
||||
|
||||
@@ -1,53 +1,47 @@
|
||||
import ResendToken from "@/core/components/ResendToken";
|
||||
import StyledForm from "@/core/components/StyledForm";
|
||||
import {LOGIN} from "@/core/data/apiRoutes";
|
||||
import { LOGIN } from "@/core/data/apiRoutes";
|
||||
import ChangeCircleIcon from "@mui/icons-material/ChangeCircle";
|
||||
import LoginIcon from "@mui/icons-material/Login";
|
||||
import {Box, Button, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
||||
import {Field, Formik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import { Box, Button, Container, Grid, Paper, Stack, TextField, Typography } from "@mui/material";
|
||||
import { Field, Formik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import * as Yup from "yup";
|
||||
import SvgLogin from "@/core/components/svgs/SvgLogin";
|
||||
import AutoSubmit from "@/core/components/AutoSubmit";
|
||||
import {CenterLayout, FullPageLayout, useRequest, useUser} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, useRequest, useUser } from "@witel/webapp-builder";
|
||||
|
||||
const SendTokenComponent = ({
|
||||
PhoneNumber,
|
||||
setOtpToken,
|
||||
timer,
|
||||
setTimer,
|
||||
initialTimerValue,
|
||||
}) => {
|
||||
const SendTokenComponent = ({ PhoneNumber, setOtpToken, timer, setTimer, initialTimerValue }) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest();
|
||||
const {setToken} = useUser();
|
||||
const { setToken } = useUser();
|
||||
|
||||
const initialValues = {
|
||||
phone_number: PhoneNumber,
|
||||
verification_code: "",
|
||||
};
|
||||
const validationSchema = Yup.object().shape({
|
||||
verification_code: Yup.string().required(
|
||||
t("LoginPage.error_message_verification_code")
|
||||
),
|
||||
verification_code: Yup.string().required(t("LoginPage.error_message_verification_code")),
|
||||
});
|
||||
|
||||
const handleSubmit = (values, props) => {
|
||||
requestServer(LOGIN, "post", {
|
||||
auth: false, data: {
|
||||
auth: false,
|
||||
data: {
|
||||
phone_number: values.phone_number,
|
||||
verification_code: values.verification_code,
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
setToken(response.data.token);
|
||||
}).catch(function (error) {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<FullPageLayout sx={{p: 1}}>
|
||||
<FullPageLayout sx={{ p: 1 }}>
|
||||
<CenterLayout>
|
||||
<Container maxWidth="sm">
|
||||
<Paper elevation={0}>
|
||||
@@ -57,35 +51,32 @@ const SendTokenComponent = ({
|
||||
validationSchema={validationSchema}
|
||||
>
|
||||
{(props) => (
|
||||
<Stack spacing={2} sx={{p: 2}}>
|
||||
<Stack
|
||||
sx={{width: "100%"}}
|
||||
alignItems='center'
|
||||
>
|
||||
<SvgLogin width={300} height={200}/>
|
||||
<Stack spacing={2} sx={{ p: 2 }}>
|
||||
<Stack sx={{ width: "100%" }} alignItems="center">
|
||||
<SvgLogin width={300} height={200} />
|
||||
</Stack>
|
||||
<Typography margin={2} variant="h4" textAlign="center">
|
||||
{t("login")}
|
||||
</Typography>
|
||||
<StyledForm sx={{width: "100%"}}>
|
||||
<Stack spacing={3} sx={{p: 2}}>
|
||||
<StyledForm sx={{ width: "100%" }}>
|
||||
<Stack spacing={3} sx={{ p: 2 }}>
|
||||
<Box
|
||||
sx={{
|
||||
display: {xs: "column", sm: "flex"},
|
||||
display: { xs: "column", sm: "flex" },
|
||||
alignItems: "center",
|
||||
textAlign: {xs: "center", sm: "unset"},
|
||||
textAlign: { xs: "center", sm: "unset" },
|
||||
justifyContent: "space-between",
|
||||
}}
|
||||
>
|
||||
<Typography variant="button" sx={{display: "block"}}>
|
||||
<Typography variant="button" sx={{ display: "block" }}>
|
||||
{t("LoginPage.sent_token_to")}: {PhoneNumber}
|
||||
</Typography>
|
||||
<Button
|
||||
size="small"
|
||||
startIcon={<ChangeCircleIcon/>}
|
||||
startIcon={<ChangeCircleIcon />}
|
||||
variant="outlined"
|
||||
onClick={() => setOtpToken(false)}
|
||||
sx={{whiteSpace: "nowrap", my: {xs: 1, sm: 0}}}
|
||||
sx={{ whiteSpace: "nowrap", my: { xs: 1, sm: 0 } }}
|
||||
>
|
||||
{t("LoginPage.change_phone_number")}
|
||||
</Button>
|
||||
@@ -95,9 +86,7 @@ const SendTokenComponent = ({
|
||||
name="verification_code"
|
||||
variant="outlined"
|
||||
label={t("LoginPage.text_field_verification_code")}
|
||||
placeholder={t(
|
||||
"LoginPage.text_field_enter_your_verification_code"
|
||||
)}
|
||||
placeholder={t("LoginPage.text_field_enter_your_verification_code")}
|
||||
value={props.values.verification_code}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
@@ -113,7 +102,10 @@ const SendTokenComponent = ({
|
||||
});
|
||||
}}
|
||||
error={
|
||||
!!(props.touched.verification_code && props.errors.verification_code)
|
||||
!!(
|
||||
props.touched.verification_code &&
|
||||
props.errors.verification_code
|
||||
)
|
||||
}
|
||||
fullWidth
|
||||
helperText={
|
||||
@@ -122,7 +114,7 @@ const SendTokenComponent = ({
|
||||
: null
|
||||
}
|
||||
/>
|
||||
<AutoSubmit/>
|
||||
<AutoSubmit />
|
||||
<Grid container>
|
||||
<Grid item xs={12}>
|
||||
<Button
|
||||
@@ -130,7 +122,7 @@ const SendTokenComponent = ({
|
||||
type="submit"
|
||||
variant="contained"
|
||||
size="large"
|
||||
endIcon={<LoginIcon/>}
|
||||
endIcon={<LoginIcon />}
|
||||
disabled={props.isSubmitting}
|
||||
>
|
||||
{t("LoginPage.button_submit")}
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
import StyledForm from "@/core/components/StyledForm";
|
||||
import {SEND_OTP_TOKEN} from "@/core/data/apiRoutes";
|
||||
import { SEND_OTP_TOKEN } from "@/core/data/apiRoutes";
|
||||
import FingerprintIcon from "@mui/icons-material/Fingerprint";
|
||||
import {Button, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
||||
import {Field, Formik} from "formik";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {useSearchParams} from "next/navigation";
|
||||
import { Button, Container, Grid, Paper, Stack, TextField, Typography } from "@mui/material";
|
||||
import { Field, Formik } from "formik";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import * as Yup from "yup";
|
||||
import SvgLogin from "@/core/components/svgs/SvgLogin";
|
||||
import {CenterLayout, FullPageLayout, LinkRouting, useRequest} from "@witel/webapp-builder";
|
||||
import { CenterLayout, FullPageLayout, LinkRouting, useRequest } from "@witel/webapp-builder";
|
||||
|
||||
|
||||
const SendUserDataComponent = ({
|
||||
setOtpToken,
|
||||
setPhoneNumber,
|
||||
PhoneNumber,
|
||||
setTimer,
|
||||
initialTimerValue,
|
||||
}) => {
|
||||
const SendUserDataComponent = ({ setOtpToken, setPhoneNumber, PhoneNumber, setTimer, initialTimerValue }) => {
|
||||
const t = useTranslations();
|
||||
const requestServer = useRequest();
|
||||
|
||||
@@ -30,28 +23,30 @@ const SendUserDataComponent = ({
|
||||
phone_number: Yup.mixed()
|
||||
.test("max", `${t("LoginPage.phone_number_max")}`, (value) => {
|
||||
const stringValue = String(value);
|
||||
return stringValue.length === 11
|
||||
return stringValue.length === 11;
|
||||
})
|
||||
.required(t("LoginPage.error_message_phone_number")),
|
||||
});
|
||||
|
||||
const handleSubmit = (values, props) => {
|
||||
requestServer(SEND_OTP_TOKEN, "post", {
|
||||
auth: false, data: {
|
||||
auth: false,
|
||||
data: {
|
||||
phone_number: values.phone_number,
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(function (response) {
|
||||
setPhoneNumber(values.phone_number);
|
||||
setOtpToken(true);
|
||||
setTimer(initialTimerValue);
|
||||
}).catch(function (error) {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
props.setSubmitting(false);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<FullPageLayout sx={{p: 1}}>
|
||||
<FullPageLayout sx={{ p: 1 }}>
|
||||
<CenterLayout>
|
||||
<Container maxWidth="sm">
|
||||
<Paper elevation={0}>
|
||||
@@ -61,26 +56,21 @@ const SendUserDataComponent = ({
|
||||
validationSchema={validationSchema}
|
||||
>
|
||||
{(props) => (
|
||||
<Stack spacing={2} sx={{p: 2}}>
|
||||
<Stack
|
||||
sx={{width: "100%"}}
|
||||
alignItems='center'
|
||||
>
|
||||
<SvgLogin width={300} height={200}/>
|
||||
<Stack spacing={2} sx={{ p: 2 }}>
|
||||
<Stack sx={{ width: "100%" }} alignItems="center">
|
||||
<SvgLogin width={300} height={200} />
|
||||
</Stack>
|
||||
<Typography margin={2} variant="h4" textAlign="center">
|
||||
{t("Titles.title_login_page")}
|
||||
</Typography>
|
||||
<StyledForm sx={{width: "100%"}}>
|
||||
<Stack spacing={3} sx={{p: 2}}>
|
||||
<StyledForm sx={{ width: "100%" }}>
|
||||
<Stack spacing={3} sx={{ p: 2 }}>
|
||||
<Field
|
||||
as={TextField}
|
||||
name="phone_number"
|
||||
variant="outlined"
|
||||
label={t("LoginPage.text_field_phone_number")}
|
||||
placeholder={t(
|
||||
"LoginPage.text_field_enter_your_phone_number"
|
||||
)}
|
||||
placeholder={t("LoginPage.text_field_enter_your_phone_number")}
|
||||
value={props.values.phone_number}
|
||||
type={"tel"}
|
||||
onChange={(event) => {
|
||||
@@ -95,21 +85,17 @@ const SendUserDataComponent = ({
|
||||
},
|
||||
});
|
||||
}}
|
||||
error={
|
||||
!!(props.touched.phone_number && props.errors.phone_number)
|
||||
}
|
||||
error={!!(props.touched.phone_number && props.errors.phone_number)}
|
||||
fullWidth
|
||||
helperText={
|
||||
props.touched.phone_number
|
||||
? props.errors.phone_number
|
||||
: null
|
||||
props.touched.phone_number ? props.errors.phone_number : null
|
||||
}
|
||||
/>
|
||||
<Grid
|
||||
container
|
||||
rowSpacing={{xs: 1, sm: 0}}
|
||||
rowSpacing={{ xs: 1, sm: 0 }}
|
||||
sx={{
|
||||
flexDirection: {xs: "column-reverse", sm: "row"},
|
||||
flexDirection: { xs: "column-reverse", sm: "row" },
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
@@ -117,7 +103,7 @@ const SendUserDataComponent = ({
|
||||
type="submit"
|
||||
variant="contained"
|
||||
size="large"
|
||||
endIcon={<FingerprintIcon/>}
|
||||
endIcon={<FingerprintIcon />}
|
||||
disabled={props.isSubmitting}
|
||||
>
|
||||
{t("LoginPage.button_request_verification")}
|
||||
@@ -133,10 +119,8 @@ const SendUserDataComponent = ({
|
||||
</CenterLayout>
|
||||
<Stack direction="row" alignItems="center" justifyContent="center">
|
||||
<LinkRouting
|
||||
sx={{margin: 2}}
|
||||
href={
|
||||
backUrlDecodedPath ? decodeURIComponent(backUrlDecodedPath) : "/"
|
||||
}
|
||||
sx={{ margin: 2 }}
|
||||
href={backUrlDecodedPath ? decodeURIComponent(backUrlDecodedPath) : "/"}
|
||||
>
|
||||
{t("LoginPage.link_routing_back_to")}{" "}
|
||||
{backUrlDecodedPath
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {useState} from "react";
|
||||
import { useState } from "react";
|
||||
import SendTokenComponent from "./SendToken";
|
||||
import SendUserDataComponent from "./SendUserData";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user