Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CmsPetrolPay
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
11
Issues
11
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
CmsPetrolPay
Commits
f012418b
Commit
f012418b
authored
Feb 22, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
1f6e62c9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
31 deletions
+73
-31
AuthGuard.jsx
src/app/auth/AuthGuard.jsx
+6
-1
JWTAuthContext.js
src/app/contexts/JWTAuthContext.js
+9
-5
navigations.js
src/app/navigations.js
+21
-22
Create.js
src/app/views/GasStation/Create.js
+16
-1
Table.js
src/app/views/GasStation/Table.js
+4
-1
Update.js
src/app/views/GasStation/Update.js
+17
-1
No files found.
src/app/auth/AuthGuard.jsx
View file @
f012418b
...
@@ -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
})
})
...
...
src/app/contexts/JWTAuthContext.js
View file @
f012418b
...
@@ -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
:
{
...
...
src/app/navigations.js
View file @
f012418b
...
@@ -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'
,
icon
:
'group'
,
hide
:
false
,
children
:
[
{
{
name
:
'Danh sách khách hàng
'
,
name
:
'Quản lý merchant
'
,
iconText
:
'LI
'
,
path
:
'/merchant
'
,
path
:
'/customer
'
,
icon
:
'apartment
'
,
id
:
'CUSTOMER
'
,
id
:
'MERCHANT
'
,
hide
:
false
,
hide
:
false
,
},
},
{
{
name
:
'Quá trình CSKH
'
,
name
:
'Quản lý cây xăng
'
,
iconText
:
'TN
'
,
path
:
'/gas-station
'
,
path
:
'/customer-care
'
,
icon
:
'local_gas_station
'
,
id
:
'CUSTOMER_CARE
'
,
id
:
'GAS_STATION
'
,
hide
:
false
,
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'
,
},
},
...
...
src/app/views/GasStation/Create.js
View file @
f012418b
...
@@ -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"
...
...
src/app/views/GasStation/Table.js
View file @
f012418b
...
@@ -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
=
{()
=>
{
...
...
src/app/views/GasStation/Update.js
View file @
f012418b
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment