From a7c5ef72ddedd8ecc8cc210b55e65acaf65b0027 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Tue, 30 Jul 2024 10:16:07 +0330 Subject: [PATCH 1/2] remove addition columns --- .../dashboard/inquiryPrivacyFencing/index.jsx | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/src/components/dashboard/inquiryPrivacyFencing/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/index.jsx index 1de7b31..b8a55b5 100644 --- a/src/components/dashboard/inquiryPrivacyFencing/index.jsx +++ b/src/components/dashboard/inquiryPrivacyFencing/index.jsx @@ -8,76 +8,6 @@ import { GET_INQUIRY_PRIVACY_FENCING_ROUTE } from "@/core/utils/routes"; const InquiryPrivacyFencingPage = () => { const columns = useMemo( () => [ - { - accessorKey: "fullname", - header: "نام کامل", - id: "fullname", - columns: [ - { - accessorKey: "first_name", - header: "اسم", - id: "first_name", - columns: [ - { - accessorKey: "part1", - header: "فامیل", - id: "part1", - enableColumnFilter: false, - datatype: "text", - columns: [ - { - accessorKey: "part1_1", - header: "part1_1", - id: "part1_1", - enableColumnFilter: false, - datatype: "text", - }, - { - accessorKey: "part1_2", - header: "part1_2", - id: "part1_2", - enableColumnFilter: false, - datatype: "text", - }, - ], - }, - { - accessorKey: "part2", - header: "part2", - id: "part2", - enableColumnFilter: false, - datatype: "text", - }, - ], - }, - { - accessorKey: "last_name", - header: "last_name", - id: "last_name", - enableColumnFilter: false, - datatype: "text", - }, - ], - }, - { - accessorKey: "something", - header: "something", - id: "something", - columns: [ - { - accessorKey: "something1", - header: "something1", - id: "something1", - }, - { - accessorKey: "something2", - header: "something2", - id: "something2", - enableColumnFilter: false, - datatype: "text", - }, - ], - }, { accessorKey: "dabirkhaneh_number", header: "شماره دبیرخانه درخواست", @@ -85,7 +15,6 @@ const InquiryPrivacyFencingPage = () => { enableColumnFilter: false, datatype: "text", filterFn: "notEquals", - columnFilterModeOptions: ["equals", "notEquals", "contains"], }, { accessorKey: "marjae_pasokh", @@ -94,7 +23,6 @@ const InquiryPrivacyFencingPage = () => { enableColumnFilter: false, datatype: "text", filterFn: "equals", - columnFilterModeOptions: ["equals", "notEquals", "contains", "lessThan", "greaterThan", "fuzzy"], }, { accessorKey: "motaghazi_is_legal", @@ -269,7 +197,6 @@ const InquiryPrivacyFencingPage = () => { header: "ماه", id: "max_month", enableColumnFilter: false, - columnFilterModeOptions: ["equals", "notEquals", "contains"], }, { accessorKey: "max_day", From fd7821473f6e298ee6060052524f7c07fc89a723 Mon Sep 17 00:00:00 2001 From: Mohammad Jalali Date: Tue, 30 Jul 2024 11:26:25 +0330 Subject: [PATCH 2/2] complete header of table and pages with a new component and styling in responsive design of them --- .../Actions/Create/index.jsx | 24 ++++++++-- .../dashboard/inquiryPrivacyFencing/index.jsx | 26 ++++++---- src/core/components/DataTable/Main.js | 13 ++++- src/core/components/DataTable/table/Paper.js | 48 ++++++++++--------- .../DataTable/toolbar/TopToolbar.js | 32 ++++++++++--- src/core/components/PageTitle.jsx | 12 +++++ 6 files changed, 110 insertions(+), 45 deletions(-) create mode 100644 src/core/components/PageTitle.jsx diff --git a/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx b/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx index db8c5c0..de81370 100644 --- a/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx +++ b/src/components/dashboard/inquiryPrivacyFencing/Actions/Create/index.jsx @@ -1,12 +1,15 @@ "use client"; import DialogTransition from "@/core/components/DialogTransition"; import { AddCircle, Close } from "@mui/icons-material"; -import { Button, Dialog, DialogTitle, IconButton } from "@mui/material"; +import { Button, Dialog, DialogTitle, IconButton, useMediaQuery } from "@mui/material"; import CreateOrUpdateForm from "../../Forms/CreateOrUpdate"; import { SET_INQUIRE_PRIVACY_FENCING } from "@/core/utils/routes"; import { useState } from "react"; +import { useTheme } from "@emotion/react"; const InquiryPrivacyFencingCreate = ({ mutate }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("sm")); const [open, setOpen] = useState(false); const handleOpen = () => { @@ -19,11 +22,22 @@ const InquiryPrivacyFencingCreate = ({ mutate }) => { return ( <> - + {isMobile ? ( + + + + ) : ( + + )} - + ایجاد پاسخ به استعلام { const columns = useMemo( @@ -233,15 +235,21 @@ const InquiryPrivacyFencingPage = () => { ); return ( - + <> + + + + + ); }; export default InquiryPrivacyFencingPage; diff --git a/src/core/components/DataTable/Main.js b/src/core/components/DataTable/Main.js index 78bf9a8..1f51695 100644 --- a/src/core/components/DataTable/Main.js +++ b/src/core/components/DataTable/Main.js @@ -11,7 +11,17 @@ import { flattenObjectOfObjects } from "@/core/utils/flattenObjectOfObjects"; const DataTable_Main = (props) => { const request = useRequest(); const { filterData, sortData, setSortData, hideData } = useDataTable(); - const { need_filter, table_url, user_id, page_name, table_name, columns, initialStateProps, TableToolbar } = props; + const { + need_filter, + table_url, + user_id, + page_name, + table_name, + columns, + initialStateProps, + TableToolbar, + table_title, + } = props; const flatColumns = flattenArrayOfObjects(columns, "columns"); const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const flattenHideData = flattenObjectOfObjects(hideData); @@ -109,6 +119,7 @@ const DataTable_Main = (props) => { return ( { + table, + table_name, + columns, + user_id, + page_name, + mutate, + need_filter, + table_url, + table_title, + ...rest + }) => { const { getState, options: { @@ -49,19 +50,19 @@ const DataTable_Paper = ({ style={{ ...(isFullScreen ? { - bottom: 0, - height: "100dvh", - left: 0, - margin: 0, - maxHeight: "100dvh", - maxWidth: "100dvw", - padding: 0, - position: "fixed", - right: 0, - top: 0, - width: "100dvw", - zIndex: 999, - } + bottom: 0, + height: "100dvh", + left: 0, + margin: 0, + maxHeight: "100dvh", + maxWidth: "100dvw", + padding: 0, + position: "fixed", + right: 0, + top: 0, + width: "100dvw", + zIndex: 999, + } : {}), ...paperProps?.style, }} @@ -84,6 +85,7 @@ const DataTable_Paper = ({ user_id={user_id} page_name={page_name} table_name={table_name} + table_title={table_title} /> ))} diff --git a/src/core/components/DataTable/toolbar/TopToolbar.js b/src/core/components/DataTable/toolbar/TopToolbar.js index e5dc946..fc21ae7 100644 --- a/src/core/components/DataTable/toolbar/TopToolbar.js +++ b/src/core/components/DataTable/toolbar/TopToolbar.js @@ -1,5 +1,5 @@ import { getCommonToolbarStyles, parseFromValuesOrFunc } from "@/core/utils/utils"; -import { Box, useMediaQuery } from "@mui/material"; +import { Box, Typography, useMediaQuery } from "@mui/material"; import DataTable_LinearProgressBar from "./LinearProgressBar"; import DataTable_TablePagination from "./TablePagination"; import FilterColumn from "@/core/components/DataTable/filter"; @@ -7,7 +7,17 @@ import UpdateTable from "@/core/components/DataTable/update/UpdateTable"; import ResetStorage from "@/core/components/DataTable/reset/ResetStorage"; import HideColumn from "@/core/components/DataTable/hide"; -const DataTable_TopToolbar = ({ mutate, need_filter, table, columns, table_url, user_id, page_name, table_name }) => { +const DataTable_TopToolbar = ({ + mutate, + need_filter, + table, + columns, + table_url, + user_id, + page_name, + table_name, + table_title, + }) => { const { getState, options: { @@ -47,11 +57,12 @@ const DataTable_TopToolbar = ({ mutate, need_filter, table, columns, table_url, > - {renderTopToolbarCustomActions?.({ table }) ?? } + {renderTopToolbarCustomActions?.({ table })} + {table_title || ""} {enableToolbarInternalActions && ( { + return ( + {title}} /> + ); +}; +export default PageTitle; +