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
8e228715
Commit
8e228715
authored
Sep 14, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
9b214793
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
739 additions
and
432 deletions
+739
-432
reconciliation.js
src/app/apis/Functions/reconciliation.js
+30
-0
url.js
src/app/apis/url.js
+6
-0
Data.js
src/app/assets/Data.js
+256
-0
translation.json
src/app/assets/languages/locates/vi/translation.json
+5
-2
Index.js
src/app/views/Reconciliation/Setting/Index.js
+36
-40
Table.js
src/app/views/Reconciliation/Setting/Table.js
+10
-70
Update.js
src/app/views/Reconciliation/Setting/Update.js
+140
-52
View.js
src/app/views/Reconciliation/Setting/View.js
+2
-36
Index.js
src/app/views/Reconciliation/Sheet/Index.js
+25
-67
Index.js
src/app/views/Reconciliation/Sheet/ListTrans/Index.js
+48
-42
Table.js
src/app/views/Reconciliation/Sheet/Table.js
+110
-63
Update.js
src/app/views/Reconciliation/Sheet/Update.js
+39
-12
View.js
src/app/views/Reconciliation/Sheet/View.js
+32
-48
No files found.
src/app/apis/Functions/reconciliation.js
View file @
8e228715
...
@@ -6,3 +6,33 @@ export const listTransReconciliation = async (body) =>
...
@@ -6,3 +6,33 @@ export const listTransReconciliation = async (body) =>
PostData
(
url
.
listTransReconciliation
,
body
)
PostData
(
url
.
listTransReconciliation
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
.
catch
((
err
)
=>
null
)
export
const
listSheetReconciliation
=
async
(
body
)
=>
PostData
(
url
.
listSheetReconciliation
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
listProviderSetting
=
async
(
body
)
=>
PostData
(
url
.
listProviderSetting
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
detailProviderSetting
=
async
(
id
,
body
)
=>
GetURL
(
`
${
url
.
detailProviderSetting
}
/
${
id
}
`
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
updateProviderSetting
=
async
(
body
)
=>
PostData
(
url
.
updateProviderSetting
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
detailSheetReconciliation
=
async
(
id
,
body
)
=>
GetURL
(
`
${
url
.
detailSheetReconciliation
}
/
${
id
}
`
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
updateSheetReconciliation
=
async
(
body
)
=>
PostData
(
url
.
updateSheetReconciliation
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/url.js
View file @
8e228715
...
@@ -120,6 +120,12 @@ export default {
...
@@ -120,6 +120,12 @@ export default {
//reconciliation
//reconciliation
listTransReconciliation
:
`
${
root
}
/paymentpartner/list/trans`
,
listTransReconciliation
:
`
${
root
}
/paymentpartner/list/trans`
,
listSheetReconciliation
:
`
${
root
}
/reconciliation/list`
,
detailSheetReconciliation
:
`
${
root
}
/reconciliation`
,
updateSheetReconciliation
:
`
${
root
}
/reconciliation/update`
,
listProviderSetting
:
`
${
root
}
/provider/paging/setting`
,
detailProviderSetting
:
`
${
root
}
/reconciliation/setting`
,
updateProviderSetting
:
`
${
root
}
/reconciliation/setting/create`
,
//Log
//Log
logAuth
:
`
${
root
}
/logging/listLogin`
,
logAuth
:
`
${
root
}
/logging/listLogin`
,
...
...
src/app/assets/Data.js
0 → 100644
View file @
8e228715
export
const
listHour
=
[
{
name
:
'00:00'
,
value
:
'00:00'
,
},
{
name
:
'01:00'
,
value
:
'01:00'
,
},
{
name
:
'02:00'
,
value
:
'02:00'
,
},
{
name
:
'03:00'
,
value
:
'03:00'
,
},
{
name
:
'04:00'
,
value
:
'04:00'
,
},
{
name
:
'05:00'
,
value
:
'05:00'
,
},
{
name
:
'06:00'
,
value
:
'06:00'
,
},
{
name
:
'07:00'
,
value
:
'07:00'
,
},
{
name
:
'08:00'
,
value
:
'08:00'
,
},
{
name
:
'09:00'
,
value
:
'09:00'
,
},
{
name
:
'10:00'
,
value
:
'10:00'
,
},
{
name
:
'11:00'
,
value
:
'11:00'
,
},
{
name
:
'12:00'
,
value
:
'12:00'
,
},
{
name
:
'13:00'
,
value
:
'13:00'
,
},
{
name
:
'14:00'
,
value
:
'14:00'
,
},
{
name
:
'15:00'
,
value
:
'15:00'
,
},
{
name
:
'16:00'
,
value
:
'16:00'
,
},
{
name
:
'17:00'
,
value
:
'17:00'
,
},
{
name
:
'18:00'
,
value
:
'18:00'
,
},
{
name
:
'19:00'
,
value
:
'19:00'
,
},
{
name
:
'20:00'
,
value
:
'20:00'
,
},
{
name
:
'21:00'
,
value
:
'21:00'
,
},
{
name
:
'22:00'
,
value
:
'22:00'
,
},
{
name
:
'23:00'
,
value
:
'23:00'
,
},
]
export
const
listWeek
=
[
{
name
:
'Thứ 2'
,
value
:
1
,
},
{
name
:
'Thứ 3'
,
value
:
2
,
},
{
name
:
'Thứ 4'
,
value
:
3
,
},
{
name
:
'Thứ 5'
,
value
:
4
,
},
{
name
:
'Thứ 6'
,
value
:
5
,
},
{
name
:
'Thứ 7'
,
value
:
6
,
},
{
name
:
'Chủ nhật'
,
value
:
7
,
},
]
export
const
listMonth
=
[
{
name
:
'Ngày 1'
,
value
:
1
,
},
{
name
:
'Ngày 2'
,
value
:
2
,
},
{
name
:
'Ngày 3'
,
value
:
3
,
},
{
name
:
'Ngày 4'
,
value
:
4
,
},
{
name
:
'Ngày 5'
,
value
:
5
,
},
{
name
:
'Ngày 6'
,
value
:
6
,
},
{
name
:
'Ngày 7'
,
value
:
7
,
},
{
name
:
'Ngày 8'
,
value
:
8
,
},
{
name
:
'Ngày 9'
,
value
:
9
,
},
{
name
:
'Ngày 10'
,
value
:
10
,
},
{
name
:
'Ngày 11'
,
value
:
11
,
},
{
name
:
'Ngày 12'
,
value
:
12
,
},
{
name
:
'Ngày 13'
,
value
:
13
,
},
{
name
:
'Ngày 14'
,
value
:
14
,
},
{
name
:
'Ngày 15'
,
value
:
15
,
},
{
name
:
'Ngày 16'
,
value
:
16
,
},
{
name
:
'Ngày 17'
,
value
:
17
,
},
{
name
:
'Ngày 18'
,
value
:
18
,
},
{
name
:
'Ngày 19'
,
value
:
19
,
},
{
name
:
'Ngày 20'
,
value
:
20
,
},
{
name
:
'Ngày 21'
,
value
:
21
,
},
{
name
:
'Ngày 22'
,
value
:
22
,
},
{
name
:
'Ngày 23'
,
value
:
23
,
},
{
name
:
'Ngày 24'
,
value
:
24
,
},
{
name
:
'Ngày 25'
,
value
:
25
,
},
{
name
:
'Ngày 26'
,
value
:
26
,
},
{
name
:
'Ngày 27'
,
value
:
27
,
},
{
name
:
'Ngày 28'
,
value
:
28
,
},
{
name
:
'Ngày 29'
,
value
:
29
,
},
{
name
:
'Ngày 30'
,
value
:
30
,
},
{
name
:
'Ngày 31'
,
value
:
31
,
},
]
src/app/assets/languages/locates/vi/translation.json
View file @
8e228715
...
@@ -354,7 +354,6 @@
...
@@ -354,7 +354,6 @@
"ERROR_NAME_IS_EXISTS"
:
"Tên sản phẩm đã tồn tại"
,
"ERROR_NAME_IS_EXISTS"
:
"Tên sản phẩm đã tồn tại"
,
"ERROR_MERCHAN_STORE_CODE_EXIST"
:
"Mã cây xăng đã tồn tại"
,
"ERROR_MERCHAN_STORE_CODE_EXIST"
:
"Mã cây xăng đã tồn tại"
,
"ERROR_CODE_IS_EXITS"
:
"Mã code đã tồn tại"
,
"ERROR_CODE_IS_EXITS"
:
"Mã code đã tồn tại"
,
"ERROR_NAME_IS_EXITS"
:
"Tên sản phẩm đã tồn tại"
,
"ERROR_NAME_IS_EXITS"
:
"Tên sản phẩm đã tồn tại"
,
"ERROR_MERCHAN_STORE_CODE"
:
"Mã cây xăng đã tồn tại"
,
"ERROR_MERCHAN_STORE_CODE"
:
"Mã cây xăng đã tồn tại"
,
...
@@ -364,8 +363,12 @@
...
@@ -364,8 +363,12 @@
"ERROR_NAME_PACKAGE_IS_EXITS"
:
"Tên gói đã tồn tại"
,
"ERROR_NAME_PACKAGE_IS_EXITS"
:
"Tên gói đã tồn tại"
,
"ERROR_NAME_FUNCTION_IS_EXITS"
:
"Tên chức năng đã tồn tại"
,
"ERROR_NAME_FUNCTION_IS_EXITS"
:
"Tên chức năng đã tồn tại"
,
"ERROR_USER_GROUP_EXISTS_DATA"
:
"Nhóm quyền đã có dữ liệu"
,
"ERROR_USER_GROUP_EXISTS_DATA"
:
"Nhóm quyền đã có dữ liệu"
,
"ERROR_DATE_INVALID"
:
"Thời gian không hợp lệ"
,
"ERROR_DATE_INVALID"
:
"Thời gian không hợp lệ"
"ERROR_NOT_PAYMENTGATE"
:
"chưa truyền code đối tác thanh toán"
,
"ERROR_FORMAT_HOUR"
:
"Sai định dang giờ"
,
"ERROR_FORMAT_DAYOFWEEK"
:
"Sai định dang ngày trong tuần"
,
"ERROR_FORMAT_DATEOFMONTH"
:
"Sai định dang ngày trong tháng"
}
}
src/app/views/Reconciliation/Setting/Index.js
View file @
8e228715
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
ToolUserView
from
'./View'
import
ToolUserView
from
'./View'
import
{
import
{
listProviderSetting
}
from
'app/apis/Functions/reconciliation'
getListSupplier
,
deleteSupplier
,
changeStatusSupplier
,
}
from
'app/apis/Functions/supplier'
import
{
useHistory
}
from
'react-router-dom'
import
{
useHistory
}
from
'react-router-dom'
import
KEY
from
'app/assets/Key'
import
KEY
from
'app/assets/Key'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
...
@@ -32,19 +28,19 @@ const ToolNotificate = (props) => {
...
@@ -32,19 +28,19 @@ const ToolNotificate = (props) => {
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
props
.
showLoading
()
//
props.showLoading()
const
res
=
await
changeStatusSupplier
({
id
,
status_id
})
//
const res = await changeStatusSupplier({ id, status_id })
props
.
hideLoading
()
//
props.hideLoading()
if
(
res
.
data
.
code
==
200
)
{
//
if (res.data.code == 200) {
getData
()
//
getData()
toast
.
success
(
'Thay đổi trạng thái thành công!'
,
{
//
toast.success('Thay đổi trạng thái thành công!', {
theme
:
'colored'
,
//
theme: 'colored',
})
//
})
}
else
{
//
} else {
toast
.
error
(
'Thay đổi trạng thái thất bại!'
,
{
//
toast.error('Thay đổi trạng thái thất bại!', {
theme
:
'colored'
,
//
theme: 'colored',
})
//
})
}
//
}
}
}
console
.
log
(
'user'
,
user
)
console
.
log
(
'user'
,
user
)
...
@@ -53,20 +49,20 @@ const ToolNotificate = (props) => {
...
@@ -53,20 +49,20 @@ const ToolNotificate = (props) => {
let
res
let
res
if
(
isInit
)
{
if
(
isInit
)
{
setPageIndex
(
0
)
setPageIndex
(
0
)
res
=
await
getListSupplier
({
res
=
await
listProviderSetting
({
provider_name
:
searchDebount
,
provider_name
:
searchDebount
,
page_no
:
0
,
page_no
:
0
,
page_size
:
pageSize
,
page_size
:
pageSize
,
status
,
status
,
type
:
3
,
//
type: 3,
})
})
}
else
{
}
else
{
res
=
await
getListSupplier
({
res
=
await
listProviderSetting
({
provider_name
:
searchDebount
,
provider_name
:
searchDebount
,
page_no
:
pageIndex
+
1
,
page_no
:
pageIndex
+
1
,
page_size
:
pageSize
,
page_size
:
pageSize
,
status
,
status
,
type
:
3
,
//
type: 3,
})
})
}
}
...
@@ -95,24 +91,24 @@ const ToolNotificate = (props) => {
...
@@ -95,24 +91,24 @@ const ToolNotificate = (props) => {
},
[
searchDebount
,
status
,
store
,
group
])
},
[
searchDebount
,
status
,
store
,
group
])
const
removeItem
=
async
(
id
)
=>
{
const
removeItem
=
async
(
id
)
=>
{
props
.
showLoading
()
//
props.showLoading()
const
res
=
await
deleteSupplier
({
id
})
//
const res = await deleteSupplier({ id })
props
.
hideLoading
()
//
props.hideLoading()
if
(
res
.
data
.
code
==
200
)
{
//
if (res.data.code == 200) {
getData
(
true
)
//
getData(true)
toast
.
success
(
'Xoá bản ghi thành công!'
,
{
//
toast.success('Xoá bản ghi thành công!', {
theme
:
'colored'
,
//
theme: 'colored',
})
//
})
}
else
if
(
res
.
data
.
code
==
401
)
{
//
} else if (res.data.code == 401) {
localStorage
.
removeItem
(
KEY
.
API_TOKEN
)
//
localStorage.removeItem(KEY.API_TOKEN)
setTimeout
(()
=>
{
//
setTimeout(() => {
history
.
push
(
'/'
)
//
history.push('/')
},
100
)
//
}, 100)
}
else
{
//
} else {
toast
.
error
(
'Xoá bản ghi thất bại!'
,
{
//
toast.error('Xoá bản ghi thất bại!', {
theme
:
'colored'
,
//
theme: 'colored',
})
//
})
}
//
}
}
}
return
(
return
(
...
...
src/app/views/Reconciliation/Setting/Table.js
View file @
8e228715
...
@@ -39,38 +39,31 @@ const columns = [
...
@@ -39,38 +39,31 @@ const columns = [
},
},
{
{
id
:
'provider_code'
,
id
:
'provider_code'
,
label
:
'
Mã nhà cung cấp
'
,
label
:
'
Đối tác
'
,
align
:
'center'
,
align
:
'center'
,
minWidth
:
150
,
minWidth
:
150
,
},
},
{
{
id
:
'
provider_name
'
,
id
:
'
type_comission
'
,
label
:
'
Tên nhà cung cấp
'
,
label
:
'
Loại hoa hồng
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
200
,
minWidth
:
200
,
},
},
{
{
id
:
'
phon
e'
,
id
:
'
type_Nam
e'
,
label
:
'
Số điện thoại
'
,
label
:
'
ĐVT
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
'auto'
,
minWidth
:
100
,
minWidth
:
100
,
},
},
{
{
id
:
'
email
'
,
id
:
'
reconciliation_cycle_name
'
,
label
:
'
Email
'
,
label
:
'
Chu ký đối soát
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
'auto'
,
minWidth
:
150
,
minWidth
:
150
,
},
},
{
id
:
'address'
,
label
:
'Địa chỉ'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
250
,
},
]
]
function
TableList
(
props
)
{
function
TableList
(
props
)
{
...
@@ -126,21 +119,11 @@ function TableList(props) {
...
@@ -126,21 +119,11 @@ function TableList(props) {
{
column
.
label
}
{
column
.
label
}
<
/TableCell
>
<
/TableCell
>
))}
))}
<
TableCell
style
=
{{
backgroundColor
:
colors
.
headerTable
,
width
:
145
,
}}
>
Tra
̣
ng
tha
́
i
<
/TableCell
>
<
TableCell
<
TableCell
style
=
{{
style
=
{{
textAlign
:
'center'
,
textAlign
:
'center'
,
backgroundColor
:
colors
.
headerTable
,
backgroundColor
:
colors
.
headerTable
,
width
:
12
0
,
width
:
6
0
,
}}
}}
>
>
H
à
nh
độ
ng
H
à
nh
độ
ng
...
@@ -178,53 +161,10 @@ function TableList(props) {
...
@@ -178,53 +161,10 @@ function TableList(props) {
<
/TableCell
>
<
/TableCell
>
)
)
})}
})}
<
TableCell
className
=
{
classes
.
border
}
>
<
Select
variant
=
{
'outlined'
}
labelId
=
"demo-simple-select-placeholder-label-label"
id
=
"demo-simple-select-placeholder-label"
onChange
=
{(
e
)
=>
handeChangeActive
(
row
.
id
,
e
.
target
.
value
)
}
displayEmpty
defaultValue
=
{
row
.
status
}
className
=
{
classes
.
formControl
}
>
<
MenuItem
value
=
{
1
}
>
Ho
ạ
t
độ
ng
<
/MenuItem
>
<
MenuItem
value
=
{
2
}
>
Kho
́
a
<
/MenuItem
>
<
/Select
>
<
/TableCell
>
<
TableCell
>
<
TableCell
>
{
checkRole
(
user
,
'/ncc/delete'
)
?
(
<
Tooltip
title
=
"Xoá"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Xóa NCC thiết bị'
,
content
:
`Bạn có muốn xóa NCC thiết bị
${
row
.
provider_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"Delete"
>
<
Icon
color
=
"error"
>
delete
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)
:
null
}
{
checkRole
(
{
checkRole
(
user
,
user
,
'/reconciliation/setting
/update
'
'/reconciliation/setting'
)
?
(
)
?
(
<
Tooltip
title
=
"Cập nhật"
>
<
Tooltip
title
=
"Cập nhật"
>
<
IconButton
<
IconButton
...
@@ -232,7 +172,7 @@ function TableList(props) {
...
@@ -232,7 +172,7 @@ function TableList(props) {
history
.
push
({
history
.
push
({
pathname
:
pathname
:
'/reconciliation/setting/update'
,
'/reconciliation/setting/update'
,
state
:
row
.
id
,
state
:
row
.
provider_code
,
})
})
}}
}}
className
=
{
classes
.
button
}
className
=
{
classes
.
button
}
...
...
src/app/views/Reconciliation/Setting/Update.js
View file @
8e228715
...
@@ -31,35 +31,71 @@ import {
...
@@ -31,35 +31,71 @@ import {
}
from
'app/config/Function'
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
import
{
detailSupplier
,
updateSupplier
}
from
'app/apis/Functions/supplier'
import
{
detailProviderSetting
,
updateProviderSetting
,
}
from
'app/apis/Functions/reconciliation'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
useAuth
from
'app/hooks/useAuth'
import
useAuth
from
'app/hooks/useAuth'
import
{
listHour
,
listMonth
,
listWeek
}
from
'app/assets/Data'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
location
=
useLocation
()
const
location
=
useLocation
()
const
[
image
,
setImage
]
=
useState
()
const
[
image
,
setImage
]
=
useState
()
const
{
user
}
=
useAuth
()
const
{
user
}
=
useAuth
()
const
[
type
,
setType
]
=
useState
(
'
percent
'
)
const
[
type
,
setType
]
=
useState
(
'
1
'
)
const
[
listMoney
,
setListMoney
]
=
useState
([
const
[
listMoney
,
setListMoney
]
=
useState
([
{
{
condition
:
0
,
condition
:
0
,
money
:
0
,
money
:
0
,
},
},
])
])
const
[
listTime
,
setListTime
]
=
useState
([])
const
[
date
,
setDate
]
=
useState
(
null
)
const
[
date
,
setDate
]
=
useState
(
null
)
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
useEffect
(()
=>
{
useEffect
(()
=>
{
getDataDefault
()
getDataDefault
()
},
[])
},
[])
useEffect
(()
=>
{
if
(
state
?.
reconciliationCycle
)
{
if
(
state
?.
reconciliationCycle
==
1
)
setListTime
(
listHour
)
if
(
state
?.
reconciliationCycle
==
2
)
setListTime
(
listWeek
)
if
(
state
?.
reconciliationCycle
==
3
)
setListTime
(
listMonth
)
}
},
[
state
?.
reconciliationCycle
])
const
history
=
useHistory
()
const
history
=
useHistory
()
const
getDataDefault
=
async
()
=>
{
const
getDataDefault
=
async
()
=>
{
props
.
showLoading
()
props
.
showLoading
()
try
{
try
{
const
res
=
await
detailSupplier
(
location
.
state
,
{})
const
res
=
await
detailProviderSetting
(
location
.
state
,
{})
setState
({
...
res
.
data
.
data
})
if
(
res
.
data
.
data
)
{
const
{
type
,
reconciliationCycle
,
reconciliationTime
,
dataSetting
,
}
=
res
.
data
.
data
setType
(
`
${
type
}
`
)
if
(
type
==
2
&&
dataSetting
)
{
const
newList
=
dataSetting
.
map
((
e
)
=>
{
return
{
condition
:
e
?.
value
,
money
:
e
?.
amountOfMoney
,
}
})
setListMoney
(
newList
)
setState
({
...
res
.
data
.
data
})
}
else
{
setState
({
...
res
.
data
.
data
,
percent
:
dataSetting
[
0
]?.
value
,
})
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
toast
.
error
(
t
(
err
),
{
toast
.
error
(
t
(
err
),
{
theme
:
'colored'
,
theme
:
'colored'
,
...
@@ -70,14 +106,36 @@ const SimpleForm = (props) => {
...
@@ -70,14 +106,36 @@ const SimpleForm = (props) => {
const
handleSubmit
=
async
(
event
)
=>
{
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
const
newValue
=
trimObject
(
state
)
const
listSetting
=
listMoney
.
map
((
e
)
=>
{
props
.
showLoading
()
return
{
const
res
=
await
updateSupplier
({
value
:
e
?.
condition
,
...
newValue
,
amountOfMoney
:
e
?.
money
,
}
})
})
props
.
showLoading
()
let
res
if
(
type
==
1
)
{
res
=
await
updateProviderSetting
({
idPartner
:
newValue
.
idPartner
,
type
:
parseInt
(
type
),
reconciliationCycle
:
newValue
?.
reconciliationCycle
,
reconciliationTime
:
newValue
?.
reconciliationTime
,
dataSetting
:
[
{
value
:
newValue
?.
percent
,
amountOfMoney
:
null
},
],
})
}
else
{
res
=
await
updateProviderSetting
({
idPartner
:
newValue
.
idPartner
,
type
:
parseInt
(
type
),
reconciliationCycle
:
newValue
?.
reconciliationCycle
,
reconciliationTime
:
newValue
?.
reconciliationTime
,
dataSetting
:
listSetting
,
})
}
props
.
hideLoading
()
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/
ncc
'
)
history
.
push
(
'/
reconciliation/setting
'
)
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Cập nhật nhà cung cấp thiết bị thành công!'
,
{
toast
.
success
(
'Cập nhật nhà cung cấp thiết bị thành công!'
,
{
theme
:
'colored'
,
theme
:
'colored'
,
...
@@ -91,11 +149,21 @@ const SimpleForm = (props) => {
...
@@ -91,11 +149,21 @@ const SimpleForm = (props) => {
}
}
const
handleChange
=
(
event
)
=>
{
const
handleChange
=
(
event
)
=>
{
console
.
log
(
'event.target.name'
,
event
.
target
.
name
)
event
.
persist
()
event
.
persist
()
setState
({
...
state
,
if
(
event
.
target
.
name
==
'reconciliationCycle'
)
{
[
event
.
target
.
name
]:
event
.
target
.
value
,
setState
({
})
...
state
,
reconciliationTime
:
'0'
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
else
{
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
}
}
const
handleChangeList
=
(
event
,
index
)
=>
{
const
handleChangeList
=
(
event
,
index
)
=>
{
event
.
persist
()
event
.
persist
()
...
@@ -104,8 +172,6 @@ const SimpleForm = (props) => {
...
@@ -104,8 +172,6 @@ const SimpleForm = (props) => {
event
.
target
.
name
==
'money'
||
event
.
target
.
name
==
'money'
||
event
.
target
.
name
==
'length'
event
.
target
.
name
==
'length'
)
{
)
{
console
.
log
(
'hêlo'
,
event
.
target
.
name
)
console
.
log
(
'value'
,
event
.
target
.
value
)
const
inputValue
=
event
.
target
.
value
const
inputValue
=
event
.
target
.
value
// Kiểm tra nếu input là số nguyên hoặc số thập phân
// Kiểm tra nếu input là số nguyên hoặc số thập phân
const
regex
=
/^-
?\d
*
\.?\d
*$/
const
regex
=
/^-
?\d
*
\.?\d
*$/
...
@@ -159,7 +225,19 @@ const SimpleForm = (props) => {
...
@@ -159,7 +225,19 @@ const SimpleForm = (props) => {
}
}
}
}
const
{
provider_code
,
provider_name
,
phone
,
email
,
merchant_id
}
=
state
const
{
provider_code
,
provider_name
,
phone
,
email
,
merchant_id
,
idPartner
,
reconciliationCycle
,
reconciliationTime
,
percent
,
}
=
state
console
.
log
(
'reconciliationTime'
,
reconciliationTime
)
return
(
return
(
<
div
className
=
"m-sm-30"
>
<
div
className
=
"m-sm-30"
>
<
div
className
=
"mb-sm-30"
>
<
div
className
=
"mb-sm-30"
>
...
@@ -182,15 +260,10 @@ const SimpleForm = (props) => {
...
@@ -182,15 +260,10 @@ const SimpleForm = (props) => {
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Đối tác"
label
=
"Đối tác"
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"
provider_code
"
name
=
"
idPartner
"
disabled
=
{
true
}
disabled
=
{
true
}
value
=
{
provider_code
||
''
}
value
=
{
idPartner
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
<
Grid
...
@@ -210,7 +283,7 @@ const SimpleForm = (props) => {
...
@@ -210,7 +283,7 @@ const SimpleForm = (props) => {
}}
}}
>
>
<
FormControlLabel
<
FormControlLabel
value
=
{
'
percent
'
}
value
=
{
'
1
'
}
control
=
{
<
Radio
/>
}
control
=
{
<
Radio
/>
}
label
=
"Theo %"
label
=
"Theo %"
style
=
{{
style
=
{{
...
@@ -218,14 +291,14 @@ const SimpleForm = (props) => {
...
@@ -218,14 +291,14 @@ const SimpleForm = (props) => {
}}
}}
/
>
/
>
<
FormControlLabel
<
FormControlLabel
value
=
{
'
cost
'
}
value
=
{
'
2
'
}
control
=
{
<
Radio
/>
}
control
=
{
<
Radio
/>
}
label
=
"Số tiền cố định"
label
=
"Số tiền cố định"
/>
/>
<
/RadioGroup
>
<
/RadioGroup
>
<
/Grid
>
<
/Grid
>
{
type
==
'
percent
'
?
(
{
type
==
'
1
'
?
(
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
...
@@ -233,8 +306,8 @@ const SimpleForm = (props) => {
...
@@ -233,8 +306,8 @@ const SimpleForm = (props) => {
label
=
"Giá trị (%)"
label
=
"Giá trị (%)"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"p
rovider_code
"
name
=
"p
ercent
"
value
=
{
p
rovider_code
||
''
}
value
=
{
p
ercent
||
''
}
validators
=
{[
'required'
]}
validators
=
{[
'required'
]}
errorMessages
=
{[
errorMessages
=
{[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
...
@@ -361,16 +434,29 @@ const SimpleForm = (props) => {
...
@@ -361,16 +434,29 @@ const SimpleForm = (props) => {
variant
=
{
'outlined'
}
variant
=
{
'outlined'
}
label
=
{
'Chu kỳ đối soát *'
}
label
=
{
'Chu kỳ đối soát *'
}
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
value
=
{
merchant_id
||
''
}
value
=
{
reconciliationCycle
||
''
}
displayEmpty
displayEmpty
name
=
"
merchant_id
"
name
=
"
reconciliationCycle
"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
validators
=
{[
'required'
]}
errorMessages
=
{[
errorMessages
=
{[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
]}
]}
>
>
{[].
map
((
e
)
=>
(
{[
{
name
:
'Hàng ngày'
,
id
:
1
,
},
{
name
:
'Hàng tuần'
,
id
:
2
,
},
{
name
:
'Hàng tháng'
,
id
:
3
,
},
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
{
e
.
name
}
<
/MenuItem
>
<
/MenuItem
>
...
@@ -378,27 +464,29 @@ const SimpleForm = (props) => {
...
@@ -378,27 +464,29 @@ const SimpleForm = (props) => {
<
/SelectValidator
>
<
/SelectValidator
>
<
/Grid
>
<
/Grid
>
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
{
reconciliationTime
&&
(
<
SelectValidator
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
variant
=
{
'outlined'
}
<
SelectValidator
label
=
{
'Thời điểm đối soát *'
}
variant
=
{
'outlined'
}
className
=
"mb-4 w-full"
label
=
{
'Thời điểm đối soát *'
}
value
=
{
merchant_id
||
''
}
className
=
"mb-4 w-full"
displayEmpty
value
=
{
reconciliationTime
||
''
}
name
=
"merchant_id"
displayEmpty
onChange
=
{
handleChange
}
name
=
"reconciliationTime"
validators
=
{[
'required'
]}
onChange
=
{
handleChange
}
errorMessages
=
{[
validators
=
{[
'required'
]}
'Không được để trống trường này'
,
errorMessages
=
{[
]}
'Không được để trống trường này'
,
>
]}
{[].
map
((
e
)
=>
(
>
<
MenuItem
value
=
{
e
.
id
}
>
{
listTime
.
map
((
e
)
=>
(
{
e
.
name
}
<
MenuItem
value
=
{
e
.
value
}
>
<
/MenuItem
>
{
e
.
name
}
))}
<
/MenuItem
>
<
/SelectValidator
>
))}
<
/Grid
>
<
/SelectValidator
>
<
/Grid
>
)}
<
/Grid
>
<
/Grid
>
<
Grid
<
Grid
style
=
{{
marginTop
:
20
}}
style
=
{{
marginTop
:
20
}}
...
...
src/app/views/Reconciliation/Setting/View.js
View file @
8e228715
...
@@ -79,11 +79,12 @@ function CustomerView(props) {
...
@@ -79,11 +79,12 @@ function CustomerView(props) {
sm
=
{
8
}
sm
=
{
8
}
xs
=
{
8
}
xs
=
{
8
}
>
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextField
<
TextField
variant
=
"outlined"
variant
=
"outlined"
className
=
"w-full"
className
=
"w-full"
label
=
"Nhập từ khoá"
label
=
"Nhập từ khoá"
fullWidth
onChange
=
{(
e
)
=>
{
onChange
=
{(
e
)
=>
{
const
text
=
e
.
target
.
value
const
text
=
e
.
target
.
value
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -92,41 +93,6 @@ function CustomerView(props) {
...
@@ -92,41 +93,6 @@ function CustomerView(props) {
}}
}}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
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
>
{[
{
id
:
1
,
name
:
'Hoạt động'
,
},
{
id
:
2
,
name
:
'Khoá'
,
},
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
{
/* {checkRole(user, '/reconciliation/setting/create') ? (
{
/* {checkRole(user, '/reconciliation/setting/create') ? (
<Link to="/reconciliation/setting/create">
<Link to="/reconciliation/setting/create">
...
...
src/app/views/Reconciliation/Sheet/Index.js
View file @
8e228715
import
React
,
{
useState
,
useEffect
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
LogAuth
from
'./View'
import
LogAuth
from
'./View'
import
{
list
Transaction
}
from
'app/apis/Functions/transac
tion'
import
{
list
SheetReconciliation
}
from
'app/apis/Functions/reconcilia
tion'
import
{
useHistory
}
from
'react-router-dom'
import
{
useHistory
}
from
'react-router-dom'
import
{
toPriceVnd
,
convertDate
}
from
'app/config/Function'
import
{
toPriceVnd
,
convertDate
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
...
@@ -8,7 +8,7 @@ import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
...
@@ -8,7 +8,7 @@ import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdownMerchant
,
dropdown
Store
}
from
'app/apis/Functions/dropdown'
import
{
dropdownMerchant
,
dropdown
Provider
}
from
'app/apis/Functions/dropdown'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
...
@@ -22,15 +22,13 @@ const ToolNotificate = (props) => {
...
@@ -22,15 +22,13 @@ const ToolNotificate = (props) => {
const
[
endDate
,
setEndDate
]
=
useState
()
const
[
endDate
,
setEndDate
]
=
useState
()
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
type
,
setType
]
=
useState
()
const
[
listType
,
setListType
]
=
useState
([])
const
[
status
,
setStatus
]
=
useState
()
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
listProvide
,
setListProvide
]
=
useState
([])
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
provide
,
setProvide
]
=
useState
()
const
[
store
,
setStore
]
=
useState
()
const
[
listStore
,
setListStore
]
=
useState
([])
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
Merchant
()
getData
Dropdown
()
},
[])
},
[])
const
changeDateRange
=
(
start
,
end
)
=>
{
const
changeDateRange
=
(
start
,
end
)
=>
{
...
@@ -43,32 +41,24 @@ const ToolNotificate = (props) => {
...
@@ -43,32 +41,24 @@ const ToolNotificate = (props) => {
let
res
let
res
if
(
init
)
{
if
(
init
)
{
setPageIndex
(
0
)
setPageIndex
(
0
)
res
=
await
list
Transac
tion
({
res
=
await
list
SheetReconcilia
tion
({
order_code
:
searchDebount
,
order_code
:
searchDebount
,
applications
,
page_no
:
0
,
page_no
:
0
,
page_size
:
pageSize
,
page_size
:
pageSize
,
from_date
:
startDate
?
convertDate
(
startDate
)
:
null
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
to_date
:
endDate
?
convertDate
(
endDate
)
:
null
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
type_code
:
type
,
status
:
status
?
status
:
0
,
merchant_id
:
merchant
,
idPaymentPartner
:
provide
?
provide
:
null
,
store_id
:
store
,
// gasoline_id: '57dd1a73-d847-4d73-9791-08dc0841e7a9',
})
})
}
else
{
}
else
{
res
=
await
list
Transac
tion
({
res
=
await
list
SheetReconcilia
tion
({
order_code
:
searchDebount
,
order_code
:
searchDebount
,
applications
,
page_no
:
pageIndex
+
1
,
page_no
:
pageIndex
+
1
,
page_size
:
pageSize
,
page_size
:
pageSize
,
from_date
:
startDate
?
convertDate
(
startDate
)
:
null
,
from_date
:
startDate
?
convertDate
(
startDate
)
:
null
,
to_date
:
endDate
?
convertDate
(
endDate
)
:
null
,
to_date
:
endDate
?
convertDate
(
endDate
)
:
null
,
type_code
:
type
,
status
:
status
?
status
:
0
,
merchant_id
:
merchant
,
idPaymentPartner
:
provide
?
provide
:
null
,
store_id
:
store
,
// gasoline_id: '57dd1a73-d847-4d73-9791-08dc0841e7a9',
})
})
}
}
...
@@ -96,43 +86,15 @@ const ToolNotificate = (props) => {
...
@@ -96,43 +86,15 @@ const ToolNotificate = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
(
true
)
getData
(
true
)
},
[
searchDebount
,
startDate
,
type
,
merchant
,
store
])
},
[
searchDebount
,
startDate
,
status
,
provide
])
useEffect
(()
=>
{
if
(
merchant
)
{
getDropdownStore
(
merchant
)
}
setStore
()
},
[
merchant
])
const
getDataMerchant
=
async
()
=>
{
const
res
=
await
dropdownMerchant
({})
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'
,
})
}
}
const
getDropdownStore
=
async
(
id
)
=>
{
const
res
=
await
dropdownStore
(
id
)
const
getDataDropdown
=
async
()
=>
{
const
res
=
await
dropdownProvider
({})
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
'res.data.data'
,
res
.
data
.
data
)
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
store_name
}
return
{
...
e
,
id
:
e
.
code
}
})
setListStore
(
newList
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
})
setListProvide
(
newList
)
}
}
}
}
...
@@ -147,15 +109,11 @@ const ToolNotificate = (props) => {
...
@@ -147,15 +109,11 @@ const ToolNotificate = (props) => {
applications
=
{
applications
}
applications
=
{
applications
}
startDate
=
{
startDate
}
startDate
=
{
startDate
}
changeDateRange
=
{
changeDateRange
}
changeDateRange
=
{
changeDateRange
}
type
=
{
type
}
listProvide
=
{
listProvide
}
setType
=
{
setType
}
provide
=
{
provide
}
listType
=
{
listType
}
setProvide
=
{
setProvide
}
merchant
=
{
merchant
}
status
=
{
status
}
setMerchant
=
{
setMerchant
}
setStatus
=
{
setStatus
}
listMerchant
=
{
listMerchant
}
store
=
{
store
}
setStore
=
{
setStore
}
listStore
=
{
listStore
}
/
>
/
>
)
)
}
}
...
...
src/app/views/Reconciliation/Sheet/ListTrans/Index.js
View file @
8e228715
...
@@ -39,49 +39,55 @@ const ToolNotificate = (props) => {
...
@@ -39,49 +39,55 @@ const ToolNotificate = (props) => {
}
}
const
getData
=
async
(
init
)
=>
{
const
getData
=
async
(
init
)
=>
{
props
.
showLoading
()
if
(
props
?.
idReconciliation
)
{
let
res
props
.
showLoading
()
if
(
init
)
{
let
res
setPageIndex
(
0
)
if
(
init
)
{
res
=
await
listTransReconciliation
({
setPageIndex
(
0
)
page_no
:
0
,
res
=
await
listTransReconciliation
({
page_size
:
pageSize
,
page_no
:
0
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
page_size
:
pageSize
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
product_code
:
null
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
payment_gate_code
:
null
,
product_code
:
null
,
statusReconciliation
:
0
,
payment_gate_code
:
null
,
type_payment
:
null
,
statusReconciliation
:
0
,
})
type_payment
:
null
,
}
else
{
idReconciliation
:
props
?.
idReconciliation
,
res
=
await
listTransReconciliation
({
is_reconciliation
:
true
,
page_no
:
pageIndex
+
1
,
})
page_size
:
pageSize
,
}
else
{
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
res
=
await
listTransReconciliation
({
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
page_no
:
pageIndex
+
1
,
product_code
:
null
,
page_size
:
pageSize
,
payment_gate_code
:
null
,
date_from
:
startDate
?
convertDate
(
startDate
)
:
null
,
statusReconciliation
:
0
,
date_to
:
endDate
?
convertDate
(
endDate
)
:
null
,
type_payment
:
null
,
product_code
:
null
,
})
payment_gate_code
:
null
,
}
statusReconciliation
:
0
,
type_payment
:
null
,
idReconciliation
:
props
?.
idReconciliation
,
is_reconciliation
:
true
,
})
}
props
.
hideLoading
()
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
' res.data.data'
,
res
.
data
.
data
)
console
.
log
(
' res.data.data'
,
res
.
data
.
data
)
const
newList
=
res
.
data
.
data
?.
data
?.
map
((
e
,
i
)
=>
{
const
newList
=
res
.
data
.
data
?.
data
?.
map
((
e
,
i
)
=>
{
return
{
...
e
,
index
:
i
+
1
+
pageIndex
*
pageSize
}
return
{
...
e
,
index
:
i
+
1
+
pageIndex
*
pageSize
}
})
})
setData
(
newList
)
setData
(
newList
)
setTotalRecord
(
res
.
data
.
data
.
total_elements
)
setTotalRecord
(
res
.
data
.
data
.
total_elements
)
}
else
if
(
res
.
data
.
code
==
401
)
{
}
else
if
(
res
.
data
.
code
==
401
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
}
}
}
...
...
src/app/views/Reconciliation/Sheet/Table.js
View file @
8e228715
...
@@ -12,13 +12,17 @@ import {
...
@@ -12,13 +12,17 @@ import {
MenuItem
,
MenuItem
,
Tooltip
,
Tooltip
,
Icon
,
Icon
,
Typography
,
}
from
'@material-ui/core'
}
from
'@material-ui/core'
import
EditIcon
from
'@material-ui/icons/Edit'
import
EditIcon
from
'@material-ui/icons/Edit'
import
DeleteIcon
from
'@material-ui/icons/Delete'
import
DeleteIcon
from
'@material-ui/icons/Delete'
import
colors
from
'app/assets/Color'
import
colors
from
'app/assets/Color'
import
useStyles
from
'app/styles/Table'
import
useStyles
from
'app/styles/Table'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
toPriceVnd
}
from
'app/config/Function'
import
{
checkRole
}
from
'app/config/Function'
import
useAuth
from
'app/hooks/useAuth'
import
{
useHistory
}
from
'react-router-dom'
const
columns
=
[
const
columns
=
[
{
{
id
:
'index'
,
id
:
'index'
,
...
@@ -26,73 +30,44 @@ const columns = [
...
@@ -26,73 +30,44 @@ const columns = [
align
:
'center'
,
align
:
'center'
,
minWidth
:
80
,
minWidth
:
80
,
},
},
{
{
id
:
'
store_nam
e'
,
id
:
'
cod
e'
,
label
:
'
Cây xăng
'
,
label
:
'
Mã phiếu đối soát
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
160
,
minWidth
:
160
,
},
},
// {
// id: 'application',
// label: 'Mã NV',
// align: 'left',
// minWidth: 140,
// },
{
{
id
:
'
order_code
'
,
id
:
'
idPaymentPartner
'
,
label
:
'
Mã hoá đơn
'
,
label
:
'
Đối tác
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
160
,
minWidth
:
80
,
},
{
id
:
'created_date'
,
label
:
'Ngày giao dịch'
,
align
:
'left'
,
minWidth
:
110
,
},
},
// {
// id: 'IP',
// label: 'Loại nhiên liệu',
// align: 'left',
// minWidth: 140,
// },
{
{
id
:
'
product_nam
e'
,
id
:
'
create_dat
e'
,
label
:
'
Sản phẩm
'
,
label
:
'
Ngày tạo phiếu
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
1
2
0
,
minWidth
:
1
1
0
,
},
},
{
{
id
:
'u
nit_pric
e'
,
id
:
'u
pdate_dat
e'
,
label
:
'
Đơn giá
'
,
label
:
'
Ngày cập nhật
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
8
0
,
minWidth
:
11
0
,
},
},
{
{
id
:
'
quantity
'
,
id
:
'
date_reconciliation
'
,
label
:
'
Lượng nhiên liệu
'
,
label
:
'
Ngày đối soát
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
8
0
,
minWidth
:
11
0
,
},
},
{
{
id
:
'
price
'
,
id
:
'
totalCommission
'
,
label
:
'
Thành tiền
'
,
label
:
'
Hoa hồng
'
,
align
:
'left'
,
align
:
'left'
,
minWidth
:
80
,
minWidth
:
80
,
},
isMonney
:
true
,
{
id
:
'type_payment'
,
label
:
'Phương thức thanh toán'
,
align
:
'left'
,
minWidth
:
100
,
},
{
id
:
'status_text'
,
label
:
'Trạng thái'
,
align
:
'left'
,
minWidth
:
100
,
},
},
]
]
...
@@ -109,14 +84,26 @@ function TableList(props) {
...
@@ -109,14 +84,26 @@ function TableList(props) {
pageIndex
,
pageIndex
,
totalRecords
,
totalRecords
,
}
=
props
}
=
props
let
history
=
useHistory
()
const
handleChangePage
=
(
event
,
newPage
)
=>
{
const
handleChangePage
=
(
event
,
newPage
)
=>
{
setPageIndex
(
newPage
)
setPageIndex
(
newPage
)
}
}
const
handleChangeRowsPerPage
=
(
event
)
=>
{
const
handleChangeRowsPerPage
=
(
event
)
=>
{
setPageSize
(
event
.
target
.
value
)
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'
}
const
{
user
}
=
useAuth
()
return
(
return
(
<
Paper
className
=
{
classes
.
root
}
>
<
Paper
className
=
{
classes
.
root
}
>
<
TableContainer
className
=
{
classes
.
container
}
>
<
TableContainer
className
=
{
classes
.
container
}
>
...
@@ -135,6 +122,23 @@ function TableList(props) {
...
@@ -135,6 +122,23 @@ function TableList(props) {
{
column
.
label
}
{
column
.
label
}
<
/TableCell
>
<
/TableCell
>
))}
))}
<
TableCell
style
=
{{
width
:
110
,
backgroundColor
:
colors
.
headerTable
,
}}
>
Tr
ạ
ng
th
á
i
<
/TableCell
>
<
TableCell
style
=
{{
textAlign
:
'center'
,
backgroundColor
:
colors
.
headerTable
,
width
:
60
,
}}
>
H
à
nh
độ
ng
<
/TableCell
>
<
/TableRow
>
<
/TableRow
>
<
/TableHead
>
<
/TableHead
>
<
TableBody
className
=
{
classes
.
columnTable
}
>
<
TableBody
className
=
{
classes
.
columnTable
}
>
...
@@ -147,28 +151,71 @@ function TableList(props) {
...
@@ -147,28 +151,71 @@ function TableList(props) {
key
=
{
row
.
id
}
key
=
{
row
.
id
}
>
>
{
columns
.
map
((
column
)
=>
{
{
columns
.
map
((
column
)
=>
{
const
avatar
=
row
[
column
.
id
]
const
data
=
row
[
column
.
id
]
return
(
return
(
<
TableCell
<
TableCell
key
=
{
column
.
id
}
key
=
{
column
.
id
}
align
=
{
column
.
align
}
align
=
{
column
.
align
}
style
=
{{
textAlign
:
column
.
id
===
'index'
?
'center'
:
typeof
data
==
'string'
?
'left'
:
'right'
,
}}
>
>
{
column
.
format
?
(
{
column
.
isMonney
<
img
?
toPriceVnd
(
data
)
src
=
{
column
.
format
(
:
data
}
avatar
)}
className
=
{
classes
.
image
}
/
>
)
:
(
avatar
)}
<
/TableCell
>
<
/TableCell
>
)
)
})}
})}
<
TableCell
style
=
{{
textAlign
:
'center'
,
}}
>
<
Typography
style
=
{{
padding
:
5
,
backgroundColor
:
renderStatusBg
(
row
?.
status
),
color
:
renderStatusColor
(
row
?.
status
),
borderRadius
:
10
,
}}
>
{
row
?.
status_name
}
<
/Typography
>
<
/TableCell
>
<
TableCell
>
{
checkRole
(
user
,
'/reconciliation/sheet'
)
?
(
<
Tooltip
title
=
"Cập nhật"
>
<
IconButton
onClick
=
{()
=>
{
history
.
push
({
pathname
:
'/reconciliation/sheet/update'
,
state
:
row
.
id
,
})
}}
className
=
{
classes
.
button
}
aria
-
label
=
"edit"
>
<
Icon
color
=
"primary"
>
edit
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)
:
null
}
<
/TableCell
>
<
/TableRow
>
<
/TableRow
>
)
)
})}
})}
...
...
src/app/views/Reconciliation/Sheet/Update.js
View file @
8e228715
...
@@ -14,7 +14,7 @@ import {
...
@@ -14,7 +14,7 @@ import {
TextField
,
TextField
,
Icon
,
Icon
,
}
from
'@material-ui/core'
}
from
'@material-ui/core'
import
{
createFunction
}
from
'app/apis/Functions/function'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
...
@@ -28,27 +28,51 @@ import {
...
@@ -28,27 +28,51 @@ import {
dropdownStore
,
dropdownStore
,
}
from
'app/apis/Functions/dropdown'
}
from
'app/apis/Functions/dropdown'
import
PickerImage
from
'app/components/Input/PickerImage'
import
PickerImage
from
'app/components/Input/PickerImage'
import
{
createSupplier
}
from
'app/apis/Functions/supplier'
import
{
detailSheetReconciliation
,
updateSheetReconciliation
,
}
from
'app/apis/Functions/reconciliation'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
useAuth
from
'app/hooks/useAuth'
import
useAuth
from
'app/hooks/useAuth'
import
ListTrans
from
'./ListTrans/Index'
import
ListTrans
from
'./ListTrans/Index'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
location
=
useLocation
()
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
listAction
,
setListAction
]
=
useState
([])
const
[
listAction
,
setListAction
]
=
useState
([])
useEffect
(()
=>
{
getDataDefault
()
},
[])
const
{
user
}
=
useAuth
()
const
{
user
}
=
useAuth
()
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
history
=
useHistory
()
const
history
=
useHistory
()
const
getDataDefault
=
async
()
=>
{
props
.
showLoading
()
try
{
const
res
=
await
detailSheetReconciliation
(
location
.
state
,
{})
if
(
res
.
data
.
data
)
{
setState
({
...
res
.
data
.
data
})
}
}
catch
(
err
)
{
toast
.
error
(
t
(
err
),
{
theme
:
'colored'
,
})
}
props
.
hideLoading
()
}
const
handleSubmit
=
async
(
event
)
=>
{
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
createSupplier
({
const
res
=
await
updateSheetReconciliation
({
...
newValue
,
...
newValue
,
type
:
'3'
,
type
:
'3'
,
status
:
1
,
status
:
1
,
...
@@ -76,8 +100,8 @@ const SimpleForm = (props) => {
...
@@ -76,8 +100,8 @@ const SimpleForm = (props) => {
[
event
.
target
.
name
]:
event
.
target
.
value
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
})
}
}
console
.
log
(
'state'
,
state
)
const
{
provider_code
,
provider_name
,
phone
,
email
,
address
}
=
state
const
{
code
,
idPaymentPartner
,
note
}
=
state
return
(
return
(
<
div
className
=
"m-sm-30"
>
<
div
className
=
"m-sm-30"
>
<
div
className
=
"mb-sm-30"
>
<
div
className
=
"mb-sm-30"
>
...
@@ -139,8 +163,8 @@ const SimpleForm = (props) => {
...
@@ -139,8 +163,8 @@ const SimpleForm = (props) => {
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
disabled
=
{
true
}
disabled
=
{
true
}
type
=
"text"
type
=
"text"
name
=
"
provider_
code"
name
=
"code"
value
=
{
provider_
code
||
''
}
value
=
{
code
||
''
}
validators
=
{[
'required'
]}
validators
=
{[
'required'
]}
errorMessages
=
{[
errorMessages
=
{[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
...
@@ -155,8 +179,8 @@ const SimpleForm = (props) => {
...
@@ -155,8 +179,8 @@ const SimpleForm = (props) => {
disabled
=
{
true
}
disabled
=
{
true
}
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"
provider_code
"
name
=
"
idPaymentPartner
"
value
=
{
provider_code
||
''
}
value
=
{
idPaymentPartner
||
''
}
validators
=
{[
'required'
]}
validators
=
{[
'required'
]}
errorMessages
=
{[
errorMessages
=
{[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
...
@@ -171,8 +195,8 @@ const SimpleForm = (props) => {
...
@@ -171,8 +195,8 @@ const SimpleForm = (props) => {
label
=
"Ghi chú"
label
=
"Ghi chú"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"
address
"
name
=
"
note
"
value
=
{
address
||
''
}
value
=
{
note
||
''
}
/
>
/
>
<
/Grid
>
<
/Grid
>
...
@@ -185,7 +209,10 @@ const SimpleForm = (props) => {
...
@@ -185,7 +209,10 @@ const SimpleForm = (props) => {
container
container
spacing
=
{
2
}
spacing
=
{
2
}
>
>
<
ListTrans
isDetail
=
{
false
}
/
>
<
ListTrans
isDetail
=
{
false
}
idReconciliation
=
{
location
.
state
}
/
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/ValidatorForm
>
<
/ValidatorForm
>
...
...
src/app/views/Reconciliation/Sheet/View.js
View file @
8e228715
...
@@ -33,15 +33,12 @@ function CustomerView(props) {
...
@@ -33,15 +33,12 @@ function CustomerView(props) {
applications
,
applications
,
startDate
,
startDate
,
changeDateRange
,
changeDateRange
,
type
,
setType
,
status
,
listType
,
setStatus
,
listMerchant
,
provide
,
setMerchant
,
setProvide
,
merchant
,
listProvide
,
store
,
setStore
,
listStore
,
}
=
props
}
=
props
const
handleChange
=
(
event
)
=>
{
const
handleChange
=
(
event
)
=>
{
...
@@ -71,7 +68,7 @@ function CustomerView(props) {
...
@@ -71,7 +68,7 @@ function CustomerView(props) {
container
container
spacing
=
{
3
}
spacing
=
{
3
}
>
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
4
}
xs
=
{
4
}
>
<
TextField
<
TextField
variant
=
"outlined"
variant
=
"outlined"
className
=
"w-full"
className
=
"w-full"
...
@@ -86,12 +83,12 @@ function CustomerView(props) {
...
@@ -86,12 +83,12 @@ function CustomerView(props) {
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Ph
ươ
ng
th
ứ
c
thanh
to
á
n
Tr
ạ
ng
th
á
i
<
/InputLabel
>
<
/InputLabel
>
<
Select
<
Select
label
=
"
Phương thức thanh toán
"
label
=
"
Trạng thái
"
value
=
{
type
}
value
=
{
status
}
onChange
=
{(
e
)
=>
set
Type
(
e
.
target
.
value
)}
onChange
=
{(
e
)
=>
set
Status
(
e
.
target
.
value
)}
inputProps
=
{{
inputProps
=
{{
name
:
'age'
,
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
id
:
'outlined-age-native-simple'
,
...
@@ -102,16 +99,25 @@ function CustomerView(props) {
...
@@ -102,16 +99,25 @@ function CustomerView(props) {
<
/MenuItem
>
<
/MenuItem
>
{[
{[
{
{
id
:
'QR'
,
name
:
'Nháp'
,
name
:
'QR'
,
value
:
1
,
id
:
1
,
},
{
name
:
'Chưa đối soát'
,
value
:
2
,
id
:
2
,
},
},
{
{
id
:
'CASH'
,
name
:
'Đang đối soát'
,
name
:
'Tiền mặt'
,
value
:
3
,
id
:
3
,
},
},
{
{
id
:
'DEBT'
,
name
:
'Đã đối soát'
,
name
:
'Công nợ'
,
value
:
4
,
id
:
4
,
},
},
].
map
((
e
)
=>
(
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
...
@@ -122,35 +128,12 @@ function CustomerView(props) {
...
@@ -122,35 +128,12 @@ function CustomerView(props) {
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Ph
á
p
nh
â
n
Đố
i
t
á
c
<
/InputLabel
>
<
Select
label
=
"Pháp nhân"
value
=
{
merchant
}
onChange
=
{(
e
)
=>
setMerchant
(
e
.
target
.
value
)}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
}}
>
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{
listMerchant
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
C
â
y
x
ă
ng
<
/InputLabel
>
<
/InputLabel
>
<
Select
<
Select
label
=
"
Cây xăng
"
label
=
"
Đối tác
"
value
=
{
stor
e
}
value
=
{
provid
e
}
onChange
=
{(
e
)
=>
set
Stor
e
(
e
.
target
.
value
)}
onChange
=
{(
e
)
=>
set
Provid
e
(
e
.
target
.
value
)}
inputProps
=
{{
inputProps
=
{{
name
:
'age'
,
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
id
:
'outlined-age-native-simple'
,
...
@@ -159,12 +142,13 @@ function CustomerView(props) {
...
@@ -159,12 +142,13 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
<
/MenuItem
>
{
list
Stor
e
.
map
((
e
)
=>
(
{
list
Provid
e
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
))}
<
/Select
>
<
/Select
>
<
/FormControl
>
<
/FormControl
>
<
/Grid
>
<
/Grid
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
3
}
xs
=
{
3
}
>
<
DateRange
<
DateRange
date
=
{
startDate
}
date
=
{
startDate
}
...
...
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