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
5acc8772
Commit
5acc8772
authored
a year ago
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
e108ebbb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
276 additions
and
10 deletions
+276
-10
merchant.js
src/app/apis/Functions/merchant.js
+10
-0
url.js
src/app/apis/url.js
+3
-0
CreateFountain.jsx
src/app/components/dialog/CreateFountain.jsx
+19
-7
UpdateFountain.jsx
src/app/components/dialog/UpdateFountain.jsx
+242
-0
Create.js
src/app/views/GasStation/Create.js
+0
-0
Index.js
src/app/views/GasStation/Index.js
+1
-1
Table.js
src/app/views/GasStation/Table.js
+1
-1
Update.js
src/app/views/GasStation/Update.js
+0
-0
Create.js
src/app/views/product/product/Create.js
+0
-1
No files found.
src/app/apis/Functions/merchant.js
View file @
5acc8772
...
@@ -60,3 +60,13 @@ export const changeStatusGasStation = async (body) =>
...
@@ -60,3 +60,13 @@ export const changeStatusGasStation = async (body) =>
PostData
(
url
.
changeStatusGasStation
,
body
)
PostData
(
url
.
changeStatusGasStation
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
.
catch
((
err
)
=>
null
)
export
const
deleteGasOnline
=
async
(
body
)
=>
PostData
(
url
.
deleteGasOnline
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
export
const
deleteGasField
=
async
(
body
)
=>
PostData
(
url
.
deleteGasField
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
This diff is collapsed.
Click to expand it.
src/app/apis/url.js
View file @
5acc8772
...
@@ -80,6 +80,9 @@ export default {
...
@@ -80,6 +80,9 @@ export default {
urlDetailGasStation
:
`
${
root
}
/merchantstore`
,
urlDetailGasStation
:
`
${
root
}
/merchantstore`
,
changeStatusGasStation
:
`
${
root
}
/merchantstore/changeStatus`
,
changeStatusGasStation
:
`
${
root
}
/merchantstore/changeStatus`
,
deleteGasOnline
:
`
${
root
}
/gasoline/delete`
,
deleteGasField
:
`
${
root
}
/gasfield/delete`
,
//Log
//Log
logAuth
:
`
${
root
}
/logging/listLogin`
,
logAuth
:
`
${
root
}
/logging/listLogin`
,
logApi
:
`
${
root
}
/logging/listCallApi`
,
logApi
:
`
${
root
}
/logging/listCallApi`
,
...
...
This diff is collapsed.
Click to expand it.
src/app/components/dialog/CreateFountain.jsx
View file @
5acc8772
...
@@ -99,10 +99,21 @@ export default function FormDialog({ onCreate }) {
...
@@ -99,10 +99,21 @@ export default function FormDialog({ onCreate }) {
}
}
const
handleSubmit
=
async
(
value
)
=>
{
const
handleSubmit
=
async
(
value
)
=>
{
let
index
=
listProduct
.
findIndex
(
e
=>
e
.
id
==
state
.
product_id
)
if
(
index
!=-
1
){
console
.
log
(
listProduct
[
index
])
console
.
log
(
"listProduct"
,
listProduct
)
console
.
log
(
'state'
,
state
)
console
.
log
(
'state'
,
state
)
onCreate
({...
state
,
type
,
type_name
:
listProduct
[
index
].
type_name
,
product_name
:
listProduct
[
index
].
product_name
})
setOpen
(
false
)
setState
({})
setType
()
}
onCreate
({...
state
,
type
})
}
}
const
handleChange
=
(
event
)
=>
{
const
handleChange
=
(
event
)
=>
{
...
@@ -137,12 +148,12 @@ export default function FormDialog({ onCreate }) {
...
@@ -137,12 +148,12 @@ export default function FormDialog({ onCreate }) {
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
<
TextValidator
className=
"mb-4 w-full"
className=
"mb-4 w-full"
label=
"
Tên
vòi xăng *"
label=
"
Mã
vòi xăng *"
onChange=
{
handleChange
}
onChange=
{
handleChange
}
variant=
"outlined"
variant=
"outlined"
type=
"text"
type=
"text"
name=
"
nam
e"
name=
"
cod
e"
value=
{
nam
e
||
''
}
value=
{
cod
e
||
''
}
validators=
{
[
'required'
]
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
errorMessages=
{
[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
...
@@ -152,12 +163,12 @@ export default function FormDialog({ onCreate }) {
...
@@ -152,12 +163,12 @@ export default function FormDialog({ onCreate }) {
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
<
TextValidator
className=
"mb-4 w-full"
className=
"mb-4 w-full"
label=
"
Mã
vòi xăng *"
label=
"
Tên
vòi xăng *"
onChange=
{
handleChange
}
onChange=
{
handleChange
}
variant=
"outlined"
variant=
"outlined"
type=
"text"
type=
"text"
name=
"
cod
e"
name=
"
nam
e"
value=
{
cod
e
||
''
}
value=
{
nam
e
||
''
}
validators=
{
[
'required'
]
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
errorMessages=
{
[
'Không được để trống trường này'
,
'Không được để trống trường này'
,
...
@@ -165,6 +176,7 @@ export default function FormDialog({ onCreate }) {
...
@@ -165,6 +176,7 @@ export default function FormDialog({ onCreate }) {
/>
/>
</
Grid
>
</
Grid
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
SelectValidator
<
SelectValidator
variant=
{
'outlined'
}
variant=
{
'outlined'
}
...
...
This diff is collapsed.
Click to expand it.
src/app/components/dialog/UpdateFountain.jsx
0 → 100644
View file @
5acc8772
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Button
,
FormControl
,
Grid
,
InputLabel
,
Select
,
TextField
,
Typography
,
Radio
,
FormControlLabel
,
DialogActions
,
Dialog
,
DialogContent
,
DialogContentText
,
DialogTitle
,
IconButton
,
Icon
,
Tooltip
,
RadioGroup
,
MenuItem
,
}
from
'@material-ui/core'
import
{
toast
}
from
'react-toastify'
import
{
useTranslation
}
from
'react-i18next'
import
{
KeyboardDatePicker
}
from
'@material-ui/pickers'
import
{
convertDate
,
toPriceVndInput
,
convertViToEn
,
}
from
'app/config/Function'
import
{
TextValidator
,
ValidatorForm
,
SelectValidator
,
}
from
'react-material-ui-form-validator'
import
{
dropdownProductType
,
dropdownProcutByType
}
from
'app/apis/Functions/dropdown'
export
default
function
FormDialog
(
props
)
{
const
{
t
}
=
useTranslation
()
const
{
open
,
handleClose
,
data
,
onAgree
}
=
props
const
[
state
,
setState
]
=
useState
({})
const
[
listType
,
setListType
]
=
useState
([])
const
[
listProduct
,
setListProduct
]
=
useState
([])
const
[
product
,
setProduct
]
=
useState
()
const
[
type
,
setType
]
=
useState
()
useEffect
(()
=>
{
if
(
data
){
setState
({...
data
})
setType
(
data
.
type
)
setProduct
(
data
.
product_id
)
}
},[
data
])
useEffect
(()
=>
{
setState
({...
state
})
if
(
type
){
getDropdownProduct
(
type
)
}
},[
type
])
useEffect
(()
=>
{
getData
()
},
[])
const
getData
=
async
()
=>
{
const
res
=
await
dropdownProductType
({})
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
type_name
,
value
:
e
.
id
}
})
setListType
(
newList
)
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
theme
:
'colored'
,
})
}
}
const
getDropdownProduct
=
async
(
type
)
=>
{
const
res
=
await
dropdownProcutByType
(
type
)
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
product_name
,
value
:
e
.
id
}
})
setListProduct
(
newList
)
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
theme
:
'colored'
,
})
}
}
const
handleSubmit
=
async
(
value
)
=>
{
let
index
=
listProduct
.
findIndex
(
e
=>
e
.
id
==
state
.
product_id
)
if
(
index
!=-
1
){
console
.
log
(
listProduct
[
index
])
console
.
log
(
"listProduct"
,
listProduct
)
console
.
log
(
'state'
,
state
)
onAgree
({...
state
,
type
,
type_name
:
listProduct
[
index
].
type_name
,
product_name
:
listProduct
[
index
].
product_name
})}
}
const
handleChange
=
(
event
)
=>
{
event
.
persist
()
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
const
{
product_id
,
name
,
code
}
=
state
console
.
log
(
"product_id"
,
product_id
)
return
(
<
Dialog
open=
{
open
}
onClose=
{
handleClose
}
aria
-
labelledby=
"form-dialog-title"
>
<
DialogTitle
id=
"form-dialog-title"
>
Thêm vòi xăng
</
DialogTitle
>
<
DialogContent
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
className=
"mb-4 w-full"
defaultValue=
{
true
}
label=
"Mã vòi xăng *"
onChange=
{
handleChange
}
variant=
"outlined"
disabled=
{
true
}
type=
"text"
name=
"code"
value=
{
code
||
''
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
]
}
/>
</
Grid
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
className=
"mb-4 w-full"
label=
"Tên vòi xăng *"
onChange=
{
handleChange
}
variant=
"outlined"
type=
"text"
name=
"name"
value=
{
name
||
''
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
]
}
/>
</
Grid
>
{
type
&&
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
SelectValidator
variant=
{
'outlined'
}
label=
{
'Loại nguyên liệu *'
}
className=
"mb-4 w-full"
value=
{
type
||
''
}
displayEmpty
name=
"merchan_id"
onChange=
{
(
event
)
=>
{
setType
(
event
.
target
.
value
)
}
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
]
}
>
{
listType
.
map
((
e
)
=>
(
<
MenuItem
value=
{
e
.
id
}
>
{
e
.
name
}
</
MenuItem
>
))
}
</
SelectValidator
>
</
Grid
>
}
{
product_id
&&
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
SelectValidator
variant=
{
'outlined'
}
label=
{
'Loại xăng *'
}
className=
"mb-4 w-full"
value=
{
product_id
||
''
}
displayEmpty
name=
"product_id"
onChange=
{
handleChange
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
]
}
>
{
listProduct
.
map
((
e
)
=>
(
<
MenuItem
value=
{
e
.
id
}
>
{
e
.
name
}
</
MenuItem
>
))
}
</
SelectValidator
>
</
Grid
>
}
</
Grid
>
</
DialogContent
>
<
DialogActions
>
<
Button
color=
"secondary"
onClick=
{
handleClose
}
>
Thoát
</
Button
>
<
Button
onClick=
{
handleSubmit
}
color=
"primary"
>
Đồng ý
</
Button
>
</
DialogActions
>
</
Dialog
>
)
}
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Create.js
View file @
5acc8772
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Index.js
View file @
5acc8772
...
@@ -92,7 +92,7 @@ const ToolNotificate = (props) => {
...
@@ -92,7 +92,7 @@ const ToolNotificate = (props) => {
const
removeItem
=
async
(
id
)
=>
{
const
removeItem
=
async
(
id
)
=>
{
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
deleteGasStation
({
id
})
const
res
=
await
deleteGasStation
({
id
Guid
:
id
})
props
.
hideLoading
()
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
getData
()
getData
()
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Table.js
View file @
5acc8772
...
@@ -211,7 +211,7 @@ function TableList(props) {
...
@@ -211,7 +211,7 @@ function TableList(props) {
setSelected
({
setSelected
({
...
row
,
...
row
,
title
:
'Xóa cây xăng'
,
title
:
'Xóa cây xăng'
,
content
:
`Bạn có muốn xóa cây xăng
${
row
.
name
}
hay không?`
,
content
:
`Bạn có muốn xóa cây xăng
${
row
.
store_
name
}
hay không?`
,
})
})
setOpen
(
true
)
setOpen
(
true
)
}}
}}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Update.js
View file @
5acc8772
This diff is collapsed.
Click to expand it.
src/app/views/product/product/Create.js
View file @
5acc8772
...
@@ -60,7 +60,6 @@ const SimpleForm = (props) => {
...
@@ -60,7 +60,6 @@ const SimpleForm = (props) => {
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
createProduct
({
const
res
=
await
createProduct
({
...
newValue
,
...
newValue
,
type_id
:
2
,
})
})
props
.
hideLoading
()
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment