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
ba6234e7
Commit
ba6234e7
authored
Aug 22, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate code
parent
a26d5168
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
26 deletions
+133
-26
dropdown.js
src/app/apis/Functions/dropdown.js
+5
-0
merchant.js
src/app/apis/Functions/merchant.js
+5
-0
url.js
src/app/apis/url.js
+5
-2
GasStationRoutes.js
src/app/views/GasStation/GasStationRoutes.js
+5
-0
Index.js
src/app/views/GasStation/Index.js
+32
-4
Table.js
src/app/views/GasStation/Table.js
+77
-8
View.js
src/app/views/GasStation/View.js
+4
-12
detail.js
src/app/views/GasStation/detail.js
+0
-0
Create.js
src/app/views/Merchant/Create.js
+0
-0
No files found.
src/app/apis/Functions/dropdown.js
View file @
ba6234e7
...
...
@@ -89,3 +89,8 @@ export const dropdownFuncitonPackge = async (body) =>
GetData
(
url
.
dropdownFuncitonPackge
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
dropdownStoreStatus
=
async
(
body
)
=>
GetData
(
url
.
dropdownStoreStatus
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/Functions/merchant.js
View file @
ba6234e7
...
...
@@ -70,3 +70,8 @@ export const deleteGasField = async (body) =>
PostData
(
url
.
deleteGasField
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
changeStatusStore
=
async
(
body
)
=>
PostData
(
url
.
changeStatusStore
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/url.js
View file @
ba6234e7
//const root = 'http://petrolpay.tasvietnam.vn:9985/api'
//const root = 'https://apigw.petropos.vn/api'
//const root = 'http://dcvf.tasvietnam.vn:9986/api'
const
root
=
'https://apigw-v2.petropos.vn/api'
//
const root = 'https://apigw-v2.petropos.vn/api'
const
root
=
'https://apitest.petropos.vn/api'
//v2
//const root = 'https://apitest-v2.petropos.vn/api'
...
...
@@ -94,6 +94,8 @@ export default {
deleteGasOnline
:
`
${
root
}
/gasoline/delete`
,
deleteGasField
:
`
${
root
}
/gasfield/delete`
,
changeStatusStore
:
`
${
root
}
/merchantstore/changeStatus`
,
//Supplier Invoice
urlGetListInvoiceSupp
:
`
${
root
}
/supplierInvoice/list`
,
urlCreateInvoiceSupp
:
`
${
root
}
/supplierInvoice/create`
,
...
...
@@ -166,4 +168,5 @@ export default {
dropdownTypeEquipment
:
`
${
root
}
/dropdown/getlisttypeatc`
,
dropdownNcc
:
`
${
root
}
/dropdown/getlistsuppliercontruct`
,
dropdownFuncitonPackge
:
`
${
root
}
/dropdown/getlistfunctionpk`
,
dropdownStoreStatus
:
`
${
root
}
/dropdown/getlistStoreStatus`
,
}
src/app/views/GasStation/GasStationRoutes.js
View file @
ba6234e7
...
...
@@ -2,6 +2,11 @@ import React from 'react'
const
GasStationRoutes
=
[
{
path
:
'/gas-station/detail'
,
component
:
React
.
lazy
(()
=>
import
(
'./detail'
)),
},
{
path
:
'/gas-station/create'
,
component
:
React
.
lazy
(()
=>
import
(
'./Create'
)),
},
...
...
src/app/views/GasStation/Index.js
View file @
ba6234e7
...
...
@@ -4,6 +4,7 @@ import {
getListGasStation
,
deleteGasStation
,
changeStatusGasStation
,
changeStatusStore
,
}
from
'app/apis/Functions/merchant'
import
{
useHistory
}
from
'react-router-dom'
import
KEY
from
'app/assets/Key'
...
...
@@ -13,6 +14,7 @@ import { toast } from 'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdownStoreStatus
}
from
'app/apis/Functions/dropdown'
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
...
...
@@ -26,13 +28,14 @@ const ToolNotificate = (props) => {
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
listStatus
,
setListStatus
]
=
useState
([])
const
history
=
useHistory
()
const
[
data
,
setData
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
useEffect
(()
=>
{
getDropDownMerchant
()
getDropdownData
()
},
[])
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
...
...
@@ -95,6 +98,17 @@ const ToolNotificate = (props) => {
}
}
const
getDropdownData
=
async
()
=>
{
const
res
=
await
dropdownStoreStatus
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setListStatus
(
res
.
data
.
data
)
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
theme
:
'colored'
,
})
}
}
const
getDropDownMerchant
=
async
()
=>
{
try
{
const
res
=
await
dropdownMerchant
()
...
...
@@ -116,13 +130,26 @@ const ToolNotificate = (props) => {
getData
(
true
)
},
[
searchDebount
,
merchant
,
status
])
const
removeItem
=
async
(
i
d
)
=>
{
const
removeItem
=
async
(
i
tem
)
=>
{
props
.
showLoading
()
const
res
=
await
deleteGasStation
({
idGuid
:
id
})
let
res
if
(
item
.
status
==
1
)
{
res
=
await
changeStatusStore
({
id
:
item
.
id
,
status_id
:
5
,
})
}
else
{
res
=
await
changeStatusStore
({
id
:
item
.
id
,
status_id
:
1
,
})
}
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
getData
(
true
)
toast
.
success
(
'
Xoá bản ghi
thành công!'
,
{
toast
.
success
(
'
Cập nhật trạng thái cây xăng
thành công!'
,
{
theme
:
'colored'
,
})
}
else
if
(
res
.
data
.
code
==
401
)
{
...
...
@@ -156,6 +183,7 @@ const ToolNotificate = (props) => {
setMerchant
=
{
setMerchant
}
status
=
{
status
}
setStatus
=
{
setStatus
}
listStatus
=
{
listStatus
}
/
>
)
}
...
...
src/app/views/GasStation/Table.js
View file @
ba6234e7
...
...
@@ -82,6 +82,12 @@ const columns = [
align
:
'left'
,
minWidth
:
'auto'
,
},
{
id
:
'status_text'
,
label
:
'Trạng thái'
,
align
:
'left'
,
minWidth
:
'auto'
,
},
]
function
TableList
(
props
)
{
...
...
@@ -135,7 +141,7 @@ function TableList(props) {
{
column
.
label
}
<
/TableCell
>
))}
{
checkRole
(
user
,
'/gas-station/changeStatus'
)
&&
(
{
/* {
checkRole(user, '/gas-station/changeStatus') && (
<TableCell
style={{
backgroundColor: colors.headerTable,
...
...
@@ -144,13 +150,13 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
)}
*/
}
<
TableCell
style
=
{{
textAlign
:
'center'
,
backgroundColor
:
colors
.
headerTable
,
width
:
1
2
0
,
width
:
1
6
0
,
}}
>
H
à
nh
độ
ng
...
...
@@ -188,7 +194,7 @@ function TableList(props) {
<
/TableCell
>
)
})}
{
/*
{checkRole(
user,
'/gas-station/changeStatus'
...
...
@@ -216,9 +222,9 @@ function TableList(props) {
</MenuItem>
</Select>
</TableCell>
)}
)}
*/
}
<
TableCell
>
{
checkRole
(
{
/* {
checkRole(
user,
'/gas-station/delete'
) ? (
...
...
@@ -262,7 +268,70 @@ function TableList(props) {
</Icon>
</IconButton>
</Tooltip>
)
:
null
}
) : null} */
}
{
row
.
status
==
1
&&
(
<
Tooltip
title
=
"Ngừng hoạt động"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Ngừng hoạt động cây xăng'
,
content
:
`Bạn có muốn ngừng hoạt động cây xăng
${
row
.
store_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"Delete"
>
<
Icon
color
=
"error"
>
stop_circle
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)}
{
row
.
status
==
5
&&
(
<
Tooltip
title
=
"Hoạt động"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Cho phép hoạt động cây xăng'
,
content
:
`Bạn có muốn cho phép hoạt động cây xăng
${
row
.
store_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"Delete"
>
<
Icon
style
=
{{
color
:
'#00C65B'
,
}}
>
not_started
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)}
<
Tooltip
title
=
"Chi tiết"
>
<
IconButton
onClick
=
{()
=>
{
history
.
push
({
pathname
:
'/gas-station/detail'
,
state
:
row
.
id
,
})
}}
className
=
{
classes
.
button
}
aria
-
label
=
"edit"
>
<
Icon
color
=
"primary"
>
visibility
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell
>
<
/TableRow
>
)
...
...
@@ -275,7 +344,7 @@ function TableList(props) {
open
=
{
open
}
handleClose
=
{
handleClose
}
onAgree
=
{()
=>
{
removeItem
(
selected
.
id
)
removeItem
(
selected
)
handleClose
()
}}
/
>
...
...
src/app/views/GasStation/View.js
View file @
ba6234e7
...
...
@@ -36,6 +36,7 @@ function CustomerView(props) {
listMerchant
,
status
,
setStatus
,
listStatus
,
}
=
props
const
[
age
,
setAge
]
=
React
.
useState
(
''
)
const
{
user
}
=
useAuth
()
...
...
@@ -135,16 +136,7 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{[
{
id
:
1
,
name
:
'Hoạt động'
,
},
{
id
:
2
,
name
:
'Khoá'
,
},
].
map
((
e
)
=>
(
{
listStatus
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
...
...
@@ -153,7 +145,7 @@ function CustomerView(props) {
<
/FormControl
>
<
/Grid
>
<
/Grid
>
{
checkRole
(
user
,
'/gas-station/create'
)
?
(
{
/* {
checkRole(user, '/gas-station/create') ? (
<Link to="/gas-station/create">
<Button
variant="contained"
...
...
@@ -162,7 +154,7 @@ function CustomerView(props) {
<span className={'text-primary'}>Thêm mới</span>
</Button>
</Link>
)
:
null
}
) : null}
*/
}
<
/Grid
>
<
Table
...
...
src/app/views/GasStation/detail.js
0 → 100644
View file @
ba6234e7
This diff is collapsed.
Click to expand it.
src/app/views/Merchant/Create.js
View file @
ba6234e7
This diff is collapsed.
Click to expand it.
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