Commit 4c108e10 by tdgiang

update code

parent f012418b
......@@ -6,7 +6,7 @@ import clsx from 'clsx'
import useSettings from 'app/hooks/useSettings'
import { useSelector } from 'react-redux'
import useAuth from 'app/hooks/useAuth'
import {navigationsAdmin} from 'app/navigations'
import {navigationsAdmin,navigations} from 'app/navigations'
const useStyles = makeStyles(({ palette, ...theme }) => ({
scrollable: {
......@@ -32,7 +32,7 @@ const Sidenav = ({ children }) => {
const classes = useStyles()
const { settings, updateSettings } = useSettings()
const [navigationUser,setNavigationUser]=useState([])
let navigation = useSelector(({ navigations }) => navigations)
//let navigation = useSelector(({ navigations }) => navigations)
const { user } = useAuth()
useEffect(()=>{
getNavigationUser()
......@@ -47,7 +47,7 @@ const Sidenav = ({ children }) => {
console.log("user",user.user_permissions)
if (user.user_permissions?.length > 0) {
const newList = navigation.map((item) => {
const newList = navigations.map((item) => {
//level 2
if (item.children) {
let flag = false;
......
import { authRoles } from './auth/authRoles'
export const navigations = [
{
name: 'Dashboard',
......@@ -14,36 +12,36 @@ export const navigations = [
path: '/merchant',
icon: 'apartment',
id: 'MERCHANT',
hide: false,
hide: true,
},
{
name: 'Quản lý cây xăng',
path: '/gas-station',
icon: 'local_gas_station',
id: 'GAS_STATION',
hide: false,
id: 'GAS-STATION',
hide: true,
},
{
name: 'Quản lý sản phẩm',
icon: 'wb_iridescent',
hide: false,
hide: true,
children: [
{
name: 'Sản phẩm',
path: '/product',
iconText: 'EM',
//icon: 'group',
hide: false,
id: 'EMPLOYEE',
hide: true,
id: 'PRODUCT',
},
{
name: 'Loại sản phẩm',
iconText: 'FN',
path: '/product-type',
hide: false,
id: 'FUNCTION',
hide: true,
id: 'PRODUCT-TYPE',
},
],
},
......@@ -51,72 +49,72 @@ export const navigations = [
name: 'Quản lý giao dịch',
path: '/transations',
icon: 'receipt_long',
id: 'DASHBOARD',
hide: false,
id: 'TRANSATIONS',
hide: true,
},
{
name: 'Quản lý thu phí',
path: '/list-fee',
icon: 'diamond',
id: 'DASHBOARD',
hide: false,
id: 'LIST-FEE',
hide: true,
},
{
name: 'Quản lý hệ thống',
icon: 'wb_iridescent',
hide: false,
hide: true,
children: [
{
name: 'Nhân viên',
path: '/employee',
iconText: 'EM',
//icon: 'group',
hide: false,
hide: true,
id: 'EMPLOYEE',
},
{
name: 'Chức năng',
iconText: 'FN',
path: '/function',
hide: false,
hide: true,
id: 'FUNCTION',
},
{
name: 'Hành động',
iconText: 'RO',
path: '/role',
hide: false,
hide: true,
id: 'ROLE',
},
{
name: 'Nhóm quyền',
iconText: 'GR',
path: '/group-role',
hide: false,
id: 'GROUP_ROLE',
hide: true,
id: 'GROUP-ROLE',
},
{
name: 'Log login,logout',
iconText: 'NO',
path: '/system/log-auth',
hide: false,
hide: true,
id: 'LOG_AUTH',
},
{
name: 'Log Hành động',
iconText: 'SM',
path: '/system/log-action',
hide: false,
hide: true,
id: 'LOG_ACTION',
},
{
name: 'Log Api',
iconText: 'SM',
path: '/system/log-api',
hide: false,
hide: true,
id: 'LOG_API',
},
],
......
......@@ -116,7 +116,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/employee/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -125,6 +125,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -169,6 +170,10 @@ function TableList(props) {
)
})}
{checkRole(
user,
'/employee/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -187,9 +192,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/employee/delete') ? (
<Tooltip title="Xoá">
......
......@@ -123,7 +123,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/function/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -132,6 +132,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -176,6 +177,10 @@ function TableList(props) {
)
})}
{checkRole(
user,
'/function/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -194,9 +199,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/function/delete') ? (
<Tooltip title="Xoá">
......
......@@ -117,6 +117,7 @@ function TableList(props) {
</TableCell>
))}
{checkRole(user, '/group-role/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -125,7 +126,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
textAlign: 'center',
......@@ -168,7 +169,10 @@ function TableList(props) {
</TableCell>
)
})}
{checkRole(
user,
'/group-role/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -187,9 +191,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(
user,
......
......@@ -130,7 +130,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/role/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -139,6 +139,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -183,6 +184,7 @@ function TableList(props) {
)
})}
{checkRole(user, '/role/changeStatus') && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -201,9 +203,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/role/delete') ? (
<Tooltip title="Xoá">
......
......@@ -135,7 +135,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/gas-station/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -144,6 +144,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -188,6 +189,10 @@ function TableList(props) {
)
})}
{checkRole(
user,
'/gas-station/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -206,9 +211,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(
user,
......
......@@ -135,7 +135,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/merchant/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -144,6 +144,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -188,6 +189,10 @@ function TableList(props) {
)
})}
{checkRole(
user,
'/merchant/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -206,9 +211,13 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/merchant/delete') ? (
<Tooltip title="Xoá">
......
......@@ -115,7 +115,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/product/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -124,6 +124,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -167,7 +168,10 @@ function TableList(props) {
</TableCell>
)
})}
{checkRole(
user,
'/product/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -186,9 +190,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/product/delete') ? (
<Tooltip title="Xoá">
......
......@@ -110,7 +110,7 @@ function TableList(props) {
{column.label}
</TableCell>
))}
{checkRole(user, '/product-type/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
......@@ -119,6 +119,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -162,7 +163,10 @@ function TableList(props) {
</TableCell>
)
})}
{checkRole(
user,
'/product-type/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
......@@ -181,9 +185,12 @@ function TableList(props) {
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(
user,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment