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,15 +116,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/employee/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -169,27 +170,34 @@ function TableList(props) {
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/employee/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/employee/delete') ? (
<Tooltip title="Xoá">
......
......@@ -123,15 +123,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/function/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -176,27 +177,34 @@ function TableList(props) {
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/function/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/function/delete') ? (
<Tooltip title="Xoá">
......
......@@ -117,15 +117,16 @@ function TableList(props) {
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/group-role/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
textAlign: 'center',
......@@ -168,28 +169,34 @@ function TableList(props) {
</TableCell>
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/group-role/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(
user,
......
......@@ -130,15 +130,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/role/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -183,27 +184,31 @@ function TableList(props) {
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(user, '/role/changeStatus') && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/role/delete') ? (
<Tooltip title="Xoá">
......
......@@ -135,15 +135,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/gas-station/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -188,27 +189,34 @@ function TableList(props) {
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/gas-station/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(
user,
......
......@@ -135,15 +135,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/merchant/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -188,27 +189,35 @@ function TableList(props) {
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/merchant/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/merchant/delete') ? (
<Tooltip title="Xoá">
......
......@@ -115,15 +115,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/product/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -167,28 +168,34 @@ function TableList(props) {
</TableCell>
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/product/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>
Khóa
</MenuItem>
</Select>
</TableCell>
)}
<TableCell>
{checkRole(user, '/product/delete') ? (
<Tooltip title="Xoá">
......
......@@ -110,15 +110,16 @@ function TableList(props) {
{column.label}
</TableCell>
))}
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
{checkRole(user, '/product-type/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
width: 125,
}}
>
Trạng thái
</TableCell>
)}
<TableCell
style={{
......@@ -162,28 +163,34 @@ function TableList(props) {
</TableCell>
)
})}
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</MenuItem>
<MenuItem value={2}>Khóa</MenuItem>
</Select>
</TableCell>
{checkRole(
user,
'/product-type/changeStatus'
) && (
<TableCell className={classes.border}>
<Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActive(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.status}
className={classes.formControl}
>
<MenuItem value={1}>
Hot động
</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