Commit f012418b by tdgiang

fix bug

parent 1f6e62c9
...@@ -22,6 +22,11 @@ import { ...@@ -22,6 +22,11 @@ import {
const getUserRoleAuthStatus = (pathname, user) => { const getUserRoleAuthStatus = (pathname, user) => {
console.log("pathname",pathname)
return true
if(pathname==='/dashboard/default' || pathname==='/' || pathname=="/dashboard")
return true
if(user){ if(user){
if(user.is_sysadmin){ if(user.is_sysadmin){
return true return true
...@@ -29,7 +34,7 @@ const getUserRoleAuthStatus = (pathname, user) => { ...@@ -29,7 +34,7 @@ const getUserRoleAuthStatus = (pathname, user) => {
let flag=false; let flag=false;
user.listPath.map(e=>{ user.listPath.map(e=>{
if(e==pathname || pathname==='/dashboard/default' || pathname==='/' || pathname=="/dashboard") if(e==pathname)
flag=true flag=true
}) })
......
...@@ -150,19 +150,23 @@ export const AuthProvider = ({ children }) => { ...@@ -150,19 +150,23 @@ export const AuthProvider = ({ children }) => {
;(async () => { ;(async () => {
try { try {
const accessToken = window.localStorage.getItem('accessToken') const accessToken = window.localStorage.getItem('accessToken')
console.log('accessToken', accessToken)
// if (accessToken && isValidToken(accessToken)) // if (accessToken && isValidToken(accessToken))
if (accessToken) { if (accessToken) {
// setSession(accessToken) // setSession(accessToken)
const res = await apiGetInfor({}) const res = await apiGetInfor({})
console.log('res', res)
if (res.data.code == 200 && res.data.data) { if (res.data.code == 200 && res.data.data) {
const user = res.data.data const user = res.data.data
console.log('res.data.data', res.data.data)
let listPath = [] let listPath = []
// user.user_permissions.map((item) => { user.user_permissions.map((item) => {
// if (item.actions) { if (item.actions) {
// item.actions.map((e) => listPath.push(e.path)) item.actions.map((e) => listPath.push(e.path))
// } }
// }) })
dispatch({ dispatch({
type: 'INIT', type: 'INIT',
payload: { payload: {
......
...@@ -8,32 +8,23 @@ export const navigations = [ ...@@ -8,32 +8,23 @@ export const navigations = [
id: 'DASHBOARD', id: 'DASHBOARD',
hide: false, hide: false,
}, },
// {
// label: 'Khách hàng',
// type: 'label',
// hide: false,
// },
{ {
name: 'Quản lý khách hàng', name: 'Quản lý merchant',
icon: 'group', path: '/merchant',
icon: 'apartment',
id: 'MERCHANT',
hide: false,
},
{
name: 'Quản lý cây xăng',
path: '/gas-station',
icon: 'local_gas_station',
id: 'GAS_STATION',
hide: false, hide: false,
children: [
{
name: 'Danh sách khách hàng',
iconText: 'LI',
path: '/customer',
id: 'CUSTOMER',
hide: false,
},
{
name: 'Quá trình CSKH',
iconText: 'TN',
path: '/customer-care',
id: 'CUSTOMER_CARE',
hide: false,
},
],
}, },
{ {
name: 'Quản lý sản phẩm', name: 'Quản lý sản phẩm',
icon: 'wb_iridescent', icon: 'wb_iridescent',
...@@ -59,7 +50,15 @@ export const navigations = [ ...@@ -59,7 +50,15 @@ export const navigations = [
{ {
name: 'Quản lý giao dịch', name: 'Quản lý giao dịch',
path: '/transations', path: '/transations',
icon: 'dashboard', icon: 'receipt_long',
id: 'DASHBOARD',
hide: false,
},
{
name: 'Quản lý thu phí',
path: '/list-fee',
icon: 'diamond',
id: 'DASHBOARD', id: 'DASHBOARD',
hide: false, hide: false,
}, },
...@@ -72,8 +71,8 @@ export const navigations = [ ...@@ -72,8 +71,8 @@ export const navigations = [
{ {
name: 'Nhân viên', name: 'Nhân viên',
path: '/employee', path: '/employee',
//icon: 'group',
iconText: 'EM', iconText: 'EM',
//icon: 'group',
hide: false, hide: false,
id: 'EMPLOYEE', id: 'EMPLOYEE',
}, },
......
...@@ -299,7 +299,7 @@ const SimpleForm = (props) => { ...@@ -299,7 +299,7 @@ const SimpleForm = (props) => {
return temp return temp
} }
const { store_name, address, merchant_id } = state const { store_name, address, merchant_id, store_code } = state
return ( return (
<div className="m-sm-30"> <div className="m-sm-30">
...@@ -363,6 +363,21 @@ const SimpleForm = (props) => { ...@@ -363,6 +363,21 @@ const SimpleForm = (props) => {
<TextValidator <TextValidator
variant="outlined" variant="outlined"
className="mb-4 w-full" className="mb-4 w-full"
label="Mã cây xăng *"
onChange={handleChange}
type="text"
name="store_code"
value={store_code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Địa chỉ *" label="Địa chỉ *"
onChange={handleChange} onChange={handleChange}
type="text" type="text"
......
...@@ -210,7 +210,10 @@ function TableList(props) { ...@@ -210,7 +210,10 @@ function TableList(props) {
</Select> </Select>
</TableCell> </TableCell>
<TableCell> <TableCell>
{checkRole(user, '/function/delete') ? ( {checkRole(
user,
'/gas-station/delete'
) ? (
<Tooltip title="Xoá"> <Tooltip title="Xoá">
<IconButton <IconButton
onClick={() => { onClick={() => {
......
...@@ -368,7 +368,7 @@ const SimpleForm = (props) => { ...@@ -368,7 +368,7 @@ const SimpleForm = (props) => {
} }
} }
const { store_name, address, merchant_id } = state const { store_name, address, merchant_id, store_code } = state
return ( return (
<div className="m-sm-30"> <div className="m-sm-30">
...@@ -435,6 +435,22 @@ const SimpleForm = (props) => { ...@@ -435,6 +435,22 @@ const SimpleForm = (props) => {
<TextValidator <TextValidator
variant="outlined" variant="outlined"
className="mb-4 w-full" className="mb-4 w-full"
label="Mã cây xăng *"
onChange={handleChange}
type="text"
name="store_code"
value={store_code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Địa chỉ *" label="Địa chỉ *"
onChange={handleChange} onChange={handleChange}
type="text" type="text"
......
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