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
ba6234e7
Commit
ba6234e7
authored
Aug 22, 2024
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate code
parent
a26d5168
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
725 additions
and
82 deletions
+725
-82
dropdown.js
src/app/apis/Functions/dropdown.js
+5
-0
merchant.js
src/app/apis/Functions/merchant.js
+5
-0
url.js
src/app/apis/url.js
+5
-2
GasStationRoutes.js
src/app/views/GasStation/GasStationRoutes.js
+5
-0
Index.js
src/app/views/GasStation/Index.js
+32
-4
Table.js
src/app/views/GasStation/Table.js
+77
-8
View.js
src/app/views/GasStation/View.js
+4
-12
detail.js
src/app/views/GasStation/detail.js
+580
-0
Create.js
src/app/views/Merchant/Create.js
+12
-56
No files found.
src/app/apis/Functions/dropdown.js
View file @
ba6234e7
...
@@ -89,3 +89,8 @@ export const dropdownFuncitonPackge = async (body) =>
...
@@ -89,3 +89,8 @@ export const dropdownFuncitonPackge = async (body) =>
GetData
(
url
.
dropdownFuncitonPackge
,
body
)
GetData
(
url
.
dropdownFuncitonPackge
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
.
catch
((
err
)
=>
null
)
export
const
dropdownStoreStatus
=
async
(
body
)
=>
GetData
(
url
.
dropdownStoreStatus
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/Functions/merchant.js
View file @
ba6234e7
...
@@ -70,3 +70,8 @@ export const deleteGasField = async (body) =>
...
@@ -70,3 +70,8 @@ export const deleteGasField = async (body) =>
PostData
(
url
.
deleteGasField
,
body
)
PostData
(
url
.
deleteGasField
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
.
catch
((
err
)
=>
null
)
export
const
changeStatusStore
=
async
(
body
)
=>
PostData
(
url
.
changeStatusStore
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
null
)
src/app/apis/url.js
View file @
ba6234e7
//const root = 'http://petrolpay.tasvietnam.vn:9985/api'
//const root = 'http://petrolpay.tasvietnam.vn:9985/api'
//const root = 'https://apigw.petropos.vn/api'
//const root = 'https://apigw.petropos.vn/api'
//const root = 'http://dcvf.tasvietnam.vn:9986/api'
//const root = 'http://dcvf.tasvietnam.vn:9986/api'
const
root
=
'https://apigw-v2.petropos.vn/api'
//
const root = 'https://apigw-v2.petropos.vn/api'
const
root
=
'https://apitest.petropos.vn/api'
//v2
//v2
//const root = 'https://apitest-v2.petropos.vn/api'
//const root = 'https://apitest-v2.petropos.vn/api'
...
@@ -94,6 +94,8 @@ export default {
...
@@ -94,6 +94,8 @@ export default {
deleteGasOnline
:
`
${
root
}
/gasoline/delete`
,
deleteGasOnline
:
`
${
root
}
/gasoline/delete`
,
deleteGasField
:
`
${
root
}
/gasfield/delete`
,
deleteGasField
:
`
${
root
}
/gasfield/delete`
,
changeStatusStore
:
`
${
root
}
/merchantstore/changeStatus`
,
//Supplier Invoice
//Supplier Invoice
urlGetListInvoiceSupp
:
`
${
root
}
/supplierInvoice/list`
,
urlGetListInvoiceSupp
:
`
${
root
}
/supplierInvoice/list`
,
urlCreateInvoiceSupp
:
`
${
root
}
/supplierInvoice/create`
,
urlCreateInvoiceSupp
:
`
${
root
}
/supplierInvoice/create`
,
...
@@ -166,4 +168,5 @@ export default {
...
@@ -166,4 +168,5 @@ export default {
dropdownTypeEquipment
:
`
${
root
}
/dropdown/getlisttypeatc`
,
dropdownTypeEquipment
:
`
${
root
}
/dropdown/getlisttypeatc`
,
dropdownNcc
:
`
${
root
}
/dropdown/getlistsuppliercontruct`
,
dropdownNcc
:
`
${
root
}
/dropdown/getlistsuppliercontruct`
,
dropdownFuncitonPackge
:
`
${
root
}
/dropdown/getlistfunctionpk`
,
dropdownFuncitonPackge
:
`
${
root
}
/dropdown/getlistfunctionpk`
,
dropdownStoreStatus
:
`
${
root
}
/dropdown/getlistStoreStatus`
,
}
}
src/app/views/GasStation/GasStationRoutes.js
View file @
ba6234e7
...
@@ -2,6 +2,11 @@ import React from 'react'
...
@@ -2,6 +2,11 @@ import React from 'react'
const
GasStationRoutes
=
[
const
GasStationRoutes
=
[
{
{
path
:
'/gas-station/detail'
,
component
:
React
.
lazy
(()
=>
import
(
'./detail'
)),
},
{
path
:
'/gas-station/create'
,
path
:
'/gas-station/create'
,
component
:
React
.
lazy
(()
=>
import
(
'./Create'
)),
component
:
React
.
lazy
(()
=>
import
(
'./Create'
)),
},
},
...
...
src/app/views/GasStation/Index.js
View file @
ba6234e7
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
getListGasStation
,
getListGasStation
,
deleteGasStation
,
deleteGasStation
,
changeStatusGasStation
,
changeStatusGasStation
,
changeStatusStore
,
}
from
'app/apis/Functions/merchant'
}
from
'app/apis/Functions/merchant'
import
{
useHistory
}
from
'react-router-dom'
import
{
useHistory
}
from
'react-router-dom'
import
KEY
from
'app/assets/Key'
import
KEY
from
'app/assets/Key'
...
@@ -13,6 +14,7 @@ import { toast } from 'react-toastify'
...
@@ -13,6 +14,7 @@ import { toast } from 'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
{
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
{
dropdownStoreStatus
}
from
'app/apis/Functions/dropdown'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
...
@@ -26,13 +28,14 @@ const ToolNotificate = (props) => {
...
@@ -26,13 +28,14 @@ const ToolNotificate = (props) => {
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
listStatus
,
setListStatus
]
=
useState
([])
const
history
=
useHistory
()
const
history
=
useHistory
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
useEffect
(()
=>
{
useEffect
(()
=>
{
getDropDownMerchant
()
getDropDownMerchant
()
getDropdownData
()
},
[])
},
[])
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
...
@@ -95,6 +98,17 @@ const ToolNotificate = (props) => {
...
@@ -95,6 +98,17 @@ const ToolNotificate = (props) => {
}
}
}
}
const
getDropdownData
=
async
()
=>
{
const
res
=
await
dropdownStoreStatus
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setListStatus
(
res
.
data
.
data
)
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
theme
:
'colored'
,
})
}
}
const
getDropDownMerchant
=
async
()
=>
{
const
getDropDownMerchant
=
async
()
=>
{
try
{
try
{
const
res
=
await
dropdownMerchant
()
const
res
=
await
dropdownMerchant
()
...
@@ -116,13 +130,26 @@ const ToolNotificate = (props) => {
...
@@ -116,13 +130,26 @@ const ToolNotificate = (props) => {
getData
(
true
)
getData
(
true
)
},
[
searchDebount
,
merchant
,
status
])
},
[
searchDebount
,
merchant
,
status
])
const
removeItem
=
async
(
i
d
)
=>
{
const
removeItem
=
async
(
i
tem
)
=>
{
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
deleteGasStation
({
idGuid
:
id
})
let
res
if
(
item
.
status
==
1
)
{
res
=
await
changeStatusStore
({
id
:
item
.
id
,
status_id
:
5
,
})
}
else
{
res
=
await
changeStatusStore
({
id
:
item
.
id
,
status_id
:
1
,
})
}
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
(
'
Cập nhật trạng thái cây xăng
thành công!'
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
if
(
res
.
data
.
code
==
401
)
{
}
else
if
(
res
.
data
.
code
==
401
)
{
...
@@ -156,6 +183,7 @@ const ToolNotificate = (props) => {
...
@@ -156,6 +183,7 @@ const ToolNotificate = (props) => {
setMerchant
=
{
setMerchant
}
setMerchant
=
{
setMerchant
}
status
=
{
status
}
status
=
{
status
}
setStatus
=
{
setStatus
}
setStatus
=
{
setStatus
}
listStatus
=
{
listStatus
}
/
>
/
>
)
)
}
}
...
...
src/app/views/GasStation/Table.js
View file @
ba6234e7
...
@@ -82,6 +82,12 @@ const columns = [
...
@@ -82,6 +82,12 @@ const columns = [
align
:
'left'
,
align
:
'left'
,
minWidth
:
'auto'
,
minWidth
:
'auto'
,
},
},
{
id
:
'status_text'
,
label
:
'Trạng thái'
,
align
:
'left'
,
minWidth
:
'auto'
,
},
]
]
function
TableList
(
props
)
{
function
TableList
(
props
)
{
...
@@ -135,7 +141,7 @@ function TableList(props) {
...
@@ -135,7 +141,7 @@ function TableList(props) {
{
column
.
label
}
{
column
.
label
}
<
/TableCell
>
<
/TableCell
>
))}
))}
{
checkRole
(
user
,
'/gas-station/changeStatus'
)
&&
(
{
/* {
checkRole(user, '/gas-station/changeStatus') && (
<TableCell
<TableCell
style={{
style={{
backgroundColor: colors.headerTable,
backgroundColor: colors.headerTable,
...
@@ -144,13 +150,13 @@ function TableList(props) {
...
@@ -144,13 +150,13 @@ function TableList(props) {
>
>
Trạng thái
Trạng thái
</TableCell>
</TableCell>
)}
)}
*/
}
<
TableCell
<
TableCell
style
=
{{
style
=
{{
textAlign
:
'center'
,
textAlign
:
'center'
,
backgroundColor
:
colors
.
headerTable
,
backgroundColor
:
colors
.
headerTable
,
width
:
1
2
0
,
width
:
1
6
0
,
}}
}}
>
>
H
à
nh
độ
ng
H
à
nh
độ
ng
...
@@ -188,7 +194,7 @@ function TableList(props) {
...
@@ -188,7 +194,7 @@ function TableList(props) {
<
/TableCell
>
<
/TableCell
>
)
)
})}
})}
{
/*
{checkRole(
{checkRole(
user,
user,
'/gas-station/changeStatus'
'/gas-station/changeStatus'
...
@@ -216,9 +222,9 @@ function TableList(props) {
...
@@ -216,9 +222,9 @@ function TableList(props) {
</MenuItem>
</MenuItem>
</Select>
</Select>
</TableCell>
</TableCell>
)}
)}
*/
}
<
TableCell
>
<
TableCell
>
{
checkRole
(
{
/* {
checkRole(
user,
user,
'/gas-station/delete'
'/gas-station/delete'
) ? (
) ? (
...
@@ -262,7 +268,70 @@ function TableList(props) {
...
@@ -262,7 +268,70 @@ function TableList(props) {
</Icon>
</Icon>
</IconButton>
</IconButton>
</Tooltip>
</Tooltip>
)
:
null
}
) : null} */
}
{
row
.
status
==
1
&&
(
<
Tooltip
title
=
"Ngừng hoạt động"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Ngừng hoạt động cây xăng'
,
content
:
`Bạn có muốn ngừng hoạt động cây xăng
${
row
.
store_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"Delete"
>
<
Icon
color
=
"error"
>
stop_circle
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)}
{
row
.
status
==
5
&&
(
<
Tooltip
title
=
"Hoạt động"
>
<
IconButton
onClick
=
{()
=>
{
setSelected
({
...
row
,
title
:
'Cho phép hoạt động cây xăng'
,
content
:
`Bạn có muốn cho phép hoạt động cây xăng
${
row
.
store_name
}
hay không?`
,
})
setOpen
(
true
)
}}
className
=
{
classes
.
button
}
aria
-
label
=
"Delete"
>
<
Icon
style
=
{{
color
:
'#00C65B'
,
}}
>
not_started
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
)}
<
Tooltip
title
=
"Chi tiết"
>
<
IconButton
onClick
=
{()
=>
{
history
.
push
({
pathname
:
'/gas-station/detail'
,
state
:
row
.
id
,
})
}}
className
=
{
classes
.
button
}
aria
-
label
=
"edit"
>
<
Icon
color
=
"primary"
>
visibility
<
/Icon
>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell
>
<
/TableCell
>
<
/TableRow
>
<
/TableRow
>
)
)
...
@@ -275,7 +344,7 @@ function TableList(props) {
...
@@ -275,7 +344,7 @@ function TableList(props) {
open
=
{
open
}
open
=
{
open
}
handleClose
=
{
handleClose
}
handleClose
=
{
handleClose
}
onAgree
=
{()
=>
{
onAgree
=
{()
=>
{
removeItem
(
selected
.
id
)
removeItem
(
selected
)
handleClose
()
handleClose
()
}}
}}
/
>
/
>
...
...
src/app/views/GasStation/View.js
View file @
ba6234e7
...
@@ -36,6 +36,7 @@ function CustomerView(props) {
...
@@ -36,6 +36,7 @@ function CustomerView(props) {
listMerchant
,
listMerchant
,
status
,
status
,
setStatus
,
setStatus
,
listStatus
,
}
=
props
}
=
props
const
[
age
,
setAge
]
=
React
.
useState
(
''
)
const
[
age
,
setAge
]
=
React
.
useState
(
''
)
const
{
user
}
=
useAuth
()
const
{
user
}
=
useAuth
()
...
@@ -135,16 +136,7 @@ function CustomerView(props) {
...
@@ -135,16 +136,7 @@ function CustomerView(props) {
<
MenuItem
value
=
""
>
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
<
/MenuItem
>
{[
{
listStatus
.
map
((
e
)
=>
(
{
id
:
1
,
name
:
'Hoạt động'
,
},
{
id
:
2
,
name
:
'Khoá'
,
},
].
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
{
e
.
name
}
<
/MenuItem
>
<
/MenuItem
>
...
@@ -153,7 +145,7 @@ function CustomerView(props) {
...
@@ -153,7 +145,7 @@ function CustomerView(props) {
<
/FormControl
>
<
/FormControl
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
{
checkRole
(
user
,
'/gas-station/create'
)
?
(
{
/* {
checkRole(user, '/gas-station/create') ? (
<Link to="/gas-station/create">
<Link to="/gas-station/create">
<Button
<Button
variant="contained"
variant="contained"
...
@@ -162,7 +154,7 @@ function CustomerView(props) {
...
@@ -162,7 +154,7 @@ function CustomerView(props) {
<span className={'text-primary'}>Thêm mới</span>
<span className={'text-primary'}>Thêm mới</span>
</Button>
</Button>
</Link>
</Link>
)
:
null
}
) : null}
*/
}
<
/Grid
>
<
/Grid
>
<
Table
<
Table
...
...
src/app/views/GasStation/detail.js
0 → 100644
View file @
ba6234e7
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
ValidatorForm
,
TextValidator
,
SelectValidator
,
}
from
'react-material-ui-form-validator'
import
{
Button
,
Grid
,
MenuItem
,
Typography
,
IconButton
,
Icon
,
Tooltip
,
}
from
'@material-ui/core'
import
_
from
'lodash'
import
{
createGasStation
,
detailGasStation
,
deleteGasField
,
deleteGasOnline
,
changeStatusStore
,
}
from
'app/apis/Functions/merchant'
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
{
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
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
openCreate
,
setOpenCreate
]
=
useState
(
false
)
const
[
listField
,
setListField
]
=
useState
([])
const
[
fountainSelected
,
setFountainSelected
]
=
useState
()
const
[
openUpdate
,
setOpenUpdate
]
=
useState
()
const
[
listProvince
,
setListProvince
]
=
useState
([])
const
location
=
useLocation
()
const
{
t
}
=
useTranslation
()
useEffect
(()
=>
{
getDateDetail
()
getData
()
},
[])
const
getDateDetail
=
async
()
=>
{
props
.
showLoading
()
const
res
=
await
detailGasStation
(
location
.
state
,
{})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
console
.
log
(
res
.
data
.
data
.
GasFueldInfo
)
if
(
res
.
data
.
data
.
GasFueldInfo
)
{
setListField
(
res
.
data
.
data
?.
GasFueldInfo
)
}
setState
(
res
.
data
.
data
)
}
else
if
(
res
.
data
.
code
==
401
)
{
setTimeout
(()
=>
{
history
.
push
(
'/'
)
},
100
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
const
getData
=
async
()
=>
{
props
.
showLoading
()
const
res
=
await
dropdownMerchant
({})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
merchant_name
}
})
setListDrop
(
newList
)
}
else
if
(
res
.
data
.
code
==
401
)
{
setTimeout
(()
=>
{
history
.
push
(
'/'
)
},
100
)
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
theme
:
'colored'
,
})
}
}
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
const
res
=
await
createGasStation
({
id
:
newValue
?.
id
,
merchant_id
:
newValue
?.
merchant_id
,
store_name
:
newValue
?.
store_name
,
address
:
newValue
?.
address
,
gas_fields
:
listField
,
store_code
:
newValue
?.
store_code
,
queue_name
:
newValue
?.
queue_name
,
account
:
newValue
?.
account
,
user_name
:
newValue
?.
user_name
,
password
:
newValue
?.
password
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
history
.
push
(
'/gas-station'
)
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
'Cập nhật cây xăng thành công!'
,
{
theme
:
'colored'
,
})
}
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
const
handleChange
=
(
event
)
=>
{
event
.
persist
()
setState
({
...
state
,
[
event
.
target
.
name
]:
event
.
target
.
value
,
})
}
const
handleDateChange
=
(
date
)
=>
{
setState
({
...
state
,
date
})
}
const
countFountain
=
()
=>
{
let
temp
=
0
listField
.
map
((
e
)
=>
{
if
(
e
.
gas_olines
)
{
temp
+=
e
.
gas_olines
.
length
}
})
return
temp
}
const
changeSatusStore
=
async
(
status
)
=>
{
if
(
location
.
state
)
{
props
.
showLoading
()
const
res
=
await
changeStatusStore
({
id
:
location
.
state
,
status_id
:
status
,
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
toast
.
success
(
`
${
status
==
4
?
'Từ chối phê duyệt'
:
'Phê duyệt'
}
trụ xăng thành công`
,
{
theme
:
'colored'
,
}
)
history
.
push
(
'/gas-station'
)
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
else
{
toast
.
error
(
'Trạng thái không hợp lệ'
,
{
theme
:
'colored'
,
})
}
}
const
{
store_name
,
province_id
,
supplier_main
,
address
,
partition_id
,
store_code
,
phone
,
email
,
merchant_id
,
provice_name
,
status
,
supplier_main_name
,
partition_name
,
merchant_name
,
}
=
state
return
(
<
div
className
=
"m-sm-30"
>
<
div
className
=
"mb-sm-30"
>
<
div
className
=
"mb-sm-30"
>
<
Breadcrumb
routeSegments
=
{[
{
name
:
'Danh sách cây xăng'
,
path
:
'/gas-station'
,
},
{
name
:
'Chi tiết'
},
]}
/
>
<
/div
>
<
SimpleCard
>
<
ValidatorForm
id
=
"form-create"
onSubmit
=
{
handleSubmit
}
onError
=
{()
=>
null
}
>
<
Grid
container
spacing
=
{
3
}
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Thuộc pháp nhân "
disabled
=
{
true
}
onChange
=
{
handleChange
}
type
=
"text"
name
=
"merchant_name"
value
=
{
merchant_name
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Mã cây xăng "
disabled
=
{
true
}
onChange
=
{
handleChange
}
type
=
"text"
name
=
"store_code"
value
=
{
store_code
||
''
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Tên cây xăng "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"store_name"
value
=
{
store_name
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Tỉnh thành phố "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"provice_name"
value
=
{
provice_name
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Địa chỉ "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"address"
value
=
{
address
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Vùng "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"partition_name"
value
=
{
partition_name
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Đơn vị cung cấp main "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"supplier_main_name"
value
=
{
supplier_main_name
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Số điện thoại "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"phone"
value
=
{
phone
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
lg
=
{
6
}
md
=
{
6
}
sm
=
{
12
}
xs
=
{
12
}
>
<
TextValidator
variant
=
"outlined"
className
=
"mb-4 w-full"
label
=
"Email "
onChange
=
{
handleChange
}
type
=
"text"
name
=
"email"
value
=
{
email
||
''
}
disabled
=
{
true
}
/
>
<
/Grid
>
<
Grid
item
container
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
justify
=
"space-between"
style
=
{{
padding
:
10
,
borderRadius
:
5
,
}}
>
<
Typography
variant
=
"h6"
>
Th
ô
ng
tin
tr
ụ
x
ă
ng
<
/Typography
>
<
Grid
item
container
lg
=
{
12
}
md
=
{
12
}
sm
=
{
12
}
xs
=
{
12
}
justify
=
"space-between"
>
<
div
>
<
Typography
variant
=
"subtitle1"
>
S
ố
l
ượ
ng
tr
ụ
:
{
listField
.
length
}
<
/Typography
>
<
Typography
variant
=
"subtitle1"
>
S
ố
l
ượ
ng
v
ò
i
:
{
countFountain
()}
<
/Typography
>
<
/div
>
<
/Grid
>
{
listField
.
map
((
item
,
index
)
=>
(
<
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
>
<
/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"
>
M
ã
v
ò
i
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
V
ò
i
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"center"
>
B
ồ
n
k
ế
t
n
ố
i
<
/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
?.
code
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
name
}
<
/TableCell
>
<
TableCell
style
=
{{
borderRight
:
'0.05px solid #e0e0e0'
,
}}
align
=
"right"
>
{
row
?.
tank_name
}
<
/TableCell
>
<
/TableRow
>
)
)}
<
/TableBody
>
<
/Table
>
<
/TableContainer
>
<
/Grid
>
<
/Grid
>
))}
<
/Grid
>
<
/Grid
>
<
Grid
style
=
{{
marginTop
:
40
,
}}
container
justify
=
{
'flex-end'
}
>
<
Button
style
=
{{
marginRight
:
20
,
}}
color
=
"inherit"
variant
=
"contained"
onClick
=
{()
=>
{
history
.
goBack
()
}}
>
<
span
className
=
"capitalize"
>
Quay
l
ạ
i
<
/span
>
<
/Button
>
{
status
==
3
&&
(
<
Button
style
=
{{
marginRight
:
20
,
}}
color
=
"secondary"
variant
=
"contained"
onClick
=
{()
=>
{
changeSatusStore
(
4
)
}}
>
<
span
style
=
{{
color
:
'white'
,
}}
className
=
"capitalize"
>
T
ừ
ch
ố
i
<
/span
>
<
/Button
>
)}
{
status
==
3
&&
(
<
Button
color
=
"primary"
variant
=
"contained"
onClick
=
{()
=>
{
changeSatusStore
(
1
)
}}
>
<
span
className
=
"capitalize"
>
Duy
ệ
t
<
/span
>
<
/Button
>
)}
<
/Grid
>
<
/ValidatorForm
>
<
/SimpleCard
>
<
/div
>
<
/div
>
)
}
const
mapStateToProps
=
(
state
)
=>
{
return
{}
}
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
SimpleForm
)
src/app/views/Merchant/Create.js
View file @
ba6234e7
...
@@ -339,16 +339,12 @@ const SimpleForm = (props) => {
...
@@ -339,16 +339,12 @@ const SimpleForm = (props) => {
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
<
Grid
xs
=
{
6
}
sm
=
{
6
}
item
>
<
SelectValidator
<
SelectValidator
variant
=
{
'outlined'
}
variant
=
{
'outlined'
}
label
=
{
'Đơn vị cung cấp
*
'
}
label
=
{
'Đơn vị cung cấp'
}
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
value
=
{
supplier_code
||
''
}
value
=
{
supplier_code
||
''
}
displayEmpty
displayEmpty
name
=
"supplier_code"
name
=
"supplier_code"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
>
>
{
listDrop
.
map
((
e
)
=>
(
{
listDrop
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
<
MenuItem
value
=
{
e
.
id
}
>
...
@@ -364,15 +360,11 @@ const SimpleForm = (props) => {
...
@@ -364,15 +360,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Mã số thuế hoá đơn
*
"
label
=
"Mã số thuế hoá đơn"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_tax_code"
name
=
"hddt_tax_code"
value
=
{
hddt_tax_code
||
''
}
value
=
{
hddt_tax_code
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -382,15 +374,11 @@ const SimpleForm = (props) => {
...
@@ -382,15 +374,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Tài khoản hoá đơn
*
"
label
=
"Tài khoản hoá đơn"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_username"
name
=
"hddt_username"
value
=
{
hddt_username
||
''
}
value
=
{
hddt_username
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -400,15 +388,11 @@ const SimpleForm = (props) => {
...
@@ -400,15 +388,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Mật khẩu hoá đơn
*
"
label
=
"Mật khẩu hoá đơn "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_password"
name
=
"hddt_password"
value
=
{
hddt_password
||
''
}
value
=
{
hddt_password
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -418,15 +402,11 @@ const SimpleForm = (props) => {
...
@@ -418,15 +402,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Chữ ký hoá đơn
*
"
label
=
"Chữ ký hoá đơn "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_character"
name
=
"hddt_character"
value
=
{
hddt_character
||
''
}
value
=
{
hddt_character
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -436,15 +416,11 @@ const SimpleForm = (props) => {
...
@@ -436,15 +416,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Loại chữ ký số
*
"
label
=
"Loại chữ ký số "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_sign_code"
name
=
"hddt_sign_code"
value
=
{
hddt_sign_code
||
''
}
value
=
{
hddt_sign_code
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -454,15 +430,11 @@ const SimpleForm = (props) => {
...
@@ -454,15 +430,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Tài khoản Admin hoá đơn điện tử
*
"
label
=
"Tài khoản Admin hoá đơn điện tử "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_account"
name
=
"hddt_account"
value
=
{
hddt_account
||
''
}
value
=
{
hddt_account
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -472,15 +444,11 @@ const SimpleForm = (props) => {
...
@@ -472,15 +444,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Mật khẩu Admin hoá đơn điện tử
*
"
label
=
"Mật khẩu Admin hoá đơn điện tử "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_acpass"
name
=
"hddt_acpass"
value
=
{
hddt_acpass
||
''
}
value
=
{
hddt_acpass
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -490,15 +458,11 @@ const SimpleForm = (props) => {
...
@@ -490,15 +458,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Đường dẫn api
*
"
label
=
"Đường dẫn api "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"hddt_base_url"
name
=
"hddt_base_url"
value
=
{
hddt_base_url
||
''
}
value
=
{
hddt_base_url
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -508,15 +472,11 @@ const SimpleForm = (props) => {
...
@@ -508,15 +472,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Mẫu hoá đơn
*
"
label
=
"Mẫu hoá đơn "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"inv_pattern"
name
=
"inv_pattern"
value
=
{
inv_pattern
||
''
}
value
=
{
inv_pattern
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -526,15 +486,11 @@ const SimpleForm = (props) => {
...
@@ -526,15 +486,11 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Ký hiệu hoá đơn
*
"
label
=
"Ký hiệu hoá đơn "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"inv_serial"
name
=
"inv_serial"
value
=
{
inv_serial
||
''
}
value
=
{
inv_serial
||
''
}
validators
=
{[
'required'
]}
errorMessages
=
{[
'Không được để trống trường này'
,
]}
/
>
/
>
<
/Grid
>
<
/Grid
>
)
:
null
}
)
:
null
}
...
@@ -567,7 +523,7 @@ const SimpleForm = (props) => {
...
@@ -567,7 +523,7 @@ const SimpleForm = (props) => {
<
TextValidator
<
TextValidator
variant
=
"outlined"
variant
=
"outlined"
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
label
=
"Độ trễ phát hành hoá đơn
*
"
label
=
"Độ trễ phát hành hoá đơn "
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
type
=
"text"
type
=
"text"
name
=
"publish_invoce_time"
name
=
"publish_invoce_time"
...
...
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