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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
34 deletions
+76
-34
AuthGuard.jsx
src/app/auth/AuthGuard.jsx
+6
-1
JWTAuthContext.js
src/app/contexts/JWTAuthContext.js
+9
-5
navigations.js
src/app/navigations.js
+24
-25
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 {
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
})
...
...
src/app/contexts/JWTAuthContext.js
View file @
f012418b
...
...
@@ -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
:
{
...
...
src/app/navigations.js
View file @
f012418b
...
...
@@ -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'
,
},
...
...
src/app/views/GasStation/Create.js
View file @
f012418b
...
...
@@ -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"
...
...
src/app/views/GasStation/Table.js
View file @
f012418b
...
...
@@ -210,7 +210,10 @@ function TableList(props) {
<
/Select
>
<
/TableCell
>
<
TableCell
>
{
checkRole
(
user
,
'/function/delete'
)
?
(
{
checkRole
(
user
,
'/gas-station/delete'
)
?
(
<
Tooltip
title
=
"Xoá"
>
<
IconButton
onClick
=
{()
=>
{
...
...
src/app/views/GasStation/Update.js
View file @
f012418b
...
...
@@ -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"
...
...
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