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
9d88a399
Commit
9d88a399
authored
Jul 10, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update build
parent
beaf9b04
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
816 additions
and
249 deletions
+816
-249
dropdown.js
src/app/apis/Functions/dropdown.js
+2
-2
landingpage.js
src/app/apis/Functions/landingpage.js
+15
-0
url.js
src/app/apis/url.js
+5
-1
Create.js
src/app/views/landingpage/package/Create.js
+55
-27
Table.js
src/app/views/landingpage/package/Table.js
+4
-26
Update.js
src/app/views/landingpage/package/Update.js
+83
-22
Create.js
src/app/views/landingpage/priceProduct/Create.js
+44
-12
Table.js
src/app/views/landingpage/priceProduct/Table.js
+11
-19
Update.js
src/app/views/landingpage/priceProduct/Update.js
+155
-20
Detail.js
src/app/views/landingpage/register/Detail.js
+333
-41
Index.js
src/app/views/landingpage/register/Index.js
+15
-30
Table.js
src/app/views/landingpage/register/Table.js
+94
-49
No files found.
src/app/apis/Functions/dropdown.js
View file @
9d88a399
...
...
@@ -75,8 +75,8 @@ export const dropdownTypeCaculator = async (body) =>
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
dropdownEquipment
=
async
(
body
)
=>
GetData
(
url
.
dropdownEquipment
,
body
)
export
const
dropdown
Type
Equipment
=
async
(
body
)
=>
GetData
(
url
.
dropdown
Type
Equipment
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
...
...
src/app/apis/Functions/landingpage.js
View file @
9d88a399
...
...
@@ -88,3 +88,18 @@ export const changeStatusPackage = async (body) =>
PostData
(
url
.
changeStatusPackage
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
getListtPaymentCost
=
async
(
body
)
=>
PostData
(
url
.
urlGetListPaymentCost
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
detailPaymentCost
=
async
(
id
,
body
)
=>
GetURL
(
`
${
url
.
urlDetailPaymentCost
}
/
${
id
}
`
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
acceptPaymentCost
=
async
(
id
,
body
)
=>
PostData
(
`
${
url
.
acceptPaymentCost
}
/
${
id
}
`
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/url.js
View file @
9d88a399
...
...
@@ -124,6 +124,10 @@ export default {
urlDetailPackage
:
`
${
root
}
/package`
,
changeStatusPackage
:
`
${
root
}
/package/changeStatus`
,
urlGetListPaymentCost
:
`
${
root
}
/paymentcosts/paging`
,
urlDetailPaymentCost
:
`
${
root
}
/paymentcosts`
,
acceptPaymentCost
:
`
${
root
}
/paymentcosts/paymentConfirm`
,
urlGetListPackageFunction
:
`
${
root
}
/functionpk/paging`
,
urlCreatePackageFunction
:
`
${
root
}
/functionpk/create`
,
urlUpdatePackageFunction
:
`
${
root
}
/functionpk/update`
,
...
...
@@ -152,7 +156,7 @@ export default {
dropdownProcutByType
:
`
${
root
}
/dropdown/productListByType`
,
dropdownListSupplier
:
`
${
root
}
/dropdown/listSupplier`
,
dropdownTypeCaculator
:
`
${
root
}
/dropdown/getlisttypecaculator`
,
dropdownEquipment
:
`
${
root
}
/dropdown/getlisttypeatc`
,
dropdown
Type
Equipment
:
`
${
root
}
/dropdown/getlisttypeatc`
,
dropdownNcc
:
`
${
root
}
/dropdown/getlistsuppliercontruct`
,
dropdownFuncitonPackge
:
`
${
root
}
/dropdown/getlistfunctionpk`
,
}
src/app/views/landingpage/package/Create.js
View file @
9d88a399
...
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import
{
ValidatorForm
,
TextValidator
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
,
FormControlLabel
,
Checkbox
}
from
'@material-ui/core'
import
{
createPackage
Function
}
from
'app/apis/Functions/landingpage'
import
{
createPackage
}
from
'app/apis/Functions/landingpage'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
...
...
@@ -15,21 +15,38 @@ import {
isNumeric
,
toPriceVnd
,
}
from
'app/config/Function'
import
{
dropdownFuncitonPackge
}
from
'app/apis/Functions/dropdown'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
outstanding
,
setOutstanding
]
=
useState
(
false
)
const
[
listFunc
,
setListFunc
]
=
useState
([])
const
[
listChecked
,
setListChecked
]
=
useState
([])
const
{
t
}
=
useTranslation
()
const
history
=
useHistory
()
useEffect
(()
=>
{
getDataDropdown
()
},
[])
const
getDataDropdown
=
async
()
=>
{
const
res
=
await
dropdownFuncitonPackge
({})
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setListFunc
(
res
.
data
.
data
)
}
}
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
createPackage
Function
({
const
res
=
await
createPackage
({
...
newValue
,
status
:
1
,
outstand
:
1
,
func_id_add
:
listChecked
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/package
-function
'
)
history
.
push
(
'/package'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Tạo chức năng gói thành công!'
,
{
theme
:
'colored'
,
...
...
@@ -61,8 +78,20 @@ const SimpleForm = (props) => {
const
handleDateChange
=
(
date
)
=>
{
setState
({
...
state
,
date
})
}
const
onPicker
=
(
value
)
=>
{
if
(
value
.
target
.
checked
)
{
const
newList
=
listChecked
.
concat
(
value
.
target
.
name
)
setListChecked
(
newList
)
}
else
{
const
newList
=
listChecked
.
filter
((
e
)
=>
{
return
e
!=
value
.
target
.
name
})
setListChecked
(
newList
)
}
}
const
{
pack_name
,
price
}
=
state
cons
t
{
description
,
func_name
,
price
}
=
state
cons
ole
.
log
(
'listChecked'
,
listChecked
)
return
(
<
div
className
=
"m-sm-30"
>
...
...
@@ -88,8 +117,8 @@ const SimpleForm = (props) => {
label
=
"Tên gói*"
onChange
=
{
handleChange
}
type
=
"text"
name
=
"
func
_name"
value
=
{
func
_name
||
''
}
name
=
"
pack
_name"
value
=
{
pack
_name
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
...
...
@@ -104,33 +133,32 @@ const SimpleForm = (props) => {
onChange
=
{
handleChange
}
type
=
"text"
name
=
"price"
value
=
{
toPriceVnd
Input
(
price
)
||
''
}
value
=
{
toPriceVnd
(
price
)
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
<
/Grid
>
<
Grid
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
item
>
<
FormControlLabel
className
=
"min-w-288"
control
=
{
<
Checkbox
size
=
"small"
color
=
"primary"
onChange
=
{(
event
)
=>
{
console
.
log
(
event
.
target
.
checked
)
setOutstanding
(
event
.
target
.
checke
d
)
}}
value
=
{
outstanding
}
<
Grid
row
container
item
xs
=
{
12
}
sm
=
{
12
}
>
{
listFunc
.
map
((
e
)
=>
(
<
Grid
item
xs
=
{
4
}
>
<
FormControlLabel
label
=
{
e
.
func_name
}
control
=
{
<
Checkbox
size
=
"small"
color
=
"primary"
onChange
=
{
onPicker
}
name
=
{
e
.
id
}
checked
=
{
listChecked
.
includes
(
e
.
i
d
)}
/
>
}
/
>
}
label
=
"Nổi bật"
/>
<
/Grid
>
))}
<
/Grid
>
<
/Grid
>
<
Grid
container
justify
=
{
'flex-end'
}
>
...
...
src/app/views/landingpage/package/Table.js
View file @
9d88a399
...
...
@@ -130,7 +130,7 @@ function TableList(props) {
<
/TableCell
>
)}
<
TableCell
{
/*
<TableCell
align={'center'}
style={{
backgroundColor: colors.headerTable,
...
...
@@ -138,7 +138,7 @@ function TableList(props) {
}}
>
Nổi bật
<
/TableCell
>
</TableCell>
*/
}
<
TableCell
style
=
{{
...
...
@@ -202,7 +202,7 @@ function TableList(props) {
<
/Select
>
<
/TableCell
>
)}
<
TableCell
className
=
{
classes
.
border
}
>
{
/*
<TableCell className={classes.border}>
<Switch
size="medium"
checked={
...
...
@@ -225,29 +225,7 @@ function TableList(props) {
'primary checkbox',
}}
/>
{
/* <Select
variant={'outlined'}
labelId="demo-simple-select-placeholder-label-label"
id="demo-simple-select-placeholder-label"
onChange={(e) =>
handeChangeActiveOutstanding(
row.id,
e.target.value
)
}
displayEmpty
defaultValue={row.outstand}
className={classes.formControl}
>
<MenuItem value={1}>
Nổi bật
</MenuItem>
<MenuItem value={2}>
Thường
</MenuItem>
</Select> */
}
<
/TableCell
>
</TableCell> */
}
<
TableCell
>
{
checkRole
(
user
,
'/package/delete'
)
?
(
...
...
src/app/views/landingpage/package/Update.js
View file @
9d88a399
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
ValidatorForm
,
TextValidator
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
}
from
'@material-ui/core'
import
{
Button
,
Grid
,
Checkbox
,
FormControlLabel
}
from
'@material-ui/core'
import
{
detailPackageFunction
,
updatePackageFunction
,
}
from
'app/apis/Functions/landingpage'
import
{
detailPackage
,
updatePackage
}
from
'app/apis/Functions/landingpage'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
Link
,
useHistory
,
useLocation
}
from
'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
trimObject
,
toPriceVndInput
,
isNumeric
,
toPriceVnd
,
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
localStorageService
from
'app/services/localStorageService'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdownFuncitonPackge
}
from
'app/apis/Functions/dropdown'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
listFunc
,
setListFunc
]
=
useState
([])
const
[
listChecked
,
setListChecked
]
=
useState
([])
const
history
=
useHistory
()
const
location
=
useLocation
()
const
{
t
}
=
useTranslation
()
...
...
@@ -23,13 +29,24 @@ const SimpleForm = (props) => {
useEffect
(()
=>
{
getData
()
},
[])
useEffect
(()
=>
{
getDataDropdown
()
},
[])
const
getDataDropdown
=
async
()
=>
{
const
res
=
await
dropdownFuncitonPackge
({})
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setListFunc
(
res
.
data
.
data
)
}
}
const
getData
=
async
()
=>
{
props
.
showLoading
()
const
res
=
await
detailPackage
Function
(
location
.
state
,
{})
const
res
=
await
detailPackage
(
location
.
state
,
{})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setState
(
res
.
data
.
data
)
const
newList
=
res
.
data
.
data
?.
fuctionPk
.
map
((
e
)
=>
e
?.
id
)
setListChecked
(
newList
)
}
else
if
(
res
.
data
.
code
==
401
)
{
localStorageService
.
removeToken
()
setTimeout
(()
=>
{
...
...
@@ -45,12 +62,13 @@ const SimpleForm = (props) => {
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
updatePackage
Function
({
const
res
=
await
updatePackage
({
...
newValue
,
func_id_add
:
listChecked
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/package
-function
'
)
history
.
push
(
'/package'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Cập nhật chức năng thành công!'
,
{
theme
:
'colored'
,
...
...
@@ -65,17 +83,37 @@ const SimpleForm = (props) => {
const
handleChange
=
(
event
)
=>
{
event
.
persist
()
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
console
.
log
(
'event.target.name'
,
event
.
target
.
name
)
if
(
event
.
target
.
name
===
'price'
)
{
if
(
event
.
target
.
value
!==
null
)
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
.
split
(
'.'
).
join
(
''
),
})
}
else
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
const
handleDateChange
=
(
date
)
=>
{
setState
({
...
state
,
date
})
}
const
{
description
,
func_name
}
=
state
const
onPicker
=
(
value
)
=>
{
if
(
value
.
target
.
checked
)
{
const
newList
=
listChecked
.
concat
(
value
.
target
.
name
)
setListChecked
(
newList
)
}
else
{
const
newList
=
listChecked
.
filter
((
e
)
=>
{
return
e
!=
value
.
target
.
name
})
setListChecked
(
newList
)
}
}
const
{
pack_name
,
price
}
=
state
console
.
log
(
'listChecked'
,
listChecked
)
return
(
<
div
className
=
"m-sm-30"
>
...
...
@@ -98,29 +136,52 @@ const SimpleForm = (props) => {
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Tên
chức năng
*"
label
=
"Tên
gói
*"
onChange
=
{
handleChange
}
type
=
"text"
name
=
"
func
_name"
value
=
{
func
_name
||
''
}
name
=
"
pack
_name"
value
=
{
pack
_name
||
''
}
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
=
"
Mô tả
"
label
=
"
Đơn giá *
"
onChange
=
{
handleChange
}
type
=
"text"
name
=
"description"
value
=
{
description
||
''
}
name
=
"price"
value
=
{
toPriceVnd
(
price
)
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
<
/Grid
>
<
Grid
row
container
item
xs
=
{
12
}
sm
=
{
12
}
>
{
listFunc
.
map
((
e
)
=>
(
<
Grid
item
xs
=
{
4
}
>
<
FormControlLabel
label
=
{
e
.
func_name
}
control
=
{
<
Checkbox
size
=
"small"
color
=
"primary"
onChange
=
{
onPicker
}
name
=
{
e
.
id
}
checked
=
{
listChecked
.
includes
(
e
.
id
)}
/
>
}
/
>
<
/Grid
>
))}
<
/Grid
>
<
/Grid
>
<
Grid
container
justify
=
{
'flex-end'
}
>
<
Button
...
...
src/app/views/landingpage/priceProduct/Create.js
View file @
9d88a399
...
...
@@ -6,7 +6,7 @@ import {
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
,
MenuItem
}
from
'@material-ui/core'
import
{
createP
ackageFunction
}
from
'app/apis/Functions/landingpage'
import
{
createP
riceProduct
}
from
'app/apis/Functions/landingpage'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
...
...
@@ -19,15 +19,46 @@ import {
isNumeric
,
toPriceVnd
,
}
from
'app/config/Function'
import
{
dropdownTypeEquipment
,
dropdownTypeCaculator
,
dropdownNcc
,
}
from
'app/apis/Functions/dropdown'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
listTypeEquipment
,
setListEquipment
]
=
useState
([])
const
[
listTypeCaculator
,
setListCaculator
]
=
useState
([])
const
[
listNcc
,
setListNcc
]
=
useState
([])
useEffect
(()
=>
{
getDataDropdown
()
},
[])
const
getDataDropdown
=
async
()
=>
{
const
resTypeEquipment
=
await
dropdownTypeEquipment
({})
if
(
resTypeEquipment
.
data
.
code
==
200
&&
resTypeEquipment
.
data
.
data
)
{
setListEquipment
(
resTypeEquipment
.
data
.
data
)
}
const
resTypeCaculator
=
await
dropdownTypeCaculator
({})
if
(
resTypeCaculator
.
data
.
code
==
200
&&
resTypeCaculator
.
data
.
data
)
{
setListCaculator
(
resTypeCaculator
.
data
.
data
)
}
const
resNcc
=
await
dropdownNcc
({})
if
(
resNcc
.
data
.
code
==
200
&&
resNcc
.
data
.
data
)
{
const
newList
=
resNcc
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
?.
supp_name
}
})
setListNcc
(
newList
)
}
}
const
{
t
}
=
useTranslation
()
const
history
=
useHistory
()
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
createP
ackageFunction
({
const
res
=
await
createP
riceProduct
({
...
newValue
,
status
:
1
,
})
...
...
@@ -35,7 +66,7 @@ const SimpleForm = (props) => {
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/price-product'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Tạo
chức năng gói
thành công!'
,
{
toast
.
success
(
'Tạo
sản phẩm
thành công!'
,
{
theme
:
'colored'
,
})
}
...
...
@@ -129,6 +160,7 @@ const SimpleForm = (props) => {
className
=
"mb-4 w-full"
label
=
"Đơn giá *"
onChange
=
{
handleChange
}
name
=
"price"
type
=
"text"
value
=
{
toPriceVndInput
(
price
)
||
''
}
validators
=
{[
'required'
]}
...
...
@@ -151,8 +183,8 @@ const SimpleForm = (props) => {
'Không được để trống trường này'
,
]}
>
{
[]
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
listTypeCaculator
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
code
}
>
{
e
.
name
}
<
/MenuItem
>
))}
...
...
@@ -163,17 +195,17 @@ const SimpleForm = (props) => {
variant
=
{
'outlined'
}
label
=
{
'Loại sản phẩm *'
}
className
=
"mb-4 w-full"
value
=
{
type
_caculator
||
''
}
value
=
{
type
||
''
}
displayEmpty
name
=
"type
_caculator
"
name
=
"type"
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
{
[]
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
listTypeEquipment
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
code
}
>
{
e
.
name
}
<
/MenuItem
>
))}
...
...
@@ -184,16 +216,16 @@ const SimpleForm = (props) => {
variant
=
{
'outlined'
}
label
=
{
'Nhà cung cấp *'
}
className
=
"mb-4 w-full"
value
=
{
type_caculator
||
''
}
value
=
{
suppconstruction_id
||
''
}
displayEmpty
name
=
"
type_caculator
"
name
=
"
suppconstruction_id
"
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
{
[]
.
map
((
e
)
=>
(
{
listNcc
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
...
...
src/app/views/landingpage/priceProduct/Table.js
View file @
9d88a399
...
...
@@ -28,7 +28,7 @@ import { Breadcrumb, SimpleCard } from 'app/components'
import
DialogTransition
from
'app/components/dialog/DialogTransition'
import
{
useHistory
}
from
'react-router-dom'
import
useAuth
from
'app/hooks/useAuth'
import
{
checkRole
}
from
'app/config/Function'
import
{
checkRole
,
toPriceVnd
}
from
'app/config/Function'
const
columns
=
[
{
...
...
@@ -51,22 +51,23 @@ const columns = [
minWidth
:
'auto'
,
},
{
id
:
'type_caculator'
,
id
:
'
name_
type_caculator'
,
label
:
'Cách tính'
,
align
:
'center'
,
minWidth
:
'auto'
,
},
{
id
:
'
number_pack
'
,
id
:
'
supplier_name
'
,
label
:
'Nhà cung cấp'
,
align
:
'center'
,
minWidth
:
'auto'
,
},
{
id
:
'price'
,
label
:
'Đ
VT
'
,
label
:
'Đ
ơn giá
'
,
align
:
'center'
,
minWidth
:
'auto'
,
isMonney
:
true
,
},
{
id
:
'date_created'
,
...
...
@@ -76,8 +77,8 @@ const columns = [
},
{
id
:
'
pric
e'
,
label
:
'
ĐVT
'
,
id
:
'
type_nam
e'
,
label
:
'
Loại sản phẩm
'
,
align
:
'center'
,
minWidth
:
'auto'
,
},
...
...
@@ -166,24 +167,15 @@ function TableList(props) {
key
=
{
row
.
id
}
>
{
columns
.
map
((
column
)
=>
{
const
imageUrl
=
row
[
column
.
id
]
const
data
=
row
[
column
.
id
]
return
(
<
TableCell
key
=
{
column
.
id
}
align
=
{
column
.
align
}
>
{
column
.
format
?
(
<
img
src
=
{
column
.
format
(
imageUrl
)}
className
=
{
classes
.
image
}
/
>
)
:
(
imageUrl
)}
{
column
.
isMonney
?
toPriceVnd
(
data
)
:
data
}
<
/TableCell
>
)
})}
...
...
src/app/views/landingpage/priceProduct/Update.js
View file @
9d88a399
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
ValidatorForm
,
TextValidator
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
}
from
'@material-ui/core'
import
{
ValidatorForm
,
TextValidator
,
SelectValidator
,
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
,
MenuItem
}
from
'@material-ui/core'
import
{
detailP
ackageFunction
,
updateP
ackageFunction
,
detailP
riceProduct
,
updateP
riceProduct
,
}
from
'app/apis/Functions/landingpage'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
Link
,
useHistory
,
useLocation
}
from
'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
trimObject
,
toPriceVndInput
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
localStorageService
from
'app/services/localStorageService'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdownTypeEquipment
,
dropdownTypeCaculator
,
dropdownNcc
,
}
from
'app/apis/Functions/dropdown'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
location
=
useLocation
()
const
{
t
}
=
useTranslation
()
const
[
listTypeEquipment
,
setListEquipment
]
=
useState
([])
const
[
listTypeCaculator
,
setListCaculator
]
=
useState
([])
const
[
listNcc
,
setListNcc
]
=
useState
([])
useEffect
(()
=>
{
getDataDropdown
()
getData
()
},
[])
const
getDataDropdown
=
async
()
=>
{
const
resTypeEquipment
=
await
dropdownTypeEquipment
({})
if
(
resTypeEquipment
.
data
.
code
==
200
&&
resTypeEquipment
.
data
.
data
)
{
setListEquipment
(
resTypeEquipment
.
data
.
data
)
}
const
resTypeCaculator
=
await
dropdownTypeCaculator
({})
if
(
resTypeCaculator
.
data
.
code
==
200
&&
resTypeCaculator
.
data
.
data
)
{
setListCaculator
(
resTypeCaculator
.
data
.
data
)
}
const
resNcc
=
await
dropdownNcc
({})
if
(
resNcc
.
data
.
code
==
200
&&
resNcc
.
data
.
data
)
{
const
newList
=
resNcc
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
?.
supp_name
}
})
setListNcc
(
newList
)
}
}
const
getData
=
async
()
=>
{
props
.
showLoading
()
const
res
=
await
detailP
ackageFunction
(
location
.
state
,
{})
const
res
=
await
detailP
riceProduct
(
location
.
state
,
{})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setState
(
res
.
data
.
data
)
...
...
@@ -45,14 +77,14 @@ const SimpleForm = (props) => {
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
updateP
ackageFunction
({
const
res
=
await
updateP
riceProduct
({
...
newValue
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/price-product'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Cập nhật
chức năng
thành công!'
,
{
toast
.
success
(
'Cập nhật
sản phẩm
thành công!'
,
{
theme
:
'colored'
,
})
}
...
...
@@ -62,20 +94,34 @@ const SimpleForm = (props) => {
})
}
}
const
handleChange
=
(
event
)
=>
{
event
.
persist
()
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
if
(
event
.
target
.
name
===
'price'
)
{
if
(
event
.
target
.
value
!==
null
)
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
.
split
(
'.'
).
join
(
''
),
})
}
else
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
const
handleDateChange
=
(
date
)
=>
{
setState
({
...
state
,
date
})
}
const
{
description
,
func_name
}
=
state
const
{
cons_name
,
unit
,
price
,
type_caculator
,
type
,
suppconstruction_id
,
}
=
state
return
(
<
div
className
=
"m-sm-30"
>
...
...
@@ -98,11 +144,26 @@ const SimpleForm = (props) => {
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Tên
chức năng
*"
label
=
"Tên
sản phẩm
*"
onChange
=
{
handleChange
}
type
=
"text"
name
=
"func_name"
value
=
{
func_name
||
''
}
name
=
"cons_name"
value
=
{
cons_name
||
''
}
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
=
"Đơn vị tính *"
onChange
=
{
handleChange
}
type
=
"text"
name
=
"unit"
value
=
{
unit
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
...
...
@@ -114,13 +175,87 @@ const SimpleForm = (props) => {
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"
Mô tả
"
label
=
"
Đơn giá *
"
onChange
=
{
handleChange
}
name
=
"price"
type
=
"text"
name
=
"description"
value
=
{
description
||
''
}
value
=
{
toPriceVndInput
(
price
)
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
<
/Grid
>
{
type_caculator
&&
(
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
<
SelectValidator
variant
=
{
'outlined'
}
label
=
{
'Cách tính *'
}
className
=
"mb-4 w-full"
value
=
{
type_caculator
||
''
}
displayEmpty
name
=
"type_caculator"
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
{
listTypeCaculator
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
code
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/SelectValidator
>
<
/Grid
>
)}
{
type
&&
(
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
<
SelectValidator
variant
=
{
'outlined'
}
label
=
{
'Loại sản phẩm *'
}
className
=
"mb-4 w-full"
value
=
{
type
||
''
}
displayEmpty
name
=
"type"
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
{
listTypeEquipment
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
code
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/SelectValidator
>
<
/Grid
>
)}
{
suppconstruction_id
&&
(
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
<
SelectValidator
variant
=
{
'outlined'
}
label
=
{
'Nhà cung cấp *'
}
className
=
"mb-4 w-full"
value
=
{
suppconstruction_id
||
''
}
displayEmpty
name
=
"suppconstruction_id"
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
{
listNcc
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/SelectValidator
>
<
/Grid
>
)}
<
/Grid
>
<
Grid
container
justify
=
{
'flex-end'
}
>
<
Button
...
...
src/app/views/landingpage/register/Detail.js
View file @
9d88a399
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
ValidatorForm
,
TextValidator
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
}
from
'@material-ui/core'
import
{
Button
,
Grid
,
Typography
}
from
'@material-ui/core'
import
{
detailPa
ckageFunction
,
updatePackageFunction
,
detailPa
ymentCost
,
acceptPaymentCost
,
}
from
'app/apis/Functions/landingpage'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
Breadcrumb
,
SimpleCard
}
from
'app/components'
import
{
Link
,
useHistory
,
useLocation
}
from
'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
t
oPriceVnd
,
t
rimObject
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
localStorageService
from
'app/services/localStorageService'
import
{
useTranslation
}
from
'react-i18next'
...
...
@@ -19,6 +19,7 @@ const SimpleForm = (props) => {
const
history
=
useHistory
()
const
location
=
useLocation
()
const
{
t
}
=
useTranslation
()
const
[
listFunc
,
setListFunc
]
=
useState
([])
useEffect
(()
=>
{
getData
()
...
...
@@ -26,10 +27,17 @@ const SimpleForm = (props) => {
const
getData
=
async
()
=>
{
props
.
showLoading
()
const
res
=
await
detailPa
ckageFunction
(
location
.
state
,
{})
const
res
=
await
detailPa
ymentCost
(
location
.
state
,
{})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setState
(
res
.
data
.
data
)
setState
({
...
res
.
data
.
data
,
status_name
:
res
.
data
.
data
.
status
==
1
?
'Đã thanh toán'
:
'Chưa thanh toán'
,
})
setListFunc
(
res
.
data
.
data
.
lstDetail
)
}
else
if
(
res
.
data
.
code
==
401
)
{
localStorageService
.
removeToken
()
setTimeout
(()
=>
{
...
...
@@ -43,19 +51,14 @@ const SimpleForm = (props) => {
}
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
updatePackageFunction
({
...
newValue
,
})
const
res
=
await
acceptPaymentCost
(
state
?.
id
)
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/package-function'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Cập nhật chức năng thành công!'
,
{
theme
:
'colored'
,
})
}
getData
()
toast
.
success
(
'Xác nhận thanh toán thành công!'
,
{
theme
:
'colored'
,
})
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
...
...
@@ -75,7 +78,22 @@ const SimpleForm = (props) => {
setState
({
...
state
,
date
})
}
const
{
description
,
func_name
}
=
state
const
{
description
,
gas_name
,
num_fuel
,
packageName
,
email
,
num_gas
,
date_created
,
phone
,
sumMoney
,
address
,
num_year
,
status
,
supplierName
,
status_name
,
}
=
state
return
(
<
div
className
=
"m-sm-30"
>
...
...
@@ -94,35 +112,305 @@ const SimpleForm = (props) => {
<
SimpleCard
>
<
ValidatorForm
onSubmit
=
{
handleSubmit
}
onError
=
{()
=>
null
}
>
<
Grid
container
spacing
=
{
3
}
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Grid
item
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Typography
variant
=
"h6"
>
Th
ô
ng
tin
phi
ế
u
đă
ng
k
ý
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Tên c
hức năng *
"
onChange
=
{
handleChange
}
label
=
"Tên c
ây xăng
"
disabled
type
=
"text"
name
=
"func_name"
value
=
{
func_name
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
name
=
"gas_name"
value
=
{
gas_name
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Số trụ xăng"
disabled
type
=
"text"
name
=
"num_fuel"
value
=
{
num_fuel
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Gói đăng ký"
disabled
type
=
"text"
name
=
"packageName"
value
=
{
packageName
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Email"
disabled
type
=
"text"
name
=
"email"
value
=
{
email
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Số vòi mỗi trụ"
disabled
type
=
"text"
name
=
"num_gas"
value
=
{
num_gas
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Thời gian đăng ký"
disabled
type
=
"text"
name
=
"num_year"
value
=
{
num_year
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Số điện thoại"
disabled
type
=
"text"
name
=
"phone"
value
=
{
phone
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Đơn vị cung cấp main"
disabled
type
=
"text"
name
=
"supplierName"
value
=
{
supplierName
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"
Mô tả
"
onChange
=
{
handleChange
}
label
=
"
Tổng số tiền
"
disabled
type
=
"text"
name
=
"description"
value
=
{
description
||
''
}
value
=
{
toPriceVnd
(
sumMoney
)
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Địa chỉ"
disabled
type
=
"text"
name
=
"address"
value
=
{
address
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Ngày đăng ký"
disabled
type
=
"text"
name
=
"date_created"
value
=
{
date_created
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextValidator
className
=
"mb-4 w-full"
label
=
"Trạng thái"
disabled
type
=
"text"
name
=
"status_name"
value
=
{
status_name
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Typography
variant
=
"h6"
>
Chi
ti
ế
t
chi
ph
í
<
/Typography
>
<
/Grid
>
{
listFunc
.
map
((
row
)
=>
(
<
Grid
item
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
container
>
<
Grid
item
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
container
spacing
=
{
1
}
>
<
Grid
item
lg
=
{
8
}
md
=
{
8
}
sm
=
{
6
}
xs
=
{
6
}
>
<
Typography
style
=
{{
fontSize
:
16
,
fontWeight
:
'bold'
,
}}
>
{
row
?.
Name
}
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
16
,
fontWeight
:
'bold'
,
}}
>
SL
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
16
,
fontWeight
:
'bold'
,
}}
>
Đ
VT
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
16
,
fontWeight
:
'bold'
,
}}
>
Đơ
n
gi
á
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
16
,
fontWeight
:
'bold'
,
}}
>
Th
à
nh
ti
ề
n
<
/Typography
>
<
/Grid
>
<
/Grid
>
{
row
.
Details
.
map
((
e
)
=>
(
<
Grid
item
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
container
spacing
=
{
1
}
>
<
Grid
item
lg
=
{
8
}
md
=
{
8
}
sm
=
{
6
}
xs
=
{
6
}
>
<
Typography
style
=
{{
fontSize
:
14
,
}}
>
{
e
?.
cons_name
}
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
14
,
}}
>
{
e
?.
quantity
}
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
14
,
}}
>
{
e
?.
unit
}
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
14
,
}}
>
{
toPriceVnd
(
e
?.
price
)}
<
/Typography
>
<
/Grid
>
<
Grid
item
lg
=
{
1
}
md
=
{
1
}
sm
=
{
2
}
xs
=
{
2
}
>
<
Typography
style
=
{{
fontSize
:
14
,
}}
>
{
toPriceVnd
(
e
?.
money
)}
<
/Typography
>
<
/Grid
>
<
/Grid
>
))}
<
/Grid
>
))}
<
/Grid
>
<
Grid
container
justify
=
{
'flex-end'
}
>
<
Grid
style
=
{{
marginTop
:
40
,
}}
container
justify
=
{
'flex-end'
}
>
<
Button
style
=
{{
marginRight
:
20
,
...
...
@@ -136,13 +424,17 @@ const SimpleForm = (props) => {
<
span
className
=
"capitalize"
>
Quay
l
ạ
i
<
/span
>
<
/Button
>
<
Button
color
=
"primary"
variant
=
"contained"
type
=
"submit"
>
<
span
className
=
"capitalize"
>
C
ậ
p
nh
ậ
t
<
/span
>
<
/Button
>
{
state
?.
status
==
0
?
(
<
Button
color
=
"primary"
variant
=
"contained"
type
=
"submit"
>
<
span
className
=
"capitalize"
>
X
á
c
nh
ậ
n
thanh
to
á
n
<
/span
>
<
/Button
>
)
:
null
}
<
/Grid
>
<
/ValidatorForm
>
<
/SimpleCard
>
...
...
src/app/views/landingpage/register/Index.js
View file @
9d88a399
import
React
,
{
useState
,
useEffect
}
from
'react'
import
ToolUserView
from
'./View'
import
{
getListPackageFunction
,
deletePackageFunction
,
changeStatusPackageFunction
,
getListtPaymentCost
,
acceptPaymentCost
,
}
from
'app/apis/Functions/landingpage'
import
{
useHistory
}
from
'react-router-dom'
import
KEY
from
'../../../assets/Key'
...
...
@@ -42,21 +41,7 @@ const ToolNotificate = (props) => {
// }
// };
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
props
.
showLoading
()
const
res
=
await
changeStatusPackageFunction
({
idGuid
:
id
,
status_id
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
getData
()
toast
.
success
(
'Thay đổi trạng thái thành công!'
,
{
theme
:
'colored'
,
})
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{}
const
getData
=
async
(
isInit
)
=>
{
props
.
showLoading
()
...
...
@@ -65,14 +50,14 @@ const ToolNotificate = (props) => {
if
(
isInit
)
{
setPageIndex
(
0
)
res
=
await
getList
PackageFunction
({
func
_name
:
searchDebount
,
res
=
await
getList
tPaymentCost
({
gas
_name
:
searchDebount
,
page_no
:
0
,
page_size
:
pageSize
,
})
}
else
{
res
=
await
getList
PackageFunction
({
func
_name
:
searchDebount
,
res
=
await
getList
tPaymentCost
({
gas
_name
:
searchDebount
,
page_no
:
pageIndex
+
1
,
page_size
:
pageSize
,
})
...
...
@@ -83,7 +68,12 @@ const ToolNotificate = (props) => {
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
res
.
data
)
const
newList
=
res
.
data
.
data
.
data
.
map
((
e
,
i
)
=>
{
return
{
...
e
,
index
:
i
+
1
+
pageIndex
*
pageSize
}
return
{
...
e
,
index
:
i
+
1
+
pageIndex
*
pageSize
,
status_name
:
e
.
status
==
1
?
'Đã thanh toán'
:
'Chưa thanh toán'
,
}
})
setData
(
newList
)
...
...
@@ -110,18 +100,13 @@ const ToolNotificate = (props) => {
const
removeItem
=
async
(
id
)
=>
{
props
.
showLoading
()
const
res
=
await
deletePackageFunction
({
idGuid
:
id
}
)
const
res
=
await
acceptPaymentCost
(
id
)
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
getData
()
toast
.
success
(
'X
oá bản ghi
thành công!'
,
{
toast
.
success
(
'X
ác nhận thanh toán
thành công!'
,
{
theme
:
'colored'
,
})
}
else
if
(
res
.
data
.
code
==
401
)
{
localStorage
.
removeItem
(
KEY
.
API_TOKEN
)
setTimeout
(()
=>
{
history
.
push
(
'/'
)
},
100
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
...
...
src/app/views/landingpage/register/Table.js
View file @
9d88a399
...
...
@@ -28,7 +28,7 @@ import { Breadcrumb, SimpleCard } from 'app/components'
import
DialogTransition
from
'app/components/dialog/DialogTransition'
import
{
useHistory
}
from
'react-router-dom'
import
useAuth
from
'app/hooks/useAuth'
import
{
checkRole
}
from
'app/config/Function'
import
{
checkRole
,
toPriceVnd
}
from
'app/config/Function'
const
columns
=
[
{
...
...
@@ -39,22 +39,75 @@ const columns = [
},
{
id
:
'
func
_name'
,
label
:
'Tên
chức năng
'
,
id
:
'
gas
_name'
,
label
:
'Tên'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
200
,
},
{
id
:
'phone'
,
label
:
'SĐT'
,
align
:
'left'
,
minWidth
:
120
,
},
{
id
:
'address'
,
label
:
'Địa chỉ'
,
align
:
'left'
,
minWidth
:
200
,
},
{
id
:
'email'
,
label
:
'Email'
,
align
:
'left'
,
minWidth
:
200
,
},
{
id
:
'suppcontruction_name'
,
label
:
'Đơn vị cung cấp ATC'
,
align
:
'left'
,
minWidth
:
160
,
},
{
id
:
'num
ber_pack
'
,
label
:
'Số
lượng gói đang áp dụng
'
,
id
:
'num
_fuel
'
,
label
:
'Số
trụ
'
,
align
:
'center'
,
minWidth
:
'auto'
,
minWidth
:
80
,
},
{
id
:
'num_gas'
,
label
:
'Số vòi'
,
align
:
'center'
,
minWidth
:
80
,
},
{
id
:
'package_name'
,
label
:
'Gói đăng ký'
,
align
:
'left'
,
minWidth
:
120
,
},
{
id
:
'money'
,
label
:
'Tổng tiền ước tính'
,
align
:
'left'
,
minWidth
:
160
,
isMonney
:
true
,
},
{
id
:
'status_name'
,
label
:
'Trạng thái'
,
align
:
'left'
,
minWidth
:
120
,
},
{
id
:
'date_created'
,
label
:
'Ngày
tạo
'
,
label
:
'Ngày
đăng ký
'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
180
,
},
]
...
...
@@ -109,7 +162,7 @@ function TableList(props) {
{
column
.
label
}
<
/TableCell
>
))}
{
checkRole
(
{
/* {
checkRole(
user,
'/package-function/changeStatus'
) && (
...
...
@@ -121,7 +174,7 @@ function TableList(props) {
>
Trạng thái
</TableCell>
)}
)}
*/
}
<
TableCell
style
=
{{
...
...
@@ -144,29 +197,19 @@ function TableList(props) {
key
=
{
row
.
id
}
>
{
columns
.
map
((
column
)
=>
{
const
imageUrl
=
row
[
column
.
id
]
const
data
=
row
[
column
.
id
]
return
(
<
TableCell
key
=
{
column
.
id
}
align
=
{
column
.
align
}
>
{
column
.
format
?
(
<
img
src
=
{
column
.
format
(
imageUrl
)}
className
=
{
classes
.
image
}
/
>
)
:
(
imageUrl
)}
{
column
.
isMonney
?
toPriceVnd
(
data
)
:
data
}
<
/TableCell
>
)
})}
{
checkRole
(
{
/* {checkRole(
user,
'/package-function/changeStatus'
) && (
...
...
@@ -193,49 +236,51 @@ function TableList(props) {
</MenuItem>
</Select>
</TableCell>
)}
)}
*/
}
<
TableCell
>
{
checkRole
(
user
,
'/package-
function/delete
'
'/package-
register/detail
'
)
?
(
<
Tooltip
title
=
"
Xoá
"
>
<
Tooltip
title
=
"
Chi tiết
"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Xóa chức năng
'
,
content
:
`Bạn có muốn xóa chức năng
${
row
.
func_name
}
hay không?`
,
history
.
push
({
pathname
:
'/package-register/detail
'
,
state
:
row
.
id
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"
Delete
"
aria
-
label
=
"
edit
"
>
<
Icon
color
=
"
error
"
>
delete
<
Icon
color
=
"
primary
"
>
visibility
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)
:
null
}
{
checkRole
(
user
,
'/package-function/update'
)
?
(
<
Tooltip
title
=
"Cập nhật"
>
{
row
.
status
!=
1
?
(
<
Tooltip
title
=
"Thanh toán"
>
<
IconButton
onClick
=
{()
=>
{
history
.
push
({
pathname
:
'/package-function/update
'
,
state
:
row
.
id
,
setSelected
({
...
row
,
title
:
'Xác nhận thanh toán
'
,
content
:
`Bạn có muốn xác nhận thanh toán
${
row
.
gas_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"
edit
"
aria
-
label
=
"
Delete
"
>
<
Icon
color
=
"primary"
>
edit
<
Icon
style
=
{{
color
:
'#07BA00'
,
}}
>
paid
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
...
...
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