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
5acc8772
Commit
5acc8772
authored
Jan 24, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
e108ebbb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
278 additions
and
12 deletions
+278
-12
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
+21
-9
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) =>
PostData
(
url
.
changeStatusGasStation
,
body
)
.
then
((
res
)
=>
res
)
.
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
)
src/app/apis/url.js
View file @
5acc8772
...
...
@@ -80,6 +80,9 @@ export default {
urlDetailGasStation
:
`
${
root
}
/merchantstore`
,
changeStatusGasStation
:
`
${
root
}
/merchantstore/changeStatus`
,
deleteGasOnline
:
`
${
root
}
/gasoline/delete`
,
deleteGasField
:
`
${
root
}
/gasfield/delete`
,
//Log
logAuth
:
`
${
root
}
/logging/listLogin`
,
logApi
:
`
${
root
}
/logging/listCallApi`
,
...
...
src/app/components/dialog/CreateFountain.jsx
View file @
5acc8772
...
...
@@ -99,10 +99,21 @@ export default function FormDialog({ onCreate }) {
}
const
handleSubmit
=
async
(
value
)
=>
{
console
.
log
(
'state'
,
state
)
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
)
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
)
=>
{
...
...
@@ -134,15 +145,15 @@ export default function FormDialog({ onCreate }) {
<
DialogContent
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
className=
"mb-4 w-full"
label=
"
Tên
vòi xăng *"
label=
"
Mã
vòi xăng *"
onChange=
{
handleChange
}
variant=
"outlined"
type=
"text"
name=
"
nam
e"
value=
{
nam
e
||
''
}
name=
"
cod
e"
value=
{
cod
e
||
''
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
...
...
@@ -152,18 +163,19 @@ export default function FormDialog({ onCreate }) {
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
TextValidator
className=
"mb-4 w-full"
label=
"
Mã
vòi xăng *"
label=
"
Tên
vòi xăng *"
onChange=
{
handleChange
}
variant=
"outlined"
type=
"text"
name=
"
cod
e"
value=
{
cod
e
||
''
}
name=
"
nam
e"
value=
{
nam
e
||
''
}
validators=
{
[
'required'
]
}
errorMessages=
{
[
'Không được để trống trường này'
,
]
}
/>
</
Grid
>
<
Grid
item
lg=
{
12
}
md=
{
12
}
sm=
{
12
}
xs=
{
12
}
>
<
SelectValidator
...
...
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
>
)
}
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) => {
const
removeItem
=
async
(
id
)
=>
{
props
.
showLoading
()
const
res
=
await
deleteGasStation
({
id
})
const
res
=
await
deleteGasStation
({
id
Guid
:
id
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
getData
()
...
...
src/app/views/GasStation/Table.js
View file @
5acc8772
...
...
@@ -211,7 +211,7 @@ function TableList(props) {
setSelected
({
...
row
,
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
)
}}
...
...
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) => {
props
.
showLoading
()
const
res
=
await
createProduct
({
...
newValue
,
type_id
:
2
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
...
...
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