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
f0cfb2a7
Commit
f0cfb2a7
authored
May 20, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Plain Diff
merge code
parents
5f45efef
f0303f73
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
200 additions
and
102 deletions
+200
-102
RootView.js
src/RootView.js
+14
-17
Footer.js
src/Screens/Account/PacrtCQG/Footer.js
+1
-1
Home.js
src/Screens/Home/Home.js
+14
-6
CaculatedStopLoss.js
src/Screens/Tool/CaculatedStopLoss.js
+1
-1
CalculatorProfitLoss.js
...Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
+2
-2
CalculatorProfitLossView.js
...ens/Tool/CalculatorProfitLoss/CalculatorProfitLossView.js
+1
-1
ItemCalculator.js
src/Screens/Tool/CalculatorProfitLoss/ItemCalculator.js
+3
-3
ConvertUnit.js
src/Screens/Tool/ConvertUnit.js
+103
-49
EscrowCalculator.js
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
+39
-12
EscrowCalculatorView.js
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
+3
-5
ExchangeRate.js
src/Screens/Tool/ExchangeRate.js
+1
-1
Transaction.js
src/apis/Functions/Transaction.js
+5
-0
url.js
src/apis/url.js
+1
-0
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
TabNavigation.js
src/routers/TabNavigation.js
+2
-1
No files found.
src/RootView.js
View file @
f0cfb2a7
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,10 +11,14 @@ import {enableScreens} from 'react-native-screens';
...
@@ -16,10 +11,14 @@ 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'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
KEY
from
'./assets/AsynStorage'
;
import
I18n
,
{
setLocation
}
from
'./helper/i18/i18n'
;
import
{
changeLanguage
}
from
'./actions/language'
;
enableScreens
();
enableScreens
();
...
@@ -29,25 +28,24 @@ const RootView = (props) => {
...
@@ -29,25 +28,24 @@ const RootView = (props) => {
dropDownAlertRef
.
current
,
dropDownAlertRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
);
);
setInitLanguage
()
},
[]);
},
[]);
const
dropDownAlertRef
=
useRef
(
null
);
const
dropDownAlertRef
=
useRef
(
null
);
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
const
setInitLanguage
=
async
()
=>
{
const
checkVersion
=
(
props
)
=>
{
const
laguage
=
await
AsyncStorage
.
getItem
(
KEY
.
LANGUAGE
);
const
verCurrent
=
DeviceInfo
.
getVersion
(
);
if
(
laguage
)
props
.
changeLanguage
(
laguage
);
console
.
log
(
'version current'
,
verCurrent
);
setLocation
(
I18n
,
laguage
);
};
};
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
}
...
@@ -86,8 +84,7 @@ const RootView = (props) => {
...
@@ -86,8 +84,7 @@ const RootView = (props) => {
paddingHorizontal
:
WIDTHXD
(
20
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
}}
/
>
/
>
<
NoInternetComponent
/>
<
NoInternetComponent
/>
<
/
>
<
/
>
);
);
};
};
...
@@ -98,4 +95,4 @@ const mapStateToProps = (state) => {
...
@@ -98,4 +95,4 @@ const mapStateToProps = (state) => {
};
};
};
};
export
default
connect
(
mapStateToProps
,
{})(
RootView
);
export
default
connect
(
mapStateToProps
,
{
changeLanguage
})(
RootView
);
src/Screens/Account/PacrtCQG/Footer.js
View file @
f0cfb2a7
...
@@ -8,10 +8,10 @@ import I18n from '../../../helper/i18/i18n';
...
@@ -8,10 +8,10 @@ import I18n from '../../../helper/i18/i18n';
const
Footer
=
(
props
)
=>
{
const
Footer
=
(
props
)
=>
{
return
(
return
(
<
View
style
=
{{
flex
:
1
,
paddingHorizontal
:
10
,
marginTop
:
10
}}
>
<
View
style
=
{{
flex
:
1
,
paddingHorizontal
:
10
,
marginTop
:
10
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginVertical
:
5
}}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
I18n
.
t
(
'Provisional'
)}:{
toPriceVnd
(
props
.
price
)}
{
I18n
.
t
(
'Provisional'
)}:{
toPriceVnd
(
props
.
price
)}
<
/Text
>
<
/Text
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginVertical
:
5
}}
>
<
AppText
i18nKey
=
{
'Open_account_demo'
}
style
=
{
styles
.
txtTitle
}
/
>
<
AppText
i18nKey
=
{
'Open_account_demo'
}
style
=
{
styles
.
txtTitle
}
/
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{()
=>
onPress
=
{()
=>
...
...
src/Screens/Home/Home.js
View file @
f0cfb2a7
...
@@ -11,6 +11,7 @@ import {getListCategoryProduct} from '../../apis/Functions/Transaction';
...
@@ -11,6 +11,7 @@ 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
});
...
@@ -23,8 +24,6 @@ const Home = (props) => {
...
@@ -23,8 +24,6 @@ const Home = (props) => {
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
);
console
.
log
(
props
.
user
);
const
SORT_TYPE
=
{
const
SORT_TYPE
=
{
DESC
:
'DESC'
,
DESC
:
'DESC'
,
ASC
:
'ASC'
,
ASC
:
'ASC'
,
...
@@ -113,7 +112,9 @@ const Home = (props) => {
...
@@ -113,7 +112,9 @@ const Home = (props) => {
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
)
{
type
=
SORT_TYPE
.
DESC
;
}
let
newData
=
let
newData
=
type
==
SORT_TYPE
.
ASC
type
==
SORT_TYPE
.
ASC
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
>
b
.
name
?
1
:
-
1
))
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
name
>
b
.
name
?
1
:
-
1
))
...
@@ -126,7 +127,9 @@ const Home = (props) => {
...
@@ -126,7 +127,9 @@ const Home = (props) => {
};
};
const
onSortByPercent
=
()
=>
{
const
onSortByPercent
=
()
=>
{
let
type
=
'ASC'
;
let
type
=
'ASC'
;
if
(
!
isSortPercent
||
isSortPercent
==
SORT_TYPE
.
ASC
)
type
=
SORT_TYPE
.
DESC
;
if
(
!
isSortPercent
||
isSortPercent
==
SORT_TYPE
.
ASC
)
{
type
=
SORT_TYPE
.
DESC
;
}
let
newData
=
let
newData
=
type
==
SORT_TYPE
.
ASC
type
==
SORT_TYPE
.
ASC
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
>
b
.
change
?
1
:
-
1
))
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
(
a
.
change
>
b
.
change
?
1
:
-
1
))
...
@@ -139,8 +142,9 @@ const Home = (props) => {
...
@@ -139,8 +142,9 @@ const Home = (props) => {
};
};
const
onSortByPriceOpenClose
=
()
=>
{
const
onSortByPriceOpenClose
=
()
=>
{
let
type
=
'ASC'
;
let
type
=
'ASC'
;
if
(
!
isSortPriceOpenClose
||
isSortPriceOpenClose
==
SORT_TYPE
.
ASC
)
if
(
!
isSortPriceOpenClose
||
isSortPriceOpenClose
==
SORT_TYPE
.
ASC
)
{
type
=
SORT_TYPE
.
DESC
;
type
=
SORT_TYPE
.
DESC
;
}
let
newData
=
let
newData
=
type
==
SORT_TYPE
.
ASC
type
==
SORT_TYPE
.
ASC
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
...
@@ -157,8 +161,9 @@ const Home = (props) => {
...
@@ -157,8 +161,9 @@ const Home = (props) => {
};
};
const
onSortByPriceHighLow
=
()
=>
{
const
onSortByPriceHighLow
=
()
=>
{
let
type
=
'ASC'
;
let
type
=
'ASC'
;
if
(
!
isSortPriceHighLow
||
isSortPriceHighLow
==
SORT_TYPE
.
ASC
)
if
(
!
isSortPriceHighLow
||
isSortPriceHighLow
==
SORT_TYPE
.
ASC
)
{
type
=
SORT_TYPE
.
DESC
;
type
=
SORT_TYPE
.
DESC
;
}
let
newData
=
let
newData
=
type
==
SORT_TYPE
.
ASC
type
==
SORT_TYPE
.
ASC
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
?
[...
dataPriceFilter
].
sort
((
a
,
b
)
=>
...
@@ -175,6 +180,7 @@ const Home = (props) => {
...
@@ -175,6 +180,7 @@ const Home = (props) => {
};
};
return
(
return
(
<>
<
HomeView
<
HomeView
data
=
{
data
}
data
=
{
data
}
dataPrice
=
{
dataPriceFilter
}
dataPrice
=
{
dataPriceFilter
}
...
@@ -187,6 +193,8 @@ const Home = (props) => {
...
@@ -187,6 +193,8 @@ const Home = (props) => {
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
/
>
/
>
<
VersionChecker
/>
<
/
>
);
);
};
};
...
...
src/Screens/Tool/CaculatedStopLoss.js
View file @
f0cfb2a7
...
@@ -79,7 +79,7 @@ const CaculatedStopLoss = (props) => {
...
@@ -79,7 +79,7 @@ const CaculatedStopLoss = (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/CalculatorProfitLoss.js
View file @
f0cfb2a7
...
@@ -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'
));
}
}
};
};
...
@@ -67,7 +67,7 @@ const CalculatorProfitLoss = (props) => {
...
@@ -67,7 +67,7 @@ const CalculatorProfitLoss = (props) => {
});
});
props
.
hideLoading
();
props
.
hideLoading
();
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
const
newList
=
[
res
.
data
.
data
].
concat
(
dataCalculator
);
const
newList
=
[
res
.
data
.
data
].
concat
(
[...
dataCalculator
]
);
setDataCalculator
(
newList
);
setDataCalculator
(
newList
);
setLotTransactionNumber
(
null
);
setLotTransactionNumber
(
null
);
setOpenPrice
(
null
);
setOpenPrice
(
null
);
...
...
src/Screens/Tool/CalculatorProfitLoss/CalculatorProfitLossView.js
View file @
f0cfb2a7
...
@@ -112,7 +112,7 @@ const CalculatorProfitLossView = (props) => {
...
@@ -112,7 +112,7 @@ const CalculatorProfitLossView = (props) => {
<
/View
>
<
/View
>
<
FlatList
<
FlatList
style
=
{{
paddingBottom
:
HEIGHTXD
(
15
),
backgroundColor
:
R
.
colors
.
white
}}
style
=
{{
paddingBottom
:
HEIGHTXD
(
15
),
backgroundColor
:
R
.
colors
.
white
}}
keyExtractor
=
{(
item
)
=>
item
.
id
}
keyExtractor
=
{(
item
)
=>
item
}
data
=
{
props
.
dataCalculator
}
data
=
{
props
.
dataCalculator
}
renderItem
=
{({
item
,
index
})
=>
(
renderItem
=
{({
item
,
index
})
=>
(
<
ItemCalculator
<
ItemCalculator
...
...
src/Screens/Tool/CalculatorProfitLoss/ItemCalculator.js
View file @
f0cfb2a7
...
@@ -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/ConvertUnit.js
View file @
f0cfb2a7
import
React
,
{
Component
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
import
{
Platform
,
StyleSheet
,
Text
,
TextInput
,
View
}
from
'react-native'
;
View
,
Text
,
StyleSheet
,
TextInput
,
TouchableOpacity
,
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
PickerItem
from
'../../components/Picker/PickerItem'
;
import
PickerItem
from
'../../components/Picker/PickerItem'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
AppText
from
'../../components/AppText'
;
import
AppText
from
'../../components/AppText'
;
import
TextField
from
'../../components/Input/TextField'
;
import
{
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
Icon
from
'react-native-vector-icons/FontAwesome'
;
import
{
getUnitList
}
from
'../../apis/Functions/Transaction'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert'
;
import
{
hideLoading
,
showLoading
}
from
'../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
const
dataType
=
[
{
value
:
'0'
,
name
:
'KG'
,
},
{
value
:
'1'
,
name
:
'Pound'
,
},
];
const
ConvertUnit
=
(
props
)
=>
{
const
ConvertUnit
=
(
props
)
=>
{
const
[
typeOne
,
setTypeOne
]
=
useState
();
const
[
fromUnitList
,
setFromUnitList
]
=
useState
([]);
const
[
typeTwo
,
setTypeTwo
]
=
useState
();
const
[
toUnitList
,
setToUnitList
]
=
useState
([]);
const
[
valueOne
,
setValueOne
]
=
useState
();
const
[
toUnit
,
setToUnit
]
=
useState
();
const
[
valueTwo
,
setValueTwo
]
=
useState
();
const
[
fromUnit
,
setFromUnit
]
=
useState
();
const
[
number
,
setNumber
]
=
useState
(
null
);
const
[
rateItem
,
setRateItem
]
=
useState
({
value_one
:
0.025000000373
,
value_two
:
0
,
name
:
'Kg,'
,
});
const
[
result
,
setResult
]
=
useState
();
const
[
result
,
setResult
]
=
useState
();
useEffect
(()
=>
{
getDataUnit
();
},
[]);
useEffect
(()
=>
{
calcultorResult
();
},
[
number
,
fromUnit
,
toUnit
]);
const
getDataUnit
=
async
()
=>
{
props
.
showLoading
();
const
res
=
await
getUnitList
({
platform
:
Platform
.
OS
,
});
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setFromUnitList
(
res
.
data
.
data
);
setFromUnit
(
res
.
data
.
data
[
0
]);
onChangeFromUnit
(
''
,
res
.
data
.
data
[
0
])
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
props
.
hideLoading
();
};
const
onChangeNumber
=
(
string
)
=>
{
let
number
=
string
.
toString
().
split
(
','
).
join
(
''
);
setNumber
(
number
);
};
const
onClick
=
()
=>
{
const
onChangeFromUnit
=
(
value
,
item
)
=>
{
console
.
log
(
'Heloo'
,
typeOne
,
typeTwo
,
valueOne
,
valueTwo
);
setFromUnit
(
item
);
let
toUnit
=
[];
item
.
rates
.
map
((
rateItem
)
=>
{
toUnit
.
push
({
id
:
rateItem
.
to_unit_id
,
value
:
rateItem
.
to_unit
.
name
,
name
:
rateItem
.
to_unit
.
name
,
rate
:
rateItem
.
value_one
>
0
?
rateItem
.
value_one
:
rateItem
.
value_two
,
});
});
setToUnitList
(
toUnit
);
setToUnit
(
toUnit
[
0
]);
};
const
onChangeToUnit
=
(
value
,
item
)
=>
{
setToUnit
(
item
);
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
let
result
=
parseFloat
(
number
)
*
item
.
rate
;
setResult
(
`
${
parseFloat
(
number
)}
${
fromUnit
.
name
}
=
${
result
}
${
item
.
name
}
`
);
}
};
const
calcultorResult
=
()
=>
{
if
(
number
&&
number
!=
''
&&
parseFloat
(
number
)
>
0
)
{
let
result
=
parseFloat
(
number
)
*
toUnit
.
rate
;
setResult
(
`
${
parseFloat
(
number
)}
${
fromUnit
.
name
}
=
${
result
}
${
toUnit
.
name
}
`
);
}
else
{
setResult
(
''
)
}
};
};
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'ConvertUnit'
}
/
>
<
HeaderBack
title
=
{
'ConvertUnit'
}
/
>
<
View
style
=
{{
flex
:
1
,
paddingTop
:
20
,
paddingHorizontal
:
20
}}
>
<
View
style
=
{{
flex
:
1
,
paddingTop
:
20
,
paddingHorizontal
:
20
}}
>
<
AppText
style
=
{
styles
.
txtTitle
}
i18nKey
=
{
'Count'
}
/
>
<
AppText
style
=
{
styles
.
txtTitle
}
i18nKey
=
{
'Count'
}
/
>
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
TextInput
<
TextInput
onChangeText
=
{(
val
)
=>
setValueOne
(
val
)}
onChangeText
=
{(
val
)
=>
onChangeNumber
(
val
)}
keyboardType
=
{
'number-pad'
}
keyboardType
=
{
'number-pad'
}
style
=
{
styles
.
wrapInput
}
style
=
{
styles
.
wrapInput
}
maxLength
=
{
12
}
maxLength
=
{
12
}
value
=
{
toPriceVnd
(
number
)}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -57,33 +106,31 @@ const ConvertUnit = (props) => {
...
@@ -57,33 +106,31 @@ const ConvertUnit = (props) => {
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
Item
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
PickerItem
<
PickerItem
width
=
{
WIDTHXD
(
400
)}
width
=
{
WIDTHXD
(
480
)}
data
=
{
dataType
}
data
=
{
fromUnitList
}
onValueChange
=
{(
value
,
items
)
=>
{
defaultValue
=
{
fromUnit
?.
name
}
setTypeTwo
(
items
);
value
=
{
fromUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeFromUnit
(
value
,
item
);
}}
}}
/
>
/
>
<
TouchableOpacity
>
{
/*<TouchableOpacity>*/
}
<
Icon
name
=
{
'exchange'
}
size
=
{
30
}
color
=
{
R
.
colors
.
black
}
/
>
{
/* <Icon name={'exchange'} size={30} color={R.colors.black} />*/
}
<
/TouchableOpacity
>
{
/*</TouchableOpacity>*/
}
<
PickerItem
<
PickerItem
width
=
{
WIDTHXD
(
400
)}
width
=
{
WIDTHXD
(
480
)}
data
=
{
dataType
}
data
=
{
toUnitList
}
onValueChange
=
{(
value
,
items
)
=>
{
defaultValue
=
{
toUnit
?.
name
}
setTypeOne
(
items
);
value
=
{
toUnit
?.
name
}
onValueChange
=
{(
value
,
item
)
=>
{
onChangeToUnit
(
value
,
item
);
}}
}}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
Text
style
=
{
styles
.
txtResult
}
>
K
ế
t
qu
ả
:
{
result
}
<
/Text
>
<
Text
style
=
{
styles
.
txtResult
}
>
{
result
}
<
/Text
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
onPress
=
{
onClick
}
style
=
{
styles
.
btnContainer
}
>
<
AppText
style
=
{
styles
.
txtBtn
}
i18nKey
=
{
'Caculate'
}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
);
...
@@ -162,4 +209,11 @@ const styles = StyleSheet.create({
...
@@ -162,4 +209,11 @@ const styles = StyleSheet.create({
marginTop
:
20
,
marginTop
:
20
,
},
},
});
});
export
default
ConvertUnit
;
const
mapStateToProps
=
(
state
)
=>
{
return
{};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
,
})(
ConvertUnit
);
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
View file @
f0cfb2a7
...
@@ -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 @
f0cfb2a7
...
@@ -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/Screens/Tool/ExchangeRate.js
View file @
f0cfb2a7
...
@@ -41,7 +41,7 @@ const ExchangeRate = (props) => {
...
@@ -41,7 +41,7 @@ const ExchangeRate = (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/apis/Functions/Transaction.js
View file @
f0cfb2a7
...
@@ -26,3 +26,8 @@ export const getListExchangeRate = async (body) =>
...
@@ -26,3 +26,8 @@ export const getListExchangeRate = async (body) =>
GetData
(
url
.
urlGetListExchangeRate
,
body
)
GetData
(
url
.
urlGetListExchangeRate
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
.
catch
((
err
)
=>
err
);
export
const
getUnitList
=
async
(
body
)
=>
GetData
(
url
.
urlGetUnitList
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/url.js
View file @
f0cfb2a7
...
@@ -59,4 +59,5 @@ export default {
...
@@ -59,4 +59,5 @@ export default {
urlGetListExchangeRate
:
root
+
'api/v1/customers/get-list-exchange-rate'
,
urlGetListExchangeRate
:
root
+
'api/v1/customers/get-list-exchange-rate'
,
urlCloseCQG
:
root
+
'api/v1/customers/cancel-open-cqg'
,
urlCloseCQG
:
root
+
'api/v1/customers/cancel-open-cqg'
,
urlUpdateCQG
:
root
+
'api/v1/customers/update-open-cqg'
,
urlUpdateCQG
:
root
+
'api/v1/customers/update-open-cqg'
,
urlGetUnitList
:
`
${
root
}
api/v1/customers/get-list-unit`
,
};
};
src/assets/images/iconUpgrade.png
View replaced file @
5f45efef
View file @
f0cfb2a7
4.2 KB
|
W:
|
H:
2.25 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/helper/i18/locales/en.js
View file @
f0cfb2a7
...
@@ -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 @
f0cfb2a7
...
@@ -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'
,
...
...
src/routers/TabNavigation.js
View file @
f0cfb2a7
...
@@ -18,7 +18,7 @@ import Test from '../Screens/NewFeed/Test';
...
@@ -18,7 +18,7 @@ import Test from '../Screens/NewFeed/Test';
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
Transaction
from
'../Screens/Transaction/Transaction'
;
import
Transaction
from
'../Screens/Transaction/Transaction'
;
import
{
AccountVerification
,
PACKETCQG
}
from
'../routers/ScreenNames'
;
import
{
AccountVerification
,
PACKETCQG
}
from
'../routers/ScreenNames'
;
import
I18n
from
'../helper/i18/i18n'
;
import
I18n
,
{
setLocation
}
from
'../helper/i18/i18n'
;
import
{
changeLanguage
}
from
'../actions/language'
;
import
{
changeLanguage
}
from
'../actions/language'
;
import
KEY
from
'../assets/AsynStorage'
;
import
KEY
from
'../assets/AsynStorage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
...
@@ -77,6 +77,7 @@ const TabNavigator = (props) => {
...
@@ -77,6 +77,7 @@ const TabNavigator = (props) => {
const
setInitLanguage
=
async
()
=>
{
const
setInitLanguage
=
async
()
=>
{
const
laguage
=
await
AsyncStorage
.
getItem
(
KEY
.
LANGUAGE
);
const
laguage
=
await
AsyncStorage
.
getItem
(
KEY
.
LANGUAGE
);
if
(
laguage
)
props
.
changeLanguage
(
laguage
);
if
(
laguage
)
props
.
changeLanguage
(
laguage
);
setLocation
(
I18n
,
laguage
);
};
};
const
showPopUp
=
()
=>
{
const
showPopUp
=
()
=>
{
...
...
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