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
2c69692f
Commit
2c69692f
authored
a year ago
by
tdgiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
5acc8772
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
156 additions
and
91 deletions
+156
-91
UpdateFountain.jsx
src/app/components/dialog/UpdateFountain.jsx
+9
-2
Index.js
src/app/views/Fee/Index.js
+3
-3
Create.js
src/app/views/GasStation/Create.js
+6
-6
Index.js
src/app/views/GasStation/Index.js
+32
-20
Update.js
src/app/views/GasStation/Update.js
+25
-4
View.js
src/app/views/GasStation/View.js
+41
-1
Index.js
src/app/views/Merchant/Index.js
+7
-15
Index.js
src/app/views/Transaction/Index.js
+3
-3
Create.js
src/app/views/product/product/Create.js
+4
-3
Index.js
src/app/views/product/product/Index.js
+5
-5
Update.js
src/app/views/product/product/Update.js
+5
-5
Create.js
src/app/views/product/type/Create.js
+5
-1
Index.js
src/app/views/product/type/Index.js
+7
-19
Update.js
src/app/views/product/type/Update.js
+4
-4
No files found.
src/app/components/dialog/UpdateFountain.jsx
View file @
2c69692f
...
@@ -46,10 +46,17 @@ export default function FormDialog( props) {
...
@@ -46,10 +46,17 @@ export default function FormDialog( props) {
const
[
product
,
setProduct
]
=
useState
()
const
[
product
,
setProduct
]
=
useState
()
const
[
type
,
setType
]
=
useState
()
const
[
type
,
setType
]
=
useState
()
console
.
log
(
"data"
,
data
)
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
data
){
if
(
data
){
setState
({...
data
})
setState
({...
data
})
if
(
data
.
type
){
setType
(
data
.
type
)
setType
(
data
.
type
)
}
else
{
setType
(
data
.
product_type_id
)
}
setProduct
(
data
.
product_id
)
setProduct
(
data
.
product_id
)
}
}
...
@@ -128,7 +135,7 @@ export default function FormDialog( props) {
...
@@ -128,7 +135,7 @@ export default function FormDialog( props) {
const
{
product_id
,
name
,
code
}
=
state
const
{
product_id
,
name
,
code
}
=
state
console
.
log
(
"
product_id"
,
product_id
)
console
.
log
(
"
listType"
,
listType
)
return
(
return
(
...
@@ -140,7 +147,7 @@ export default function FormDialog( props) {
...
@@ -140,7 +147,7 @@ export default function FormDialog( props) {
>
>
<
DialogTitle
id=
"form-dialog-title"
>
<
DialogTitle
id=
"form-dialog-title"
>
Thêm
vòi xăng
Cập nhật
vòi xăng
</
DialogTitle
>
</
DialogTitle
>
<
DialogContent
>
<
DialogContent
>
...
...
This diff is collapsed.
Click to expand it.
src/app/views/Fee/Index.js
View file @
2c69692f
...
@@ -8,7 +8,7 @@ import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
...
@@ -8,7 +8,7 @@ import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
dropdownStore
,
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
{
dropdownStore
,
dropdownMerchant
}
from
'app/apis/Functions/dropdown'
import
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
applications
,
setApplications
]
=
useState
(
''
)
const
[
applications
,
setApplications
]
=
useState
(
''
)
...
@@ -20,7 +20,7 @@ const ToolNotificate = (props) => {
...
@@ -20,7 +20,7 @@ const ToolNotificate = (props) => {
const
[
startDate
,
setStartDate
]
=
useState
(
new
Date
())
const
[
startDate
,
setStartDate
]
=
useState
(
new
Date
())
const
[
endDate
,
setEndDate
]
=
useState
(
new
Date
())
const
[
endDate
,
setEndDate
]
=
useState
(
new
Date
())
const
[
report
,
setReport
]
=
useState
()
const
[
report
,
setReport
]
=
useState
()
const
{
t
}
=
useTranslation
()
const
[
listModule
,
setListModule
]
=
useState
([])
const
[
listModule
,
setListModule
]
=
useState
([])
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
merchant
,
setMerchant
]
=
useState
()
const
[
merchant
,
setMerchant
]
=
useState
()
...
@@ -97,7 +97,7 @@ const ToolNotificate = (props) => {
...
@@ -97,7 +97,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy dữ liệu thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Create.js
View file @
2c69692f
...
@@ -32,7 +32,7 @@ import Paper from '@material-ui/core/Paper'
...
@@ -32,7 +32,7 @@ import Paper from '@material-ui/core/Paper'
import
CreateField
from
'app/components/dialog/CreateField'
import
CreateField
from
'app/components/dialog/CreateField'
import
CreateFountain
from
'app/components/dialog/CreateFountain'
import
CreateFountain
from
'app/components/dialog/CreateFountain'
import
UpdateFountain
from
'app/components/dialog/UpdateFountain'
import
UpdateFountain
from
'app/components/dialog/UpdateFountain'
import
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
history
=
useHistory
()
...
@@ -41,7 +41,7 @@ const SimpleForm = (props) => {
...
@@ -41,7 +41,7 @@ const SimpleForm = (props) => {
const
[
listField
,
setListField
]
=
useState
([])
const
[
listField
,
setListField
]
=
useState
([])
const
[
fountainSelected
,
setFountainSelected
]
=
useState
()
const
[
fountainSelected
,
setFountainSelected
]
=
useState
()
const
[
openUpdate
,
setOpenUpdate
]
=
useState
()
const
[
openUpdate
,
setOpenUpdate
]
=
useState
()
const
{
t
}
=
useTranslation
()
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
()
getData
()
},
[])
},
[])
...
@@ -86,7 +86,7 @@ const SimpleForm = (props) => {
...
@@ -86,7 +86,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Tạo cây xăng thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -264,7 +264,7 @@ const SimpleForm = (props) => {
...
@@ -264,7 +264,7 @@ const SimpleForm = (props) => {
return
temp
return
temp
}
}
const
{
store_name
,
address
,
merchan_id
}
=
state
const
{
store_name
,
address
,
merchan
t
_id
}
=
state
return
(
return
(
<
div
className
=
"m-sm-30"
>
<
div
className
=
"m-sm-30"
>
...
@@ -292,9 +292,9 @@ const SimpleForm = (props) => {
...
@@ -292,9 +292,9 @@ const SimpleForm = (props) => {
variant
=
{
'outlined'
}
variant
=
{
'outlined'
}
label
=
{
'Thuộc pháp nhân *'
}
label
=
{
'Thuộc pháp nhân *'
}
className
=
"mb-4 w-full"
className
=
"mb-4 w-full"
value
=
{
merchan_id
||
''
}
value
=
{
merchan
t
_id
||
''
}
displayEmpty
displayEmpty
name
=
"merchan_id"
name
=
"merchan
t
_id"
onChange
=
{
handleChange
}
onChange
=
{
handleChange
}
validators
=
{[
'required'
]}
validators
=
{[
'required'
]}
errorMessages
=
{[
errorMessages
=
{[
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Index.js
View file @
2c69692f
...
@@ -11,36 +11,29 @@ import { connect } from 'react-redux'
...
@@ -11,36 +11,29 @@ import { connect } from 'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
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
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
{
t
}
=
useTranslation
()
const
[
activeSelected
,
setActiveSeleted
]
=
useState
(
null
)
const
[
activeSelected
,
setActiveSeleted
]
=
useState
(
null
)
const
[
changeActive
,
setChangeActive
]
=
useState
(
1
)
const
[
changeActive
,
setChangeActive
]
=
useState
(
1
)
const
[
pageIndex
,
setPageIndex
]
=
useState
(
0
)
const
[
pageIndex
,
setPageIndex
]
=
useState
(
0
)
const
[
pageSize
]
=
useState
(
10
)
const
[
pageSize
]
=
useState
(
10
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
listMerchant
,
setListMerchant
]
=
useState
([])
const
[
merchant
,
setMerchant
]
=
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
(()
=>
{
// getListPermission();
getDropDownMerchant
()
// }, []);
},
[])
// const getListPermission = () => {
// let temp = localStorage.getItem(KEY.LISTPATH);
// let listPath = JSON.parse(temp);
// if (listPath) {
// const newlist = listPath.map((e) => {
// if (e.function_code) return e.function_code;
// return e.action_code;
// });
// setPermissions(newlist);
// }
// };
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
props
.
showLoading
()
props
.
showLoading
()
...
@@ -52,7 +45,7 @@ const ToolNotificate = (props) => {
...
@@ -52,7 +45,7 @@ const ToolNotificate = (props) => {
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
{
}
else
{
toast
.
error
(
'Thay đổi trạng thái thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -61,9 +54,10 @@ const ToolNotificate = (props) => {
...
@@ -61,9 +54,10 @@ const ToolNotificate = (props) => {
const
getData
=
async
()
=>
{
const
getData
=
async
()
=>
{
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
getListGasStation
({
const
res
=
await
getListGasStation
({
name
:
searchDebount
,
text_search
:
searchDebount
,
page_no
:
pageIndex
+
1
,
page_no
:
pageIndex
+
1
,
page_size
:
pageSize
,
page_size
:
pageSize
,
merchant_id
:
merchant
,
})
})
props
.
hideLoading
()
props
.
hideLoading
()
...
@@ -82,13 +76,28 @@ const ToolNotificate = (props) => {
...
@@ -82,13 +76,28 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
// enqueueSnackbar('Error!', { variant: 'error' })
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
const
getDropDownMerchant
=
async
()
=>
{
try
{
const
res
=
await
dropdownMerchant
()
console
.
log
(
res
)
const
newList
=
res
.
data
.
data
.
map
((
e
)
=>
{
return
{
...
e
,
name
:
e
.
merchant_name
}
})
setListMerchant
(
newList
)
}
catch
(
err
)
{
//toast.error(t(err))
}
}
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
()
getData
()
},
[
searchDebount
,
pageIndex
])
},
[
searchDebount
,
pageIndex
,
merchant
])
const
removeItem
=
async
(
id
)
=>
{
const
removeItem
=
async
(
id
)
=>
{
props
.
showLoading
()
props
.
showLoading
()
...
@@ -105,7 +114,7 @@ const ToolNotificate = (props) => {
...
@@ -105,7 +114,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Xoá bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -125,6 +134,9 @@ const ToolNotificate = (props) => {
...
@@ -125,6 +134,9 @@ const ToolNotificate = (props) => {
handeChangeActive
=
{
handeChangeActive
}
handeChangeActive
=
{
handeChangeActive
}
totalRecords
=
{
totalRecords
}
totalRecords
=
{
totalRecords
}
permissions
=
{
permissions
}
permissions
=
{
permissions
}
listMerchant
=
{
listMerchant
}
merchant
=
{
merchant
}
setMerchant
=
{
setMerchant
}
/
>
/
>
)
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/Update.js
View file @
2c69692f
...
@@ -70,7 +70,7 @@ const SimpleForm = (props) => {
...
@@ -70,7 +70,7 @@ const SimpleForm = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy thông tin bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -120,7 +120,7 @@ const SimpleForm = (props) => {
...
@@ -120,7 +120,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Cập nhật cây xăng thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -168,7 +168,13 @@ const SimpleForm = (props) => {
...
@@ -168,7 +168,13 @@ const SimpleForm = (props) => {
const
deletePillar
=
(
index
)
=>
{
const
deletePillar
=
(
index
)
=>
{
let
arr
=
[...
listField
]
let
arr
=
[...
listField
]
console
.
log
(
'arr'
,
arr
)
if
(
arr
[
index
].
id
)
{
callApiDeletePillar
(
arr
[
index
].
id
)
}
arr
.
splice
(
index
,
1
)
arr
.
splice
(
index
,
1
)
setListField
(
arr
)
setListField
(
arr
)
toast
.
success
(
'Xoá trụ thành công!'
,
{
toast
.
success
(
'Xoá trụ thành công!'
,
{
theme
:
'colored'
,
theme
:
'colored'
,
...
@@ -264,11 +270,12 @@ const SimpleForm = (props) => {
...
@@ -264,11 +270,12 @@ const SimpleForm = (props) => {
let
arr
=
[...
listField
]
let
arr
=
[...
listField
]
let
newList
=
arr
.
map
((
e
,
i
)
=>
{
let
newList
=
arr
.
map
((
e
,
i
)
=>
{
if
(
i
==
fountainSelected
.
index
)
{
console
.
log
(
'data'
,
data
)
console
.
log
(
'data'
,
data
)
console
.
log
(
'e.gas_olines'
,
e
.
gas_olines
)
console
.
log
(
'e.gas_olines'
,
e
.
gas_olines
)
if
(
e
.
gas_olines
.
findIndex
((
e
)
=>
e
.
code
==
data
.
code
)
!=
-
1
)
{
if
(
e
.
gas_olines
.
findIndex
((
e
)
=>
e
.
code
==
data
.
code
)
!=
-
1
)
{
const
temp
=
e
.
gas_olines
.
map
((
item
)
=>
{
const
temp
=
e
.
gas_olines
.
map
((
item
)
=>
{
console
.
log
(
'Run item'
,
item
)
console
.
log
(
'Run data'
,
data
)
if
(
item
.
code
==
data
.
code
)
return
{
...
data
}
if
(
item
.
code
==
data
.
code
)
return
{
...
data
}
return
{
...
item
}
return
{
...
item
}
})
})
...
@@ -282,8 +289,8 @@ const SimpleForm = (props) => {
...
@@ -282,8 +289,8 @@ const SimpleForm = (props) => {
gas_olines
:
e
.
gas_olines
,
gas_olines
:
e
.
gas_olines
,
}
}
}
}
}
else
return
{
...
e
}
})
})
console
.
log
(
'newList'
,
newList
)
setListField
(
newList
)
setListField
(
newList
)
setOpenUpdate
(
false
)
setOpenUpdate
(
false
)
...
@@ -315,6 +322,20 @@ const SimpleForm = (props) => {
...
@@ -315,6 +322,20 @@ const SimpleForm = (props) => {
}
}
}
}
const
callApiDeletePillar
=
async
(
id
)
=>
{
props
.
showLoading
()
const
res
=
await
deleteGasField
({
idGuid
:
id
})
props
.
hideLoading
()
if
(
res
.
data
.
code
==
200
)
{
return
true
}
else
{
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
return
false
}
}
const
{
store_name
,
address
,
merchant_id
}
=
state
const
{
store_name
,
address
,
merchant_id
}
=
state
return
(
return
(
...
...
This diff is collapsed.
Click to expand it.
src/app/views/GasStation/View.js
View file @
2c69692f
...
@@ -31,6 +31,9 @@ function CustomerView(props) {
...
@@ -31,6 +31,9 @@ function CustomerView(props) {
pageIndex
,
pageIndex
,
totalRecords
,
totalRecords
,
permissions
,
permissions
,
merchant
,
setMerchant
,
listMerchant
,
}
=
props
}
=
props
const
[
age
,
setAge
]
=
React
.
useState
(
''
)
const
[
age
,
setAge
]
=
React
.
useState
(
''
)
const
{
user
}
=
useAuth
()
const
{
user
}
=
useAuth
()
...
@@ -62,7 +65,16 @@ function CustomerView(props) {
...
@@ -62,7 +65,16 @@ function CustomerView(props) {
container
container
spacing
=
{
3
}
spacing
=
{
3
}
>
>
<
Grid
item
lg
=
{
3
}
md
=
{
3
}
sm
=
{
6
}
xs
=
{
6
}
>
<
Grid
spacing
=
{
3
}
container
item
lg
=
{
8
}
md
=
{
8
}
sm
=
{
8
}
xs
=
{
8
}
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
TextField
<
TextField
variant
=
"outlined"
variant
=
"outlined"
className
=
"w-full"
className
=
"w-full"
...
@@ -75,6 +87,34 @@ function CustomerView(props) {
...
@@ -75,6 +87,34 @@ function CustomerView(props) {
}}
}}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
lg
=
{
4
}
md
=
{
4
}
sm
=
{
6
}
xs
=
{
6
}
>
<
FormControl
variant
=
"outlined"
fullWidth
>
<
InputLabel
htmlFor
=
"outlined-age-native-simple"
>
Ph
á
p
nh
â
n
<
/InputLabel
>
<
Select
label
=
"Pháp nhân"
value
=
{
merchant
}
onChange
=
{(
e
)
=>
setMerchant
(
e
.
target
.
value
)
}
inputProps
=
{{
name
:
'age'
,
id
:
'outlined-age-native-simple'
,
}}
>
<
MenuItem
value
=
""
>
<
em
>
T
ấ
t
c
ả
<
/em
>
<
/MenuItem
>
{
listMerchant
.
map
((
e
)
=>
(
<
MenuItem
value
=
{
e
.
id
}
>
{
e
.
name
}
<
/MenuItem
>
))}
<
/Select
>
<
/FormControl
>
<
/Grid
>
<
/Grid
>
{
checkRole
(
user
,
'/gas-station/create'
)
?
(
{
checkRole
(
user
,
'/gas-station/create'
)
?
(
<
Link
to
=
"/gas-station/create"
>
<
Link
to
=
"/gas-station/create"
>
<
Button
<
Button
...
...
This diff is collapsed.
Click to expand it.
src/app/views/Merchant/Index.js
View file @
2c69692f
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
...
@@ -24,7 +24,7 @@ const ToolNotificate = (props) => {
...
@@ -24,7 +24,7 @@ const ToolNotificate = (props) => {
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
...
@@ -38,7 +38,7 @@ const ToolNotificate = (props) => {
...
@@ -38,7 +38,7 @@ const ToolNotificate = (props) => {
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
{
}
else
{
toast
.
error
(
'Thay đổi trạng thái thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -63,13 +63,10 @@ const ToolNotificate = (props) => {
...
@@ -63,13 +63,10 @@ const ToolNotificate = (props) => {
setData
(
newList
)
setData
(
newList
)
setTotalRecord
(
res
.
data
.
data
.
total_elements
)
setTotalRecord
(
res
.
data
.
data
.
total_elements
)
}
else
if
(
res
.
data
.
code
==
401
)
{
localStorage
.
removeItem
(
KEY
.
API_TOKEN
)
setTimeout
(()
=>
{
history
.
push
(
'/'
)
},
100
)
}
else
{
}
else
{
// enqueueSnackbar('Error!', { variant: 'error' })
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
}
}
...
@@ -86,13 +83,8 @@ const ToolNotificate = (props) => {
...
@@ -86,13 +83,8 @@ const ToolNotificate = (props) => {
toast
.
success
(
'Xoá bản ghi thành công!'
,
{
toast
.
success
(
'Xoá bản ghi thành công!'
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
if
(
res
.
data
.
code
==
401
)
{
localStorage
.
removeItem
(
KEY
.
API_TOKEN
)
setTimeout
(()
=>
{
history
.
push
(
'/'
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Xoá bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/Transaction/Index.js
View file @
2c69692f
...
@@ -7,7 +7,7 @@ import { connect } from 'react-redux'
...
@@ -7,7 +7,7 @@ import { connect } from 'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
applications
,
setApplications
]
=
useState
(
''
)
const
[
applications
,
setApplications
]
=
useState
(
''
)
...
@@ -18,7 +18,7 @@ const ToolNotificate = (props) => {
...
@@ -18,7 +18,7 @@ const ToolNotificate = (props) => {
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
[
startDate
,
setStartDate
]
=
useState
()
const
[
startDate
,
setStartDate
]
=
useState
()
const
[
endDate
,
setEndDate
]
=
useState
()
const
[
endDate
,
setEndDate
]
=
useState
()
const
{
t
}
=
useTranslation
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
changeDateRange
=
(
start
,
end
)
=>
{
const
changeDateRange
=
(
start
,
end
)
=>
{
...
@@ -49,7 +49,7 @@ const ToolNotificate = (props) => {
...
@@ -49,7 +49,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy dữ liệu thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/product/Create.js
View file @
2c69692f
...
@@ -27,11 +27,12 @@ import { trimObject, toPriceVndInput } from 'app/config/Function'
...
@@ -27,11 +27,12 @@ import { trimObject, toPriceVndInput } from 'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
createProduct
}
from
'app/apis/Functions/product'
import
{
createProduct
}
from
'app/apis/Functions/product'
import
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
()
getData
()
},
[])
},
[])
...
@@ -49,7 +50,7 @@ const SimpleForm = (props) => {
...
@@ -49,7 +50,7 @@ const SimpleForm = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -70,7 +71,7 @@ const SimpleForm = (props) => {
...
@@ -70,7 +71,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Tạo sản phẩm thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/product/Index.js
View file @
2c69692f
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
activeSelected
,
setActiveSeleted
]
=
useState
(
null
)
const
[
activeSelected
,
setActiveSeleted
]
=
useState
(
null
)
...
@@ -23,7 +23,7 @@ const ToolNotificate = (props) => {
...
@@ -23,7 +23,7 @@ const ToolNotificate = (props) => {
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
...
@@ -37,7 +37,7 @@ const ToolNotificate = (props) => {
...
@@ -37,7 +37,7 @@ const ToolNotificate = (props) => {
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
{
}
else
{
toast
.
error
(
'Thay đổi trạng thái thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -67,7 +67,7 @@ const ToolNotificate = (props) => {
...
@@ -67,7 +67,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -92,7 +92,7 @@ const ToolNotificate = (props) => {
...
@@ -92,7 +92,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Xoá bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/product/Update.js
View file @
2c69692f
...
@@ -14,12 +14,12 @@ import { Link, useHistory, useLocation } from 'react-router-dom'
...
@@ -14,12 +14,12 @@ import { Link, useHistory, useLocation } from 'react-router-dom'
import
{
trimObject
,
toPriceVndInput
}
from
'app/config/Function'
import
{
trimObject
,
toPriceVndInput
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
import
localStorageService
from
'app/services/localStorageService'
import
localStorageService
from
'app/services/localStorageService'
import
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
[
listDrop
,
setListDrop
]
=
useState
([])
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
const
location
=
useLocation
()
const
location
=
useLocation
()
useEffect
(()
=>
{
useEffect
(()
=>
{
getDropDown
()
getDropDown
()
...
@@ -39,7 +39,7 @@ const SimpleForm = (props) => {
...
@@ -39,7 +39,7 @@ const SimpleForm = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy thông tin bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -59,7 +59,7 @@ const SimpleForm = (props) => {
...
@@ -59,7 +59,7 @@ const SimpleForm = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy giữ liệu thất bại !'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -80,7 +80,7 @@ const SimpleForm = (props) => {
...
@@ -80,7 +80,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Cập nhật sản phẩm thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/type/Create.js
View file @
2c69692f
...
@@ -9,9 +9,13 @@ import { Breadcrumb, SimpleCard } from 'app/components'
...
@@ -9,9 +9,13 @@ import { Breadcrumb, SimpleCard } from 'app/components'
import
{
Link
,
useHistory
,
useLocation
}
from
'react-router-dom'
import
{
Link
,
useHistory
,
useLocation
}
from
'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
trimObject
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
import
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
const
handleSubmit
=
async
(
event
)
=>
{
const
handleSubmit
=
async
(
event
)
=>
{
const
newValue
=
trimObject
(
state
)
const
newValue
=
trimObject
(
state
)
props
.
showLoading
()
props
.
showLoading
()
...
@@ -27,7 +31,7 @@ const SimpleForm = (props) => {
...
@@ -27,7 +31,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Tạo loại sản phẩm thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/type/Index.js
View file @
2c69692f
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
...
@@ -11,7 +11,7 @@ import { connect } from 'react-redux'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
showLoading
,
hideLoading
}
from
'app/redux/actions/loadingAction'
import
{
toast
}
from
'react-toastify'
import
{
toast
}
from
'react-toastify'
import
useDebounce
from
'app/hooks/useDebounce'
import
useDebounce
from
'app/hooks/useDebounce'
import
{
useTranslation
}
from
'react-i18next'
const
ToolNotificate
=
(
props
)
=>
{
const
ToolNotificate
=
(
props
)
=>
{
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
[
txtSearch
,
setTxtSearch
]
=
useState
(
''
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
const
searchDebount
=
useDebounce
(
txtSearch
,
1000
)
...
@@ -24,23 +24,9 @@ const ToolNotificate = (props) => {
...
@@ -24,23 +24,9 @@ const ToolNotificate = (props) => {
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
[
totalRecords
,
setTotalRecord
]
=
useState
(
0
)
const
history
=
useHistory
()
const
history
=
useHistory
()
const
{
t
}
=
useTranslation
()
const
[
data
,
setData
]
=
useState
([])
const
[
data
,
setData
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
const
[
permissions
,
setPermissions
]
=
useState
([])
// useEffect(() => {
// getListPermission();
// }, []);
// const getListPermission = () => {
// let temp = localStorage.getItem(KEY.LISTPATH);
// let listPath = JSON.parse(temp);
// if (listPath) {
// const newlist = listPath.map((e) => {
// if (e.function_code) return e.function_code;
// return e.action_code;
// });
// setPermissions(newlist);
// }
// };
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
const
handeChangeActive
=
async
(
id
,
status_id
)
=>
{
props
.
showLoading
()
props
.
showLoading
()
...
@@ -52,7 +38,7 @@ const ToolNotificate = (props) => {
...
@@ -52,7 +38,7 @@ const ToolNotificate = (props) => {
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
else
{
}
else
{
toast
.
error
(
'Thay đổi trạng thái thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -81,7 +67,9 @@ const ToolNotificate = (props) => {
...
@@ -81,7 +67,9 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
// enqueueSnackbar('Error!', { variant: 'error' })
toast
.
error
(
t
(
res
.
data
.
error
),
{
theme
:
'colored'
,
})
}
}
}
}
...
@@ -104,7 +92,7 @@ const ToolNotificate = (props) => {
...
@@ -104,7 +92,7 @@ const ToolNotificate = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Xoá bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/app/views/product/type/Update.js
View file @
2c69692f
...
@@ -13,7 +13,7 @@ import { Link, useHistory, useLocation } from 'react-router-dom'
...
@@ -13,7 +13,7 @@ import { Link, useHistory, useLocation } from 'react-router-dom'
import
{
trimObject
}
from
'app/config/Function'
import
{
trimObject
}
from
'app/config/Function'
import
{
connect
}
from
'react-redux'
import
{
connect
}
from
'react-redux'
import
localStorageService
from
'app/services/localStorageService'
import
localStorageService
from
'app/services/localStorageService'
import
{
useTranslation
}
from
'react-i18next'
const
SimpleForm
=
(
props
)
=>
{
const
SimpleForm
=
(
props
)
=>
{
const
[
state
,
setState
]
=
useState
({})
const
[
state
,
setState
]
=
useState
({})
const
history
=
useHistory
()
const
history
=
useHistory
()
...
@@ -21,7 +21,7 @@ const SimpleForm = (props) => {
...
@@ -21,7 +21,7 @@ const SimpleForm = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
()
getData
()
},
[])
},
[])
const
{
t
}
=
useTranslation
()
const
getData
=
async
()
=>
{
const
getData
=
async
()
=>
{
props
.
showLoading
()
props
.
showLoading
()
const
res
=
await
detailProductType
(
location
.
state
,
{})
const
res
=
await
detailProductType
(
location
.
state
,
{})
...
@@ -34,7 +34,7 @@ const SimpleForm = (props) => {
...
@@ -34,7 +34,7 @@ const SimpleForm = (props) => {
history
.
push
(
'/'
)
history
.
push
(
'/'
)
},
100
)
},
100
)
}
else
{
}
else
{
toast
.
error
(
'Lấy thông tin bản ghi thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
@@ -57,7 +57,7 @@ const SimpleForm = (props) => {
...
@@ -57,7 +57,7 @@ const SimpleForm = (props) => {
})
})
}
}
}
else
{
}
else
{
toast
.
error
(
'Cập nhật loại sản phẩm thất bại!'
,
{
toast
.
error
(
t
(
res
.
data
.
error
)
,
{
theme
:
'colored'
,
theme
:
'colored'
,
})
})
}
}
...
...
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