diff --git a/example.env.local b/example.env.local index 4be359a..9715afe 100644 --- a/example.env.local +++ b/example.env.local @@ -1,5 +1,5 @@ NEXT_PUBLIC_API_NAME = "Loan Facilities Dashboard" -NEXT_PUBLIC_API_VERSION = "1.25.4" +NEXT_PUBLIC_API_VERSION = "1.25.6" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl" diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index e504a11..5cd50ca 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -359,10 +359,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": "مقدار پیشنهادی باید مثبت باشد", @@ -546,6 +557,8 @@ "LoanHistory": { "id": "کد یکتا", "name": "نام", + "tanafos_period": "دوره تنفس", + "sakht_period": "دوره ساخت", "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", @@ -556,6 +569,7 @@ "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست", "history": "تاریخچه", + "province_name": "استان", "Table_history_error": "خطا در دریافت اطلاعات", "history_report": "فایل ضمیمه", "Table_head_name": "نام", diff --git a/src/components/dashboard/loan-history/index.jsx b/src/components/dashboard/loan-history/index.jsx index 66f28de..222c6ae 100644 --- a/src/components/dashboard/loan-history/index.jsx +++ b/src/components/dashboard/loan-history/index.jsx @@ -137,17 +137,6 @@ function DashboardLoanHistoryComponent() { ); }, }, - { - accessorFn: (row) => - moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"), - id: "updated_at", - header: t("LoanHistory.updated_at"), - enableColumnFilter: false, - datatype: "numeric", - Cell: ({renderedCellValue}) => ( - {renderedCellValue} - ), - }, { accessorFn: (row) => row.navgan_id, id: "navgan_id", @@ -167,6 +156,46 @@ 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", + header: t("LoanHistory.province_name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.vehicle_type, id: "vehicle_type", diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/ConfirmContent.jsx index ada0a12..d338080 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, @@ -14,10 +15,7 @@ import { } from "@mui/material" import {useFormik} from "formik"; import {useTranslations} from "next-intl"; -import { - CONFIRM_MACHINARY_OFFICE, - CONFIRM_MACHINARY_OFFICE_DETAILS -} from "@/core/data/apiRoutes"; +import {CONFIRM_MACHINARY_OFFICE, CONFIRM_MACHINARY_OFFICE_DETAILS} from "@/core/data/apiRoutes"; import {useEffect, useState} from "react"; import PriceField from "@/core/components/PriceField"; import * as Yup from "yup"; @@ -28,13 +26,13 @@ const vehicle_amount = { "اتوبوس": 7000, "مینی بوس": 2000, } -const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , handleSizeChangeClick}) => { +const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type, handleSizeChangeClick}) => { const t = useTranslations(); const [selectedImage, setSelectedImage] = useState(""); const [fileType, setfileType] = useState(null); const [fileName, setfileName] = useState(null); const [showAddIcon, setShowAddIcon] = useState(true); - const requestServer = useRequest({auth: true , notification: false}) + const requestServer = useRequest({auth: true, notification: false}) const {update_notification} = useNotification() const [accordionStates, setAccordionStates] = useState([]); const [hasImageShown, setHasImageShown] = useState(false); @@ -46,7 +44,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han useEffect(() => { requestServer(`${CONFIRM_MACHINARY_OFFICE_DETAILS}/${rowId}`, 'get') .then((response) => { - const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false); + const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false); setAccordionStates(booleanData); setDetailsData(response.data) }) @@ -60,13 +58,11 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han const newAccordionStates = accordionStates.map((state, i) => i === index ? !state : false); setAccordionStates(newAccordionStates); - if (!newAccordionStates[index]) - { + if (!newAccordionStates[index]) { handleSizeChangeClick('sm'); setHasImageShown(false); setIsSkeleton(false) - } - else { + } else { handleSizeChangeClick('xl'); setHasImageShown(true); setImageLink(detailsList.data.attachment_files[index]) @@ -75,14 +71,26 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han }; 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) => { @@ -98,15 +106,20 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han 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); if (values.confirm_img != null) formData.append("attachment", values.confirm_img); requestServer(`${CONFIRM_MACHINARY_OFFICE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -166,7 +179,7 @@ const ConfirmContent = ({mutate, setOpenConfirmDialog, rowId, vehicle_type , han - {loading ? : renderCustomAccordions()} + {loading ? : renderCustomAccordions()} + + {t("ConfirmDialog.sakht_period_day")}, + }} + /> + + + {t("ConfirmDialog.tanafos_period_month")}, + }} + /> + {t("MachinaryOffice.upload_file")} - - + + diff --git a/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx index 445aab3..febb675 100644 --- a/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx +++ b/src/components/dashboard/machinary-office/Form/ConfirmForm/index.jsx @@ -33,9 +33,15 @@ const Confirm = ({rowId, mutate, vehicle_type}) => { + 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 4078032..ae140fc 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(); @@ -90,6 +90,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -137,35 +138,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 ( <> @@ -173,7 +145,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 9a647a7..94010a2 100644 --- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx @@ -20,6 +20,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(); @@ -97,6 +98,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl requestServer(`${CONFIRM_TRANSPORTATION_ASSISTANCE}/${rowId}`, 'post', { data: formData, + notification: true }).then((response) => { setOpenConfirmDialog(false) mutate() @@ -146,34 +148,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 ( <> @@ -181,7 +155,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