formatted
This commit is contained in:
@@ -1,22 +1,10 @@
|
||||
import {Button} from "@mui/material";
|
||||
import { Button } from "@mui/material";
|
||||
|
||||
const Toolbar = ({columns}) => {
|
||||
const Toolbar = ({ columns }) => {
|
||||
return (
|
||||
<>
|
||||
<Button>add something</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default Toolbar
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
};
|
||||
export default Toolbar;
|
||||
|
||||
@@ -1,149 +1,128 @@
|
||||
'use client'
|
||||
"use client";
|
||||
import DataTable from "@/core/components/DataTable";
|
||||
import {useMemo} from "react";
|
||||
import { useMemo } from "react";
|
||||
|
||||
function HomeComponent() {
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
accessorKey: 'fullname',
|
||||
header: 'نام کامل',
|
||||
accessorKey: "fullname",
|
||||
header: "نام کامل",
|
||||
id: "fullname",
|
||||
columns: [
|
||||
{
|
||||
accessorKey: 'name.firstName',
|
||||
header: 'نام',
|
||||
accessorKey: "name.firstName",
|
||||
header: "نام",
|
||||
id: "firstName",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
enableClickToCopy: true,
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains"
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
},
|
||||
{
|
||||
accessorKey: 'name.lastName',
|
||||
header: 'نام خانوادگی',
|
||||
accessorKey: "name.lastName",
|
||||
header: "نام خانوادگی",
|
||||
id: "lastName",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains"
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
accessorKey: 'address',
|
||||
header: 'آدرس',
|
||||
accessorKey: "address",
|
||||
header: "آدرس",
|
||||
id: "address",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "notEquals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains"
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
},
|
||||
{
|
||||
accessorKey: 'city',
|
||||
header: 'شهر',
|
||||
accessorKey: "city",
|
||||
header: "شهر",
|
||||
id: "city",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"fuzzy"
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains", "lessThan", "greaterThan", "fuzzy"],
|
||||
},
|
||||
{
|
||||
accessorKey: 'state',
|
||||
header: 'وضعیت',
|
||||
accessorKey: "state",
|
||||
header: "وضعیت",
|
||||
id: "state",
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains"
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals", "contains"],
|
||||
},
|
||||
{
|
||||
accessorKey: 'price',
|
||||
header: 'محدوده',
|
||||
accessorKey: "price",
|
||||
header: "محدوده",
|
||||
id: "price",
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
],
|
||||
columnFilterModeOptions: ["equals", "notEquals"],
|
||||
},
|
||||
{
|
||||
accessorKey: 'created_at',
|
||||
header: 'تاریخ ساخت',
|
||||
accessorKey: "created_at",
|
||||
header: "تاریخ ساخت",
|
||||
id: "created_at",
|
||||
enableColumnFilter: true,
|
||||
datatype: "date",
|
||||
filterFn: "between",
|
||||
},
|
||||
{
|
||||
accessorKey: 'updated_at',
|
||||
header: 'تاریخ بروزرسانی',
|
||||
accessorKey: "updated_at",
|
||||
header: "تاریخ بروزرسانی",
|
||||
id: "updated_at",
|
||||
enableColumnFilter: true,
|
||||
datatype: "date",
|
||||
filterFn: "equals",
|
||||
},
|
||||
{
|
||||
accessorKey: 'company',
|
||||
header: 'نام شرکت',
|
||||
accessorKey: "company",
|
||||
header: "نام شرکت",
|
||||
id: "company",
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnSelectOption: [
|
||||
{value: 1, label: "وایتل"},
|
||||
{value: 2, label: "اسنپ"},
|
||||
{value: 3, label: "تپسی"}
|
||||
{ value: 1, label: "وایتل" },
|
||||
{ value: 2, label: "اسنپ" },
|
||||
{ value: 3, label: "تپسی" },
|
||||
],
|
||||
},
|
||||
{
|
||||
accessorKey: 'area',
|
||||
header: 'منطقه',
|
||||
accessorKey: "area",
|
||||
header: "منطقه",
|
||||
id: "area",
|
||||
enableColumnFilter: true,
|
||||
datatype: "array",
|
||||
filterFn: "equals",
|
||||
columnSelectOption: [
|
||||
{value: 1, label: "وایتل"},
|
||||
{value: 2, label: "اسنپ"},
|
||||
{value: 3, label: "تپسی"}
|
||||
{ value: 1, label: "وایتل" },
|
||||
{ value: 2, label: "اسنپ" },
|
||||
{ value: 3, label: "تپسی" },
|
||||
],
|
||||
},
|
||||
],
|
||||
[],
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DataTable columns={columns} table_url={"api"} user_id={0} page_name={'testPage'} table_name={'testTable'}/>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
table_url={"api"}
|
||||
user_id={0}
|
||||
page_name={"testPage"}
|
||||
table_name={"testTable"}
|
||||
/>
|
||||
</>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,38 +3,25 @@ import { Stack, Typography } from "@mui/material";
|
||||
import Image from "next/image";
|
||||
|
||||
const HeaderBottom = () => {
|
||||
return (
|
||||
<Stack
|
||||
sx={{
|
||||
px: 2,
|
||||
py: 1,
|
||||
background: (theme) => theme.palette.primary2.main,
|
||||
}}
|
||||
spacing={4}
|
||||
alignItems={"center"}
|
||||
direction={"row"}
|
||||
>
|
||||
<Image
|
||||
alt=""
|
||||
priority
|
||||
src={"/images/rmsLogo.svg"}
|
||||
width={65}
|
||||
height={71}
|
||||
/>
|
||||
<Stack alignItems={"center"} spacing={1}>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{ color: (theme) => theme.palette.primary2.contrastText }}
|
||||
return (
|
||||
<Stack
|
||||
sx={{
|
||||
px: 2,
|
||||
py: 1,
|
||||
background: (theme) => theme.palette.primary2.main,
|
||||
}}
|
||||
spacing={4}
|
||||
alignItems={"center"}
|
||||
direction={"row"}
|
||||
>
|
||||
سامانه جامع راهداری
|
||||
</Typography>
|
||||
<Typography
|
||||
sx={{ color: (theme) => theme.palette.primary2.contrastText }}
|
||||
>
|
||||
rms.rmto.ir
|
||||
</Typography>
|
||||
</Stack>
|
||||
</Stack>
|
||||
);
|
||||
<Image alt="" priority src={"/images/rmsLogo.svg"} width={65} height={71} />
|
||||
<Stack alignItems={"center"} spacing={1}>
|
||||
<Typography variant="h5" sx={{ color: (theme) => theme.palette.primary2.contrastText }}>
|
||||
سامانه جامع راهداری
|
||||
</Typography>
|
||||
<Typography sx={{ color: (theme) => theme.palette.primary2.contrastText }}>rms.rmto.ir</Typography>
|
||||
</Stack>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default HeaderBottom;
|
||||
|
||||
@@ -2,16 +2,10 @@ import { Stack } from "@mui/material";
|
||||
import Image from "next/image";
|
||||
|
||||
const HeaderTop = () => {
|
||||
return (
|
||||
<Stack sx={{ p: 2 }}>
|
||||
<Image
|
||||
alt=""
|
||||
priority
|
||||
src={"/images/headerLogo.png"}
|
||||
width={190}
|
||||
height={44}
|
||||
/>
|
||||
</Stack>
|
||||
);
|
||||
return (
|
||||
<Stack sx={{ p: 2 }}>
|
||||
<Image alt="" priority src={"/images/headerLogo.png"} width={190} height={44} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default HeaderTop;
|
||||
|
||||
@@ -3,11 +3,11 @@ import HeaderTop from "./HaederTop";
|
||||
import HeaderBottom from "./HaederBottom";
|
||||
|
||||
const HeaderWithLogo = () => {
|
||||
return (
|
||||
<Stack>
|
||||
<HeaderTop />
|
||||
<HeaderBottom />
|
||||
</Stack>
|
||||
);
|
||||
return (
|
||||
<Stack>
|
||||
<HeaderTop />
|
||||
<HeaderBottom />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
export default HeaderWithLogo;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const HeaderMenu = () => {
|
||||
return <>منو</>;
|
||||
return <>منو</>;
|
||||
};
|
||||
export default HeaderMenu;
|
||||
|
||||
@@ -9,108 +9,102 @@ import HeaderMenu from "./HeaderMenu";
|
||||
|
||||
const drawerWidth = 300;
|
||||
|
||||
const Main = styled(Paper, { shouldForwardProp: (prop) => prop !== "open" })(
|
||||
({ theme, open }) => ({
|
||||
const Main = styled(Paper, { shouldForwardProp: (prop) => prop !== "open" })(({ theme, open }) => ({
|
||||
flexGrow: 1,
|
||||
transition: theme.transitions.create("margin", {
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen,
|
||||
}),
|
||||
marginLeft: `-${drawerWidth}px`,
|
||||
...(open && {
|
||||
transition: theme.transitions.create("margin", {
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
duration: theme.transitions.duration.enteringScreen,
|
||||
}),
|
||||
marginLeft: 0,
|
||||
transition: theme.transitions.create("margin", {
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
duration: theme.transitions.duration.enteringScreen,
|
||||
}),
|
||||
marginLeft: 0,
|
||||
}),
|
||||
})
|
||||
);
|
||||
}));
|
||||
|
||||
const AppBar = styled(MuiAppBar, {
|
||||
shouldForwardProp: (prop) => prop !== "open",
|
||||
shouldForwardProp: (prop) => prop !== "open",
|
||||
})(({ theme, open }) => ({
|
||||
transition: theme.transitions.create(["margin", "width"], {
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen,
|
||||
}),
|
||||
...(open && {
|
||||
width: `calc(100% - ${drawerWidth}px)`,
|
||||
marginLeft: `${drawerWidth}px`,
|
||||
transition: theme.transitions.create(["margin", "width"], {
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
duration: theme.transitions.duration.enteringScreen,
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen,
|
||||
}),
|
||||
...(open && {
|
||||
width: `calc(100% - ${drawerWidth}px)`,
|
||||
marginLeft: `${drawerWidth}px`,
|
||||
transition: theme.transitions.create(["margin", "width"], {
|
||||
easing: theme.transitions.easing.easeOut,
|
||||
duration: theme.transitions.duration.enteringScreen,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
}));
|
||||
|
||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
padding: theme.spacing(0, 1),
|
||||
...theme.mixins.toolbar,
|
||||
justifyContent: "flex-end",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
padding: theme.spacing(0, 1),
|
||||
...theme.mixins.toolbar,
|
||||
justifyContent: "flex-end",
|
||||
}));
|
||||
|
||||
const HeaderWithSidebar = ({ children }) => {
|
||||
const [open, setOpen] = useState(true);
|
||||
const [open, setOpen] = useState(true);
|
||||
|
||||
const handleDrawerOpen = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
const handleDrawerClose = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
return (
|
||||
<Box sx={{ display: "flex" }}>
|
||||
<AppBar
|
||||
sx={{ position: "fixed", top: "unset" }}
|
||||
elevation={0}
|
||||
open={open}
|
||||
>
|
||||
<Toolbar variant="dense">
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
edge="start"
|
||||
sx={{ mr: 2, ...(open && { display: "none" }) }}
|
||||
>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
|
||||
<HeaderMenu />
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Drawer
|
||||
sx={{
|
||||
width: drawerWidth,
|
||||
flexShrink: 0,
|
||||
"& .MuiDrawer-paper": {
|
||||
width: drawerWidth,
|
||||
boxSizing: "border-box",
|
||||
borderTop: 1,
|
||||
borderTopColor: "divider",
|
||||
top: "unset",
|
||||
},
|
||||
}}
|
||||
variant="persistent"
|
||||
anchor="left"
|
||||
open={open}
|
||||
>
|
||||
<DrawerHeader>
|
||||
<IconButton onClick={handleDrawerClose}>
|
||||
<ChevronRightIcon />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<SidebarMenu />
|
||||
</Drawer>
|
||||
<Main elevation={0} open={open}>
|
||||
<DrawerHeader />
|
||||
{children}
|
||||
</Main>
|
||||
</Box>
|
||||
);
|
||||
const handleDrawerOpen = () => {
|
||||
setOpen(true);
|
||||
};
|
||||
const handleDrawerClose = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
return (
|
||||
<Box sx={{ display: "flex" }}>
|
||||
<AppBar sx={{ position: "fixed", top: "unset" }} elevation={0} open={open}>
|
||||
<Toolbar variant="dense">
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
edge="start"
|
||||
sx={{ mr: 2, ...(open && { display: "none" }) }}
|
||||
>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
<Box sx={{ flexGrow: 1, display: { xs: "none", md: "flex" } }}>
|
||||
<HeaderMenu />
|
||||
</Box>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Drawer
|
||||
sx={{
|
||||
width: drawerWidth,
|
||||
flexShrink: 0,
|
||||
"& .MuiDrawer-paper": {
|
||||
width: drawerWidth,
|
||||
boxSizing: "border-box",
|
||||
borderTop: 1,
|
||||
borderTopColor: "divider",
|
||||
top: "unset",
|
||||
},
|
||||
}}
|
||||
variant="persistent"
|
||||
anchor="left"
|
||||
open={open}
|
||||
>
|
||||
<DrawerHeader>
|
||||
<IconButton onClick={handleDrawerClose}>
|
||||
<ChevronRightIcon />
|
||||
</IconButton>
|
||||
</DrawerHeader>
|
||||
<SidebarMenu />
|
||||
</Drawer>
|
||||
<Main elevation={0} open={open}>
|
||||
<DrawerHeader />
|
||||
{children}
|
||||
</Main>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
export default HeaderWithSidebar;
|
||||
|
||||
Reference in New Issue
Block a user