From 460b46512b7c76b9a8affe0438062bdbe0f4db8c Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Tue, 11 Jul 2023 15:02:13 +0330 Subject: [PATCH] design loan request page --- public/locales/fa/app.json | 32 +- .../dashboard/loan-request/index.jsx | 441 +++++++++++++++++- src/components/login-navy/index.jsx | 11 +- src/pages/dashboard/loan-follow-up/index.jsx | 2 +- src/pages/dashboard/loan-request/index.jsx | 2 +- 5 files changed, 477 insertions(+), 11 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index d4073b1..07e2420 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -44,9 +44,6 @@ "error_message_required": "اجباری!", "button_make_account": "ایجاد حساب" }, - "Dashboard": { - "dashboard_page": "داشبورد" - }, "RegisterPage": { "link_routing_back_to": "بازگشت به", "link_routing_login_navy": "صفحه ورود", @@ -58,5 +55,34 @@ "text_field_enter_your_navgan_id": "شماره ناوگان خود را وارد کنید", "error_message_required": "اجباری!", "button_request_verification": "دریافت کد یکبارمصرف" + }, + "Dashboard": { + "dashboard_page": "داشبورد" + }, + "LoanFollowUp": { + "loan_follow_up_page": "پیگیری درخواست" + }, + "LoanRequest": { + "loan_request_page": "فرم درخواست وام", + "error_message_required": "اجباری!", + "text_field_phone_number": "شماره تلفن", + "text_field_enter_your_phone_number": "شماره تلفن خود را وارد کنید", + "text_field_first_name": "نام", + "text_field_enter_your_first_name": "نام خود را وارد کنید", + "text_field_last_name": "نام خانوادگی", + "text_field_enter_your_last_name": "نام خانوادگی خود را وارد کنید", + "text_field_vehicle_type": "نام وسیله نقلیه", + "text_field_enter_your_vehicle_type": "نام وسیله نقلیه خود را وارد کنید", + "text_field_province": "استان", + "text_field_enter_your_province": "استان خود را وارد کنید", + "text_field_navgan_id": "شماره ناوگان", + "text_field_enter_your_navgan_id": "شماره ناوگان خود را وارد کنید", + "text_field_national_code": "کد ملی", + "text_field_enter_your_national_code": "کد ملی خود را وارد کنید", + "text_field_birth_certificate_id": "شماره شناسنامه", + "text_field_enter_your_birth_certificate_id": "شماره شناسنامه خود را وارد کنید", + "text_field_plate_number": "شماره پلاک", + "text_field_enter_your_plate_number": "شماره پلاک خود را وارد کنید", + "button_submit": "ثبت درخواست" } } diff --git a/src/components/dashboard/loan-request/index.jsx b/src/components/dashboard/loan-request/index.jsx index b13cf78..385d6dc 100644 --- a/src/components/dashboard/loan-request/index.jsx +++ b/src/components/dashboard/loan-request/index.jsx @@ -1,16 +1,453 @@ +import StyledForm from "@/core/components/StyledForm"; import CenterLayout from "@/layouts/CenterLayout"; import DashboardLayouts from "@/layouts/dashboardLayouts"; import useUser from "@/lib/app/hooks/useUser"; +import { Box, Button, Stack, TextField } from "@mui/material"; +import { Field, Formik } from "formik"; import { useTranslations } from "next-intl"; -import React from "react"; +import Image from "next/image"; +import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; +import * as Yup from "yup"; const DashboardLoanRequestComponent = () => { const t = useTranslations(); const { token } = useUser(); + + const initialValues = { + first_name: "", + last_name: "", + phone_number: "", + vehicle_type: "", + plate_number: "", + province: "", + navgan_id: "", + national_code: "", + birth_certificate_id: "", + national_card_img: "", + birth_certificate_img: "", + }; + + const validationSchema = Yup.object().shape({ + first_name: Yup.string().required(t("LoanRequest.error_message_required")), + last_name: Yup.string().required(t("LoanRequest.error_message_required")), + phone_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + vehicle_type: Yup.string().required( + t("LoanRequest.error_message_required") + ), + plate_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + province: Yup.string().required(t("LoanRequest.error_message_required")), + navgan_id: Yup.string().required(t("LoanRequest.error_message_required")), + national_code: Yup.string().required( + t("LoanRequest.error_message_required") + ), + birth_certificate_id: Yup.string().required( + t("LoanRequest.error_message_required") + ), + }); + return ( -

نکنه وامم میخوای؟؟؟

+ + {(props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {t("app_name")} + + + {t("app_name")} + + + + + + + + )} +
); diff --git a/src/components/login-navy/index.jsx b/src/components/login-navy/index.jsx index 8f1cbbd..e3fd879 100644 --- a/src/components/login-navy/index.jsx +++ b/src/components/login-navy/index.jsx @@ -49,10 +49,10 @@ const LoginComponent = () => { // }); // }; const initialValues = { - phone_number: "" + phone_number: "", }; const validationSchema = Yup.object().shape({ - phone_number: Yup.string().required(t("LoginPage.error_message_required")) + phone_number: Yup.string().required(t("LoginPage.error_message_required")), }); return ( @@ -87,13 +87,16 @@ const LoginComponent = () => { )} type={"text"} error={ - props.touched.phone_number && props.errors.phone_number + props.touched.phone_number && + props.errors.phone_number ? true : false } fullWidth helperText={ - props.touched.phone_number ? props.errors.phone_number : null + props.touched.phone_number + ? props.errors.phone_number + : null } /> - + ); diff --git a/src/pages/dashboard/loan-request/index.jsx b/src/pages/dashboard/loan-request/index.jsx index b76f172..f66f9fb 100644 --- a/src/pages/dashboard/loan-request/index.jsx +++ b/src/pages/dashboard/loan-request/index.jsx @@ -6,7 +6,7 @@ import { parse } from "next-useragent"; export default function LoanRequest() { return ( - + );