From 6dec676f9bd6e7567d1b75180afe74d44f16f88e Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Tue, 6 Feb 2024 14:28:04 +0330 Subject: [PATCH 1/3] bank management cartable --- public/locales/fa/app.json | 20 +- .../dashboard/bank-management/Form/Update.jsx | 68 ++++++ .../bank-management/TableRowActions.jsx | 15 ++ .../dashboard/bank-management/index.jsx | 207 ++++++++++++++++++ src/core/data/apiRoutes.js | 4 + src/core/data/sidebarMenu.jsx | 11 + src/pages/dashboard/bank-management/index.jsx | 21 ++ 7 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 src/components/dashboard/bank-management/Form/Update.jsx create mode 100644 src/components/dashboard/bank-management/TableRowActions.jsx create mode 100644 src/components/dashboard/bank-management/index.jsx create mode 100644 src/pages/dashboard/bank-management/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 53699b0..2d14e59 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -48,6 +48,7 @@ "machinery-expert": "کارتابل کارشناسی", "passenger-boss": "کارتابل کارگروه", "transportation-assistant": "بررسی وام های تبصره 18", + "bank-management": "کارتابل نظارت بانک", "navgan-province-manager": "بررسی وام های تبصره 18", "refahi-province-manager": "مدیر کل استانی", "refahi-loan-management": "مدیریت وام", @@ -108,6 +109,7 @@ "dashboard_page": "داشبورد", "reports": "گزارشات", "passenger_boss_page": "کارتابل کارگروه", + "bank_management_page": "کارتابل نظارت بانک", "transportation_assistance": "بررسی وام های تبصره 18", "change_password": "تغییر رمز عبور", "province_manager_page": "بررسی وام های تبصره 18", @@ -413,6 +415,19 @@ "max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد", "excel_report": "گزارش اکسل" }, + "BankManagement": { + "name": "نام", + "id": "کد یکتا", + "national_serial_number": "سریال پشت کارت ملی", + "birthday": "تاریخ تولد", + "branch_name": "نام شعبه", + "bank_state": "وضعیت بانک", + "state_name": "وضعیت درخواست", + "national_id": "کد ملی", + "proposed_amount": "مبلغ پیشنهادی", + "bank_loan_amount": "مبلغ وام بانک", + "navgan_id": "کد ناوگان" + }, "UserManagement": { "name": "نام", "id": "کد یکتا", @@ -479,10 +494,12 @@ "description": "توضیحات خود را وارد نمائید", "optional": " (اختیاری)", "description_error": "وارد کردن توضیحات الزامی است!", - "choose_file" : "انتخاب فایل" + "choose_file": "انتخاب فایل" }, "UpdateDialog": { "update": "ویرایش", + "resend": "بروزرسانی اطلاعات", + "typography": "آیا از بروزرسانی این مورد اطمینان دارید ؟", "description": "توضیحات خود را وارد نمائید", "description_error": "وارد کردن توضیحات الزامی است!", "next-state-id": "وضعیت", @@ -510,6 +527,7 @@ "type_id": "نوع کاربر", "navgan_id": "کد ناوگان", "button-update": "ویرایش", + "button-resend": "بروزرسانی اطلاعات", "loading_permissions_list": "درحال دریافت لیست دسترسی ها" }, "UploadSystem": { diff --git a/src/components/dashboard/bank-management/Form/Update.jsx b/src/components/dashboard/bank-management/Form/Update.jsx new file mode 100644 index 0000000..659ba1b --- /dev/null +++ b/src/components/dashboard/bank-management/Form/Update.jsx @@ -0,0 +1,68 @@ +import {useTranslations} from "next-intl"; +import {useState} from "react"; +import { + Button, + Dialog, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Tooltip, + Typography +} from "@mui/material"; +import RefreshIcon from '@mui/icons-material/Refresh'; +import useRequest from "@/lib/app/hooks/useRequest"; +import useNotification from "@/lib/app/hooks/useNotification"; +import {RESEND_BANK_STATEMENT} from "@/core/data/apiRoutes"; + +const UpdateForm = ({rowId, mutate}) => { + const t = useTranslations(); + const [openConfirmDialog, setOpenConfirmDialog] = useState(false); + const [isSubmitting, setIsSubmitting] = useState(false) + const requestServer = useRequest({auth: true}) + const {update_notification} = useNotification() + const handleSubmit = () => { + setIsSubmitting(true) + requestServer(`${RESEND_BANK_STATEMENT}/${rowId}`, 'post').then((response) => { + setOpenConfirmDialog(false) + mutate() + update_notification() + }).catch(() => { + }).finally(() => { + setIsSubmitting(false) + }); + } + + return ( + <> + + { + setOpenConfirmDialog(true) + }} + > + + + + + {t("UpdateDialog.resend")} + + {t("UpdateDialog.typography")} + + + + + + + + ); +}; +export default UpdateForm; \ No newline at end of file diff --git a/src/components/dashboard/bank-management/TableRowActions.jsx b/src/components/dashboard/bank-management/TableRowActions.jsx new file mode 100644 index 0000000..18d5e31 --- /dev/null +++ b/src/components/dashboard/bank-management/TableRowActions.jsx @@ -0,0 +1,15 @@ +import {Box} from "@mui/material"; +import UpdateForm from "@/components/dashboard/bank-management/Form/Update"; + +const TableRow = ({row, mutate}) => { + return ( + + + + ); +}; + +export default TableRow; diff --git a/src/components/dashboard/bank-management/index.jsx b/src/components/dashboard/bank-management/index.jsx new file mode 100644 index 0000000..f89ee8a --- /dev/null +++ b/src/components/dashboard/bank-management/index.jsx @@ -0,0 +1,207 @@ +import {Box, Typography} from "@mui/material"; +import {useMemo} from "react"; +import {useTranslations} from "next-intl"; +import moment from "jalali-moment"; +import DataTable from "@/core/components/DataTable"; +import TableRowActions from "@/components/dashboard/bank-management/TableRowActions"; +import {GET_BANK_STATEMENT} from "@/core/data/apiRoutes"; + +function DashboardBankManagementComponent() { + const t = useTranslations(); + const columns = useMemo( + () => [ + { + accessorFn: (row) => row.id, + id: "id", + header: t("BankManagement.id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.navgan_id, + id: "navgan_id", + header: t("BankManagement.navgan_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.name, + id: "name", + header: t("BankManagement.name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.national_id, + id: "national_id", + header: t("BankManagement.national_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.national_serial_number, + id: "national_serial_number", + header: t("BankManagement.national_serial_number"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.birthday, + id: "birthday", + header: t("BankManagement.birthday"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {moment(renderedCellValue).locale("fa").format("yyyy/MM/DD")} + ), + }, + { + accessorFn: (row) => row.proposed_amount, + id: "proposed_amount", + header: t("BankManagement.proposed_amount"), + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.bank_loan_amount, + id: "bank_loan_amount", + header: t("BankManagement.bank_loan_amount"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.branch_name, + id: "branch_name", + header: t("BankManagement.branch_name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.bank_state, + id: "bank_state", + header: t("BankManagement.bank_state"), + enableColumnFilter: true, + datatype: "text", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains" + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + } + ], + [] + ); + return ( + + + + ); +} + +export default DashboardBankManagementComponent; diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 94c0982..d222a1a 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -243,6 +243,10 @@ export const ADD_ADMIN_SETTING = BASE_URL + "/dashboard/settings/store" export const UPDATE_ADMIN_SETTING = BASE_URL + "/dashboard/settings/update" export const DELETE_ADMIN_SETTING = BASE_URL + "/dashboard/settings/delete" +//bank statement +export const GET_BANK_STATEMENT = BASE_URL + "/dashboard/bank_referred_loans" +export const RESEND_BANK_STATEMENT = BASE_URL + "/dashboard/bank_referred_loans/resend" + // loan statistics export const GET_LOAN_STATISTICS = BASE_URL + "/dashboard/reports/navgan/statistics" diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index cc32838..031b701 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -16,6 +16,7 @@ import AccessibilityIcon from '@mui/icons-material/Accessibility'; import AssessmentIcon from '@mui/icons-material/Assessment'; import SecurityIcon from '@mui/icons-material/Security'; import SettingsIcon from '@mui/icons-material/Settings'; +import AccountBalanceIcon from '@mui/icons-material/AccountBalance'; const sidebarMenu = [ [ @@ -97,6 +98,16 @@ const sidebarMenu = [ selected: false, permissions: ["manage_province_affairs_navgan"], }, + { + key: "sidebar.bank-management", + secondary: "secondary.navgan-province-manager", + name: "management", + type: "page", + route: "/dashboard/bank-management", + icon: , + selected: false, + permissions: ["manage_bank_referred_loans"], + }, { key: "sidebar.navgan-loan-management", secondary: "secondary.navgan-loan-management", diff --git a/src/pages/dashboard/bank-management/index.jsx b/src/pages/dashboard/bank-management/index.jsx new file mode 100644 index 0000000..2a92155 --- /dev/null +++ b/src/pages/dashboard/bank-management/index.jsx @@ -0,0 +1,21 @@ +import {parse} from "next-useragent"; +import DashboardBankManagementComponent from "@/components/dashboard/bank-management"; + +export default function BankManagement() { + return ( + + ); +} + +export async function getServerSideProps({req, locale}) { + const {isBot} = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.bank_management_page", + isBot, + locale, + layout: {name: 'DashboardLayout', props: {permissions: ["manage_bank_referred_loans"]}} + }, + }; +} From 30753bb22729b381006968363ab391d3a68be452 Mon Sep 17 00:00:00 2001 From: Yasiu1376 Date: Wed, 7 Feb 2024 17:13:34 +0330 Subject: [PATCH 2/3] add reserve_loan --- public/locales/fa/app.json | 18 +- .../Form/ReserveForm/index.jsx | 75 ++++ .../machinary-office/TableRowActions.jsx | 5 + .../reserve-loan/Form/CanselReserve/index.jsx | 73 ++++ .../reserve-loan/TableRowActions.jsx | 15 + .../dashboard/reserve-loan/TableToolbar.jsx | 12 + .../dashboard/reserve-loan/index.jsx | 331 ++++++++++++++++++ src/core/data/apiRoutes.js | 9 + src/core/data/sidebarMenu.jsx | 11 + src/pages/dashboard/reserve-loan/index.jsx | 21 ++ 10 files changed, 568 insertions(+), 2 deletions(-) create mode 100644 src/components/dashboard/machinary-office/Form/ReserveForm/index.jsx create mode 100644 src/components/dashboard/reserve-loan/Form/CanselReserve/index.jsx create mode 100644 src/components/dashboard/reserve-loan/TableRowActions.jsx create mode 100644 src/components/dashboard/reserve-loan/TableToolbar.jsx create mode 100644 src/components/dashboard/reserve-loan/index.jsx create mode 100644 src/pages/dashboard/reserve-loan/index.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 53699b0..1b9c3c5 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -62,7 +62,8 @@ "role-management": "مدیریت نقش ها", "edit-profile": "ویرایش پروفایل", "loan-history": "کارتابل نظارت", - "loan-history-province": "کارتابل نظارت استانی" + "loan-history-province": "کارتابل نظارت استانی", + "reserve-loan" : "وام های رزرو" }, "secondary": { "passenger-office": "توزیع درخواست", @@ -115,6 +116,7 @@ "passenger_office_page": "اداره مسافر", "loan_management_page": "مدیریت وام", "machinary_office_page": "کارتابل کارشناسی", + "reserve_loans": "وام های رزرو", "development_assistant_page": "معاون توسعه", "inspector_expert_page": "بازدید کارشناس", "commercial_chief_page": "رئیس اداره بازرگانی", @@ -411,7 +413,19 @@ "upload_file_format": "فرمت قابل قبول : png,jpg,pdf", "print_report": "چاپ گزارش کارشناسی", "max_amount": "حداکثر مبلغ پیشنهادی {value} میلیون ریال می باشد", - "excel_report": "گزارش اکسل" + "excel_report": "گزارش اکسل", + "reserve-loan-title" : "رزرو وام", + "description-reserve-loan-first": "آیا از رزرو وام به کد یکتا", + "description-reserve-loan-second": "اطمینان دارید؟", + "button-reserve-cancel": "بستن", + "button-reserve-confirm": "رزرو" + }, + "ReserveLoan": { + "title": "لغو رزرو", + "description-loan-first": "آیا از لغو رزرو وام به کد یکتا", + "description-loan-second": "اطمینان دارید؟", + "button-cancel": "بستن", + "button-confirm": "لغو رزرو" }, "UserManagement": { "name": "نام", diff --git a/src/components/dashboard/machinary-office/Form/ReserveForm/index.jsx b/src/components/dashboard/machinary-office/Form/ReserveForm/index.jsx new file mode 100644 index 0000000..8056abc --- /dev/null +++ b/src/components/dashboard/machinary-office/Form/ReserveForm/index.jsx @@ -0,0 +1,75 @@ +import { + Button, + Dialog, + DialogActions, + DialogContent, + DialogTitle, + IconButton, + Tooltip, Typography +} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useState} from "react"; +import RepartitionIcon from '@mui/icons-material/Repartition'; +import useRequest from "@/lib/app/hooks/useRequest"; +import useNotification from "@/lib/app/hooks/useNotification"; +import {RESERVE_MACHINARY_LOAN} from "@/core/data/apiRoutes"; + +const ReserveForm = ({rowId, mutate}) => { + const t = useTranslations(); + const [openConfirmDialog, setOpenConfirmDialog] = useState(false); + const requestServer = useRequest({auth: true, notification: false}); + const [isSubmitting, setIsSubmitting] = useState(false); + const {update_notification} = useNotification() + + const handleSubmit = () => { + setIsSubmitting(true) + requestServer(`${RESERVE_MACHINARY_LOAN}/${rowId}`, 'post').then((response) => { + setOpenConfirmDialog(false) + mutate() + update_notification() + }).catch(() => { + }).finally(() => { + setIsSubmitting(false) + }); + } + + return ( + <> + + { + setOpenConfirmDialog(true) + }} + > + + + + + + {t("MachinaryOffice.reserve-loan-title")} + + + {t("MachinaryOffice.description-reserve-loan-first")} {rowId} {t("MachinaryOffice.description-reserve-loan-second")} + + + + + + + + ) + +} +export default ReserveForm; \ No newline at end of file diff --git a/src/components/dashboard/machinary-office/TableRowActions.jsx b/src/components/dashboard/machinary-office/TableRowActions.jsx index f50938e..0e111cb 100644 --- a/src/components/dashboard/machinary-office/TableRowActions.jsx +++ b/src/components/dashboard/machinary-office/TableRowActions.jsx @@ -1,6 +1,7 @@ import {Box} from "@mui/material"; import Confirm from "./Form/ConfirmForm"; import Reject from "./Form/RejectForm"; +import ReserveForm from "@/components/dashboard/machinary-office/Form/ReserveForm"; const TableRow = ({row, mutate}) => { return ( @@ -10,6 +11,10 @@ const TableRow = ({row, mutate}) => { vehicle_type={row.original.vehicle_type} mutate={mutate} /> + { + const t = useTranslations(); + const [openConfirmDialog, setOpenConfirmDialog] = useState(false); + const requestServer = useRequest({auth: true, notification: false}); + const [isSubmitting, setIsSubmitting] = useState(false) + + const handleSubmit = () => { + setIsSubmitting(true) + requestServer(`${CANSEL_RESERVE_MACHINARY_LOAN}/${rowId}`, 'get').then((response) => { + setOpenConfirmDialog(false) + mutate() + update_notification() + }).catch(() => { + }).finally(() => { + setIsSubmitting(false) + }); + } + + return ( + <> + + { + setOpenConfirmDialog(true) + }} + > + + + + + + {t("ReserveLoan.title")} + + + {t("ReserveLoan.description-loan-first")} {rowId} {t("ReserveLoan.description-loan-second")} + + + + + + + + ) + +} +export default CanselReserve; \ No newline at end of file diff --git a/src/components/dashboard/reserve-loan/TableRowActions.jsx b/src/components/dashboard/reserve-loan/TableRowActions.jsx new file mode 100644 index 0000000..147ff26 --- /dev/null +++ b/src/components/dashboard/reserve-loan/TableRowActions.jsx @@ -0,0 +1,15 @@ +import {Box} from "@mui/material"; +import CanselReserve from "./Form/CanselReserve"; + +const TableRow = ({row, mutate}) => { + return ( + + {/**/} + + ); +}; + +export default TableRow; diff --git a/src/components/dashboard/reserve-loan/TableToolbar.jsx b/src/components/dashboard/reserve-loan/TableToolbar.jsx new file mode 100644 index 0000000..bd5e9e8 --- /dev/null +++ b/src/components/dashboard/reserve-loan/TableToolbar.jsx @@ -0,0 +1,12 @@ +import {Stack} from "@mui/material"; + + +const TableToolbar = ({table}) => { + return ( + + + + ) +} + +export default TableToolbar \ No newline at end of file diff --git a/src/components/dashboard/reserve-loan/index.jsx b/src/components/dashboard/reserve-loan/index.jsx new file mode 100644 index 0000000..06095b5 --- /dev/null +++ b/src/components/dashboard/reserve-loan/index.jsx @@ -0,0 +1,331 @@ +import {Box, Stack, Typography} from "@mui/material"; +import {useMemo} from "react"; +import {GET_RESERVE_MACHINARY_LOAN} from "@/core/data/apiRoutes"; +import {useTranslations} from "next-intl"; +import TableRowActions from "./TableRowActions"; +import moment from "jalali-moment"; +import DataTable from "@/core/components/DataTable"; +import MuiDatePicker from "@/core/components/MuiDatePicker"; +import TableToolbar from "@/components/dashboard/reserve-loan/TableToolbar"; + +function DashboardReserveLoan() { + const t = useTranslations(); + const columns = useMemo( + () => [ + { + accessorFn: (row) => row.id, + id: "id", + header: t("MachinaryOffice.id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.score, + id: "score", + header: t("MachinaryOffice.score"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.is_legal_person, + id: "is_legal_person", + header: t("MachinaryOffice.is_legal_person"), + enableColumnFilter: false, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: ["equals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue === 1 ? `${t("MachinaryOffice.hoghoghi")}` : `${t("MachinaryOffice.haghighi")}`} + ), + }, + { + accessorFn: (row) => row.navgan_id, + id: "navgan_id", + header: t("MachinaryOffice.navgan_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.name, + id: "name", + header: t("MachinaryOffice.name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.national_id, + id: "national_id", + header: t("MachinaryOffice.national_id"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.shenase_meli, + id: "shenase_meli", + header: t("MachinaryOffice.shenase_meli"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.province_name, + id: "province_name", + header: t("MachinaryOffice.province_name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("MachinaryOffice.city_name"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => + moment(row.created_at).locale("fa").format("HH:mm | yyyy/MM/DD"), + id: "created_at", + header: t("MachinaryOffice.created_at"), + enableColumnFilter: true, + datatype: "date", + filterFn: "lessThan", + columnFilterModeOptions: ["lessThan", "greaterThan"], + Cell: ({renderedCellValue}) => { + return {renderedCellValue}; + }, + Header: ({column}) => <>{column.columnDef.header}, + Filter: ({column}) => { + return ( + + ); + }, + }, + { + accessorFn: (row) => row.phone_number, + id: "phone_number", + header: t("MachinaryOffice.phone_number"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.statement_count, + id: "statement_count", + header: t("MachinaryOffice.statement_count"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.navgan_capacity, + id: "navgan_capacity", + header: t("MachinaryOffice.navgan_capacity"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.manufacture_date, + id: "manufacture_date", + header: t("MachinaryOffice.manufacture_date"), + enableColumnFilter: true, + datatype: "numeric", + filterFn: "equals", + columnFilterModeOptions: [ + "equals", + "notEquals", + "contains", + "lessThan", + "greaterThan", + "between", + ], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.vehicle_type, + id: "vehicle_type", + header: t("MachinaryOffice.vehicle_type"), + enableColumnFilter: true, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("MachinaryOffice.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + + + {renderedCellValue.split('-')[3]} + + + {renderedCellValue.split('-')[2]} + {renderedCellValue.split('-')[1]} + {renderedCellValue.split('-')[0]} + + + ), + }, + { + accessorFn: (row) => row.state_name, + id: "state_id", + header: t("MachinaryOffice.state_name"), + enableColumnFilter: false, + datatype: "numeric", + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, + ], + [] + ); + return ( + + + + ); +} + +export default DashboardReserveLoan; diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 94c0982..beb73fd 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -73,6 +73,15 @@ export const REJECT_MACHINARY_OFFICE = BASE_URL + "/dashboard/machinery_expert/reject"; export const EXPORT_MACHINARY_OFFICE = BASE_URL + "/dashboard/machinery_expert/export"; + + +export const GET_RESERVE_MACHINARY_LOAN = + BASE_URL + "/dashboard/machinery_expert/reserved/show"; +export const RESERVE_MACHINARY_LOAN = + BASE_URL + "/dashboard/machinery_expert/reserve"; + +export const CANSEL_RESERVE_MACHINARY_LOAN = + BASE_URL + "/dashboard/machinery_expert/unreserved"; //machinary office //commercial chief diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index cc32838..28b5a6d 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -16,6 +16,7 @@ import AccessibilityIcon from '@mui/icons-material/Accessibility'; import AssessmentIcon from '@mui/icons-material/Assessment'; import SecurityIcon from '@mui/icons-material/Security'; import SettingsIcon from '@mui/icons-material/Settings'; +import RepartitionIcon from '@mui/icons-material/Repartition'; const sidebarMenu = [ [ @@ -66,6 +67,16 @@ const sidebarMenu = [ selected: false, permissions: ["manage_machinery_navgan"], }, + { + key: "sidebar.reserve-loan", + secondary: "secondary.navgan-province-manager", + name: "reserve_loan", + type: "page", + route: "/dashboard/reserve-loan", + icon: , + selected: false, + permissions: ["manage_machinery_navgan"], + }, { key: "sidebar.passenger-boss", secondary: "secondary.navgan-province-manager", diff --git a/src/pages/dashboard/reserve-loan/index.jsx b/src/pages/dashboard/reserve-loan/index.jsx new file mode 100644 index 0000000..9ab7f23 --- /dev/null +++ b/src/pages/dashboard/reserve-loan/index.jsx @@ -0,0 +1,21 @@ +import {parse} from "next-useragent"; +import DashboardReserveLoan from "@/components/dashboard/reserve-loan"; + +export default function PassengerOffice() { + return ( + + ); +} + +export async function getServerSideProps({req, locale}) { + const {isBot} = parse(req.headers["user-agent"]); + return { + props: { + messages: (await import(`&/locales/${locale}/app.json`)).default, + title: "Dashboard.reserve_loans", + isBot, + locale, + layout: {name: 'DashboardLayout', props: {permissions: ["manage_machinery_navgan"]}} + }, + }; +} From 3e652fa8a14454db502773275bb3100775b976dd Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sat, 10 Feb 2024 10:39:23 +0330 Subject: [PATCH 3/3] change version --- example.env.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.env.local b/example.env.local index 4474c59..cc19d23 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.30.1" +NEXT_PUBLIC_API_VERSION = "1.31.0" NEXT_PUBLIC_DEFAULT_LANGUAGE = "fa" NEXT_PUBLIC_DEFAULT_DIRECTION = "rtl"