Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
InvestCustomer
Commits
9d789f65
Commit
9d789f65
authored
May 18, 2021
by
Nguyễn Thị Thúy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'phase2_tool' into 'dev_phase2'
complete escrow calculator See merge request
!13
parents
1a31e058
ff0a6cfa
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
295 additions
and
266 deletions
+295
-266
RootView.js
src/RootView.js
+61
-74
Home.js
src/Screens/Home/Home.js
+177
-167
CalculatorProfitLoss.js
...Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
+1
-1
ItemCalculator.js
src/Screens/Tool/CalculatorProfitLoss/ItemCalculator.js
+3
-3
EscrowCalculator.js
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
+40
-13
EscrowCalculatorView.js
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
+3
-5
iconUpgrade.png
src/assets/images/iconUpgrade.png
+0
-0
en.js
src/helper/i18/locales/en.js
+5
-2
vn.js
src/helper/i18/locales/vn.js
+5
-1
No files found.
src/RootView.js
View file @
9d789f65
import
React
,
{
useEffect
,
useRef
}
from
'react'
;
import
React
,
{
useEffect
,
useRef
}
from
'react'
;
import
{
import
{
View
,
View
,
Text
,
ImageBackground
,
StyleSheet
,
StatusBar
,
SafeAreaView
,
}
from
'react-native'
;
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
...
@@ -16,7 +11,6 @@ import {enableScreens} from 'react-native-screens';
...
@@ -16,7 +11,6 @@ import {enableScreens} from 'react-native-screens';
import
NoInternetComponent
from
'./components/NoInternet'
;
import
NoInternetComponent
from
'./components/NoInternet'
;
import
DropdownAlert
from
'react-native-dropdownalert'
;
import
DropdownAlert
from
'react-native-dropdownalert'
;
import
DeviceInfo
from
'react-native-device-info'
;
import
DeviceInfo
from
'react-native-device-info'
;
import
VersionChecker
from
'./Screens/VersionChecker'
;
import
R
from
'./assets/R'
;
import
R
from
'./assets/R'
;
import
{
WIDTHXD
,
HEIGHTXD
}
from
'./Config/Functions'
;
import
{
WIDTHXD
,
HEIGHTXD
}
from
'./Config/Functions'
;
import
DropdownManager
from
'./components/DropdownAlert/DropdownManager'
;
import
DropdownManager
from
'./components/DropdownAlert/DropdownManager'
;
...
@@ -24,78 +18,71 @@ import DropdownManager from './components/DropdownAlert/DropdownManager';
...
@@ -24,78 +18,71 @@ import DropdownManager from './components/DropdownAlert/DropdownManager';
enableScreens
();
enableScreens
();
const
RootView
=
(
props
)
=>
{
const
RootView
=
(
props
)
=>
{
useEffect
(()
=>
{
useEffect
(()
=>
{
DropdownManager
.
register
(
DropdownManager
.
register
(
dropDownAlertRef
.
current
,
dropDownAlertRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
);
);
},
[]);
},
[]);
const
dropDownAlertRef
=
useRef
(
null
);
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
const
checkVersion
=
(
props
)
=>
{
const
dropDownAlertRef
=
useRef
(
null
);
const
verCurrent
=
DeviceInfo
.
getVersion
();
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
console
.
log
(
'version current'
,
verCurrent
);
};
return
(
return
(
<>
<>
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
/Modal
>
<
/Modal
>
<
StackNavigation
/>
<
StackNavigation
/>
<
/View
>
<
/View
>
{
/*<VersionChecker/>*/
}
<
DropdownAlert
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
1000
}
closeInterval
=
{
1000
}
ref
=
{
dropDownAlertRef
}
ref
=
{
dropDownAlertRef
}
warnColor
=
{
R
.
colors
.
orange400
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
}}
/
>
/
>
<
DropdownAlert
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
600000
}
closeInterval
=
{
600000
}
ref
=
{
dropDownAlertLongTimeRef
}
ref
=
{
dropDownAlertLongTimeRef
}
warnColor
=
{
R
.
colors
.
orange400
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
}}
/
>
/
>
<
NoInternetComponent
/>
<
/
>
<
NoInternetComponent
/>
);
<
/
>
);
};
};
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
loadingModal
:
state
.
ModalLoadingReducer
,
loadingModal
:
state
.
ModalLoadingReducer
,
};
};
};
};
export
default
connect
(
mapStateToProps
,
{})(
RootView
);
export
default
connect
(
mapStateToProps
,
{})(
RootView
);
src/Screens/Home/Home.js
View file @
9d789f65
...
@@ -11,186 +11,196 @@ import {getListCategoryProduct} from '../../apis/Functions/Transaction';
...
@@ -11,186 +11,196 @@ import {getListCategoryProduct} from '../../apis/Functions/Transaction';
import
{
hideLoading
,
showLoading
}
from
'../../actions/loadingAction'
;
import
{
hideLoading
,
showLoading
}
from
'../../actions/loadingAction'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert/index'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert/index'
;
import
VersionChecker
from
'../VersionChecker'
;
const
Home
=
(
props
)
=>
{
const
Home
=
(
props
)
=>
{
const
[
data
,
setData
]
=
useState
({
total_deposit
:
0
,
total_withdraw
:
0
});
const
[
data
,
setData
]
=
useState
({
total_deposit
:
0
,
total_withdraw
:
0
});
const
[
dataPrice
,
setDataPrice
]
=
useState
([]);
const
[
dataPrice
,
setDataPrice
]
=
useState
([]);
const
[
dataPriceFilter
,
setDataPriceFilter
]
=
useState
([]);
const
[
dataPriceFilter
,
setDataPriceFilter
]
=
useState
([]);
const
[
listImage
,
setListImage
]
=
useState
([]);
const
[
listImage
,
setListImage
]
=
useState
([]);
const
[
filters
,
setFilters
]
=
useState
([]);
const
[
filters
,
setFilters
]
=
useState
([]);
const
[
filterId
,
setFilterId
]
=
useState
(
-
1
);
const
[
filterId
,
setFilterId
]
=
useState
(
-
1
);
const
[
isSortName
,
setIsSortName
]
=
useState
(
null
);
const
[
isSortName
,
setIsSortName
]
=
useState
(
null
);
const
[
isSortPercent
,
setIsSortPercent
]
=
useState
(
null
);
const
[
isSortPercent
,
setIsSortPercent
]
=
useState
(
null
);
const
[
isSortPriceOpenClose
,
setIsSortPriceOpenClose
]
=
useState
(
null
);
const
[
isSortPriceOpenClose
,
setIsSortPriceOpenClose
]
=
useState
(
null
);
const
[
isSortPriceHighLow
,
setIsSortPriceHighLow
]
=
useState
(
null
);
const
[
isSortPriceHighLow
,
setIsSortPriceHighLow
]
=
useState
(
null
);
const
SORT_TYPE
=
{
const
SORT_TYPE
=
{
DESC
:
'DESC'
,
DESC
:
'DESC'
,
ASC
:
'ASC'
,
ASC
:
'ASC'
,
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
getData
();
getData
();
initSocket
();
initSocket
();
},
[]);
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
newList
=
const
newList
=
filterId
==
-
1
filterId
==
-
1
?
[...
dataPrice
]
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
(
item
)
=>
item
.
category_id
==
filterId
);
:
_
.
filter
([...
dataPrice
],
(
item
)
=>
item
.
category_id
==
filterId
);
setDataPriceFilter
(
newList
);
setDataPriceFilter
(
newList
);
},
[
dataPrice
]);
},
[
dataPrice
]);
const
initSocket
=
()
=>
{
const
initSocket
=
()
=>
{
let
io
=
require
(
'socket.io-client'
);
let
io
=
require
(
'socket.io-client'
);
let
socket
=
io
.
connect
(
'http://222.252.22.174:8087'
,
{
let
socket
=
io
.
connect
(
'http://222.252.22.174:8087'
,
{
transports
:
[
'websocket'
],
transports
:
[
'websocket'
],
jsonp
:
false
,
jsonp
:
false
,
reconnect
:
true
,
reconnect
:
true
,
});
});
socket
.
on
(
'response-update-price'
,
(
message
)
=>
{
socket
.
on
(
'response-update-price'
,
(
message
)
=>
{
receivedMessage
(
message
);
receivedMessage
(
message
);
});
});
};
};
const
receivedMessage
=
(
message
)
=>
{
const
receivedMessage
=
(
message
)
=>
{
setDataPrice
(
message
);
setDataPrice
(
message
);
};
};
const
getData
=
async
()
=>
{
const
getData
=
async
()
=>
{
props
.
showLoading
();
props
.
showLoading
();
const
res
=
await
getTransaction
({});
const
res
=
await
getTransaction
({});
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setData
(
res
.
data
.
data
);
setData
(
res
.
data
.
data
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
}
const
res1
=
await
getImagesHome
({});
const
res1
=
await
getImagesHome
({});
if
(
res1
.
data
.
code
==
200
&&
res1
.
data
.
data
)
{
if
(
res1
.
data
.
code
==
200
&&
res1
.
data
.
data
)
{
setListImage
(
res1
.
data
.
data
);
setListImage
(
res1
.
data
.
data
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
}
const
resCategoryProduct
=
await
getListCategoryProduct
({
const
resCategoryProduct
=
await
getListCategoryProduct
({
keyword
:
''
,
keyword
:
''
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
page_size
:
20
,
page_size
:
20
,
page_index
:
1
,
page_index
:
1
,
type
:
'PRODUCT'
,
type
:
'PRODUCT'
,
});
});
console
.
log
(
resCategoryProduct
);
console
.
log
(
resCategoryProduct
);
if
((
resCategoryProduct
.
data
.
code
=
200
&&
resCategoryProduct
.
data
.
data
))
{
if
((
resCategoryProduct
.
data
.
code
=
200
&&
resCategoryProduct
.
data
.
data
))
{
let
data
=
[];
let
data
=
[];
data
.
push
({
id
:
-
1
,
name
:
'All'
});
data
.
push
({
id
:
-
1
,
name
:
'All'
});
setFilters
(
data
.
concat
([...
resCategoryProduct
.
data
.
data
]));
setFilters
(
data
.
concat
([...
resCategoryProduct
.
data
.
data
]));
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
}
}
const
resPriceHome
=
await
getPriceTable
({});
const
resPriceHome
=
await
getPriceTable
({});
if
(
resPriceHome
.
data
.
code
==
200
&&
resPriceHome
.
data
.
data
)
{
if
(
resPriceHome
.
data
.
code
==
200
&&
resPriceHome
.
data
.
data
)
{
setDataPrice
(
resPriceHome
.
data
.
data
);
setDataPrice
(
resPriceHome
.
data
.
data
);
setDataPriceFilter
(
resPriceHome
.
data
.
data
);
setDataPriceFilter
(
resPriceHome
.
data
.
data
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
}
props
.
hideLoading
();
props
.
hideLoading
();
console
.
log
(
'filterId'
,
filterId
);
console
.
log
(
'filterId'
,
filterId
);
console
.
log
(
'filters'
,
filters
);
console
.
log
(
'filters'
,
filters
);
};
};
const
changeFilter
=
(
id
)
=>
{
const
changeFilter
=
(
id
)
=>
{
setFilterId
(
id
);
setFilterId
(
id
);
const
newList
=
const
newList
=
id
==
-
1
id
==
-
1
?
[...
dataPrice
]
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
(
item
)
=>
item
.
category_id
==
id
);
:
_
.
filter
([...
dataPrice
],
(
item
)
=>
item
.
category_id
==
id
);
setDataPriceFilter
(
newList
);
setDataPriceFilter
(
newList
);
console
.
log
(
id
,
newList
);
console
.
log
(
id
,
newList
);
};
};
const
onSortByName
=
()
=>
{
const
onSortByName
=
()
=>
{
let
type
=
'ASC'
;
let
type
=
'ASC'
;
if
(
!
isSortName
||
isSortName
==
SORT_TYPE
.
ASC
)
type
=
SORT_TYPE
.
DESC
;
if
(
!
isSortName
||
isSortName
==
SORT_TYPE
.
ASC
)
{
let
newData
=
type
=
SORT_TYPE
.
DESC
;
type
==
SORT_TYPE
.
ASC
}
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
>
b
.
name
?
1
:
-
1
))
let
newData
=
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
<
b
.
name
?
1
:
-
1
));
type
==
SORT_TYPE
.
ASC
setDataPriceFilter
(
newData
);
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
>
b
.
name
?
1
:
-
1
))
setIsSortPriceOpenClose
(
null
);
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
<
b
.
name
?
1
:
-
1
));
setIsSortName
(
type
);
setDataPriceFilter
(
newData
);
setIsSortPercent
(
null
);
setIsSortPriceOpenClose
(
null
);
setIsSortPriceHighLow
(
null
);
setIsSortName
(
type
);
};
setIsSortPercent
(
null
);
const
onSortByPercent
=
()
=>
{
setIsSortPriceHighLow
(
null
);
let
type
=
'ASC'
;
};
if
(
!
isSortPercent
||
isSortPercent
==
SORT_TYPE
.
ASC
)
type
=
SORT_TYPE
.
DESC
;
const
onSortByPercent
=
()
=>
{
let
newData
=
let
type
=
'ASC'
;
type
==
SORT_TYPE
.
ASC
if
(
!
isSortPercent
||
isSortPercent
==
SORT_TYPE
.
ASC
)
{
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
>
b
.
change
?
1
:
-
1
))
type
=
SORT_TYPE
.
DESC
;
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
<
b
.
change
?
1
:
-
1
));
}
setDataPriceFilter
(
newData
);
let
newData
=
setIsSortPriceOpenClose
(
null
);
type
==
SORT_TYPE
.
ASC
setIsSortName
(
null
);
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
>
b
.
change
?
1
:
-
1
))
setIsSortPercent
(
type
);
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
<
b
.
change
?
1
:
-
1
));
setIsSortPriceHighLow
(
null
);
setDataPriceFilter
(
newData
);
};
setIsSortPriceOpenClose
(
null
);
const
onSortByPriceOpenClose
=
()
=>
{
setIsSortName
(
null
);
let
type
=
'ASC'
;
setIsSortPercent
(
type
);
if
(
!
isSortPriceOpenClose
||
isSortPriceOpenClose
==
SORT_TYPE
.
ASC
)
setIsSortPriceHighLow
(
null
);
type
=
SORT_TYPE
.
DESC
;
};
let
newData
=
const
onSortByPriceOpenClose
=
()
=>
{
type
==
SORT_TYPE
.
ASC
let
type
=
'ASC'
;
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
if
(
!
isSortPriceOpenClose
||
isSortPriceOpenClose
==
SORT_TYPE
.
ASC
)
{
a
.
open_price
>
b
.
open_price
?
1
:
-
1
,
type
=
SORT_TYPE
.
DESC
;
)
}
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
let
newData
=
a
.
open_price
<
b
.
open_price
?
1
:
-
1
,
type
==
SORT_TYPE
.
ASC
);
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
setDataPriceFilter
(
newData
);
a
.
open_price
>
b
.
open_price
?
1
:
-
1
,
setIsSortPriceOpenClose
(
type
);
)
setIsSortName
(
null
);
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
setIsSortPercent
(
null
);
a
.
open_price
<
b
.
open_price
?
1
:
-
1
,
setIsSortPriceHighLow
(
null
);
);
};
setDataPriceFilter
(
newData
);
const
onSortByPriceHighLow
=
()
=>
{
setIsSortPriceOpenClose
(
type
);
let
type
=
'ASC'
;
setIsSortName
(
null
);
if
(
!
isSortPriceHighLow
||
isSortPriceHighLow
==
SORT_TYPE
.
ASC
)
setIsSortPercent
(
null
);
type
=
SORT_TYPE
.
DESC
;
setIsSortPriceHighLow
(
null
);
let
newData
=
};
type
==
SORT_TYPE
.
ASC
const
onSortByPriceHighLow
=
()
=>
{
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
let
type
=
'ASC'
;
a
.
high_price
>
b
.
high_price
?
1
:
-
1
,
if
(
!
isSortPriceHighLow
||
isSortPriceHighLow
==
SORT_TYPE
.
ASC
)
{
)
type
=
SORT_TYPE
.
DESC
;
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
}
a
.
high_price
<
b
.
high_price
?
1
:
-
1
,
let
newData
=
);
type
==
SORT_TYPE
.
ASC
setDataPriceFilter
(
newData
);
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
setIsSortPriceOpenClose
(
null
);
a
.
high_price
>
b
.
high_price
?
1
:
-
1
,
setIsSortName
(
null
);
)
setIsSortPercent
(
null
);
:
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
setIsSortPriceHighLow
(
type
);
a
.
high_price
<
b
.
high_price
?
1
:
-
1
,
};
);
setDataPriceFilter
(
newData
);
setIsSortPriceOpenClose
(
null
);
setIsSortName
(
null
);
setIsSortPercent
(
null
);
setIsSortPriceHighLow
(
type
);
};
return
(
return
(
<
HomeView
<>
data
=
{
data
}
<
HomeView
dataPrice
=
{
dataPriceFilter
}
data
=
{
data
}
listImage
=
{
listImage
}
dataPrice
=
{
dataPriceFilter
}
filterId
=
{
filterId
}
listImage
=
{
listImage
}
filters
=
{
filters
}
filterId
=
{
filterId
}
setFilterId
=
{
changeFilter
}
filters
=
{
filters
}
onSortByName
=
{
onSortByName
}
setFilterId
=
{
changeFilter
}
onSortByPercent
=
{
onSortByPercent
}
onSortByName
=
{
onSortByName
}
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
onSortByPercent
=
{
onSortByPercent
}
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
/
>
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
);
/
>
<
VersionChecker
/>
<
/
>
);
};
};
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
user
:
state
.
userReducer
,
user
:
state
.
userReducer
,
};
};
};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
Home
);
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
Home
);
src/Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
View file @
9d789f65
...
@@ -36,7 +36,7 @@ const CalculatorProfitLoss = (props) => {
...
@@ -36,7 +36,7 @@ const CalculatorProfitLoss = (props) => {
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setDataProduct
(
res
.
data
.
data
);
setDataProduct
(
res
.
data
.
data
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
,
I18n
.
t
(
'Can_not_get_data'
)
));
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
}
};
};
...
...
src/Screens/Tool/CalculatorProfitLoss/ItemCalculator.js
View file @
9d789f65
...
@@ -37,7 +37,7 @@ const ItemCalculator = (props) => {
...
@@ -37,7 +37,7 @@ const ItemCalculator = (props) => {
});
});
setExpanded
(
!
expanded
);
setExpanded
(
!
expanded
);
};
};
console
.
log
(
props
.
item
.
transaction_type
);
console
.
log
(
props
.
item
);
return
(
return
(
<
View
<
View
...
@@ -78,8 +78,8 @@ const ItemCalculator = (props) => {
...
@@ -78,8 +78,8 @@ const ItemCalculator = (props) => {
content
=
{
I18n
.
t
(
props
.
item
.
transaction_type
)}
content
=
{
I18n
.
t
(
props
.
item
.
transaction_type
)}
color
=
{
color
=
{
props
.
item
.
transaction_type
==
'SELL_OUT'
props
.
item
.
transaction_type
==
'SELL_OUT'
?
R
.
colors
.
green
?
R
.
colors
.
red2
:
R
.
colors
.
red2
:
R
.
colors
.
green
}
}
/
>
/
>
<
TextField
<
TextField
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
View file @
9d789f65
...
@@ -12,11 +12,12 @@ const EscrowCalculator = (props) => {
...
@@ -12,11 +12,12 @@ const EscrowCalculator = (props) => {
lotNumber
:
null
,
lotNumber
:
null
,
firstEscrow
:
0
,
firstEscrow
:
0
,
}]);
}]);
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
null
);
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
0
);
const
[
firstEscrowTotal
,
setFirstEscrowTotal
]
=
useState
(
0
);
const
[
firstEscrowTotal
,
setFirstEscrowTotal
]
=
useState
(
0
);
const
[
message
,
setMessage
]
=
useState
(
''
);
useEffect
(()
=>
{
useEffect
(()
=>
{
getProductData
()
getProductData
()
;
},
[])
},
[])
;
const
getProductData
=
async
()
=>
{
const
getProductData
=
async
()
=>
{
const
res
=
await
getTransactionListByCategory
({
const
res
=
await
getTransactionListByCategory
({
...
@@ -27,31 +28,56 @@ const EscrowCalculator = (props) => {
...
@@ -27,31 +28,56 @@ const EscrowCalculator = (props) => {
type
:
'PRICE_TABLE'
,
type
:
'PRICE_TABLE'
,
category_id
:
-
1
,
category_id
:
-
1
,
});
});
console
.
log
(
'res'
,
res
);
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setDataProduct
(
res
.
data
.
data
);
setDataProduct
(
res
.
data
.
data
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
,
I18n
.
t
(
'Can_not_get_data'
)))
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
}
};
};
const
onCalculator
=
()
=>
{
const
onCalculator
=
()
=>
{
if
(
firstEscrowTotal
===
''
||
firstEscrowTotal
==
0
)
{
showAlert
(
TYPE
.
WARN
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'EnterContractInfo'
));
return
}
if
(
firstEscrow
===
''
||
firstEscrow
==
0
)
{
showAlert
(
TYPE
.
WARN
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'EnterFirstEscrow'
));
return
}
if
(
parseFloat
(
firstEscrowTotal
)
<=
parseFloat
(
firstEscrow
))
{
setMessage
(
I18n
.
t
(
'YouCanTransaction'
));
}
else
{
setMessage
(
I18n
.
t
(
'YouCanNotTransaction'
));
}
};
};
const
onDelete
=
()
=>
{
const
onDelete
=
()
=>
{
setListInput
([{
product
:
null
,
lotNumber
:
null
,
firstEscrow
:
0
,
}])
setFirstEscrow
(
0
)
setFirstEscrowTotal
(
0
)
setMessage
(
''
)
};
};
const
setItemInput
=
(
item
,
index
)
=>
{
const
setItemInput
=
(
item
,
index
)
=>
{
let
data
=
[...
listInput
]
let
data
=
[...
listInput
]
;
data
[
index
]
=
item
data
[
index
]
=
item
;
setListInput
(
data
)
setListInput
(
data
)
;
let
firstEscrowTotalTmp
=
0
let
firstEscrowTotalTmp
=
0
;
data
.
map
((
item
)
=>
{
data
.
map
((
item
)
=>
{
if
(
item
.
firstEscrow
)
firstEscrowTotalTmp
=
firstEscrowTotalTmp
+
item
.
firstEscrow
if
(
item
.
firstEscrow
)
{
})
firstEscrowTotalTmp
=
firstEscrowTotalTmp
+
item
.
firstEscrow
;
setFirstEscrowTotal
(
firstEscrowTotalTmp
)
}
}
});
setFirstEscrowTotal
(
firstEscrowTotalTmp
);
};
const
onAdd
=
()
=>
{
const
onAdd
=
()
=>
{
let
data
=
[...
listInput
];
let
data
=
[...
listInput
];
data
.
push
({
data
.
push
({
...
@@ -73,6 +99,7 @@ const EscrowCalculator = (props) => {
...
@@ -73,6 +99,7 @@ const EscrowCalculator = (props) => {
firstEscrowTotal
=
{
firstEscrowTotal
}
firstEscrowTotal
=
{
firstEscrowTotal
}
setItemInput
=
{
setItemInput
}
setItemInput
=
{
setItemInput
}
setFirstEscrow
=
{
setFirstEscrow
}
setFirstEscrow
=
{
setFirstEscrow
}
message
=
{
message
}
/
>
/
>
);
);
};
};
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
View file @
9d789f65
...
@@ -35,11 +35,12 @@ const EscrowCalculatorView = (props) => {
...
@@ -35,11 +35,12 @@ const EscrowCalculatorView = (props) => {
dataProduct
=
{
props
.
dataProduct
}
dataProduct
=
{
props
.
dataProduct
}
setProduct
=
{(
product
)
=>
{
setProduct
=
{(
product
)
=>
{
item
.
product
=
product
;
item
.
product
=
product
;
item
.
firstEscrow
=
parseFloat
(
item
.
lotNumber
)
*
product
.
escrow
;
props
.
setItemInput
(
item
,
index
);
props
.
setItemInput
(
item
,
index
);
}}
}}
setLotNumber
=
{(
lotNumber
)
=>
{
setLotNumber
=
{(
lotNumber
)
=>
{
item
.
lotNumber
=
lotNumber
.
split
(
'.'
).
join
(
''
);
item
.
lotNumber
=
lotNumber
.
split
(
'.'
).
join
(
''
);
item
.
firstEscrow
=
parseFloat
(
item
.
lotNumber
)
*
12312
;
item
.
firstEscrow
=
item
.
product
?
parseFloat
(
item
.
lotNumber
)
*
item
.
product
.
escrow
:
0
;
props
.
setItemInput
(
item
,
index
);
props
.
setItemInput
(
item
,
index
);
}}
}}
/
>
/
>
...
@@ -73,10 +74,7 @@ const EscrowCalculatorView = (props) => {
...
@@ -73,10 +74,7 @@ const EscrowCalculatorView = (props) => {
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
inputStyle
=
{{
backgroundColor
:
R
.
colors
.
gray7
}}
inputStyle
=
{{
backgroundColor
:
R
.
colors
.
gray7
}}
/
>
/
>
<
Text
style
=
{
styles
.
textMessage
}
>
<
Text
style
=
{
styles
.
textMessage
}
>
{
props
.
message
}
<
/Text
>
B
ạ
n
c
ó
th
ể
giao
d
ị
ch
c
á
c
h
ợ
p
đồ
ng
k
ể
tr
ê
n
v
ớ
i
m
ứ
c
k
ý
qu
ỹ
kh
ả
dung
hi
ệ
n
t
ạ
i
<
/Text
>
<
/View
>
<
/View
>
<
View
<
View
...
...
src/assets/images/iconUpgrade.png
View replaced file @
1a31e058
View file @
9d789f65
4.2 KB
|
W:
|
H:
2.25 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/helper/i18/locales/en.js
View file @
9d789f65
...
@@ -257,8 +257,6 @@ export default {
...
@@ -257,8 +257,6 @@ export default {
'(estimated according to the current state processing rate of MXV)'
,
'(estimated according to the current state processing rate of MXV)'
,
Caculate
:
'Caculate'
,
Caculate
:
'Caculate'
,
ConversionUnit
:
'Conversion unit'
,
ConversionUnit
:
'Conversion unit'
,
Delete
:
'Delete'
,
UnitsQuotedFloor
:
'Units quoted in the floor'
,
UnitsQuotedFloor
:
'Units quoted in the floor'
,
ConversionPrice
:
'Conversion price'
,
ConversionPrice
:
'Conversion price'
,
ConvertUSD
:
'Convert USD/Ton'
,
ConvertUSD
:
'Convert USD/Ton'
,
...
@@ -274,6 +272,11 @@ export default {
...
@@ -274,6 +272,11 @@ export default {
ProfitLoss
:
'Profit/Loss'
,
ProfitLoss
:
'Profit/Loss'
,
BUY_IN
:
'Buy in'
,
BUY_IN
:
'Buy in'
,
SELL_OUT
:
'Sell out'
,
SELL_OUT
:
'Sell out'
,
YouCanNotTransaction
:
'You can not trade the above contracts with the current available escrow'
,
YouCanTransaction
:
'You can trade the above contracts with the current available escrow'
,
EnterContractInfo
:
'Enter contract information'
,
EnterFirstEscrow
:
'Enter first escrow'
,
CloseAccount
:
'Close account'
,
CloseAccount
:
'Close account'
,
UpdatePacket
:
'Update packet'
,
UpdatePacket
:
'Update packet'
,
Count
:
'Count'
,
Count
:
'Count'
,
...
...
src/helper/i18/locales/vn.js
View file @
9d789f65
...
@@ -251,7 +251,6 @@ export default {
...
@@ -251,7 +251,6 @@ export default {
noteStopLoss
:
'Ước tính theo tỷ lệ xử lý trạng thái hiện tại của MXV'
,
noteStopLoss
:
'Ước tính theo tỷ lệ xử lý trạng thái hiện tại của MXV'
,
Caculate
:
'Tính'
,
Caculate
:
'Tính'
,
ConversionUnit
:
'Đơn vị quy đổi'
,
ConversionUnit
:
'Đơn vị quy đổi'
,
Delete
:
'Xoá'
,
UnitsQuotedFloor
:
'Đơn vị yết giá trên sàn'
,
UnitsQuotedFloor
:
'Đơn vị yết giá trên sàn'
,
ConversionPrice
:
'Giá quy đổi'
,
ConversionPrice
:
'Giá quy đổi'
,
ConvertUSD
:
'Quy đổi USD/Tấn'
,
ConvertUSD
:
'Quy đổi USD/Tấn'
,
...
@@ -269,6 +268,11 @@ export default {
...
@@ -269,6 +268,11 @@ export default {
SELL_OUT
:
'Bán ra'
,
SELL_OUT
:
'Bán ra'
,
EscrowCalculator
:
'Tính ký quỹ'
,
EscrowCalculator
:
'Tính ký quỹ'
,
FirstEscrowTotal
:
'Ký quỹ khả dụng'
,
FirstEscrowTotal
:
'Ký quỹ khả dụng'
,
YouCanNotTransaction
:
'Bạn không thể giao dịch các hợp đồng kể trên với mức ký quỹ khả dụng hiện tại'
,
YouCanTransaction
:
'Bạn có thể giao dịch các hợp đồng kể trên với mức ký quỹ khả dụng hiện tại'
,
EnterContractInfo
:
'Nhập thông tin hợp đồng'
,
EnterFirstEscrow
:
'Nhập ký quỹ ban đầu'
,
CloseAccount
:
'Đóng tài khoản'
,
CloseAccount
:
'Đóng tài khoản'
,
UpdatePacket
:
'Cập nhật gói cước'
,
UpdatePacket
:
'Cập nhật gói cước'
,
Count
:
'Số lượng'
,
Count
:
'Số lượng'
,
...
...
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