Commit f012418b by tdgiang

fix bug

parent 1f6e62c9
......@@ -22,6 +22,11 @@ import {
const getUserRoleAuthStatus = (pathname, user) => {
console.log("pathname",pathname)
return true
if(pathname==='/dashboard/default' || pathname==='/' || pathname=="/dashboard")
return true
if(user){
if(user.is_sysadmin){
return true
......@@ -29,7 +34,7 @@ const getUserRoleAuthStatus = (pathname, user) => {
let flag=false;
user.listPath.map(e=>{
if(e==pathname || pathname==='/dashboard/default' || pathname==='/' || pathname=="/dashboard")
if(e==pathname)
flag=true
})
......
......@@ -150,19 +150,23 @@ export const AuthProvider = ({ children }) => {
;(async () => {
try {
const accessToken = window.localStorage.getItem('accessToken')
console.log('accessToken', accessToken)
// if (accessToken && isValidToken(accessToken))
if (accessToken) {
// setSession(accessToken)
const res = await apiGetInfor({})
console.log('res', res)
if (res.data.code == 200 && res.data.data) {
const user = res.data.data
console.log('res.data.data', res.data.data)
let listPath = []
// user.user_permissions.map((item) => {
// if (item.actions) {
// item.actions.map((e) => listPath.push(e.path))
// }
// })
user.user_permissions.map((item) => {
if (item.actions) {
item.actions.map((e) => listPath.push(e.path))
}
})
dispatch({
type: 'INIT',
payload: {
......
......@@ -8,32 +8,23 @@ export const navigations = [
id: 'DASHBOARD',
hide: false,
},
// {
// label: 'Khách hàng',
// type: 'label',
// hide: false,
// },
{
name: 'Quản lý khách hàng',
icon: 'group',
name: 'Quản lý merchant',
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,
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',
icon: 'wb_iridescent',
......@@ -59,7 +50,15 @@ export const navigations = [
{
name: 'Quản lý giao dịch',
path: '/transations',
icon: 'dashboard',
icon: 'receipt_long',
id: 'DASHBOARD',
hide: false,
},
{
name: 'Quản lý thu phí',
path: '/list-fee',
icon: 'diamond',
id: 'DASHBOARD',
hide: false,
},
......@@ -72,8 +71,8 @@ export const navigations = [
{
name: 'Nhân viên',
path: '/employee',
//icon: 'group',
iconText: 'EM',
//icon: 'group',
hide: false,
id: 'EMPLOYEE',
},
......
......@@ -299,7 +299,7 @@ const SimpleForm = (props) => {
return temp
}
const { store_name, address, merchant_id } = state
const { store_name, address, merchant_id, store_code } = state
return (
<div className="m-sm-30">
......@@ -363,6 +363,21 @@ const SimpleForm = (props) => {
<TextValidator
variant="outlined"
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ỉ *"
onChange={handleChange}
type="text"
......
......@@ -210,7 +210,10 @@ function TableList(props) {
</Select>
</TableCell>
<TableCell>
{checkRole(user, '/function/delete') ? (
{checkRole(
user,
'/gas-station/delete'
) ? (
<Tooltip title="Xoá">
<IconButton
onClick={() => {
......
......@@ -368,7 +368,7 @@ const SimpleForm = (props) => {
}
}
const { store_name, address, merchant_id } = state
const { store_name, address, merchant_id, store_code } = state
return (
<div className="m-sm-30">
......@@ -435,6 +435,22 @@ const SimpleForm = (props) => {
<TextValidator
variant="outlined"
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ỉ *"
onChange={handleChange}
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