TF-103 debug add page accessibility and edit form redirecting follow up problem
This commit is contained in:
@@ -158,7 +158,8 @@
|
|||||||
"file_field_payan_khedmat_image": "تصویر کارت پایان خدمت",
|
"file_field_payan_khedmat_image": "تصویر کارت پایان خدمت",
|
||||||
"error_message_national_card_image": "تصویر کارت ملی خود را وارد کنید",
|
"error_message_national_card_image": "تصویر کارت ملی خود را وارد کنید",
|
||||||
"error_message_shenasname_image": "تصویر شناسنامه خود را وارد کنید",
|
"error_message_shenasname_image": "تصویر شناسنامه خود را وارد کنید",
|
||||||
"error_message_payan_khedmat_image": "تصویر کارت پایان خدمت خود را وارد کنید"
|
"error_message_payan_khedmat_image": "تصویر کارت پایان خدمت خود را وارد کنید",
|
||||||
|
"add_loan_request_permission": "اکنون امکان ثبت درخواست جدید برای شما مقدور نیست"
|
||||||
},
|
},
|
||||||
"EditLoanRequest": {
|
"EditLoanRequest": {
|
||||||
"edit_loan_request_page": "ویرایش درخواست وام"
|
"edit_loan_request_page": "ویرایش درخواست وام"
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import {Button, Typography} from "@mui/material";
|
||||||
|
import {useTranslations} from "next-intl";
|
||||||
|
import CenterLayout from "@/layouts/CenterLayout";
|
||||||
|
import {useRouter} from "next/router";
|
||||||
|
import {NextLinkComposed} from "@/core/components/LinkRouting";
|
||||||
|
|
||||||
|
const AccessibilityComponent = () => {
|
||||||
|
const t = useTranslations();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<CenterLayout>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
fontSize: "16px",
|
||||||
|
fontWeight: 600,
|
||||||
|
my: 2
|
||||||
|
}}>
|
||||||
|
{t("LoanRequest.add_loan_request_permission")}
|
||||||
|
</Typography>
|
||||||
|
<Button color="primary" variant="contained"
|
||||||
|
component={NextLinkComposed}
|
||||||
|
to={{
|
||||||
|
pathname: "/dashboard/refahi/followUp-loan",
|
||||||
|
}}>
|
||||||
|
{t("LoanFollowUp.loan_follow_up_page")}
|
||||||
|
</Button>
|
||||||
|
</CenterLayout>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AccessibilityComponent;
|
||||||
@@ -20,11 +20,13 @@ import {useTranslations} from "next-intl";
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import useRequest from "@/lib/app/hooks/useRequest";
|
import useRequest from "@/lib/app/hooks/useRequest";
|
||||||
import useProvince from "@/lib/app/hooks/useProvince";
|
import useProvince from "@/lib/app/hooks/useProvince";
|
||||||
|
import {useRouter} from "next/router";
|
||||||
|
|
||||||
const AddFormComponent = () => {
|
const AddFormComponent = () => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const requestServer = useRequest()
|
const requestServer = useRequest()
|
||||||
const {provinceList, isLoadingProvinceList, errorProvinceList} = useProvince()
|
const {provinceList, isLoadingProvinceList, errorProvinceList} = useProvince();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
// initial values, validation and request action of form
|
// initial values, validation and request action of form
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
@@ -81,6 +83,7 @@ const AddFormComponent = () => {
|
|||||||
formData.append("payan_khedmat_image", values.payan_khedmat_image);
|
formData.append("payan_khedmat_image", values.payan_khedmat_image);
|
||||||
requestServer(SEND_LOAN_REQUEST_WELFARE, "post", {auth: true, data: formData})
|
requestServer(SEND_LOAN_REQUEST_WELFARE, "post", {auth: true, data: formData})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
|
router.replace('/dashboard/refahi/followUp-loan');
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import {Box, Chip, Divider} from "@mui/material";
|
|
||||||
import {useTranslations} from "next-intl";
|
import {useTranslations} from "next-intl";
|
||||||
import AddFormComponent from "@/components/dashboard/refahi/add-request-loan/forms/AddForm";
|
import AddFormComponent from "@/components/dashboard/refahi/add-request-loan/forms/AddForm";
|
||||||
|
import AccessibilityComponent from "@/components/dashboard/refahi/add-request-loan/accessibility";
|
||||||
|
|
||||||
const LoanRequestComponent = () => {
|
const LoanRequestComponent = () => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const {user} = useUser();
|
const {user} = useUser();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardLayouts>
|
<DashboardLayouts>
|
||||||
<AddFormComponent/>
|
{user.can_request_a_new_loan ? <AddFormComponent/> : <AccessibilityComponent/>}
|
||||||
</DashboardLayouts>
|
</DashboardLayouts>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,11 +15,9 @@ import useLoading from "@/lib/app/hooks/useLoading";
|
|||||||
|
|
||||||
const EditFormComponent = ({provinceList, initialValues}) => {
|
const EditFormComponent = ({provinceList, initialValues}) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const {directionApp} = useDirection();
|
|
||||||
const {token} = useUser();
|
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const {setLoadingPage} = useLoading();
|
|
||||||
|
|
||||||
// validation and request action of form
|
// validation and request action of form
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {DETAILS_LOAN_REQUEST_WELFARE, GET_PROVINCE_LIST} from "@/core/data/apiRo
|
|||||||
import useLoading from "@/lib/app/hooks/useLoading";
|
import useLoading from "@/lib/app/hooks/useLoading";
|
||||||
import useRequest from "@/lib/app/hooks/useRequest";
|
import useRequest from "@/lib/app/hooks/useRequest";
|
||||||
import {useRouter} from "next/router";
|
import {useRouter} from "next/router";
|
||||||
|
import {log} from "next/dist/server/typescript/utils";
|
||||||
|
|
||||||
const LoanRequestComponent = () => {
|
const LoanRequestComponent = () => {
|
||||||
const requestServer = useRequest();
|
const requestServer = useRequest();
|
||||||
@@ -60,17 +61,20 @@ const LoanRequestComponent = () => {
|
|||||||
|
|
||||||
// Redirect to /dashboard/refahi/followUp-loan if state_id is not 7
|
// Redirect to /dashboard/refahi/followUp-loan if state_id is not 7
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialValues && initialValues.state_id !== 7) {
|
if (!initialValues) return
|
||||||
router.push('/dashboard/refahi/followUp-loan');
|
if (initialValues.state_id === 7) return
|
||||||
}
|
|
||||||
}, [initialValues, router]);
|
router.replace('/dashboard/refahi/followUp-loan');
|
||||||
|
}, [initialValues]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardLayouts>
|
<>
|
||||||
{initialValues && initialValues.state_id === 7 && (
|
{initialValues && initialValues.state_id === 7 && (
|
||||||
<EditFormComponent provinceList={provinceList} initialValues={initialValues}/>
|
<DashboardLayouts>
|
||||||
|
<EditFormComponent provinceList={provinceList} initialValues={initialValues}/>
|
||||||
|
</DashboardLayouts>
|
||||||
)}
|
)}
|
||||||
</DashboardLayouts>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user