From b7b0d4f66e179582ffba97a08219945c6a279bf1 Mon Sep 17 00:00:00 2001 From: AminGhasempoor Date: Sun, 7 Jan 2024 11:09:39 +0330 Subject: [PATCH] add plate and city columns and print excel and sorting based on score column --- public/locales/fa/app.json | 22 ++++-- .../loan-history/Buttons/printExcel.jsx | 67 ++++++++++++++++++ .../dashboard/loan-history/TableToolbar.jsx | 12 ++++ .../dashboard/loan-history/index.jsx | 68 +++++++++++++------ .../machinary-office/Buttons/printExcel.jsx | 1 - .../dashboard/machinary-office/index.jsx | 64 +++++++++++------ .../Buttons/printExcel.jsx | 67 ++++++++++++++++++ .../navgan-loan-management/TableToolbar.jsx | 12 ++++ .../navgan-loan-management/index.jsx | 68 +++++++++++++------ .../Buttons/printExcel.jsx | 1 - .../navgan-province-manager/index.jsx | 24 +++++++ .../passenger-boss/Buttons/printExcel.jsx | 1 - .../dashboard/passenger-boss/index.jsx | 64 +++++++++++------ .../Buttons/printExcel.jsx | 1 - .../transportation-assistance/index.jsx | 24 +++++++ src/core/data/apiRoutes.js | 2 + src/lib/app/hooks/useRequest.jsx | 12 +++- 17 files changed, 417 insertions(+), 93 deletions(-) create mode 100644 src/components/dashboard/loan-history/Buttons/printExcel.jsx create mode 100644 src/components/dashboard/loan-history/TableToolbar.jsx create mode 100644 src/components/dashboard/navgan-loan-management/Buttons/printExcel.jsx create mode 100644 src/components/dashboard/navgan-loan-management/TableToolbar.jsx diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 8388f4d..f4caa9c 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -196,6 +196,8 @@ "NavganProvinceManager": { "name": "نام", "id": "کد یکتا", + "city_name": "شهرستان", + "plate_number": "پلاک", "statement_count": "تعداد صورت وضعیت", "shenase_meli": "شناسه ملی", "is_legal_person": "نوع شخص", @@ -220,9 +222,11 @@ }, "PassengerBoss": { "name": "نام", + "city_name": "شهرستان", + "plate_number": "پلاک", "statement_count": "تعداد صورت وضعیت", "id": "کد یکتا", - "score": "رتبه", + "score": "اولویت", "navgan_capacity": "ظرفیت", "manufacture_date": "سال ساخت", "shenase_meli": "شناسه ملی", @@ -279,8 +283,11 @@ "NavganLoanManagement": { "name": "نام", "id": "کد یکتا", + "excel_report": "گزارش اکسل", + "city_name": "شهرستان", + "plate_number": "پلاک", "statement_count": "تعداد صورت وضعیت", - "score": "رتبه", + "score": "اولویت", "navgan_capacity": "ظرفیت", "manufacture_date": "سال ساخت", "national_id": "کد ملی", @@ -324,6 +331,8 @@ }, "TransportationAssistance": { "name": "نام", + "city_name": "شهرستان", + "plate_number": "پلاک", "id": "کد یکتا", "statement_count": "تعداد صورت وضعیت", "shenase_meli": "شناسه ملی", @@ -361,9 +370,11 @@ }, "MachinaryOffice": { "name": "نام", + "city_name": "شهرستان", + "plate_number": "پلاک", "statement_count": "تعداد صورت وضعیت", "id": "کد یکتا", - "score": "رتبه", + "score": "اولویت", "navgan_capacity": "ظرفیت", "manufacture_date": "سال ساخت", "shenase_meli": "شناسه ملی", @@ -614,9 +625,12 @@ }, "LoanHistory": { "id": "کد یکتا", + "excel_report": "گزارش اکسل", + "city_name": "شهرستان", + "plate_number": "پلاک", "statement_count": "تعداد صورت وضعیت", "name": "نام", - "score": "رتبه", + "score": "اولویت", "navgan_capacity": "ظرفیت", "manufacture_date": "سال ساخت", "shenase_meli": "شناسه ملی", diff --git a/src/components/dashboard/loan-history/Buttons/printExcel.jsx b/src/components/dashboard/loan-history/Buttons/printExcel.jsx new file mode 100644 index 0000000..e99111d --- /dev/null +++ b/src/components/dashboard/loan-history/Buttons/printExcel.jsx @@ -0,0 +1,67 @@ +import {Button, CircularProgress} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useMemo, useState} from "react"; +import useRequest from "@/lib/app/hooks/useRequest"; +import {EXPORT_LOAN_HISTORY} from "@/core/data/apiRoutes"; +import moment from "jalali-moment"; +import FileSaver from 'file-saver'; +import DescriptionIcon from '@mui/icons-material/Description'; + +const PrintExcel = ({table}) => { + const t = useTranslations(); + const [loading, setLoading] = useState(false) + const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}}) + const {columnFilters, columnFilterFns, sorting} = table.getState() + const columns = table.getAllColumns() + + const filterParams = useMemo(() => { + const params = new URLSearchParams(); + const filters = columnFilters.map((filter) => { + let datatype; + for (const i in columns) { + if (columns[i].id == filter.id) { + datatype = columns[i].columnDef.datatype; + } + } + return { + ...filter, fn: columnFilterFns[filter.id], datatype: datatype, + }; + }); + params.set("start", '0'); + params.set("filters", JSON.stringify(filters ?? [])); + params.set("sorting", JSON.stringify(sorting ?? [])); + return params; + }, [columnFilters, columnFilterFns, sorting, columns,]); + + + const clickHandler = () => { + setLoading(true) + requestServer(`${EXPORT_LOAN_HISTORY}?${filterParams}`, 'get', { + auth: true, + requestOptions: {responseType: 'blob'} + }).then((response) => { + const filename = `گزارش وام ها تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; + FileSaver.saveAs(response.data, filename); + }).catch(() => { + }).finally(() => { + setLoading(false) + }) + } + + + return ( + + ) +} + +export default PrintExcel \ No newline at end of file diff --git a/src/components/dashboard/loan-history/TableToolbar.jsx b/src/components/dashboard/loan-history/TableToolbar.jsx new file mode 100644 index 0000000..a79df69 --- /dev/null +++ b/src/components/dashboard/loan-history/TableToolbar.jsx @@ -0,0 +1,12 @@ +import {Stack} from "@mui/material"; +import PrintExcel from "@/components/dashboard/loan-history/Buttons/printExcel"; + +const TableToolbar = ({table}) => { + return ( + + + + ) +} + +export default TableToolbar \ 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 40e6a26..0d8bee8 100644 --- a/src/components/dashboard/loan-history/index.jsx +++ b/src/components/dashboard/loan-history/index.jsx @@ -6,6 +6,7 @@ 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/loan-history/TableToolbar"; function DashboardLoanHistoryComponent() { const t = useTranslations(); @@ -30,6 +31,25 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.score, + id: "score", + header: t("LoanHistory.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", @@ -124,6 +144,18 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("LoanHistory.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"), @@ -176,25 +208,6 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, - { - accessorFn: (row) => row.score, - id: "score", - header: t("LoanHistory.score"), - enableColumnFilter: true, - datatype: "numeric", - filterFn: "equals", - columnFilterModeOptions: [ - "equals", - "notEquals", - "contains", - "lessThan", - "greaterThan", - "between", - ], - Cell: ({renderedCellValue}) => ( - {renderedCellValue} - ), - }, { accessorFn: (row) => row.navgan_capacity, id: "navgan_capacity", @@ -245,6 +258,18 @@ function DashboardLoanHistoryComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("LoanHistory.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", @@ -330,10 +355,11 @@ function DashboardLoanHistoryComponent() { tableUrl={GET_LOAN_HISTORY} columns={columns} selectableRow={false} - enableCustomToolbar={false} + enableCustomToolbar={true} + CustomToolbar={TableToolbar} enableLastUpdate={true} sorting={[{ - id: 'id', desc: false + id: 'score', desc: false }]} enablePinning={true} enableDensityToggle={false} diff --git a/src/components/dashboard/machinary-office/Buttons/printExcel.jsx b/src/components/dashboard/machinary-office/Buttons/printExcel.jsx index cba05a0..221e6b3 100644 --- a/src/components/dashboard/machinary-office/Buttons/printExcel.jsx +++ b/src/components/dashboard/machinary-office/Buttons/printExcel.jsx @@ -38,7 +38,6 @@ const PrintExcel = ({table}) => { setLoading(true) requestServer(`${EXPORT_MACHINARY_OFFICE}?${filterParams}`, 'get', { auth: true, - notification: false, requestOptions: {responseType: 'blob'} }).then((response) => { const filename = `گزارش ماشین آلات تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; diff --git a/src/components/dashboard/machinary-office/index.jsx b/src/components/dashboard/machinary-office/index.jsx index 72c6e98..256ca87 100644 --- a/src/components/dashboard/machinary-office/index.jsx +++ b/src/components/dashboard/machinary-office/index.jsx @@ -31,6 +31,25 @@ function DashboardMachinaryOfficeComponent() { {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", @@ -125,6 +144,18 @@ function DashboardMachinaryOfficeComponent() { {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"), @@ -177,25 +208,6 @@ function DashboardMachinaryOfficeComponent() { {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.navgan_capacity, id: "navgan_capacity", @@ -246,6 +258,18 @@ function DashboardMachinaryOfficeComponent() { {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} + ), + }, { accessorFn: (row) => row.state_name, id: "state_id", @@ -269,7 +293,7 @@ function DashboardMachinaryOfficeComponent() { CustomToolbar={TableToolbar} enableLastUpdate={true} sorting={[{ - id: 'id', desc: false + id: 'score', desc: false }]} enablePinning={true} enableDensityToggle={false} diff --git a/src/components/dashboard/navgan-loan-management/Buttons/printExcel.jsx b/src/components/dashboard/navgan-loan-management/Buttons/printExcel.jsx new file mode 100644 index 0000000..45183f7 --- /dev/null +++ b/src/components/dashboard/navgan-loan-management/Buttons/printExcel.jsx @@ -0,0 +1,67 @@ +import {Button, CircularProgress} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useMemo, useState} from "react"; +import useRequest from "@/lib/app/hooks/useRequest"; +import {EXPORT_LOAN_MANAGEMENT_HISTORY} from "@/core/data/apiRoutes"; +import moment from "jalali-moment"; +import FileSaver from 'file-saver'; +import DescriptionIcon from '@mui/icons-material/Description'; + +const PrintExcel = ({table}) => { + const t = useTranslations(); + const [loading, setLoading] = useState(false) + const requestServer = useRequest({auth: true, pending: false, success: {notification: {show: false}}}) + const {columnFilters, columnFilterFns, sorting} = table.getState() + const columns = table.getAllColumns() + + const filterParams = useMemo(() => { + const params = new URLSearchParams(); + const filters = columnFilters.map((filter) => { + let datatype; + for (const i in columns) { + if (columns[i].id == filter.id) { + datatype = columns[i].columnDef.datatype; + } + } + return { + ...filter, fn: columnFilterFns[filter.id], datatype: datatype, + }; + }); + params.set("start", '0'); + params.set("filters", JSON.stringify(filters ?? [])); + params.set("sorting", JSON.stringify(sorting ?? [])); + return params; + }, [columnFilters, columnFilterFns, sorting, columns,]); + + + const clickHandler = () => { + setLoading(true) + requestServer(`${EXPORT_LOAN_MANAGEMENT_HISTORY}?${filterParams}`, 'get', { + auth: true, + requestOptions: {responseType: 'blob'} + }).then((response) => { + const filename = `گزارش مدیریت وام ها تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; + FileSaver.saveAs(response.data, filename); + }).catch(() => { + }).finally(() => { + setLoading(false) + }) + } + + + return ( + + ) +} + +export default PrintExcel \ No newline at end of file diff --git a/src/components/dashboard/navgan-loan-management/TableToolbar.jsx b/src/components/dashboard/navgan-loan-management/TableToolbar.jsx new file mode 100644 index 0000000..ea08f96 --- /dev/null +++ b/src/components/dashboard/navgan-loan-management/TableToolbar.jsx @@ -0,0 +1,12 @@ +import {Stack} from "@mui/material"; +import PrintExcel from "@/components/dashboard/navgan-loan-management/Buttons/printExcel"; + +const TableToolbar = ({table}) => { + return ( + + + + ) +} + +export default TableToolbar \ No newline at end of file diff --git a/src/components/dashboard/navgan-loan-management/index.jsx b/src/components/dashboard/navgan-loan-management/index.jsx index 465873c..d049e01 100644 --- a/src/components/dashboard/navgan-loan-management/index.jsx +++ b/src/components/dashboard/navgan-loan-management/index.jsx @@ -6,6 +6,7 @@ import TableRowActions from "./TableRowActions"; import DataTable from "@/core/components/DataTable"; import moment from "jalali-moment"; import MuiDatePicker from "@/core/components/MuiDatePicker"; +import TableToolbar from "@/components/dashboard/navgan-loan-management/TableToolbar"; function DashboardNavganLoanManagementComponent() { const t = useTranslations(); @@ -31,6 +32,25 @@ function DashboardNavganLoanManagementComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.score, + id: "score", + header: t("NavganLoanManagement.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", @@ -125,6 +145,18 @@ function DashboardNavganLoanManagementComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("NavganLoanManagement.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"), @@ -177,25 +209,6 @@ function DashboardNavganLoanManagementComponent() { {renderedCellValue} ), }, - { - accessorFn: (row) => row.score, - id: "score", - header: t("NavganLoanManagement.score"), - enableColumnFilter: true, - datatype: "numeric", - filterFn: "equals", - columnFilterModeOptions: [ - "equals", - "notEquals", - "contains", - "lessThan", - "greaterThan", - "between", - ], - Cell: ({renderedCellValue}) => ( - {renderedCellValue} - ), - }, { accessorFn: (row) => row.navgan_capacity, id: "navgan_capacity", @@ -246,6 +259,18 @@ function DashboardNavganLoanManagementComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("NavganLoanManagement.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", @@ -332,10 +357,11 @@ function DashboardNavganLoanManagementComponent() { tableUrl={GET_LOAN_MANAGEMENT_NAVGAN} columns={columns} selectableRow={false} - enableCustomToolbar={false} + enableCustomToolbar={true} + CustomToolbar={TableToolbar} enableLastUpdate={true} sorting={[{ - id: 'id', desc: false + id: 'score', desc: false }]} enablePinning={true} enableDensityToggle={false} diff --git a/src/components/dashboard/navgan-province-manager/Buttons/printExcel.jsx b/src/components/dashboard/navgan-province-manager/Buttons/printExcel.jsx index 6c0aac3..e35c61d 100644 --- a/src/components/dashboard/navgan-province-manager/Buttons/printExcel.jsx +++ b/src/components/dashboard/navgan-province-manager/Buttons/printExcel.jsx @@ -38,7 +38,6 @@ const PrintExcel = ({table}) => { setLoading(true) requestServer(`${EXPORT_NAVGAN_PROVINCE_MANAGER}?${filterParams}`, 'get', { auth: true, - notification: false, requestOptions: {responseType: 'blob'} }).then((response) => { const filename = `گزارش مدیر کل استانی تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; diff --git a/src/components/dashboard/navgan-province-manager/index.jsx b/src/components/dashboard/navgan-province-manager/index.jsx index 2b835f0..fc8fcef 100644 --- a/src/components/dashboard/navgan-province-manager/index.jsx +++ b/src/components/dashboard/navgan-province-manager/index.jsx @@ -126,6 +126,18 @@ function DashboardNavganProvinceManagerComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("NavganProvinceManager.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"), @@ -190,6 +202,18 @@ function DashboardNavganProvinceManagerComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("NavganProvinceManager.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", diff --git a/src/components/dashboard/passenger-boss/Buttons/printExcel.jsx b/src/components/dashboard/passenger-boss/Buttons/printExcel.jsx index d04f129..b8e7e45 100644 --- a/src/components/dashboard/passenger-boss/Buttons/printExcel.jsx +++ b/src/components/dashboard/passenger-boss/Buttons/printExcel.jsx @@ -38,7 +38,6 @@ const PrintExcel = ({table}) => { setLoading(true) requestServer(`${EXPORT_PASSENGER_BOSS}?${filterParams}`, 'get', { auth: true, - notification: false, requestOptions: {responseType: 'blob'} }).then((response) => { const filename = `گزارش کارگروه استانی تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; diff --git a/src/components/dashboard/passenger-boss/index.jsx b/src/components/dashboard/passenger-boss/index.jsx index 2de0e63..0da7cc0 100644 --- a/src/components/dashboard/passenger-boss/index.jsx +++ b/src/components/dashboard/passenger-boss/index.jsx @@ -32,6 +32,25 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.score, + id: "score", + header: t("PassengerBoss.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", @@ -126,6 +145,18 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("PassengerBoss.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"), @@ -178,25 +209,6 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, - { - accessorFn: (row) => row.score, - id: "score", - header: t("PassengerBoss.score"), - enableColumnFilter: true, - datatype: "numeric", - filterFn: "equals", - columnFilterModeOptions: [ - "equals", - "notEquals", - "contains", - "lessThan", - "greaterThan", - "between", - ], - Cell: ({renderedCellValue}) => ( - {renderedCellValue} - ), - }, { accessorFn: (row) => row.navgan_capacity, id: "navgan_capacity", @@ -247,6 +259,18 @@ function DashboardPassengerOfficeComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("PassengerBoss.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", @@ -317,7 +341,7 @@ function DashboardPassengerOfficeComponent() { CustomToolbar={TableToolbar} enableLastUpdate={true} sorting={[{ - id: 'id', desc: false + id: 'score', desc: false }]} enablePinning={true} enableDensityToggle={false} diff --git a/src/components/dashboard/transportation-assistance/Buttons/printExcel.jsx b/src/components/dashboard/transportation-assistance/Buttons/printExcel.jsx index b74eecc..bfce213 100644 --- a/src/components/dashboard/transportation-assistance/Buttons/printExcel.jsx +++ b/src/components/dashboard/transportation-assistance/Buttons/printExcel.jsx @@ -38,7 +38,6 @@ const PrintExcel = ({table}) => { setLoading(true) requestServer(`${EXPORT_TRANSPORTATION_ASSISTANCE}?${filterParams}`, 'get', { auth: true, - notification: false, requestOptions: {responseType: 'blob'} }).then((response) => { const filename = `گزارش معاونت حمل و نقل تاریخ_${moment().format('jYYYY_jMM_jDD')}.xlsx`; diff --git a/src/components/dashboard/transportation-assistance/index.jsx b/src/components/dashboard/transportation-assistance/index.jsx index ad7acbd..46ad2b6 100644 --- a/src/components/dashboard/transportation-assistance/index.jsx +++ b/src/components/dashboard/transportation-assistance/index.jsx @@ -126,6 +126,18 @@ function DashboardTransportationAssistanceComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.city_name, + id: "city_name", + header: t("TransportationAssistance.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"), @@ -190,6 +202,18 @@ function DashboardTransportationAssistanceComponent() { {renderedCellValue} ), }, + { + accessorFn: (row) => row.plate_number, + id: "plate_number", + header: t("TransportationAssistance.plate_number"), + enableColumnFilter: false, + datatype: "text", + filterFn: "contains", + columnFilterModeOptions: ["contains", "equals", "notEquals"], + Cell: ({renderedCellValue}) => ( + {renderedCellValue} + ), + }, { accessorFn: (row) => row.proposed_amount, id: "proposed_amount", diff --git a/src/core/data/apiRoutes.js b/src/core/data/apiRoutes.js index 2de4dd8..e96af16 100644 --- a/src/core/data/apiRoutes.js +++ b/src/core/data/apiRoutes.js @@ -171,6 +171,7 @@ export const UPDATE_LOAN_MANAGEMENT_NAVGAN = BASE_URL + "/dashboard/navgan_loans/update" export const GET_LOAN_STATE_NAVGAN = BASE_URL + "/dashboard/loan_states/navgan" +export const EXPORT_LOAN_MANAGEMENT_HISTORY = BASE_URL + "/dashboard/navgan_loans/export" //loan management navgan //expert management @@ -229,3 +230,4 @@ export const GET_LOAN_DISTRIBUTION = BASE_URL + "/dashboard/reports/navgan/loan_ //loan history export const GET_LOAN_HISTORY = BASE_URL + "/dashboard/navgan_loans" export const GET_HISTORY_DETAIL = BASE_URL + "/dashboard/navgan_loans" +export const EXPORT_LOAN_HISTORY = BASE_URL + "/dashboard/navgan_loans/export" diff --git a/src/lib/app/hooks/useRequest.jsx b/src/lib/app/hooks/useRequest.jsx index 4c3be1d..9421c61 100644 --- a/src/lib/app/hooks/useRequest.jsx +++ b/src/lib/app/hooks/useRequest.jsx @@ -8,13 +8,19 @@ import Notifications from "@/core/components/notifications"; import useToast from "@/lib/app/hooks/useToast"; const defaultOptions = { - auth: false, data: {}, requestOptions: { + auth: false, + data: {}, + requestOptions: { headers: {} - }, notification: true, pending: true, success: { + }, + notification: true, + pending: true, + success: { notification: { show: true, }, - }, failed: { + }, + failed: { notification: { show: true, },