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
9b214793
Commit
9b214793
authored
Sep 13, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
4e54ba3a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
222 additions
and
133 deletions
+222
-133
dropdown.js
src/app/apis/Functions/dropdown.js
+5
-0
url.js
src/app/apis/url.js
+2
-1
Index.js
src/app/views/Reconciliation/ListTrans/Index.js
+54
-59
Table.js
src/app/views/Reconciliation/ListTrans/Table.js
+77
-38
View.js
src/app/views/Reconciliation/ListTrans/View.js
+84
-35
No files found.
src/app/apis/Functions/dropdown.js
View file @
9b214793
...
...
@@ -94,3 +94,8 @@ export const dropdownStoreStatus = async (body) =>
GetData
(
url
.
dropdownStoreStatus
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
dropdownProvider
=
async
(
body
)
=>
GetData
(
url
.
dropdownProvider
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/url.js
View file @
9b214793
...
...
@@ -119,7 +119,7 @@ export default {
changeStatusSupplier
:
`
${
root
}
/provider/changeStatus`
,
//reconciliation
listTransReconciliation
:
`
${
root
}
/
reconciliation
/list/trans`
,
listTransReconciliation
:
`
${
root
}
/
paymentpartner
/list/trans`
,
//Log
logAuth
:
`
${
root
}
/logging/listLogin`
,
...
...
@@ -178,4 +178,5 @@ export default {
dropdownNcc
:
`
${
root
}
/dropdown/getlistsuppliercontruct`
,
dropdownFuncitonPackge
:
`
${
root
}
/dropdown/getlistfunctionpk`
,
dropdownStoreStatus
:
`
${
root
}
/dropdown/getlistStoreStatus`
,
dropdownProvider
:
`
${
root
}
/dropdown/Provider`
,
}
src/app/views/Reconciliation/ListTrans/Index.js
View file @
9b214793
...
...
@@ -8,7 +8,7 @@ import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdown
Merchant
,
dropdownStore
}
from
'app/apis/Functions/dropdown'
import
{
dropdown
Product
,
dropdownProvider
}
from
'app/apis/Functions/dropdown'
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
...
...
@@ -24,13 +24,21 @@ const ToolNotificate = (props) => {
const
[
data
,
setData
]
=
useState
([])
const
[
type
,
setType
]
=
useState
()
const
[
listType
,
setListType
]
=
useState
([])
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
store
,
setStore
]
=
useState
()
const
[
listStore
,
setListStore
]
=
useState
([])
const
[
listProvide
,
setListProvide
]
=
useState
([])
const
[
provide
,
setProvide
]
=
useState
()
const
[
listProduct
,
setListProduct
]
=
useState
([])
const
[
product
,
setProduct
]
=
useState
()
const
[
status
,
setStatus
]
=
useState
()
useEffect
(()
=>
{
getData
(
false
)
},
[
pageIndex
])
useEffect
(()
=>
{
getDataMerchant
()
getData
(
true
)
},
[
searchDebount
,
startDate
,
type
,
provide
,
product
,
status
])
useEffect
(()
=>
{
getDataDropdown
()
},
[])
const
changeDateRange
=
(
start
,
end
)
=>
{
...
...
@@ -38,6 +46,12 @@ const ToolNotificate = (props) => {
setEndDate
(
end
)
}
const
renderStatusName
=
(
status
)
=>
{
if
(
status
==
3
)
return
'Đã đối soát'
if
(
status
==
2
)
return
'Đang đối soát'
return
'Chưa đối soát'
}
const
getData
=
async
(
init
)
=>
{
props
.
showLoading
()
let
res
...
...
@@ -48,10 +62,10 @@ const ToolNotificate = (props) => {
page_size
:
pageSize
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
product_code
:
null
,
payment_gate_code
:
null
,
statusReconciliation
:
0
,
type_payment
:
null
,
product_code
:
product
?
product
:
null
,
payment_gate_code
:
provide
?
provide
:
null
,
statusReconciliation
:
status
?
status
:
0
,
type_payment
:
type
?
type
:
null
,
})
}
else
{
res
=
await
listTransReconciliation
({
...
...
@@ -59,18 +73,25 @@ const ToolNotificate = (props) => {
page_size
:
pageSize
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
product_code
:
null
,
payment_gate_code
:
null
,
statusReconciliation
:
0
,
type_payment
:
null
,
product_code
:
product
?
product
:
null
,
payment_gate_code
:
provide
?
provide
:
null
,
statusReconciliation
:
status
?
status
:
0
,
type_payment
:
type
?
type
:
null
,
})
}
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
' res.data.data'
,
res
.
data
.
data
)
const
newList
=
res
.
data
.
data
?.
data
?.
map
((
e
,
i
)
=>
{
return
{
...
e
,
index
:
i
+
1
+
pageIndex
*
pageSize
}
return
{
...
e
,
statusReconciliationName
:
renderStatusName
(
e
?.
statusReconciliation
),
index
:
i
+
1
+
pageIndex
*
pageSize
,
}
})
setData
(
newList
)
setTotalRecord
(
res
.
data
.
data
.
total_elements
)
...
...
@@ -85,49 +106,21 @@ const ToolNotificate = (props) => {
}
}
useEffect
(()
=>
{
getData
(
false
)
},
[
pageIndex
])
useEffect
(()
=>
{
getData
(
true
)
},
[
searchDebount
,
startDate
,
type
,
merchant
,
store
])
useEffect
(()
=>
{
if
(
merchant
)
{
getDropdownStore
(
merchant
)
}
setStore
()
},
[
merchant
])
const
getDataMerchant
=
async
()
=>
{
const
res
=
await
dropdownMerchant
({})
const
getDataDropdown
=
async
()
=>
{
const
res
=
await
dropdownProvider
({})
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
merchant_name
}
})
setListMerchant
(
newList
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
return
{
...
e
,
id
:
e
.
code
}
})
setListProvide
(
newList
)
}
}
const
getDropdownStore
=
async
(
id
)
=>
{
const
res
=
await
dropdownStore
(
id
)
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
'res.data.data'
,
res
.
data
.
data
)
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
store_name
}
})
setListStore
(
newList
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
const
resPro
=
await
dropdownProduct
({})
if
(
resPro
.
data
.
code
==
200
&&
resPro
.
data
.
data
)
{
const
newList
=
resPro
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
id
:
e
.
product_code
,
name
:
e
?.
product_name
}
})
setListProduct
(
newList
)
}
}
...
...
@@ -145,12 +138,14 @@ const ToolNotificate = (props) => {
type
=
{
type
}
setType
=
{
setType
}
listType
=
{
listType
}
merchant
=
{
merchant
}
setMerchant
=
{
setMerchant
}
listMerchant
=
{
listMerchant
}
store
=
{
store
}
setStore
=
{
setStore
}
listStore
=
{
listStore
}
listProvide
=
{
listProvide
}
listProduct
=
{
listProduct
}
provide
=
{
provide
}
setProvide
=
{
setProvide
}
product
=
{
product
}
setProduct
=
{
setProduct
}
status
=
{
status
}
setStatus
=
{
setStatus
}
/
>
)
}
...
...
src/app/views/Reconciliation/ListTrans/Table.js
View file @
9b214793
...
...
@@ -12,13 +12,14 @@ import {
MenuItem
,
Tooltip
,
Icon
,
Typography
,
}
from
'@material-ui/core'
import
EditIcon
from
'@material-ui/icons/Edit'
import
DeleteIcon
from
'@material-ui/icons/Delete'
import
colors
from
'app/assets/Color'
import
useStyles
from
'app/styles/Table'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
toPriceVnd
}
from
'app/config/Function'
const
columns
=
[
{
id
:
'index'
,
...
...
@@ -26,38 +27,25 @@ const columns = [
align
:
'center'
,
minWidth
:
80
,
},
{
id
:
'
store_nam
e'
,
label
:
'
Cây xăng
'
,
id
:
'
created_dat
e'
,
label
:
'
Thời gian giao dịch
'
,
align
:
'left'
,
minWidth
:
1
6
0
,
minWidth
:
1
1
0
,
},
// {
// id: 'application',
// label: 'Mã NV',
// align: 'left',
// minWidth: 140,
// },
{
id
:
'order_code'
,
label
:
'Mã hoá đơn'
,
align
:
'left'
,
minWidth
:
160
,
},
{
id
:
'
created_dat
e'
,
label
:
'
Ngày giao dịch
'
,
id
:
'
store_nam
e'
,
label
:
'
Cây xăng
'
,
align
:
'left'
,
minWidth
:
1
1
0
,
minWidth
:
1
6
0
,
},
// {
// id: 'IP',
// label: 'Loại nhiên liệu',
// align: 'left',
// minWidth: 140,
// },
{
id
:
'product_name'
,
label
:
'Sản phẩm'
,
...
...
@@ -69,19 +57,31 @@ const columns = [
label
:
'Đơn giá'
,
align
:
'left'
,
minWidth
:
80
,
isMonney
:
true
,
},
{
id
:
'quantity'
,
label
:
'Lượng nhiên liệu'
,
align
:
'left'
,
minWidth
:
80
,
isMonney
:
true
,
},
{
id
:
'price'
,
label
:
'Thành tiền'
,
align
:
'left'
,
minWidth
:
80
,
isMonney
:
true
,
},
{
id
:
'commission'
,
label
:
'Hoa hồng'
,
align
:
'left'
,
minWidth
:
80
,
isMonney
:
true
,
},
{
id
:
'type_payment'
,
label
:
'Phương thức thanh toán'
,
...
...
@@ -89,10 +89,10 @@ const columns = [
minWidth
:
100
,
},
{
id
:
'
status_text
'
,
label
:
'
Trạng thái
'
,
id
:
'
payment_gate_code
'
,
label
:
'
Đối tác
'
,
align
:
'left'
,
minWidth
:
10
0
,
minWidth
:
8
0
,
},
]
...
...
@@ -117,6 +117,18 @@ function TableList(props) {
setPageSize
(
event
.
target
.
value
)
}
const
renderStatusBg
=
(
status
)
=>
{
if
(
status
==
3
)
return
'#ECFDF3'
if
(
status
==
2
)
return
'#FFDC98'
return
'#F2F4F7'
}
const
renderStatusColor
=
(
status
)
=>
{
if
(
status
==
3
)
return
'#027A48'
if
(
status
==
2
)
return
'#F1AA1F'
return
'#344054'
}
return
(
<
Paper
className
=
{
classes
.
root
}
>
<
TableContainer
className
=
{
classes
.
container
}
>
...
...
@@ -135,6 +147,14 @@ function TableList(props) {
{
column
.
label
}
<
/TableCell
>
))}
<
TableCell
style
=
{{
width
:
110
,
backgroundColor
:
colors
.
headerTable
,
}}
>
Tr
ạ
ng
th
á
i
đố
i
so
á
t
<
/TableCell
>
<
/TableRow
>
<
/TableHead
>
<
TableBody
className
=
{
classes
.
columnTable
}
>
...
...
@@ -147,28 +167,47 @@ function TableList(props) {
key
=
{
row
.
id
}
>
{
columns
.
map
((
column
)
=>
{
const
avatar
=
row
[
column
.
id
]
const
data
=
row
[
column
.
id
]
return
(
<
TableCell
key
=
{
column
.
id
}
align
=
{
column
.
align
}
style
=
{{
textAlign
:
column
.
id
===
'index'
?
'center'
:
typeof
data
==
'string'
?
'left'
:
'right'
,
}}
>
{
column
.
format
?
(
<
img
src
=
{
column
.
format
(
avatar
)}
className
=
{
classes
.
image
}
/
>
)
:
(
avatar
)}
{
column
.
isMonney
?
toPriceVnd
(
data
)
:
data
}
<
/TableCell
>
)
})}
<
TableCell
style
=
{{
textAlign
:
'center'
,
}}
>
<
Typography
style
=
{{
padding
:
5
,
backgroundColor
:
renderStatusBg
(
row
?.
statusReconciliation
),
color
:
renderStatusColor
(
row
?.
statusReconciliation
),
borderRadius
:
10
,
}}
>
{
row
?.
statusReconciliationName
}
<
/Typography
>
<
/TableCell
>
<
/TableRow
>
)
})}
...
...
src/app/views/Reconciliation/ListTrans/View.js
View file @
9b214793
...
...
@@ -42,6 +42,14 @@ function CustomerView(props) {
store
,
setStore
,
listStore
,
listProvide
,
listProduct
,
provide
,
setProvide
,
product
,
setProduct
,
status
,
setStatus
,
}
=
props
const
handleChange
=
(
event
)
=>
{
...
...
@@ -64,14 +72,14 @@ function CustomerView(props) {
<
Grid
style
=
{{
padding
:
10
,
marginBottom
:
2
0
,
marginBottom
:
1
0
,
}}
//justify={'space-between'}
alignItems
=
{
'center'
}
container
spacing
=
{
3
}
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
TextField
variant
=
"outlined"
className
=
"w-full"
...
...
@@ -82,16 +90,15 @@ function CustomerView(props) {
}}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Ph
ươ
ng
th
ứ
c
thanh
to
á
n
Đố
i
t
á
c
<
/InputLabel
>
<
Select
label
=
"
Phương thức thanh toán
"
value
=
{
typ
e
}
onChange
=
{(
e
)
=>
set
Typ
e
(
e
.
target
.
value
)}
label
=
"
Đối tác
"
value
=
{
provid
e
}
onChange
=
{(
e
)
=>
set
Provid
e
(
e
.
target
.
value
)}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
...
...
@@ -100,34 +107,21 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{[
{
id
:
'QR'
,
name
:
'QR'
,
},
{
id
:
'CASH'
,
name
:
'Tiền mặt'
,
},
{
id
:
'DEBT'
,
name
:
'Công nợ'
,
},
].
map
((
e
)
=>
(
{
listProvide
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Ph
á
p
nh
â
n
S
ả
n
ph
ẩ
m
<
/InputLabel
>
<
Select
label
=
"
Pháp nhân
"
value
=
{
merchan
t
}
onChange
=
{(
e
)
=>
set
Merchan
t
(
e
.
target
.
value
)}
label
=
"
Sản phẩm
"
value
=
{
produc
t
}
onChange
=
{(
e
)
=>
set
Produc
t
(
e
.
target
.
value
)}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
...
...
@@ -136,21 +130,22 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{
list
Merchan
t
.
map
((
e
)
=>
(
{
list
Produc
t
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
C
â
y
x
ă
ng
PT
thanh
to
á
n
<
/InputLabel
>
<
Select
label
=
"
Cây xăng
"
value
=
{
stor
e
}
onChange
=
{(
e
)
=>
set
Stor
e
(
e
.
target
.
value
)}
label
=
"
PT thanh toán
"
value
=
{
typ
e
}
onChange
=
{(
e
)
=>
set
Typ
e
(
e
.
target
.
value
)}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
...
...
@@ -159,13 +154,67 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{
listStore
.
map
((
e
)
=>
(
{[
{
id
:
'QR'
,
name
:
'QR'
,
},
{
id
:
'CASH'
,
name
:
'Tiền mặt'
,
},
{
id
:
'DEBT'
,
name
:
'Công nợ'
,
},
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Tr
ạ
ng
th
á
i
<
/InputLabel
>
<
Select
label
=
"Trạng thái"
value
=
{
status
}
onChange
=
{(
e
)
=>
setStatus
(
e
.
target
.
value
)}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
}}
>
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{[
{
name
:
'Chưa đối soát'
,
value
:
1
,
id
:
1
,
},
{
name
:
'Đang đối soát'
,
value
:
2
,
id
:
2
,
},
{
name
:
'Đã đối soát'
,
value
:
3
,
id
:
3
,
},
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
2
}
md
=
{
2
}
sm
=
{
3
}
xs
=
{
3
}
>
<
DateRange
date
=
{
startDate
}
changeDateRange
=
{
changeDateRange
}
...
...
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