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
9
Issues
9
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
52744883
Commit
52744883
authored
Jan 17, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
f006fbb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
386 additions
and
34 deletions
+386
-34
CreateField.jsx
src/app/components/dialog/CreateField.jsx
+84
-0
Create.js
src/app/views/GasStation/Create.js
+302
-34
No files found.
src/app/components/dialog/CreateField.jsx
0 → 100644
View file @
52744883
import
React
,
{
useState
,
useEffect
,
use
}
from
"react"
;
import
{
Button
,
FormControl
,
Grid
,
InputLabel
,
Select
,
TextField
,
Typography
,
DialogActions
,
Dialog
,
DialogContent
,
DialogContentText
,
DialogTitle
,
IconButton
,
Icon
,
Tooltip
}
from
'@material-ui/core'
import
{
toast
}
from
'react-toastify'
import
{
useTranslation
}
from
'react-i18next'
import
{
hideLoading
,
showLoading
}
from
'app/redux/actions/loadingAction'
import
{
connect
}
from
'react-redux'
function
FormDialog
(
props
)
{
const
{
t
}
=
useTranslation
()
const
{
open
,
handleClose
,
data
,
onAgree
}
=
props
const
[
amount
,
setamount
]
=
useState
()
return
(
<
Dialog
open=
{
open
}
onClose=
{
handleClose
}
aria
-
labelledby=
"form-dialog-title"
>
<
DialogTitle
id=
"form-dialog-title"
>
Cập nhật CTV
</
DialogTitle
>
<
DialogContent
>
<
TextField
style=
{
{
marginBttom
:
20
,
minWidth
:
400
}
}
variant=
"outlined"
autoFocus
margin=
"dense"
label=
"Lời nhuận chia sẻ %"
fullWidth
value=
{
amount
||
''
}
onChange=
{
(
event
)
=>
setamount
(
event
.
target
.
value
)
}
/>
</
DialogContent
>
<
DialogActions
>
<
Button
color=
"secondary"
onClick=
{
handleClose
}
>
Thoát
</
Button
>
<
Button
onClick=
{
onAgree
}
color=
"primary"
>
Đồng ý
</
Button
>
</
DialogActions
>
</
Dialog
>
)
}
const
mapStateToProps
=
(
state
)
=>
{
return
{}
}
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
FormDialog
)
src/app/views/GasStation/Create.js
View file @
52744883
...
...
@@ -4,7 +4,15 @@ import {
TextValidator
,
SelectValidator
,
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
,
MenuItem
,
Typography
}
from
'@material-ui/core'
import
{
Button
,
Grid
,
MenuItem
,
Typography
,
IconButton
,
Icon
,
Tooltip
,
}
from
'@material-ui/core'
import
{
createFunction
}
from
'app/apis/Functions/function'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
...
...
@@ -14,11 +22,52 @@ import { Link, useHistory, useLocation } from 'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
Table
from
'@material-ui/core/Table'
import
TableBody
from
'@material-ui/core/TableBody'
import
TableCell
from
'@material-ui/core/TableCell'
import
TableContainer
from
'@material-ui/core/TableContainer'
import
TableHead
from
'@material-ui/core/TableHead'
import
TableRow
from
'@material-ui/core/TableRow'
import
Paper
from
'@material-ui/core/Paper'
import
CreateField
from
'app/components/dialog/CreateField'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
listField
,
setListField
]
=
useState
([
{
field_name
:
'Trụ 1'
,
gas_olines
:
[
{
product_id
:
'BDDD46BC-2264-43EF-21B7-08DC08411423'
,
name
:
'Vòi 1'
,
code
:
'A95'
,
},
{
product_id
:
'6D3A81A6-A189-4D83-BA47-08DC0CF4D4C3'
,
name
:
'Vòi 2'
,
code
:
'A99'
,
},
],
},
{
field_name
:
'Trụ 2'
,
gas_olines
:
[
{
product_id
:
'BDDD46BC-2264-43EF-21B7-08DC08411423'
,
name
:
'Vòi 1'
,
code
:
'A95'
,
},
{
product_id
:
'6D3A81A6-A189-4D83-BA47-08DC0CF4D4C3'
,
name
:
'Vòi 2'
,
code
:
'A99'
,
},
],
},
])
const
[
openCreate
,
setOpenCreate
]
=
useState
(
false
)
useEffect
(()
=>
{
getData
()
...
...
@@ -79,6 +128,11 @@ const SimpleForm = (props) => {
setState
({
...
state
,
date
})
}
const
onCreateField
=
()
=>
{}
const
handleCloseCreate
=
()
=>
{
setOpenCreate
(
false
)
}
const
{
store_name
,
address
,
merchan_id
}
=
state
return
(
...
...
@@ -193,44 +247,253 @@ const SimpleForm = (props) => {
justify
=
"space-between"
>
<
div
>
<
Typography
>
<
Typography
variant
=
"subtitle1"
>
S
ố
l
ượ
ng
v
ò
i
m
ỗ
i
tr
ụ
:
1
<
/Typography
>
<
Typography
>
S
ố
l
ượ
ng
tr
ụ
:
3
<
/Typography
>
<
Typography
variant
=
"subtitle1"
>
S
ố
l
ượ
ng
tr
ụ
:
3
<
/Typography
>
<
/div
>
<
Typography
variant
=
"h6"
>
Th
ê
m
tr
ụ
<
/Typography
>
<
Button
style
=
{{
width
:
120
,
}}
variant
=
"contained"
className
=
{
'bg-light-primary'
}
>
<
span
className
=
{
'text-primary'
}
>
Th
ê
m
m
ớ
i
<
/span
>
<
/Button
>
<
/Grid
>
<
Grid
style
=
{{
border
:
'1px solid #B9B9B9'
,
borderRadius
:
5
,
padding
:
10
,
marginTop
:
10
,
}}
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Grid
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
div
style
=
{{
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
display
:
'flex'
,
}}
>
<
Typography
variant
=
"h6"
>
TR
Ụ
1
<
/Typography
>
<
Typography
variant
=
"h6"
>
Xo
á
tr
ụ
<
/Typography
>
<
/div
>
{
listField
.
map
((
item
)
=>
(
<
Grid
style
=
{{
border
:
'1px solid #B9B9B9'
,
borderRadius
:
5
,
padding
:
10
,
marginTop
:
20
,
}}
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
Grid
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
>
<
div
style
=
{{
alignItems
:
'center'
,
justifyContent
:
'space-between'
,
display
:
'flex'
,
marginBottom
:
10
,
}}
>
<
Typography
variant
=
"h6"
>
{
item
.
field_name
}
<
/Typography
>
<
Button
variant
=
"contained"
style
=
{{
backgroundColor
:
'#FC2B05'
,
color
:
'white'
,
}}
>
<
span
>
Xo
á
tr
ụ
<
/span
>
<
/Button
>
<
/div
>
<
TableContainer
component
=
{
Paper
}
>
<
Table
aria
-
label
=
"simple table"
>
<
TableHead
>
<
TableRow
style
=
{{
backgroundColor
:
'#F3F3F3'
,
}}
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
width
:
100
,
}}
align
=
"center"
>
STT
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
V
ò
i
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
M
ã
v
ò
i
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
Lo
ạ
i
nhi
ê
n
li
ệ
u
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
S
ả
n
ph
ẩ
m
<
/TableCell
>
<
TableCell
align
=
"center"
>
Tr
ạ
ng
th
á
i
ho
ạ
t
độ
ng
<
/TableCell
>
<
TableCell
style
=
{{
textAlign
:
'center'
,
width
:
120
,
}}
align
=
"center"
>
H
à
nh
độ
ng
<
/TableCell
>
<
/TableRow
>
<
/TableHead
>
<
TableBody
>
{
item
?.
gas_olines
.
map
(
(
row
,
index
)
=>
(
<
TableRow
key
=
{
row
.
name
}
>
<
TableCell
component
=
"th"
scope
=
"row"
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
{
index
+
1
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
name
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
code
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
type_name
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
product_name
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
status
}
<
/TableCell
>
<
TableCell
>
<
Tooltip
title
=
"Xoá"
>
<
IconButton
onClick
=
{()
=>
{}}
//className={classes.button}
aria
-
label
=
"Delete"
>
<
Icon
color
=
"primary"
>
edit
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
<
Tooltip
title
=
"Xoá"
>
<
IconButton
onClick
=
{()
=>
{}}
//className={classes.button}
aria
-
label
=
"Delete"
>
<
Icon
color
=
"error"
>
delete
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell
>
<
/TableRow
>
)
)}
<
/TableBody
>
<
/Table
>
<
/TableContainer
>
<
IconButton
onClick
=
{()
=>
{}}
aria
-
label
=
"edit"
>
<
Icon
color
=
"primary"
>
add_circle
<
/Icon
>
<
/IconButton
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
))}
<
/Grid
>
<
/Grid
>
<
Grid
...
...
@@ -260,6 +523,11 @@ const SimpleForm = (props) => {
<
span
className
=
"capitalize"
>
Th
ê
m
m
ớ
i
<
/span
>
<
/Button
>
<
/Grid
>
<
CreateField
open
=
{
openCreate
}
handleClose
=
{
handleCloseCreate
}
onAgree
=
{
onCreateField
}
/
>
<
/ValidatorForm
>
<
/SimpleCard
>
<
/div
>
...
...
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