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
151a84a2
Commit
151a84a2
authored
May 18, 2021
by
Nguyễn Thị Thúy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete escrow calculator
parent
a957bd76
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
118 additions
and
99 deletions
+118
-99
RootView.js
src/RootView.js
+61
-74
Home.js
src/Screens/Home/Home.js
+0
-0
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 @
151a84a2
import
React
,
{
useEffect
,
useRef
}
from
'react'
;
import
{
View
,
Text
,
ImageBackground
,
StyleSheet
,
StatusBar
,
SafeAreaView
,
View
,
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
...
...
@@ -16,7 +11,6 @@ import {enableScreens} from 'react-native-screens';
import
NoInternetComponent
from
'./components/NoInternet'
;
import
DropdownAlert
from
'react-native-dropdownalert'
;
import
DeviceInfo
from
'react-native-device-info'
;
import
VersionChecker
from
'./Screens/VersionChecker'
;
import
R
from
'./assets/R'
;
import
{
WIDTHXD
,
HEIGHTXD
}
from
'./Config/Functions'
;
import
DropdownManager
from
'./components/DropdownAlert/DropdownManager'
;
...
...
@@ -24,78 +18,71 @@ import DropdownManager from './components/DropdownAlert/DropdownManager';
enableScreens
();
const
RootView
=
(
props
)
=>
{
useEffect
(()
=>
{
DropdownManager
.
register
(
dropDownAlertRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
);
},
[]);
const
dropDownAlertRef
=
useRef
(
null
);
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
useEffect
(()
=>
{
DropdownManager
.
register
(
dropDownAlertRef
.
current
,
dropDownAlertLongTimeRef
.
current
,
);
},
[]);
const
checkVersion
=
(
props
)
=>
{
const
verCurrent
=
DeviceInfo
.
getVersion
();
console
.
log
(
'version current'
,
verCurrent
);
};
const
dropDownAlertRef
=
useRef
(
null
);
const
dropDownAlertLongTimeRef
=
useRef
(
null
);
return
(
<>
<
View
style
=
{{
flex
:
1
}}
>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
/Modal
>
<
StackNavigation
/>
<
/View
>
{
/*<VersionChecker/>*/
}
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
1000
}
ref
=
{
dropDownAlertRef
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
/
>
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
600000
}
ref
=
{
dropDownAlertLongTimeRef
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
/
>
<
NoInternetComponent
/>
<
/
>
);
return
(
<>
<
View
style
=
{{
flex
:
1
}}
>
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
/Modal
>
<
StackNavigation
/>
<
/View
>
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
main
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
1000
}
ref
=
{
dropDownAlertRef
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
/
>
<
DropdownAlert
inactiveStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
activeStatusBarBackgroundColor
=
{
R
.
colors
.
colorMain
}
warnImageSrc
=
{
R
.
images
.
iconWarn
}
successImageSrc
=
{
R
.
images
.
iconSuccess
}
errorImageSrc
=
{
R
.
images
.
iconError
}
titleStyle
=
{{
color
:
'#fff'
}}
messageStyle
=
{{
color
:
'#fff'
}}
closeInterval
=
{
600000
}
ref
=
{
dropDownAlertLongTimeRef
}
warnColor
=
{
R
.
colors
.
orange400
}
defaultContainer
=
{{
borderBottomRightRadius
:
WIDTHXD
(
30
),
borderBottomLeftRadius
:
WIDTHXD
(
30
),
paddingTop
:
HEIGHTXD
(
30
),
paddingVertical
:
HEIGHTXD
(
30
),
paddingHorizontal
:
WIDTHXD
(
20
),
}}
/
>
<
NoInternetComponent
/>
<
/
>
);
};
const
mapStateToProps
=
(
state
)
=>
{
return
{
loadingModal
:
state
.
ModalLoadingReducer
,
};
return
{
loadingModal
:
state
.
ModalLoadingReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{})(
RootView
);
src/Screens/Home/Home.js
View file @
151a84a2
This diff is collapsed.
Click to expand it.
src/Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
View file @
151a84a2
...
...
@@ -36,7 +36,7 @@ const CalculatorProfitLoss = (props) => {
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setDataProduct
(
res
.
data
.
data
);
}
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 @
151a84a2
...
...
@@ -37,7 +37,7 @@ const ItemCalculator = (props) => {
});
setExpanded
(
!
expanded
);
};
console
.
log
(
props
.
item
.
transaction_type
);
console
.
log
(
props
.
item
);
return
(
<
View
...
...
@@ -78,8 +78,8 @@ const ItemCalculator = (props) => {
content
=
{
I18n
.
t
(
props
.
item
.
transaction_type
)}
color
=
{
props
.
item
.
transaction_type
==
'SELL_OUT'
?
R
.
colors
.
green
:
R
.
colors
.
red2
?
R
.
colors
.
red2
:
R
.
colors
.
green
}
/
>
<
TextField
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
View file @
151a84a2
...
...
@@ -12,11 +12,12 @@ const EscrowCalculator = (props) => {
lotNumber
:
null
,
firstEscrow
:
0
,
}]);
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
null
);
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
0
);
const
[
firstEscrowTotal
,
setFirstEscrowTotal
]
=
useState
(
0
);
const
[
message
,
setMessage
]
=
useState
(
''
);
useEffect
(()
=>
{
getProductData
()
},
[])
getProductData
()
;
},
[])
;
const
getProductData
=
async
()
=>
{
const
res
=
await
getTransactionListByCategory
({
...
...
@@ -27,31 +28,56 @@ const EscrowCalculator = (props) => {
type
:
'PRICE_TABLE'
,
category_id
:
-
1
,
});
console
.
log
(
'res'
,
res
);
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
setDataProduct
(
res
.
data
.
data
);
}
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
=
()
=>
{
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
=
()
=>
{
setListInput
([{
product
:
null
,
lotNumber
:
null
,
firstEscrow
:
0
,
}])
setFirstEscrow
(
0
)
setFirstEscrowTotal
(
0
)
setMessage
(
''
)
};
const
setItemInput
=
(
item
,
index
)
=>
{
let
data
=
[...
listInput
]
data
[
index
]
=
item
setListInput
(
data
)
let
firstEscrowTotalTmp
=
0
let
data
=
[...
listInput
]
;
data
[
index
]
=
item
;
setListInput
(
data
)
;
let
firstEscrowTotalTmp
=
0
;
data
.
map
((
item
)
=>
{
if
(
item
.
firstEscrow
)
firstEscrowTotalTmp
=
firstEscrowTotalTmp
+
item
.
firstEscrow
})
setFirstEscrowTotal
(
firstEscrowTotalTmp
)
}
if
(
item
.
firstEscrow
)
{
firstEscrowTotalTmp
=
firstEscrowTotalTmp
+
item
.
firstEscrow
;
}
});
setFirstEscrowTotal
(
firstEscrowTotalTmp
);
};
const
onAdd
=
()
=>
{
let
data
=
[...
listInput
];
data
.
push
({
...
...
@@ -73,6 +99,7 @@ const EscrowCalculator = (props) => {
firstEscrowTotal
=
{
firstEscrowTotal
}
setItemInput
=
{
setItemInput
}
setFirstEscrow
=
{
setFirstEscrow
}
message
=
{
message
}
/
>
);
};
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
View file @
151a84a2
...
...
@@ -35,11 +35,12 @@ const EscrowCalculatorView = (props) => {
dataProduct
=
{
props
.
dataProduct
}
setProduct
=
{(
product
)
=>
{
item
.
product
=
product
;
item
.
firstEscrow
=
parseFloat
(
item
.
lotNumber
)
*
product
.
escrow
;
props
.
setItemInput
(
item
,
index
);
}}
setLotNumber
=
{(
lotNumber
)
=>
{
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
);
}}
/
>
...
...
@@ -73,10 +74,7 @@ const EscrowCalculatorView = (props) => {
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
inputStyle
=
{{
backgroundColor
:
R
.
colors
.
gray7
}}
/
>
<
Text
style
=
{
styles
.
textMessage
}
>
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
>
<
Text
style
=
{
styles
.
textMessage
}
>
{
props
.
message
}
<
/Text
>
<
/View
>
<
View
...
...
src/assets/images/iconUpgrade.png
View replaced file @
a957bd76
View file @
151a84a2
4.2 KB
|
W:
|
H:
2.25 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/helper/i18/locales/en.js
View file @
151a84a2
...
...
@@ -257,8 +257,6 @@ export default {
'(estimated according to the current state processing rate of MXV)'
,
Caculate
:
'Caculate'
,
ConversionUnit
:
'Conversion unit'
,
Delete
:
'Delete'
,
UnitsQuotedFloor
:
'Units quoted in the floor'
,
ConversionPrice
:
'Conversion price'
,
ConvertUSD
:
'Convert USD/Ton'
,
...
...
@@ -274,4 +272,9 @@ export default {
ProfitLoss
:
'Profit/Loss'
,
BUY_IN
:
'Buy in'
,
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'
,
};
src/helper/i18/locales/vn.js
View file @
151a84a2
...
...
@@ -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'
,
Caculate
:
'Tính'
,
ConversionUnit
:
'Đơn vị quy đổi'
,
Delete
:
'Xoá'
,
UnitsQuotedFloor
:
'Đơn vị yết giá trên sàn'
,
ConversionPrice
:
'Giá quy đổi'
,
ConvertUSD
:
'Quy đổi USD/Tấn'
,
...
...
@@ -269,4 +268,9 @@ export default {
SELL_OUT
:
'Bán ra'
,
EscrowCalculator
:
'Tính ký quỹ'
,
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'
,
};
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