diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index bef7b52..6dc116b 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -135,22 +135,23 @@ }, "LoanRequest": { "finish_loan_request": "درخواست شما با موفقیت ثبت شد", - "back_to_dashboard": "بازگشت به صفحه اصلی", + "checkbox": "بدینوسیله صحت کلیه اطلاعات مندرج در این فرم را تایید و گواهی میدهم .", + "back_to_dashboard": "پیگیری درخواست ها", "cityList_empty": "ابتدا استان را وارد کنید", "cityList_loading": "درحال دریافت لیست شهر ها ...", "loan_request_page": "ثبت درخواست وام", "personal_info": "اطلاعات شخصی", "national_code_number": "کد ملی می بایست شامل اعداد باشد", "national_code_max": "کد ملی می بایست 10 رقم باشد", - "shenasname_serial_max": "سریال پشت کارت ملی می بایست 10 رقم باشد", + "shenasname_serial_max": "سریال پشت کارت ملی می بایست شامل 10 بخش باشد", "postal_code_max": "کد پستی می بایست 10 رقم باشد", "tel_number_max": "شماره ثابت می بایست 11 رقم باشد", "national_code_positive": "کد ملی می بایست مثبت باشد", "uploading_documents": "اسناد", "error_message_name": "لطفا نام خود را وارد کنید!", "error_message_plate_number": "لطفا شماره پلاک را به درستی وارد کنید!", - "error_message_occupation_id": "لطفا کد شغل (با توجه به مستندات ارائه شده) را به درستی وارد کنید!", - "error_message_education_id": "لطفا تحصیلات (با توجه به مستندات ارائه شده) را به درستی وارد کنید!", + "error_message_occupation_id": "لطفا کد شغل را به درستی وارد کنید!", + "error_message_education_id": "لطفا تحصیلات را به درستی وارد کنید!", "error_message_tel_number": "لطفا شماره ثابت (با پیش شماره استان) خود را وارد کنید!", "error_message_vehicle_type": "لطفا نوع وسیله نقلیه خود را وارد کنید!", "error_message_navgan_id": "لطفا کد هوشمند ناوگان خود را وارد کنید!", @@ -160,6 +161,7 @@ "error_message_shenasname_serial": "لطفا سریال پشت کارت ملی خود را وارد کنید!", "error_message_postal_code": "لطفا کد پستی خود را وارد کنید!", "error_message_national_code": "لطفا کد ملی خود را وارد کنید!", + "error_message_checkedBox": "لطفا کد صحت اطلاعات خود را تایید کنید!", "error_message_navgan_type": "لطفا نوع ناوگان خود را وارد کنید!", "error_message_address": "لطفا آدرس خود را وارد کنید!", "text_field_tel_number": "شماره ثابت (با پیش شماره استان)", diff --git a/src/components/dashboard/navgan/add-request-loan/forms/AddForm.jsx b/src/components/dashboard/navgan/add-request-loan/forms/AddForm.jsx index 9fb8f08..9dd5706 100644 --- a/src/components/dashboard/navgan/add-request-loan/forms/AddForm.jsx +++ b/src/components/dashboard/navgan/add-request-loan/forms/AddForm.jsx @@ -1,11 +1,11 @@ import SelectBox from "@/core/components/SelectBox"; import {SEND_LOAN_REQUEST_NAVGAN} from "@/core/data/apiRoutes"; import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; -import {Box, Button, Grid, Stack, TextField, Typography} from "@mui/material"; +import {Box, Button, Checkbox, FormControlLabel, Grid, Stack, TextField, Typography} from "@mui/material"; import {useFormik} from "formik"; import {useTranslations} from "next-intl"; import * as Yup from "yup"; -import {CenterLayout, LinkRouting, useRequest} from "@witel/webapp-builder"; +import {CenterLayout, useRequest} from "@witel/webapp-builder"; import useProvince from "@/lib/app/hooks/useProvince"; import useCities from "@/lib/app/hooks/useCities"; import PlateNumber from "@/core/components/PlateNumber"; @@ -14,15 +14,21 @@ import UseEducations from "@/lib/app/hooks/useEducations"; import useOccupations from "@/lib/app/hooks/useOccupations"; 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"; const AddFormComponent = () => { const t = useTranslations(); const [finishLoanRequest, setFinishLoanRequest] = useState(false) + const [checked, setChecked] = useState(false); const requestServer = useRequest() const {provinceList, isLoadingProvinceList, errorProvinceList} = useProvince() const {cityTextField, cityList, setProvinceID, isLoadingCityList} = useCities() const {educationsList, isLoadingEducationsList, errorEducationsList} = UseEducations() const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations() + const handleCheckBoxChange = (event) => { + setChecked(event.target.checked); + }; const initialValues = { telephone_number: "", @@ -42,6 +48,7 @@ const AddFormComponent = () => { birthday: "", education_id: "", occupation_id: "", + checkedBox: false }; const validationSchema = Yup.object().shape({ @@ -161,13 +168,16 @@ const AddFormComponent = () => { {finishLoanRequest ? ( - - {t("LoanRequest.finish_loan_request")} + + + {t("LoanRequest.finish_loan_request")} - + ) : ( <> @@ -278,7 +288,22 @@ const AddFormComponent = () => { label={t("LoanRequest.text_field_navgan_type")} size="small" selectType="navgan_type" - selectors={[{id: 1, value: 1, name: "روستایی"}, {id: 2, value: 2, name: "عمومی"}]} + selectors={[ + { + id: 1, value: "روستایی", name: "روستایی" + }, + { + id: 2, + value: "عمومی", + name: "عمومی" + }, + { + id: 3, + value: "منطقه آزاد", + name: "منطقه آزاد" + } + ]} + schema={{value: 'value', name: 'name'}} select={formik.values.navgan_type} handleChange={(event) => { formik.setFieldValue('navgan_type', event.target.value) @@ -316,6 +341,7 @@ const AddFormComponent = () => { isLoading={isLoadingProvinceList} errorEcured={errorProvinceList} selectors={provinceList} + schema={{value: 'value', name: 'name'}} select={formik.values.province_id} handleChange={(event) => { formik.setFieldValue('province_id', event.target.value); @@ -335,6 +361,7 @@ const AddFormComponent = () => { label={isLoadingCityList ? `${t("LoanRequest.cityList_loading")}` : (cityList.length === 0 ? `${t("LoanRequest.cityList_empty")}` : cityTextField)} size="small" selectType="city_id" + schema={{value: 'value', name: 'name'}} disabled={cityList.length === 0} selectors={cityList} select={formik.values.city_id} @@ -352,9 +379,25 @@ const AddFormComponent = () => { name="vehicle_type" label={t("LoanRequest.text_field_vehicle_type")} size="small" + schema={{value: 'value', name: 'name'}} selectType="vehicle_type" - selectors={[{id: 0, value: "اتوبوس", name: "اتوبوس"}, - {id: 1, value: "مینی بوس", name: "مینی بوس"}]} + selectors={[ + { + id: 0, + value: "اتوبوس", + name: "اتوبوس" + }, + { + id: 1, + value: "مینی بوس", + name: "مینی بوس" + }, + { + id: 2, + value: "سواری", + name: "سواری" + } + ]} select={formik.values.vehicle_type} handleChange={(event) => formik.setFieldValue('vehicle_type', event.target.value)} error={formik.touched.vehicle_type && Boolean(formik.errors.vehicle_type)} @@ -377,6 +420,7 @@ const AddFormComponent = () => { selectType="education_id" selectors={educationsList} select={formik.values.education_id} + schema={{value: 'id', name: 'title'}} handleChange={(event) => { formik.setFieldValue('education_id', event.target.value) }} @@ -394,6 +438,7 @@ const AddFormComponent = () => { isLoading={isLoadingOccupationsList} errorEcured={errorOccupationsList} selectType="occupation_id" + schema={{value: 'id', name: 'title'}} selectors={occupationsList} select={formik.values.occupation_id} handleChange={(event) => { @@ -425,6 +470,22 @@ const AddFormComponent = () => { /> + + + { + formik.setFieldValue("checkedBox", event.target.checked) + }} + /> + } + label={`${t("LoanRequest.checkbox")}`}/> + + + { type="submit" variant="contained" size="large" - sx={{mt: 2}} + sx={{my: 4}} endIcon={} - disabled={formik.isSubmitting} + disabled={formik.values.checkedBox ? (formik.isSubmitting || !formik.dirty || !formik.isValid) : true} > {t("LoanRequest.button_submit")} diff --git a/src/core/components/SelectBox.jsx b/src/core/components/SelectBox.jsx index faa0cb8..0ee7a47 100644 --- a/src/core/components/SelectBox.jsx +++ b/src/core/components/SelectBox.jsx @@ -9,6 +9,7 @@ function SelectBox({ handleChange, error, onBlur, + schema, disabled, helperText, isLoading, @@ -42,8 +43,8 @@ function SelectBox({ ) : ( selectors.map((selector) => ( - - {selector.name || selector.title} + + {selector[schema.name]} )) )} diff --git a/src/core/components/svgs/SvgDone.jsx b/src/core/components/svgs/SvgDone.jsx new file mode 100644 index 0000000..9042c27 --- /dev/null +++ b/src/core/components/svgs/SvgDone.jsx @@ -0,0 +1,96 @@ +import {useTheme} from "@mui/material"; + +const SvgDone = ({width, height}) => { + const theme = useTheme() + const fillColor = theme.palette.primary.main + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) +} + +export default SvgDone \ No newline at end of file