diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index f1d29a0..ed2acdb 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -358,10 +358,21 @@ "description": "توضیحات خود را وارد نمائید", "choose_file": "انتخاب فایل", "approved_amount": "مبلغ تصویب شده", + "sakht_period": "دوره ساخت", + "tanafos_period": "دوره تنفس", "approved_amount_error": "وارد کردن مبلغ تصویب شده الزامیست", + "sakht_period_error": "وارد کردن دوره ساخت الزامیست", + "tanafos_period_error": "وارد کردن دوره تنفس الزامیست", "approved_amount_positive": "مبلغ تصویب شده باید مثبت باشد", "approved_amount_number": "مبلغ تصویب شده باید عدد باشد", + "sakht_period_positive": "دوره ساخت باید مثبت باشد", + "tanafos_period_positive": "دوره تنفس باید مثبت باشد", + "sakht_period_number": "دوره ساخت باید عدد باشد", + "tanafos_period_number": "دوره تنفس باید عدد باشد", "toman": "میلیون تومان", + "tanafos_period_month": "ماه", + "approved_amount_title": "مبلغ تصویب شده کارگروه", + "sakht_period_day": "روز", "proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست", "proposed_amount": "مبلغ پیشنهادی", "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد", @@ -545,6 +556,8 @@ "LoanHistory": { "id": "کد یکتا", "name": "نام", + "tanafos_period": "دوره تنفس", + "sakht_period": "دوره ساخت", "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", diff --git a/src/components/dashboard/loan-history/index.jsx b/src/components/dashboard/loan-history/index.jsx index dd536ed..222c6ae 100644 --- a/src/components/dashboard/loan-history/index.jsx +++ b/src/components/dashboard/loan-history/index.jsx @@ -156,6 +156,34 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.sakht_period, + id: "sakht_period", + header: t("LoanHistory.sakht_period"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals" + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.tanafos_period, + id: "tanafos_period", + header: t("LoanHistory.tanafos_period"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals" + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.province_name, id: "province_name", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx index da2e889..c04a2de 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx @@ -7,6 +7,7 @@ import { DialogContent, FormHelperText, Grid, + InputAdornment, LinearProgress, Stack, TextField, @@ -70,14 +71,26 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand }; const validationSchema = Yup.object().shape({ - proposed_amount: Yup.mixed().test( - "is-number", - `${t("ConfirmDialog.proposed_amount_number")}`, - (value) => !isNaN(value) - ).test("max-amount", `${t("MachinaryOffice.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`, - (value) => value <= vehicle_amount[vehicle_type]) + proposed_amount: Yup.mixed() + .test( + "is-number", + `${t("ConfirmDialog.proposed_amount_number")}`, + (value) => !isNaN(value) + ) + .test("max-amount", `${t("MachinaryOffice.max_amount", {value: parseInt(vehicle_amount[vehicle_type]).toLocaleString('en')})}`, + (value) => value <= vehicle_amount[vehicle_type]) .test("positive", `${t("ConfirmDialog.proposed_amount_positive")}`, (value) => value >= 0) .required(t("ConfirmDialog.proposed_amount_error")), + sakht_period: Yup.mixed() + .test("is-number", `${t("ConfirmDialog.sakht_period_number")}`, + (value) => !isNaN(value)) + .test("positive", `${t("ConfirmDialog.sakht_period_positive")}`, (value) => value > 0) + .required(t("ConfirmDialog.sakht_period_error")), + tanafos_period: Yup.mixed() + .test("is-number", `${t("ConfirmDialog.tanafos_period_number")}`, + (value) => !isNaN(value)) + .test("positive", `${t("ConfirmDialog.tanafos_period_positive")}`, (value) => value > 0) + .required(t("ConfirmDialog.tanafos_period_error")), confirm_img: Yup.mixed() .required(t("MachinaryOffice.upload_file_required")) .test('fileSize', `${t("MachinaryOffice.upload_file_unit")}`, (value) => { @@ -92,11 +105,15 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand initialValues: { description: "", proposed_amount: "", + sakht_period: "", + tanafos_period: "", confirm_img: null }, validationSchema, onSubmit: (values, {setSubmitting}) => { const formData = new FormData(); formData.append("proposed_amount", values.proposed_amount); + formData.append("sakht_period", values.sakht_period); + formData.append("tanafos_period", values.tanafos_period); if (values.description != "") formData.append("expert_description", values.description); const attachment = [ { @@ -107,6 +124,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand if (values.confirm_img != null) formData.append("attachment", JSON.stringify(attachment)); requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -208,6 +226,54 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, hand fullWidth /> + + {t("ConfirmDialog.sakht_period_day")}, + }} + /> + + + {t("ConfirmDialog.tanafos_period_month")}, + }} + /> + {t("MachinaryOffice.upload_file")} { + PaperProps={{ + sx: { + transition: 'all .3s', + boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px' + } + }} maxWidth={dialogSize}> {t("MachinaryOffice.confirm")} - diff --git a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx index fbe463b..e345417 100644 --- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx @@ -2,7 +2,6 @@ import UploadSystem from "@/core/components/UploadSystem"; import useNotification from "@/lib/app/hooks/useNotification"; import useRequest from "@/lib/app/hooks/useRequest"; import { - Box, Button, DialogActions, DialogContent, @@ -20,6 +19,7 @@ import {useEffect, useState} from "react"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; import ImageContent from "@/core/components/ImageContent"; +import NumberShowBox from "@/core/components/NumberShowBox"; const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => { const t = useTranslations(); @@ -96,6 +96,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -143,35 +144,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl return null; }; - const numberShowBox = () => { - return ( - <> - - {t("ConfirmDialog.proposed_amount")} - - {isNaN((detailsList?.data?.proposed_amount) / 10) - ? "" - : ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "} - {t("ConfirmDialog.unit")} - - - - {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} - - {isNaN((detailsList?.data?.approved_amount) / 10) - ? "" - : ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "} - {t("ConfirmDialog.unit")} - - - - ); - }; - return ( <> @@ -179,7 +151,26 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl {loading ? : <> - {numberShowBox()} + + + + {renderCustomAccordions()} } diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx index e212043..720f9b9 100644 --- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx @@ -2,7 +2,6 @@ import UploadSystem from "@/core/components/UploadSystem"; import useNotification from "@/lib/app/hooks/useNotification"; import useRequest from "@/lib/app/hooks/useRequest"; import { - Box, Button, DialogActions, DialogContent, @@ -21,6 +20,7 @@ import PriceField from "@/core/components/PriceField"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; import ImageContent from "@/core/components/ImageContent"; +import NumberShowBox from "@/core/components/NumberShowBox"; const vehicle_amount = { "اتوبوس": 7000, @@ -105,6 +105,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand requestServer(`${CONFIRM_PASSENGER_BOSS}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -158,22 +159,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand } return null; }; - const numberShowBox = () => { - return ( - <> - - {t("ConfirmDialog.proposed_amount")} - - {isNaN((detailsList?.data?.proposed_amount) / 10) - ? "" - : ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "} - {t("ConfirmDialog.unit")} - - - - ); - }; return ( <> @@ -182,7 +167,21 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type, hand {loading ? : <> - {numberShowBox()} + + + {renderCustomAccordions()} } diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx index 6737426..e9cb958 100644 --- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx @@ -2,7 +2,6 @@ import UploadSystem from "@/core/components/UploadSystem"; import useNotification from "@/lib/app/hooks/useNotification"; import useRequest from "@/lib/app/hooks/useRequest"; import { - Box, Button, DialogActions, DialogContent, @@ -20,6 +19,7 @@ import {useEffect, useState} from "react"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; import ImageContent from "@/core/components/ImageContent"; +import NumberShowBox from "@/core/components/NumberShowBox"; const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeClick}) => { const t = useTranslations(); @@ -102,6 +102,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -148,34 +149,6 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl } return null; }; - const numberShowBox = () => { - return ( - <> - - {t("ConfirmDialog.proposed_amount")} - - {isNaN((detailsList?.data?.proposed_amount) / 10) - ? "" - : ((detailsList?.data?.proposed_amount) / 10).toLocaleString()}{" "} - {t("ConfirmDialog.unit")} - - - - {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} - - {isNaN((detailsList?.data?.approved_amount) / 10) - ? "" - : ((detailsList?.data?.approved_amount) / 10).toLocaleString()}{" "} - {t("ConfirmDialog.unit")} - - - - ); - }; return ( <> @@ -183,7 +156,26 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl {loading ? : <> - {numberShowBox()} + + + + {renderCustomAccordions()} } diff --git a/src/core/components/NumberShowBox.jsx b/src/core/components/NumberShowBox.jsx new file mode 100644 index 0000000..b8e45b1 --- /dev/null +++ b/src/core/components/NumberShowBox.jsx @@ -0,0 +1,19 @@ +import {Box, Typography} from "@mui/material"; + +const NumberShowBox = ({showNumber, headerTitle, unitTitle}) => { + return ( + <> + + {headerTitle} + + {isNaN(showNumber) || showNumber === null + ? "" + : (showNumber).toLocaleString()}{" "} + {unitTitle} + + + + ); +}; +export default NumberShowBox \ No newline at end of file