update
This commit is contained in:
@@ -6,6 +6,9 @@ NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"
|
|||||||
NEXT_PUBLIC_PRIMARY_MAIN = "#084070"
|
NEXT_PUBLIC_PRIMARY_MAIN = "#084070"
|
||||||
NEXT_PUBLIC_SECONDARY_MAIN = "#FF4E00"
|
NEXT_PUBLIC_SECONDARY_MAIN = "#FF4E00"
|
||||||
|
|
||||||
|
NEXT_PUBLIC_FACILITY_BANK = 33
|
||||||
|
NEXT_PUBLIC_FACILITY_PERSON = 10
|
||||||
|
|
||||||
NEXT_PUBLIC_BASE_URL = "https://loan-v2.witel.ir"
|
NEXT_PUBLIC_BASE_URL = "https://loan-v2.witel.ir"
|
||||||
NEXT_PUBLIC_POWERED_BY_URL = "https://witel.ir"
|
NEXT_PUBLIC_POWERED_BY_URL = "https://witel.ir"
|
||||||
|
|
||||||
|
|||||||
@@ -1,85 +1,72 @@
|
|||||||
import UploadSystem from "@/core/components/UploadSystem";
|
import UploadSystem from "@/core/components/UploadSystem";
|
||||||
import useNotification from "@/lib/app/hooks/useNotification";
|
import useNotification from "@/lib/app/hooks/useNotification";
|
||||||
import useRequest from "@/lib/app/hooks/useRequest";
|
import useRequest from "@/lib/app/hooks/useRequest";
|
||||||
import {
|
import { Button, DialogActions, DialogContent, FormHelperText, Stack, TextField, Typography } from "@mui/material";
|
||||||
Button,
|
import { useFormik } from "formik";
|
||||||
DialogActions,
|
import { useTranslations } from "next-intl";
|
||||||
DialogContent,
|
import { CONFIRM_PASSENGER_BOSS } from "@/core/data/apiRoutes";
|
||||||
FormHelperText,
|
import { useState } from "react";
|
||||||
Stack,
|
|
||||||
TextField,
|
|
||||||
Typography
|
|
||||||
} from "@mui/material"
|
|
||||||
import {useFormik} from "formik";
|
|
||||||
import {useTranslations} from "next-intl";
|
|
||||||
import {CONFIRM_PASSENGER_BOSS} from "@/core/data/apiRoutes";
|
|
||||||
import {useState} from "react";
|
|
||||||
import PriceField from "@/core/components/PriceField";
|
import PriceField from "@/core/components/PriceField";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import SelectBox from "@/core/components/SelectBox";
|
import SelectBox from "@/core/components/SelectBox";
|
||||||
import {useConfig} from "@/lib/app/hooks/useConfig";
|
import { useConfig } from "@/lib/app/hooks/useConfig";
|
||||||
|
|
||||||
const vehicle_amount = {
|
const vehicle_amount = {
|
||||||
"اتوبوس": 7000,
|
اتوبوس: 7000,
|
||||||
"مینی بوس": 2000,
|
"مینی بوس": 2000,
|
||||||
}
|
};
|
||||||
|
|
||||||
const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) => {
|
const ConfirmContent = ({ rowId, mutate, setOpenConfirmDialog, vehicle_type }) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const [expertImg, setExpertImg] = useState("");
|
const [expertImg, setExpertImg] = useState("");
|
||||||
const [expertFileType, setExpertFileType] = useState(null);
|
const [expertFileType, setExpertFileType] = useState(null);
|
||||||
const [expertFileName, setExpertFileName] = useState(null);
|
const [expertFileName, setExpertFileName] = useState(null);
|
||||||
const [showExpertAddIcon, setShowExpertAddIcon] = useState(true);
|
const [showExpertAddIcon, setShowExpertAddIcon] = useState(true);
|
||||||
const requestServer = useRequest({auth: true, notification: false})
|
const requestServer = useRequest({ auth: true, notification: false });
|
||||||
const {update_notification} = useNotification();
|
const { update_notification } = useNotification();
|
||||||
const {config} = useConfig()
|
const { config } = useConfig();
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
approved_amount: Yup.mixed().test(
|
approved_amount: Yup.mixed()
|
||||||
"is-number",
|
.test("is-number", `${t("ConfirmDialog.approved_amount_number")}`, (value) => !isNaN(value))
|
||||||
`${t("ConfirmDialog.approved_amount_number")}`,
|
.test(
|
||||||
(value) => !isNaN(value)
|
"max-amount",
|
||||||
).test("max-amount", `${t("PassengerBoss.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`,
|
`${t("PassengerBoss.max_amount", {
|
||||||
(value) => value <= vehicle_amount[vehicle_type])
|
value: parseInt(vehicle_amount[vehicle_type]).toLocaleString("en"),
|
||||||
|
})}`,
|
||||||
|
(value) => value <= vehicle_amount[vehicle_type]
|
||||||
|
)
|
||||||
.test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
|
.test("positive", `${t("ConfirmDialog.approved_amount_positive")}`, (value) => value >= 0)
|
||||||
.required(t("ConfirmDialog.approved_amount_error")),
|
.required(t("ConfirmDialog.approved_amount_error")),
|
||||||
repayment_period: Yup.mixed().test(
|
repayment_period: Yup.mixed()
|
||||||
"is-number",
|
.test("is-number", `${t("ConfirmDialog.repayment_period_number")}`, (value) => !isNaN(value))
|
||||||
`${t("ConfirmDialog.repayment_period_number")}`,
|
.test("positive", `${t("ConfirmDialog.repayment_period_positive")}`, (value) => value >= 0)
|
||||||
(value) => !isNaN(value)
|
|
||||||
).test("positive", `${t("ConfirmDialog.repayment_period_positive")}`, (value) => value >= 0)
|
|
||||||
.required(t("ConfirmDialog.repayment_period_error")),
|
.required(t("ConfirmDialog.repayment_period_error")),
|
||||||
committed_employment: Yup.mixed().test(
|
committed_employment: Yup.mixed()
|
||||||
"is-number",
|
.test("is-number", `${t("ConfirmDialog.committed_employment_number")}`, (value) => !isNaN(value))
|
||||||
`${t("ConfirmDialog.committed_employment_number")}`,
|
.test("positive", `${t("ConfirmDialog.committed_employment_positive")}`, (value) => value >= 0)
|
||||||
(value) => !isNaN(value)
|
|
||||||
).test("positive", `${t("ConfirmDialog.committed_employment_positive")}`, (value) => value >= 0)
|
|
||||||
.required(t("ConfirmDialog.committed_employment_error")),
|
.required(t("ConfirmDialog.committed_employment_error")),
|
||||||
existing_employment: Yup.mixed().test(
|
existing_employment: Yup.mixed()
|
||||||
"is-number",
|
.test("is-number", `${t("ConfirmDialog.existing_employment_number")}`, (value) => !isNaN(value))
|
||||||
`${t("ConfirmDialog.existing_employment_number")}`,
|
.test("positive", `${t("ConfirmDialog.existing_employment_positive")}`, (value) => value >= 0)
|
||||||
(value) => !isNaN(value)
|
|
||||||
).test("positive", `${t("ConfirmDialog.existing_employment_positive")}`, (value) => value >= 0)
|
|
||||||
.required(t("ConfirmDialog.existing_employment_error")),
|
.required(t("ConfirmDialog.existing_employment_error")),
|
||||||
sakht_period: Yup.mixed()
|
sakht_period: Yup.mixed()
|
||||||
.test("is-number", `${t("ConfirmDialog.sakht_period_number")}`,
|
.test("is-number", `${t("ConfirmDialog.sakht_period_number")}`, (value) => !isNaN(value))
|
||||||
(value) => !isNaN(value))
|
|
||||||
.test("positive", `${t("ConfirmDialog.sakht_period_positive")}`, (value) => value > 0)
|
.test("positive", `${t("ConfirmDialog.sakht_period_positive")}`, (value) => value > 0)
|
||||||
.required(t("ConfirmDialog.sakht_period_error")),
|
.required(t("ConfirmDialog.sakht_period_error")),
|
||||||
tanafos_period: Yup.mixed()
|
tanafos_period: Yup.mixed()
|
||||||
.test("is-number", `${t("ConfirmDialog.tanafos_period_number")}`,
|
.test("is-number", `${t("ConfirmDialog.tanafos_period_number")}`, (value) => !isNaN(value))
|
||||||
(value) => !isNaN(value))
|
|
||||||
.test("positive", `${t("ConfirmDialog.tanafos_period_positive")}`, (value) => value > 0)
|
.test("positive", `${t("ConfirmDialog.tanafos_period_positive")}`, (value) => value > 0)
|
||||||
.required(t("ConfirmDialog.tanafos_period_error")),
|
.required(t("ConfirmDialog.tanafos_period_error")),
|
||||||
expert_img: Yup.mixed()
|
expert_img: Yup.mixed()
|
||||||
.required(t("PassengerBoss.upload_expert_file_required"))
|
.required(t("PassengerBoss.upload_expert_file_required"))
|
||||||
.test('fileSize', `${t("PassengerBoss.upload_expert_file_unit")}`, (value) => {
|
.test("fileSize", `${t("PassengerBoss.upload_expert_file_unit")}`, (value) => {
|
||||||
return value.size <= 5 * 1024 * 1024;
|
return value.size <= 5 * 1024 * 1024;
|
||||||
})
|
})
|
||||||
.test('fileType', `${t("PassengerBoss.upload_expert_file_format")}`, (value) => {
|
.test("fileType", `${t("PassengerBoss.upload_expert_file_format")}`, (value) => {
|
||||||
const allowedTypes = ['image/jpg', 'image/jpeg', 'image/png', 'application/pdf'];
|
const allowedTypes = ["image/jpg", "image/jpeg", "image/png", "application/pdf"];
|
||||||
return allowedTypes.includes(value.type);
|
return allowedTypes.includes(value.type);
|
||||||
})
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const formik = useFormik({
|
const formik = useFormik({
|
||||||
@@ -96,8 +83,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
tanafos_period: "",
|
tanafos_period: "",
|
||||||
existing_employment: "",
|
existing_employment: "",
|
||||||
expert_img: null,
|
expert_img: null,
|
||||||
}, validationSchema,
|
},
|
||||||
onSubmit: (values, {setSubmitting}) => {
|
validationSchema,
|
||||||
|
onSubmit: (values, { setSubmitting }) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("approved_amount", Number(values.approved_amount) * 1000000);
|
formData.append("approved_amount", Number(values.approved_amount) * 1000000);
|
||||||
formData.append("facility_bank", Number(values.facility_bank) * 1000000);
|
formData.append("facility_bank", Number(values.facility_bank) * 1000000);
|
||||||
@@ -115,8 +103,8 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
const attachments = [
|
const attachments = [
|
||||||
{
|
{
|
||||||
title: "فایل ضمیمه گزارش کارشناس",
|
title: "فایل ضمیمه گزارش کارشناس",
|
||||||
file: values.expert_img
|
file: values.expert_img,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
attachments.forEach((attachment, index) => {
|
attachments.forEach((attachment, index) => {
|
||||||
formData.append(`attachment[${index}][title]`, attachment.title);
|
formData.append(`attachment[${index}][title]`, attachment.title);
|
||||||
@@ -124,17 +112,19 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', {
|
requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, "post", {
|
||||||
notification: true,
|
notification: true,
|
||||||
data: formData,
|
data: formData,
|
||||||
}).then((response) => {
|
})
|
||||||
setOpenConfirmDialog(false)
|
.then((response) => {
|
||||||
mutate()
|
setOpenConfirmDialog(false);
|
||||||
update_notification()
|
mutate();
|
||||||
}).catch(() => {
|
update_notification();
|
||||||
}).finally(() => {
|
})
|
||||||
setSubmitting(false);
|
.catch(() => {})
|
||||||
});
|
.finally(() => {
|
||||||
|
setSubmitting(false);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -148,19 +138,28 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
setExpertFileName(fileName);
|
setExpertFileName(fileName);
|
||||||
formik.setFieldValue("expert_img", uploadedFile).then(() => {
|
formik.setFieldValue("expert_img", uploadedFile).then(() => {
|
||||||
formik.setFieldTouched("expert_img", true);
|
formik.setFieldTouched("expert_img", true);
|
||||||
})
|
});
|
||||||
setShowExpertAddIcon(false);
|
setShowExpertAddIcon(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleAmountChange = (event) => {
|
const handleAmountChange = (event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
formik.setFieldValue("approved_amount", event.target.value).then(() => {
|
formik.setFieldValue("approved_amount", event.target.value).then(() => {
|
||||||
formik.setFieldValue("facility_bank", parseInt((config.facility_bank / 100) * event.target.value, 10))
|
formik.setFieldValue(
|
||||||
formik.setFieldValue("facility_gov", parseInt((config.facility_gov / 100) * event.target.value, 10))
|
"facility_bank",
|
||||||
formik.setFieldValue("facility_person", parseInt((config.facility_person / 100) * event.target.value, 10))
|
parseInt((parseInt(process.env.NEXT_PUBLIC_FACILITY_BANK) / 100) * event.target.value, 10)
|
||||||
})
|
);
|
||||||
|
formik.setFieldValue(
|
||||||
|
"facility_gov",
|
||||||
|
parseInt(((100 - parseInt(process.env.NEXT_PUBLIC_FACILITY_BANK)) / 100) * event.target.value, 10)
|
||||||
|
);
|
||||||
|
formik.setFieldValue(
|
||||||
|
"facility_person",
|
||||||
|
parseInt((parseInt(process.env.NEXT_PUBLIC_FACILITY_PERSON) / 100) * event.target.value, 10)
|
||||||
|
);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
formik.setFieldValue("approved_amount", formik.values.approved_amount)
|
formik.setFieldValue("approved_amount", formik.values.approved_amount);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,20 +172,28 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
name="description"
|
name="description"
|
||||||
multiline
|
multiline
|
||||||
rows={8}
|
rows={8}
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.description")}</span><small>{t("ConfirmDialog.optional")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.description")}</span>
|
||||||
|
<small>{t("ConfirmDialog.optional")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
value={formik.values.description}
|
value={formik.values.description}
|
||||||
onChange={formik.handleChange}
|
onChange={formik.handleChange}
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{mt: 1}}
|
sx={{ mt: 1 }}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack>
|
<Stack>
|
||||||
<PriceField
|
<PriceField
|
||||||
name="approved_amount"
|
name="approved_amount"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.approved_amount")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.approved_amount")}</span>
|
||||||
|
<small>{t("ConfirmDialog.unit")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
type="text"
|
type="text"
|
||||||
inputProps={{
|
inputProps={{
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
@@ -197,22 +204,21 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
value={formik.values.approved_amount}
|
value={formik.values.approved_amount}
|
||||||
onChange={handleAmountChange}
|
onChange={handleAmountChange}
|
||||||
onBlur={formik.handleBlur("approved_amount")}
|
onBlur={formik.handleBlur("approved_amount")}
|
||||||
error={
|
error={formik.touched.approved_amount && Boolean(formik.errors.approved_amount)}
|
||||||
formik.touched.approved_amount &&
|
helperText={formik.touched.approved_amount && formik.errors.approved_amount}
|
||||||
Boolean(formik.errors.approved_amount)
|
sx={{ mt: 1 }}
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
formik.touched.approved_amount && formik.errors.approved_amount
|
|
||||||
}
|
|
||||||
sx={{mt: 1}}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack>
|
<Stack>
|
||||||
<PriceField
|
<PriceField
|
||||||
name="facility_bank"
|
name="facility_bank"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.facility_bank")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.facility_bank")}</span>
|
||||||
|
<small>{t("ConfirmDialog.unit")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
type="text"
|
type="text"
|
||||||
inputProps={{
|
inputProps={{
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
@@ -228,8 +234,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
<Stack>
|
<Stack>
|
||||||
<PriceField
|
<PriceField
|
||||||
name="facility_gov"
|
name="facility_gov"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.facility_gov")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.facility_gov")}</span>
|
||||||
|
<small>{t("ConfirmDialog.unit")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
type="text"
|
type="text"
|
||||||
inputProps={{
|
inputProps={{
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
@@ -245,8 +255,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
<Stack>
|
<Stack>
|
||||||
<PriceField
|
<PriceField
|
||||||
name="facility_person"
|
name="facility_person"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.facility_person")}</span><small>{t("ConfirmDialog.unit")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.facility_person")}</span>
|
||||||
|
<small>{t("ConfirmDialog.unit")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={formik.values.facility_person}
|
value={formik.values.facility_person}
|
||||||
disabled
|
disabled
|
||||||
@@ -256,8 +270,12 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
<Stack>
|
<Stack>
|
||||||
<TextField
|
<TextField
|
||||||
name="physical_progress"
|
name="physical_progress"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.physical_progress")}</span><small>{t("ConfirmDialog.optional")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.physical_progress")}</span>
|
||||||
|
<small>{t("ConfirmDialog.optional")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
type="text"
|
type="text"
|
||||||
inputProps={{
|
inputProps={{
|
||||||
inputMode: "number",
|
inputMode: "number",
|
||||||
@@ -268,9 +286,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
value={formik.values.physical_progress}
|
value={formik.values.physical_progress}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
formik.setFieldValue("physical_progress", event.target.value)
|
formik.setFieldValue("physical_progress", event.target.value);
|
||||||
} else {
|
} else {
|
||||||
formik.setFieldValue("physical_progress", formik.values.physical_progress)
|
formik.setFieldValue("physical_progress", formik.values.physical_progress);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onBlur={formik.handleBlur("physical_progress")}
|
onBlur={formik.handleBlur("physical_progress")}
|
||||||
@@ -280,17 +298,21 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
<Stack>
|
<Stack>
|
||||||
<SelectBox
|
<SelectBox
|
||||||
name="repayment_period"
|
name="repayment_period"
|
||||||
label={<>
|
label={
|
||||||
<span>{t("ConfirmDialog.repayment_period")}</span> <small>{t("ConfirmDialog.month")}</small></>}
|
<>
|
||||||
|
<span>{t("ConfirmDialog.repayment_period")}</span>{" "}
|
||||||
|
<small>{t("ConfirmDialog.month")}</small>
|
||||||
|
</>
|
||||||
|
}
|
||||||
selectType="repayment_period"
|
selectType="repayment_period"
|
||||||
selectors={[
|
selectors={[
|
||||||
{id : 0, value : "12", name : "12 ماه"},
|
{ id: 0, value: "12", name: "12 ماه" },
|
||||||
{id : 1, value : "24", name : "24 ماه"},
|
{ id: 1, value: "24", name: "24 ماه" },
|
||||||
{id : 2, value : "36", name : "36 ماه"},
|
{ id: 2, value: "36", name: "36 ماه" },
|
||||||
{id : 3, value : "48", name : "48 ماه"},
|
{ id: 3, value: "48", name: "48 ماه" },
|
||||||
{id : 4, value : "60", name : "60 ماه"}
|
{ id: 4, value: "60", name: "60 ماه" },
|
||||||
]}
|
]}
|
||||||
schema={{value: "value", name: "name"}}
|
schema={{ value: "value", name: "name" }}
|
||||||
select={formik.values.repayment_period}
|
select={formik.values.repayment_period}
|
||||||
value={formik.values.repayment_period}
|
value={formik.values.repayment_period}
|
||||||
handleChange={(event) => {
|
handleChange={(event) => {
|
||||||
@@ -313,38 +335,38 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
value: "1",
|
value: "1",
|
||||||
name: "1 ماه"
|
name: "1 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
value: "2",
|
value: "2",
|
||||||
name: "2 ماه"
|
name: "2 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
value: "3",
|
value: "3",
|
||||||
name: "3 ماه"
|
name: "3 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
value: "4",
|
value: "4",
|
||||||
name: "4 ماه"
|
name: "4 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
value: "5",
|
value: "5",
|
||||||
name: "5 ماه"
|
name: "5 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
value: "6",
|
value: "6",
|
||||||
name: "6 ماه"
|
name: "6 ماه",
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
schema={{value: 'value', name: 'name'}}
|
schema={{ value: "value", name: "name" }}
|
||||||
select={formik.values.sakht_period}
|
select={formik.values.sakht_period}
|
||||||
handleChange={(event) => {
|
handleChange={(event) => {
|
||||||
formik.setFieldValue('sakht_period', event.target.value)
|
formik.setFieldValue("sakht_period", event.target.value);
|
||||||
}}
|
}}
|
||||||
setFieldTouched={formik.setFieldTouched}
|
setFieldTouched={formik.setFieldTouched}
|
||||||
error={formik.touched.sakht_period && Boolean(formik.errors.sakht_period)}
|
error={formik.touched.sakht_period && Boolean(formik.errors.sakht_period)}
|
||||||
@@ -363,28 +385,28 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
value: "1",
|
value: "1",
|
||||||
name: "1 ماه"
|
name: "1 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
value: "2",
|
value: "2",
|
||||||
name: "2 ماه"
|
name: "2 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
value: "3",
|
value: "3",
|
||||||
name: "3 ماه"
|
name: "3 ماه",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
value: "4",
|
value: "4",
|
||||||
name: "4 ماه"
|
name: "4 ماه",
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
schema={{value: 'value', name: 'name'}}
|
schema={{ value: "value", name: "name" }}
|
||||||
select={formik.values.tanafos_period}
|
select={formik.values.tanafos_period}
|
||||||
handleChange={(event) => {
|
handleChange={(event) => {
|
||||||
formik.setFieldValue('tanafos_period', event.target.value)
|
formik.setFieldValue("tanafos_period", event.target.value);
|
||||||
}}
|
}}
|
||||||
setFieldTouched={formik.setFieldTouched}
|
setFieldTouched={formik.setFieldTouched}
|
||||||
error={formik.touched.tanafos_period && Boolean(formik.errors.tanafos_period)}
|
error={formik.touched.tanafos_period && Boolean(formik.errors.tanafos_period)}
|
||||||
@@ -406,19 +428,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
value={formik.values.committed_employment}
|
value={formik.values.committed_employment}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
formik.setFieldValue("committed_employment", event.target.value)
|
formik.setFieldValue("committed_employment", event.target.value);
|
||||||
} else {
|
} else {
|
||||||
formik.setFieldValue("committed_employment", formik.values.committed_employment)
|
formik.setFieldValue("committed_employment", formik.values.committed_employment);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onBlur={formik.handleBlur("committed_employment")}
|
onBlur={formik.handleBlur("committed_employment")}
|
||||||
error={
|
error={formik.touched.committed_employment && Boolean(formik.errors.committed_employment)}
|
||||||
formik.touched.committed_employment &&
|
helperText={formik.touched.committed_employment && formik.errors.committed_employment}
|
||||||
Boolean(formik.errors.committed_employment)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
formik.touched.committed_employment && formik.errors.committed_employment
|
|
||||||
}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -436,19 +453,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
value={formik.values.existing_employment}
|
value={formik.values.existing_employment}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
if (!isNaN(event.target.value)) {
|
if (!isNaN(event.target.value)) {
|
||||||
formik.setFieldValue("existing_employment", event.target.value)
|
formik.setFieldValue("existing_employment", event.target.value);
|
||||||
} else {
|
} else {
|
||||||
formik.setFieldValue("existing_employment", formik.values.existing_employment)
|
formik.setFieldValue("existing_employment", formik.values.existing_employment);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onBlur={formik.handleBlur("existing_employment")}
|
onBlur={formik.handleBlur("existing_employment")}
|
||||||
error={
|
error={formik.touched.existing_employment && Boolean(formik.errors.existing_employment)}
|
||||||
formik.touched.existing_employment &&
|
helperText={formik.touched.existing_employment && formik.errors.existing_employment}
|
||||||
Boolean(formik.errors.existing_employment)
|
|
||||||
}
|
|
||||||
helperText={
|
|
||||||
formik.touched.existing_employment && formik.errors.existing_employment
|
|
||||||
}
|
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -465,32 +477,36 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type}) =>
|
|||||||
imageAlt={t("app_name")}
|
imageAlt={t("app_name")}
|
||||||
imageSize={[250, 150]}
|
imageSize={[250, 150]}
|
||||||
onBlur={formik.handleBlur("expert_img")}
|
onBlur={formik.handleBlur("expert_img")}
|
||||||
error={
|
error={formik.touched.expert_img && Boolean(formik.errors.expert_img)}
|
||||||
formik.touched.expert_img &&
|
|
||||||
Boolean(formik.errors.expert_img)
|
|
||||||
}
|
|
||||||
setShowAddIcon={setShowExpertAddIcon}
|
setShowAddIcon={setShowExpertAddIcon}
|
||||||
showAddIcon={showExpertAddIcon}
|
showAddIcon={showExpertAddIcon}
|
||||||
/>
|
/>
|
||||||
<FormHelperText
|
<FormHelperText error={Boolean(formik.errors.expert_img)}>
|
||||||
error={Boolean(formik.errors.expert_img)}
|
|
||||||
>
|
|
||||||
{formik.touched.expert_img && formik.errors.expert_img}
|
{formik.touched.expert_img && formik.errors.expert_img}
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setOpenConfirmDialog(false)} variant="outlined" color="secondary"
|
<Button
|
||||||
disabled={formik.isSubmitting} autoFocus>
|
onClick={() => setOpenConfirmDialog(false)}
|
||||||
|
variant="outlined"
|
||||||
|
color="secondary"
|
||||||
|
disabled={formik.isSubmitting}
|
||||||
|
autoFocus
|
||||||
|
>
|
||||||
{t("ConfirmDialog.button-cancel")}
|
{t("ConfirmDialog.button-cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={formik.handleSubmit} variant="contained" color="primary"
|
<Button
|
||||||
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}>
|
onClick={formik.handleSubmit}
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
disabled={formik.isSubmitting || !formik.dirty || !formik.isValid}
|
||||||
|
>
|
||||||
{t("ConfirmDialog.button-confirm")}
|
{t("ConfirmDialog.button-confirm")}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
export default ConfirmContent
|
export default ConfirmContent;
|
||||||
|
|||||||
Reference in New Issue
Block a user