From dfa26ace1d052d00e75fb51dcc469f6a48992cf7 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Sun, 10 Dec 2023 16:28:35 +0330 Subject: [PATCH 1/7] add approved and proposed column to refer pages and tables and update loan history page texts --- public/locales/fa/app.json | 18 +++++- .../dashboard/loan-history/index.jsx | 56 ++++++++++++++++--- .../navgan-province-manager/index.jsx | 38 +++++++++++++ .../dashboard/passenger-boss/index.jsx | 19 +++++++ .../transportation-assistance/index.jsx | 38 +++++++++++++ 5 files changed, 159 insertions(+), 10 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 5088829..d94082a 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -191,6 +191,8 @@ "id": "کد یکتا", "national_id": "کد ملی", "phone_number": "موبایل", + "proposed_amount": "مبلغ پیشنهادی", + "approved_amount": "مبلغ مصوب", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", @@ -206,6 +208,7 @@ "id": "کد یکتا", "national_id": "کد ملی", "phone_number": "موبایل", + "proposed_amount": "مبلغ پیشنهادی", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", @@ -282,6 +285,8 @@ "id": "کد یکتا", "national_id": "کد ملی", "phone_number": "موبایل", + "proposed_amount": "مبلغ پیشنهادی", + "approved_amount": "مبلغ مصوب", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", @@ -537,6 +542,17 @@ "update_again": "بروزرسانی مجدد" }, "LoanHistory": { + "id": "کد یکتا", + "name": "نام", + "national_id": "کد ملی", + "phone_number": "موبایل", + "proposed_amount": "مبلغ پیشنهادی", + "approved_amount": "مبلغ مصوب", + "created_at": "تاریخ درخواست", + "updated_at": "تاریخ بروزرسانی", + "navgan_id": "کد ناوگان", + "vehicle_type": "نوع ماشین", + "state_name": "وضعیت درخواست", "history": "تاریخچه", "Table_history_error": "خطا در دریافت اطلاعات", "history_report": "فایل ضمیمه", @@ -547,4 +563,4 @@ "Table_head_file": "فایل پیوست", "empty_history_detail": "سابقه ای برای این وام وجود ندارد" } -} +} \ No newline at end of file diff --git a/src/components/dashboard/loan-history/index.jsx b/src/components/dashboard/loan-history/index.jsx index c2bb293..66f28de 100644 --- a/src/components/dashboard/loan-history/index.jsx +++ b/src/components/dashboard/loan-history/index.jsx @@ -14,7 +14,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.id, id: "id", - header: t("PassengerOffice.id"), + header: t("LoanHistory.id"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -33,7 +33,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.name, id: "name", - header: t("MachinaryOffice.name"), + header: t("LoanHistory.name"), enableColumnFilter: true, datatype: "text", filterFn: "contains", @@ -45,7 +45,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.national_id, id: "national_id", - header: t("MachinaryOffice.national_id"), + header: t("LoanHistory.national_id"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -64,7 +64,45 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.phone_number, id: "phone_number", - header: t("MachinaryOffice.phone_number"), + header: t("LoanHistory.phone_number"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.proposed_amount, + id: "proposed_amount", + header: t("LoanHistory.proposed_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.approved_amount, + id: "approved_amount", + header: t("LoanHistory.approved_amount"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -84,7 +122,7 @@ function DashboardLoanHistoryComponent() { accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), id: "created_at", - header: t("MachinaryOffice.created_at"), + header: t("LoanHistory.created_at"), enableColumnFilter: true, datatype: "date", filterFn: "lessThan", @@ -103,7 +141,7 @@ function DashboardLoanHistoryComponent() { accessorFn: (row) => moment(row.updated_at).locale("fa").format("HH:mm | yyyy/MM/DD"), id: "updated_at", - header: t("MachinaryOffice.updated_at"), + header: t("LoanHistory.updated_at"), enableColumnFilter: false, datatype: "numeric", Cell: ({renderedCellValue}) => ( @@ -113,7 +151,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.navgan_id, id: "navgan_id", - header: t("MachinaryOffice.navgan_id"), + header: t("LoanHistory.navgan_id"), enableColumnFilter: true, datatype: "numeric", filterFn: "equals", @@ -132,7 +170,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.vehicle_type, id: "vehicle_type", - header: t("MachinaryOffice.vehicle_type"), + header: t("LoanHistory.vehicle_type"), enableColumnFilter: true, datatype: "text", filterFn: "contains", @@ -144,7 +182,7 @@ function DashboardLoanHistoryComponent() { { accessorFn: (row) => row.state_name, id: "state_id", - header: t("MachinaryOffice.state_name"), + header: t("LoanHistory.state_name"), enableColumnFilter: false, datatype: "numeric", Cell: ({renderedCellValue}) => ( diff --git a/src/components/dashboard/navgan-province-manager/index.jsx b/src/components/dashboard/navgan-province-manager/index.jsx index 0397fc5..4e2a9ed 100644 --- a/src/components/dashboard/navgan-province-manager/index.jsx +++ b/src/components/dashboard/navgan-province-manager/index.jsx @@ -82,6 +82,44 @@ function DashboardNavganProvinceManagerComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.proposed_amount, + id: "proposed_amount", + header: t("NavganProvinceManager.proposed_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.approved_amount, + id: "approved_amount", + header: t("NavganProvinceManager.approved_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), diff --git a/src/components/dashboard/passenger-boss/index.jsx b/src/components/dashboard/passenger-boss/index.jsx index 1a13b3b..13674dc 100644 --- a/src/components/dashboard/passenger-boss/index.jsx +++ b/src/components/dashboard/passenger-boss/index.jsx @@ -82,6 +82,25 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.proposed_amount, + id: "proposed_amount", + header: t("PassengerBoss.proposed_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), diff --git a/src/components/dashboard/transportation-assistance/index.jsx b/src/components/dashboard/transportation-assistance/index.jsx index a1cdae0..b0acd92 100644 --- a/src/components/dashboard/transportation-assistance/index.jsx +++ b/src/components/dashboard/transportation-assistance/index.jsx @@ -82,6 +82,44 @@ function DashboardTransportationAssistanceComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.proposed_amount, + id: "proposed_amount", + header: t("TransportationAssistance.proposed_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.approved_amount, + id: "approved_amount", + header: t("TransportationAssistance.approved_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), From 55707b4b3968ab96ab7e165e9a1727755a71fea0 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Sun, 10 Dec 2023 16:56:59 +0330 Subject: [PATCH 2/7] update confirm modal of transportation assistant --- public/locales/fa/app.json | 8 +-- .../Form/ConfirmForm/ConfirmContent.jsx | 54 +++++++++++-------- .../transportation-assistance/index.jsx | 2 +- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index d94082a..439f259 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -192,7 +192,7 @@ "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", - "approved_amount": "مبلغ مصوب", + "approved_amount": "مبلغ تصویب شده", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", @@ -286,7 +286,7 @@ "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", - "approved_amount": "مبلغ مصوب", + "approved_amount": "مبلغ تصویب شده", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", @@ -362,7 +362,7 @@ "approved_amount_number": "مبلغ تصویب شده باید عدد باشد", "toman": "میلیون تومان", "proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست", - "proposed_amount": "مقدار پیشنهادی", + "proposed_amount": "مبلغ پیشنهادی", "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد", "proposed_amount_number": "مقدار پیشنهادی باید عدد باشد" }, @@ -547,7 +547,7 @@ "national_id": "کد ملی", "phone_number": "موبایل", "proposed_amount": "مبلغ پیشنهادی", - "approved_amount": "مبلغ مصوب", + "approved_amount": "مبلغ تصویب شده", "created_at": "تاریخ درخواست", "updated_at": "تاریخ بروزرسانی", "navgan_id": "کد ناوگان", diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx index 076af16..833bdf6 100644 --- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx @@ -6,7 +6,9 @@ import { Button, DialogActions, DialogContent, - FormHelperText, Grid, LinearProgress, + FormHelperText, + Grid, + LinearProgress, Stack, TextField, Typography @@ -18,13 +20,14 @@ import {useEffect, useState} from "react"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; import ImageContent from "@/core/components/ImageContent"; -const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeClick}) => { + +const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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 [accordionStates, setAccordionStates] = useState([]); const [hasAccordionOpened, setHasAccordionOpened] = useState([]); const {update_notification} = useNotification(); @@ -37,14 +40,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl useEffect(() => { requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get') .then((response) => { - const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false); - setAccordionStates(booleanData); - setHasAccordionOpened(booleanData); - setDetailsData(response.data) + const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false); + setAccordionStates(booleanData); + setHasAccordionOpened(booleanData); + setDetailsData(response.data) }) .catch(() => { }).finally(() => { - setLoading(false); + setLoading(false); }); }, []); @@ -52,13 +55,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl 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]) @@ -144,8 +145,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl const numberShowBox = () => { return ( <> - - {t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")} + + {t("ConfirmDialog.proposed_amount")} {t("sidebar.machinery-expert")} {isNaN((detailsList?.data?.proposed_amount) / 10) ? "" @@ -153,8 +157,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl {t("ConfirmDialog.unit")} - - {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} + + {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} {isNaN((detailsList?.data?.approved_amount) / 10) ? "" @@ -170,7 +177,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl - {loading ? : + {loading ? : <> {numberShowBox()} {renderCustomAccordions()} @@ -220,9 +227,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl - - - + + + @@ -233,7 +245,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl diff --git a/src/components/dashboard/transportation-assistance/index.jsx b/src/components/dashboard/transportation-assistance/index.jsx index b0acd92..2ff3796 100644 --- a/src/components/dashboard/transportation-assistance/index.jsx +++ b/src/components/dashboard/transportation-assistance/index.jsx @@ -85,7 +85,7 @@ function DashboardTransportationAssistanceComponent() { { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", - header: t("TransportationAssistance.proposed_amount"), + header: `${t("TransportationAssistance.proposed_amount")}`, enableColumnFilter: true, datatype: "numeric", filterFn: "equals", From 6ec8202add5af93f2781b995b71da72b816fc33b Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Tue, 19 Dec 2023 11:15:55 +0330 Subject: [PATCH 3/7] change titles --- public/locales/fa/app.json | 30 +++---- .../Form/ConfirmForm/ConfirmContent.jsx | 78 ++++++++++--------- .../Form/ConfirmForm/ConfirmContent.jsx | 33 ++++---- .../Form/ConfirmForm/ConfirmContent.jsx | 52 ++++++++----- src/core/data/sidebarMenu.jsx | 6 +- 5 files changed, 108 insertions(+), 91 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 5088829..cc4ab3f 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -42,10 +42,10 @@ "dashboard": "داشبورد", "reports": "گزارشات", "passenger-office-chief": "اداره مسافر", - "machinery-expert": "ماشین آلات", - "passenger-boss": "رئیس مسافر ", - "transportation-assistant": "معاونت حمل و نقل", - "navgan-province-manager": "مدیر کل استانی", + "machinery-expert": "کارتابل قیمت گذاری", + "passenger-boss": "کارتابل کارگروه", + "transportation-assistant": "بررسی وام های تبصره 18", + "navgan-province-manager": "بررسی وام های تبصره 18", "refahi-province-manager": "مدیر کل استانی", "refahi-loan-management": "مدیریت وام", "navgan-loan-management": "مدیریت وام", @@ -62,7 +62,7 @@ }, "secondary": { "passenger-office": "توزیع درخواست", - "passenger-boss": "کارگروه استانی", + "passenger-boss": "کارگروه", "refahi-province-manager": "رفاهی", "refahi-loan-management": "رفاهی", "navgan-loan-management": "ناوگان", @@ -102,14 +102,14 @@ "Dashboard": { "dashboard_page": "داشبورد", "reports": "گزارشات", - "passenger_boss_page": "رئیس مسافر", - "transportation_assistance": "معاونت حمل و نقل", + "passenger_boss_page": "کارتابل کارگروه", + "transportation_assistance": "بررسی وام های تبصره 18", "change_password": "تغییر رمز عبور", - "province_manager_page": "مدیر کل استانی", + "province_manager_page": "بررسی وام های تبصره 18", "province_head_expert": "کارشناس ستادی", "passenger_office_page": "اداره مسافر", "loan_management_page": "مدیریت وام", - "machinary_office_page": "ماشین آلات", + "machinary_office_page": "کارتابل قیمت گذاری", "development_assistant_page": "معاون توسعه", "inspector_expert_page": "بازدید کارشناس", "commercial_chief_page": "رئیس اداره بازرگانی", @@ -212,8 +212,8 @@ "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست", "confirm": "ارجاع به معاون حمل و نقل", - "upload_file": "صورت جلسه کارگروه استانی را بارگذاری کنید", - "upload_file_required": "وارد کردن صورت جلسه کارگروه استانی الزامیست", + "upload_file": "صورت جلسه کارگروه را بارگذاری کنید", + "upload_file_required": "وارد کردن صورت جلسه کارگروه الزامیست", "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد", "upload_file_format": "فرمت قابل قبول : png,jpg,pdf", "print_final_credit_amount": "چاپ صورت جلسه تعیین مبلغ نهایی", @@ -287,7 +287,7 @@ "navgan_id": "کد ناوگان", "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست", - "confirm": "ارجاع به مدیر کل استانی", + "confirm": "ارجاع به مدیر کل", "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد", "upload_file_format": "فرمت قابل قبول : png,jpg,pdf", "excel_report": "گزارش اکسل" @@ -313,12 +313,12 @@ "navgan_id": "کد ناوگان", "vehicle_type": "نوع ماشین", "state_name": "وضعیت درخواست", - "confirm": "ارجاع به کارگروه استانی", + "confirm": "ارجاع به کارگروه", "upload_file": "گزارش کارشناسی را بارگذاری کنید", "upload_file_required": "وارد کردن گزارش کارشناسی الزامیست", "upload_file_unit": "فایل بارگذاری شده باید حداکثر 2Mb باشد", "upload_file_format": "فرمت قابل قبول : png,jpg,pdf", - "print_report": "چاپ گزارش کارشناسی ماشین آلات", + "print_report": "چاپ گزارش کارشناسی", "max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد", "excel_report": "گزارش اکسل" }, @@ -357,7 +357,7 @@ "approved_amount_number": "مبلغ تصویب شده باید عدد باشد", "toman": "میلیون تومان", "proposed_amount_error": "وارد کردن مقدار پیشنهادی الزامیست", - "proposed_amount": "مقدار پیشنهادی", + "proposed_amount": "مبلغ پیشنهادی", "proposed_amount_positive": "مقدار پیشنهادی باید مثبت باشد", "proposed_amount_number": "مقدار پیشنهادی باید عدد باشد" }, 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 aa2107f..4078032 100644 --- a/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/navgan-province-manager/Form/ConfirmForm/ConfirmContent.jsx @@ -15,10 +15,7 @@ import { } from "@mui/material" import {useFormik} from "formik"; import {useTranslations} from "next-intl"; -import { - CONFIRM_NAVGAN_PROVINCE_MANAGER, - CONFIRM_PROVINCE_MANAGER_DETAILS -} from "@/core/data/apiRoutes"; +import {CONFIRM_NAVGAN_PROVINCE_MANAGER, CONFIRM_PROVINCE_MANAGER_DETAILS} from "@/core/data/apiRoutes"; import {useEffect, useState} from "react"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; @@ -30,7 +27,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl 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); @@ -55,7 +52,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl useEffect(() => { requestServer(`${CONFIRM_PROVINCE_MANAGER_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) }) @@ -69,13 +66,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl 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]) @@ -143,28 +138,32 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl }; const numberShowBox = () => { - return ( - <> - - {t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")} - - {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 ( + <> + + {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 ( @@ -172,10 +171,10 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl - {loading ? : + {loading ? : <> - {numberShowBox()} - {renderCustomAccordions()} + {numberShowBox()} + {renderCustomAccordions()} } @@ -222,8 +221,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl - - + + diff --git a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx index 8f3de83..e212043 100644 --- a/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/passenger-boss/Form/ConfirmForm/ConfirmContent.jsx @@ -15,10 +15,7 @@ import { } from "@mui/material" import {useFormik} from "formik"; import {useTranslations} from "next-intl"; -import { - CONFIRM_PASSENGER_BOSS, - EXPORT_PASSENGER_BOSS_DETAILS, -} from "@/core/data/apiRoutes"; +import {CONFIRM_PASSENGER_BOSS, EXPORT_PASSENGER_BOSS_DETAILS,} from "@/core/data/apiRoutes"; import {useEffect, useState} from "react"; import PriceField from "@/core/components/PriceField"; import * as Yup from "yup"; @@ -29,13 +26,13 @@ const vehicle_amount = { "اتوبوس": 7000, "مینی بوس": 2000, } -const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , handleSizeChangeClick}) => { +const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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); @@ -47,7 +44,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han useEffect(() => { requestServer(`${EXPORT_PASSENGER_BOSS_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) }) @@ -61,13 +58,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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]) @@ -166,8 +161,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han const numberShowBox = () => { return ( <> - - {t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")} + + {t("ConfirmDialog.proposed_amount")} {isNaN((detailsList?.data?.proposed_amount) / 10) ? "" @@ -184,7 +180,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han - {loading ? : + {loading ? : <> {numberShowBox()} {renderCustomAccordions()} @@ -260,8 +256,13 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, vehicle_type , han - - + + diff --git a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx index 076af16..9480f7a 100644 --- a/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx +++ b/src/components/dashboard/transportation-assistance/Form/ConfirmForm/ConfirmContent.jsx @@ -6,7 +6,9 @@ import { Button, DialogActions, DialogContent, - FormHelperText, Grid, LinearProgress, + FormHelperText, + Grid, + LinearProgress, Stack, TextField, Typography @@ -18,13 +20,14 @@ import {useEffect, useState} from "react"; import * as Yup from "yup"; import CustomAccordion from "@/core/components/CustomAccordion"; import ImageContent from "@/core/components/ImageContent"; -const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeClick}) => { + +const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, 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 [accordionStates, setAccordionStates] = useState([]); const [hasAccordionOpened, setHasAccordionOpened] = useState([]); const {update_notification} = useNotification(); @@ -37,14 +40,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl useEffect(() => { requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get') .then((response) => { - const booleanData = Array.from({ length: response.data.data.attachment_files.length }, () => false); - setAccordionStates(booleanData); - setHasAccordionOpened(booleanData); - setDetailsData(response.data) + const booleanData = Array.from({length: response.data.data.attachment_files.length}, () => false); + setAccordionStates(booleanData); + setHasAccordionOpened(booleanData); + setDetailsData(response.data) }) .catch(() => { }).finally(() => { - setLoading(false); + setLoading(false); }); }, []); @@ -52,13 +55,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl 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]) @@ -144,8 +145,9 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl const numberShowBox = () => { return ( <> - - {t("ConfirmDialog.approved_amount")} {t("sidebar.machinery-expert")} + + {t("ConfirmDialog.proposed_amount")} {isNaN((detailsList?.data?.proposed_amount) / 10) ? "" @@ -153,8 +155,11 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl {t("ConfirmDialog.unit")} - - {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} + + {t("ConfirmDialog.approved_amount")} {t("secondary.passenger-boss")} {isNaN((detailsList?.data?.approved_amount) / 10) ? "" @@ -170,7 +175,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl - {loading ? : + {loading ? : <> {numberShowBox()} {renderCustomAccordions()} @@ -220,9 +225,14 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl - - - + + + @@ -233,7 +243,7 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog ,handleSizeChangeCl diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 2fd6792..21511e3 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -37,7 +37,7 @@ const sidebarMenu = [ }, { key: "sidebar.passenger-office-chief", - secondary: "secondary.passenger-office", + secondary: "secondary.navgan-province-manager", name: "passenger_office_chief", type: "page", route: "/dashboard/passenger-office-chief", @@ -47,6 +47,7 @@ const sidebarMenu = [ }, { key: "sidebar.machinery-expert", + secondary: "secondary.navgan-province-manager", name: "machinery_expert", type: "page", route: "/dashboard/machinery-expert", @@ -56,7 +57,7 @@ const sidebarMenu = [ }, { key: "sidebar.passenger-boss", - secondary: "secondary.passenger-boss", + secondary: "secondary.navgan-province-manager", name: "province_working_group", type: "page", route: "/dashboard/passenger-boss", @@ -67,6 +68,7 @@ const sidebarMenu = [ { key: "sidebar.transportation-assistant", + secondary: "secondary.navgan-province-manager", name: "transportation_assistant", type: "page", route: "/dashboard/transportation-assistant", From 4cc54bf91de8868b0a65ac300e030c5a27fce23a Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Tue, 19 Dec 2023 12:04:29 +0330 Subject: [PATCH 4/7] change sidebar --- public/locales/fa/app.json | 3 +- src/components/layouts/Dashboard/index.jsx | 2 +- src/core/data/sidebarMenu.jsx | 50 +++++++++++++--------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 954f1ca..4e26061 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -66,7 +66,8 @@ "refahi-province-manager": "رفاهی", "refahi-loan-management": "رفاهی", "navgan-loan-management": "ناوگان", - "navgan-province-manager": "ناوگان" + "navgan-province-manager": "ناوگان", + "admin-management": "ادمین" }, "Authorization": { "typography_your_login_is_valid_and_you_do_not_need_to_login_again": "شما دسترسی لازم به این صفحه را دارید نیاز به ورود مجدد نیست.", diff --git a/src/components/layouts/Dashboard/index.jsx b/src/components/layouts/Dashboard/index.jsx index ef3f3bd..de85d31 100644 --- a/src/components/layouts/Dashboard/index.jsx +++ b/src/components/layouts/Dashboard/index.jsx @@ -5,7 +5,7 @@ import Header from "@/components/layouts/Dashboard/Header"; import Sidebar from "@/components/layouts/Dashboard/Sidebar"; import Content from "@/components/layouts/Dashboard/Content"; -const drawerWidth = 240; +const drawerWidth = 260; const DashboardLayouts = (props) => { const {window} = props; diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 21511e3..f2e6e40 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -35,6 +35,16 @@ const sidebarMenu = [ selected: false, permission: "all", }, + { + key: "sidebar.loan-history", + name: "loan-history", + type: "page", + route: "/dashboard/loan-history", + icon: , + selected: false, + permission: "manage_navgan_loan", + }, + ], [ { key: "sidebar.passenger-office-chief", secondary: "secondary.navgan-province-manager", @@ -86,8 +96,20 @@ const sidebarMenu = [ selected: false, permission: "manage_province_affairs_navgan", }, + { + key: "sidebar.navgan-loan-management", + secondary: "secondary.navgan-loan-management", + name: "navgan_loan_management", + type: "page", + route: "/dashboard/navgan-loan-management", + icon: , + selected: false, + permission: "manage_navgan_loan", + }, + ], [ { key: "sidebar.province-head-expert", + secondary: "secondary.refahi-province-manager", name: "province_head_expert", type: "page", route: "/dashboard/province-head-expert", @@ -97,6 +119,7 @@ const sidebarMenu = [ }, { key: "sidebar.inspector-expert", + secondary: "secondary.refahi-province-manager", name: "inspector_expert", type: "page", route: "/dashboard/inspector-expert", @@ -106,6 +129,7 @@ const sidebarMenu = [ }, { key: "sidebar.commercial-chief", + secondary: "secondary.refahi-province-manager", name: "commercial_chief", type: "page", route: "/dashboard/commercial-chief", @@ -115,6 +139,7 @@ const sidebarMenu = [ }, { key: "sidebar.development-assistant", + secondary: "secondary.refahi-province-manager", name: "development_assistant", type: "page", route: "/dashboard/development-assistant", @@ -142,18 +167,10 @@ const sidebarMenu = [ selected: false, permission: "manage_refahi_loan", }, - { - key: "sidebar.navgan-loan-management", - secondary: "secondary.navgan-loan-management", - name: "navgan_loan_management", - type: "page", - route: "/dashboard/navgan-loan-management", - icon: , - selected: false, - permission: "manage_navgan_loan", - }, + ], [ { key: "sidebar.expert-management", + secondary: "secondary.admin-management", name: "expert_management", type: "page", route: "/dashboard/expert-management", @@ -163,6 +180,7 @@ const sidebarMenu = [ }, { key: "sidebar.user-management", + secondary: "secondary.admin-management", name: "user_management", type: "page", route: "/dashboard/user-management", @@ -172,22 +190,14 @@ const sidebarMenu = [ }, { key: "sidebar.role-management", + secondary: "secondary.admin-management", name: "role_management", type: "page", route: "/dashboard/role-management", icon: , selected: false, permission: "manage_roles", - }, - { - key: "sidebar.loan-history", - name: "loan-history", - type: "page", - route: "/dashboard/loan-history", - icon: , - selected: false, - permission: "manage_navgan_loan", - }, + } ], ]; From 2d22f12dc4e23cacba49666e3c1c75a53cc1296f Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Tue, 19 Dec 2023 12:07:31 +0330 Subject: [PATCH 5/7] change sidebar --- .../layouts/Dashboard/Sidebar/SidebarList.jsx | 98 +++++++------------ 1 file changed, 37 insertions(+), 61 deletions(-) diff --git a/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx b/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx index 1c76f07..f3afdba 100644 --- a/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx +++ b/src/components/layouts/Dashboard/Sidebar/SidebarList.jsx @@ -8,51 +8,34 @@ import useUser from "@/lib/app/hooks/useUser"; function reducer(state, action) { switch (action.type) { case "COLLAPSE_MENU": - return state.map((itemsArr) => - itemsArr.map((item) => - action.key === item.key ? {...item, showSubItem: !item.showSubItem} : item - ) - ); + return state.map((itemsArr) => itemsArr.map((item) => action.key === item.key ? { + ...item, + showSubItem: !item.showSubItem + } : item)); case "SELECTED": - return state.map((itemsArr) => - itemsArr.map((item) => { - return item.type === "page" - ? {...item, selected: action.route === item.route, routing: false} - : item.subItem && Array.isArray(item.subItem) - ? { - ...item, - subItem: item.subItem.map((subitem) => ({ - ...subitem, - selected: subitem.route === action.route, - routing: false - })), - showSubItem: item.subItem.some( - (subitem) => subitem.selected - ), - } - : item; - }) - ); + return state.map((itemsArr) => itemsArr.map((item) => { + return item.type === "page" ? { + ...item, + selected: action.route === item.route, + routing: false + } : item.subItem && Array.isArray(item.subItem) ? { + ...item, subItem: item.subItem.map((subitem) => ({ + ...subitem, selected: subitem.route === action.route, routing: false + })), showSubItem: item.subItem.some((subitem) => subitem.selected), + } : item; + })); case "SELECTING": - return state.map((itemsArr) => - itemsArr.map((item) => { - return item.type === "page" - ? {...item, selected: action.route === item.route, routing: action.route === item.route} - : item.subItem && Array.isArray(item.subItem) - ? { - ...item, - subItem: item.subItem.map((subitem) => ({ - ...subitem, - selected: subitem.route === action.route, - routing: subitem.route === action.route - })), - showSubItem: item.subItem.some( - (subitem) => subitem.selected - ), - } - : item; - }) - ); + return state.map((itemsArr) => itemsArr.map((item) => { + return item.type === "page" ? { + ...item, + selected: action.route === item.route, + routing: action.route === item.route + } : item.subItem && Array.isArray(item.subItem) ? { + ...item, subItem: item.subItem.map((subitem) => ({ + ...subitem, selected: subitem.route === action.route, routing: subitem.route === action.route + })), showSubItem: item.subItem.some((subitem) => subitem.selected), + } : item; + })); default: throw new Error(); } @@ -81,28 +64,21 @@ export default function SidebarList({handleDrawerToggle}) { useEffect(() => { selectedKey && document.querySelector(`[data-route="${selectedKey}"]`)?.scrollIntoView({ - behavior: "smooth", - block: "center" + behavior: "smooth", block: "center" }); }, [selectedKey]); - return ( - - {itemMenu.map((itemArr, index) => ( - - {itemArr.map((item) => - - {(user?.permissions?.includes(item.permission) || item.permission === "all") && - } - - )} + return ( + {itemMenu.map((itemArr, index) => ( + {itemArr.map((item) => + {(user?.permissions?.includes(item.permission) || item.permission === "all") && } + )} - - ))} + ))} ); From 4a99933c420985044f34c07732308d33f596515a Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Wed, 20 Dec 2023 15:18:06 +0330 Subject: [PATCH 6/7] fixed bug --- src/core/data/sidebarMenu.jsx | 4 ++-- src/pages/dashboard/loan-history/index.jsx | 2 +- src/pages/dashboard/reports/index.jsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index f2e6e40..d53267f 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -33,7 +33,7 @@ const sidebarMenu = [ route: "/dashboard/reports", icon: , selected: false, - permission: "all", + permission: "view_reports_navgan", }, { key: "sidebar.loan-history", @@ -42,7 +42,7 @@ const sidebarMenu = [ route: "/dashboard/loan-history", icon: , selected: false, - permission: "manage_navgan_loan", + permission: "view_navgan_loans", }, ], [ { diff --git a/src/pages/dashboard/loan-history/index.jsx b/src/pages/dashboard/loan-history/index.jsx index d84d43e..04ab36a 100644 --- a/src/pages/dashboard/loan-history/index.jsx +++ b/src/pages/dashboard/loan-history/index.jsx @@ -15,7 +15,7 @@ export async function getServerSideProps({req, locale}) { title: "Dashboard.loan_history", isBot, locale, - layout: {name: 'DashboardLayout', props: {permissions: ["manage_navgan_loan"]}} + layout: {name: 'DashboardLayout', props: {permissions: ["view_navgan_loans"]}} }, }; } diff --git a/src/pages/dashboard/reports/index.jsx b/src/pages/dashboard/reports/index.jsx index 9dba421..7a7de52 100644 --- a/src/pages/dashboard/reports/index.jsx +++ b/src/pages/dashboard/reports/index.jsx @@ -14,7 +14,7 @@ export async function getServerSideProps({req, locale}) { messages: (await import(`&/locales/${locale}/app.json`)).default, title: "Dashboard.reports", isBot, - layout: {name: 'DashboardLayout'} + layout: {name: 'DashboardLayout', props: {permissions: ["view_reports_navgan"]}} }, }; } From 47cbc90d3ee134fdfb546c0e49f3a28fca053d56 Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Wed, 20 Dec 2023 15:20:24 +0330 Subject: [PATCH 7/7] change version --- example.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.env.local b/example.env.local index 7b2ec17..4be359a 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.28.3" +NEXT_PUBLIC_API_VERSION = "1.25.4" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"