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
811b48c0
Commit
811b48c0
authored
May 14, 2021
by
Nguyễn Thị Thúy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete calculator escrow and profit loss UI
parent
8f273cc7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
333 additions
and
228 deletions
+333
-228
CalculatorProfitLoss.js
...Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
+68
-43
CalculatorProfitLossView.js
...ens/Tool/CalculatorProfitLoss/CalculatorProfitLossView.js
+77
-76
EscrowCalculator.js
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
+54
-23
EscrowCalculatorView.js
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
+71
-83
ItemEscrowCalculator.js
src/Screens/Tool/EscrowCalculator/ItemEscrowCalculator.js
+60
-0
en.js
src/helper/i18/locales/en.js
+3
-3
No files found.
src/Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss.js
View file @
811b48c0
import
React
,
{
Component
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
View
,
Text
}
from
'react-native'
;
import
CalculatorProfitLossView
from
'./CalculatorProfitLossView'
;
import
CalculatorProfitLossView
from
'./CalculatorProfitLossView'
;
import
EscrowCalculatorView
from
'../EscrowCalculator/EscrowCalculatorView'
;
import
{
RadioBuySale
}
from
'../../../Config/constants'
;
import
{
RadioBuySale
}
from
'../../../Config/constants'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
{
checkFormatArray
}
from
'../../../Config/Functions'
;
import
{
showAlert
,
TYPE
}
from
'../../../components/DropdownAlert'
;
import
{
getTransactionListByCategory
}
from
'../../../apis/Functions/Transaction'
;
import
{
Platform
}
from
'react-native'
;
const
CalculatorProfitLoss
=
(
props
)
=>
{
const
CalculatorProfitLoss
=
(
props
)
=>
{
const
[
dataProduct
,
setDataProduct
]
=
useState
([
const
[
dataProduct
,
setDataProduct
]
=
useState
([]);
{
id
:
0
,
name
:
'Ngô'
,
},
{
id
:
1
,
name
:
'Đậu tương'
,
}]);
const
[
product
,
setProduct
]
=
useState
(
null
);
const
[
product
,
setProduct
]
=
useState
(
null
);
const
[
transactionType
,
setTransactionType
]
=
useState
(
RadioBuySale
[
0
].
value
);
const
[
transactionType
,
setTransactionType
]
=
useState
(
RadioBuySale
[
0
].
value
);
const
[
dataCalculator
,
setDataCalculator
]
=
useState
([
const
[
dataCalculator
,
setDataCalculator
]
=
useState
([]);
{
const
[
lotTransactionNumber
,
setLotTransactionNumber
]
=
useState
(
null
);
name
:
'Ngô'
,
const
[
openPrice
,
setOpenPrice
]
=
useState
(
null
);
status
:
'Mua'
,
const
[
closeStatusPrice
,
setCloseStatusPrice
]
=
useState
(
null
);
slot_number
:
6
,
useEffect
(()
=>
{
profit_loss_usd
:
639324325
,
getProductData
()
profit_loss_vnd
:
1234349235455
,
},
[])
},
{
const
getProductData
=
async
()
=>
{
name
:
'Đậu tương'
,
const
res
=
await
getTransactionListByCategory
({
status
:
'Bán'
,
keyword
:
''
,
slot_number
:
6
,
platform
:
Platform
.
OS
,
profit_loss_usd
:
639324325
,
page_size
:
1000
,
profit_loss_vnd
:
1234349235455
,
page_index
:
1
,
},
type
:
'PRICE_TABLE'
,
{
category_id
:
-
1
,
name
:
'Bạc'
,
});
status
:
'Mua'
,
if
(
res
.
status
==
200
&&
res
.
data
.
code
==
200
)
{
slot_number
:
6
,
setDataProduct
(
res
.
data
.
data
);
profit_loss_usd
:
639324325
,
}
else
{
profit_loss_vnd
:
1234349235455
,
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
,
I18n
.
t
(
'Can_not_get_data'
)))
},
}
]);
};
const
[
lotTransactionNUmber
,
setLotTransactionNUmber
]
=
useState
(
0
);
const
[
openPrice
,
setOpenPrice
]
=
useState
(
0
);
const
[
closeStatusPrice
,
setCloseStatusPrice
]
=
useState
(
0
);
const
onCalculator
=
()
=>
{
const
onCalculator
=
()
=>
{
const
titles
=
[
I18n
.
t
(
'Product'
),
I18n
.
t
(
'LotTransactionNumber'
),
I18n
.
t
(
'OpenPrice'
),
I18n
.
t
(
'CloseStatusPrice'
),
];
const
index
=
checkFormatArray
([
product
,
lotTransactionNumber
,
openPrice
,
closeStatusPrice
,
]);
if
(
index
===
true
)
{
let
newData
=
[...
dataCalculator
]
newData
.
push
({
name
:
'Bạc'
,
status
:
'Mua'
,
slot_number
:
6
,
profit_loss_usd
:
639324325
,
profit_loss_vnd
:
1234349235455
,
})
setDataCalculator
(
newData
)
setLotTransactionNumber
(
null
)
setOpenPrice
(
null
)
setCloseStatusPrice
(
null
)
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
`
${
I18n
.
t
(
'Please_fill_in'
)}${
titles
[
index
]}
`
)
}
};
};
const
onDelete
=
()
=>
{
const
onDelete
=
()
=>
{
setDataCalculator
([])
setLotTransactionNumber
(
null
)
setOpenPrice
(
null
)
setCloseStatusPrice
(
null
)
};
};
const
setLotN
U
mber
=
(
text
)
=>
{
const
setLotN
u
mber
=
(
text
)
=>
{
setLotTransactionN
U
mber
(
text
.
split
(
','
).
join
(
''
));
setLotTransactionN
u
mber
(
text
.
split
(
','
).
join
(
''
));
};
};
const
setOpenPriceEvent
=
(
text
)
=>
{
const
setOpenPriceEvent
=
(
text
)
=>
{
...
@@ -66,12 +90,13 @@ const CalculatorProfitLoss = (props) => {
...
@@ -66,12 +90,13 @@ const CalculatorProfitLoss = (props) => {
<
CalculatorProfitLossView
<
CalculatorProfitLossView
dataProduct
=
{
dataProduct
}
dataProduct
=
{
dataProduct
}
setProduct
=
{
setProduct
}
setProduct
=
{
setProduct
}
product
=
{
product
}
dataCalculator
=
{
dataCalculator
}
dataCalculator
=
{
dataCalculator
}
onCalculator
=
{
onCalculator
}
onCalculator
=
{
onCalculator
}
onDelete
=
{
onDelete
}
onDelete
=
{
onDelete
}
setTransactionType
=
{
setTransactionType
}
setTransactionType
=
{
setTransactionType
}
setLotN
Umber
=
{
setLotNU
mber
}
setLotN
umber
=
{
setLotNu
mber
}
lotTransactionN
Umber
=
{
lotTransactionNU
mber
}
lotTransactionN
umber
=
{
lotTransactionNu
mber
}
openPrice
=
{
openPrice
}
openPrice
=
{
openPrice
}
setOpenPrice
=
{
setOpenPriceEvent
}
setOpenPrice
=
{
setOpenPriceEvent
}
closeStatusPrice
=
{
closeStatusPrice
}
closeStatusPrice
=
{
closeStatusPrice
}
...
...
src/Screens/Tool/CalculatorProfitLoss/CalculatorProfitLossView.js
View file @
811b48c0
...
@@ -8,7 +8,6 @@ import R from '../../../assets/R';
...
@@ -8,7 +8,6 @@ import R from '../../../assets/R';
import
RadioForm
from
'react-native-simple-radio-button'
;
import
RadioForm
from
'react-native-simple-radio-button'
;
import
{
RadioBuySale
}
from
'../../../Config/constants'
;
import
{
RadioBuySale
}
from
'../../../Config/constants'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
ItemPrice
from
'../../Home/ItemPrice'
;
import
ItemCalculator
from
'./ItemCalculator'
;
import
ItemCalculator
from
'./ItemCalculator'
;
const
CalculatorProfitLossView
=
(
props
)
=>
{
const
CalculatorProfitLossView
=
(
props
)
=>
{
...
@@ -16,84 +15,86 @@ const CalculatorProfitLossView = (props) => {
...
@@ -16,84 +15,86 @@ const CalculatorProfitLossView = (props) => {
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
'white'
}}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
'white'
}}
>
<
HeaderBack
title
=
{
'CalculatorProfitLoss'
}
isWhite
=
{
true
}
/
>
<
HeaderBack
title
=
{
'CalculatorProfitLoss'
}
isWhite
=
{
true
}
/
>
<
ScrollView
>
<
ScrollView
>
<
View
style
=
{{
paddingHorizontal
:
WIDTHXD
(
60
),
paddingVertical
:
HEIGHTXD
(
60
)}}
>
<
View
style
=
{{
paddingHorizontal
:
WIDTHXD
(
60
),
paddingVertical
:
HEIGHTXD
(
60
)}}
>
<
Text
<
Text
style
=
{
styles
.
textTitle
}
>
style
=
{
styles
.
textTitle
}
>
{
I18n
.
t
(
'Product'
)}
{
I18n
.
t
(
'Product'
)}
<
/Text
>
<
/Text
>
<
PickerItem
<
PickerItem
data
=
{
props
.
dataProduct
}
data
=
{
props
.
dataProduct
}
onValueChange
=
{(
value
,
item
)
=>
{
onValueChange
=
{(
value
,
item
)
=>
{
props
.
setProduct
(
item
);
props
.
setProduct
(
item
);
}}
iconSize
=
{
WIDTHXD
(
40
)}
iconColor
=
{
R
.
colors
.
black
}
/
>
<
Text
style
=
{[
styles
.
textTitle
,
{
marginTop
:
HEIGHTXD
(
30
)}]}
>
{
I18n
.
t
(
'Tradding'
)}
<
/Text
>
<
View
style
=
{{
width
:
WIDTHXD
(
600
),
height
:
HEIGHTXD
(
85
)}}
>
<
RadioForm
radio_props
=
{
RadioBuySale
}
labelStyle
=
{{
fontSize
:
getFontXD
(
42
)}}
formHorizontal
=
{
true
}
style
=
{
styles
.
row
}
initial
=
{
0
}
buttonSize
=
{
WIDTHXD
(
30
)}
onPress
=
{(
value
)
=>
{
props
.
setTransactionType
(
value
);
}}
}}
defaultValue
=
{
props
.
product
?.
name
}
iconSize
=
{
WIDTHXD
(
40
)}
iconColor
=
{
R
.
colors
.
black
}
/
>
/
>
<
Text
style
=
{[
styles
.
textTitle
,
{
marginTop
:
HEIGHTXD
(
30
)}]}
>
{
I18n
.
t
(
'Tradding'
)}
<
/Text
>
<
View
style
=
{{
width
:
WIDTHXD
(
600
),
height
:
HEIGHTXD
(
85
)}}
>
<
RadioForm
radio_props
=
{
RadioBuySale
}
labelStyle
=
{{
fontSize
:
getFontXD
(
42
)}}
formHorizontal
=
{
true
}
style
=
{
styles
.
row
}
initial
=
{
0
}
buttonSize
=
{
WIDTHXD
(
30
)}
onPress
=
{(
value
)
=>
{
props
.
setTransactionType
(
value
);
}}
/
>
<
/View
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setLotNumber
(
val
);
}}
title
=
{
I18n
.
t
(
'LotTransactionNumber'
)}
value
=
{
toPriceVnd
(
props
.
lotTransactionNumber
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setOpenPrice
(
val
);
}}
title
=
{
I18n
.
t
(
'OpenPrice'
)}
value
=
{
toPriceVnd
(
props
.
openPrice
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setCloseStatusPrice
(
val
);
}}
title
=
{
I18n
.
t
(
'CloseStatusPrice'
)}
value
=
{
toPriceVnd
(
props
.
closeStatusPrice
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
View
style
=
{{
width
:
'100%'
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
marginTop
:
HEIGHTXD
(
50
),
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onDelete
();
}}
style
=
{[
styles
.
btn
,
{
backgroundColor
:
R
.
colors
.
red2
,
marginRight
:
WIDTHXD
(
72
)}]}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Delete'
)}
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onCalculator
();
}}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Calculator'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
TextMoney
<
FlatList
onChangeText
=
{(
val
)
=>
{
style
=
{{
paddingBottom
:
HEIGHTXD
(
15
),
backgroundColor
:
R
.
colors
.
white
}}
props
.
setLotNUmber
(
val
)
keyExtractor
=
{(
item
)
=>
item
.
id
}
}}
data
=
{
props
.
dataCalculator
}
title
=
{
I18n
.
t
(
'LotTransactionNumber'
)}
renderItem
=
{({
item
,
index
})
=>
<
ItemCalculator
item
=
{
item
}
value
=
{
toPriceVnd
(
props
.
lotTransactionNUmber
)}
isLastItem
=
{
index
===
props
.
dataCalculator
.
length
-
1
}
/>
}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setOpenPrice
(
val
)
}}
title
=
{
I18n
.
t
(
'OpenPrice'
)}
value
=
{
toPriceVnd
(
props
.
openPrice
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setCloseStatusPrice
(
val
)
}}
title
=
{
I18n
.
t
(
'CloseStatusPrice'
)}
value
=
{
toPriceVnd
(
props
.
closeStatusPrice
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
View
style
=
{{
width
:
'100%'
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
marginTop
:
HEIGHTXD
(
50
),
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onDelete
()
}}
style
=
{[
styles
.
btn
,
{
backgroundColor
:
R
.
colors
.
red2
,
marginRight
:
WIDTHXD
(
72
)}]}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Delete'
)}
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onCalculator
()
}}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Calculator'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
FlatList
style
=
{{
paddingBottom
:
HEIGHTXD
(
15
),
backgroundColor
:
R
.
colors
.
white
}}
keyExtractor
=
{(
item
)
=>
item
.
id
}
data
=
{
props
.
dataCalculator
}
renderItem
=
{({
item
,
index
})
=>
<
ItemCalculator
item
=
{
item
}
isLastItem
=
{
index
===
props
.
dataCalculator
.
length
-
1
}
/>
}
/>
/>
<
/ScrollView
>
<
/ScrollView
>
<
/View
>
<
/View
>
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculator.js
View file @
811b48c0
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
EscrowCalculatorView
from
'./EscrowCalculatorView'
;
import
EscrowCalculatorView
from
'./EscrowCalculatorView'
;
import
{
getTransactionListByCategory
}
from
'../../../apis/Functions/Transaction'
;
import
{
Platform
}
from
'react-native'
;
import
{
showAlert
,
TYPE
}
from
'../../../components/DropdownAlert'
;
import
I18n
from
'../../../helper/i18/i18n'
;
const
EscrowCalculator
=
(
props
)
=>
{
const
EscrowCalculator
=
(
props
)
=>
{
const
[
dataProduct
,
setDataProduct
]
=
useState
([
const
[
dataProduct
,
setDataProduct
]
=
useState
([]);
{
const
[
listInput
,
setListInput
]
=
useState
([{
id
:
0
,
product
:
null
,
name
:
'Ngô'
,
lotNumber
:
null
,
},
firstEscrow
:
0
,
{
}]);
id
:
1
,
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
null
);
name
:
'Đậu tương'
,
const
[
firstEscrowTotal
,
setFirstEscrowTotal
]
=
useState
(
0
);
}])
useEffect
(()
=>
{
const
[
product
,
setProduct
]
=
useState
(
null
)
getProductData
()
const
[
lotNumber
,
setLotNumber
]
=
useState
(
null
)
},
[])
const
[
firstEscrow
,
setFirstEscrow
]
=
useState
(
null
)
const
getProductData
=
async
()
=>
{
const
setLotNumberEvent
=
(
text
)
=>
{
const
res
=
await
getTransactionListByCategory
({
setLotNumber
(
text
.
split
(
','
).
join
(
''
));
keyword
:
''
,
setFirstEscrow
(
text
.
split
(
','
).
join
(
''
));
platform
:
Platform
.
OS
,
page_size
:
1000
,
page_index
:
1
,
type
:
'PRICE_TABLE'
,
category_id
:
-
1
,
});
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'
)))
}
};
};
const
onCalculator
=
()
=>
{
const
onCalculator
=
()
=>
{
}
}
;
const
onDelete
=
()
=>
{
const
onDelete
=
()
=>
{
}
};
const
onAdd
=
()
=>
{
const
setItemInput
=
(
item
,
index
)
=>
{
let
data
=
[...
listInput
]
data
[
index
]
=
item
setListInput
(
data
)
let
firstEscrowTotalTmp
=
0
data
.
map
((
item
)
=>
{
if
(
item
.
firstEscrow
)
firstEscrowTotalTmp
=
firstEscrowTotalTmp
+
item
.
firstEscrow
})
setFirstEscrowTotal
(
firstEscrowTotalTmp
)
}
}
const
onAdd
=
()
=>
{
let
data
=
[...
listInput
];
data
.
push
({
product
:
null
,
lotNumber
:
null
,
firstEscrow
:
null
,
});
setListInput
(
data
);
};
return
(
return
(
<
EscrowCalculatorView
<
EscrowCalculatorView
dataProduct
=
{
dataProduct
}
dataProduct
=
{
dataProduct
}
setProduct
=
{
setProduct
}
lotNumber
=
{
lotNumber
}
firstEscrow
=
{
firstEscrow
}
firstEscrow
=
{
firstEscrow
}
setLotNumber
=
{
setLotNumberEvent
}
onCalculator
=
{
onCalculator
}
onCalculator
=
{
onCalculator
}
onDelete
=
{
onDelete
}
onDelete
=
{
onDelete
}
onAdd
=
{
onAdd
}
onAdd
=
{
onAdd
}
listInput
=
{
listInput
}
firstEscrowTotal
=
{
firstEscrowTotal
}
setItemInput
=
{
setItemInput
}
setFirstEscrow
=
{
setFirstEscrow
}
/
>
/
>
);
);
};
};
...
...
src/Screens/Tool/EscrowCalculator/EscrowCalculatorView.js
View file @
811b48c0
import
React
from
'react'
;
import
React
from
'react'
;
import
{
StyleSheet
,
Text
,
TouchableOpacity
,
View
}
from
'react-native'
;
import
{
FlatList
,
StyleSheet
,
Text
,
TouchableOpacity
,
View
,
Scroll
View
}
from
'react-native'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../../components/Header/HeaderBack'
;
import
{
getFontXD
,
getWidth
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
R
from
'../../../assets/R'
;
import
R
from
'../../../assets/R'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
PickerItem
from
'../../../components/Picker/PickerItem'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
{
ADDMETHODPAY
}
from
'../../../routers/ScreenNames'
;
import
Icon
from
'react-native-vector-icons/Entypo'
;
import
Icon
from
'react-native-vector-icons/Entypo'
;
import
ItemEscrowCalculator
from
'./ItemEscrowCalculator'
;
const
EscrowCalculatorView
=
(
props
)
=>
{
const
EscrowCalculatorView
=
(
props
)
=>
{
return
(
return
(
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
'white'
}}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
'white'
}}
>
<
HeaderBack
title
=
{
'EscrowCalculator'
}
isWhite
=
{
true
}
/
>
<
HeaderBack
title
=
{
'EscrowCalculator'
}
isWhite
=
{
true
}
/
>
<
View
style
=
{
styles
.
viewInput
}
>
<
ScrollView
style
=
{{
paddingVertical
:
HEIGHTXD
(
60
)}}
>
<
Text
<
View
>
style
=
{
styles
.
textTitle
}
>
<
FlatList
{
I18n
.
t
(
'Product'
)}
keyExtractor
=
{(
item
)
=>
item
.
id
}
<
/Text
>
data
=
{
props
.
listInput
}
<
PickerItem
renderItem
=
{({
item
,
index
})
=>
<
ItemEscrowCalculator
item
=
{
item
}
data
=
{
props
.
dataProduct
}
dataProduct
=
{
props
.
dataProduct
}
onValueChange
=
{(
value
,
item
)
=>
{
setProduct
=
{(
product
)
=>
{
props
.
setProduct
(
item
);
item
.
product
=
product
}}
props
.
setItemInput
(
item
,
index
)
iconSize
=
{
WIDTHXD
(
40
)}
}}
iconColor
=
{
R
.
colors
.
black
}
setLotNumber
=
{(
lotNumber
)
=>
{
item
.
lotNumber
=
lotNumber
.
split
(
'.'
).
join
(
''
)
item
.
firstEscrow
=
parseFloat
(
item
.
lotNumber
)
*
12312
props
.
setItemInput
(
item
,
index
)
}}
/>
}
/>
/>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'flex-end'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onAdd
();
}}
style
=
{
styles
.
containerBtn
}
>
<
Icon
name
=
{
'plus'
}
size
=
{
27
}
color
=
{
R
.
colors
.
white
}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
paddingHorizontal
:
WIDTHXD
(
60
)}}
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setFirstEscrow
(
val
.
split
(
'.'
).
join
(
''
))
}}
title
=
{
I18n
.
t
(
'FirstEscrow'
)}
value
=
{
props
.
firstEscrow
}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
180
),
fontSize
:
getFontXD
(
39
),
}}
/
>
<
TextMoney
editable
=
{
false
}
title
=
{
I18n
.
t
(
'FirstEscrowTotal'
)}
value
=
{
props
.
firstEscrowTotal
}
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
>
<
/View
>
<
TextMoney
<
View
style
=
{{
onChangeText
=
{(
val
)
=>
{
width
:
'100%'
,
props
.
setLotNumber
(
val
)
flexDirection
:
'row'
,
}}
justifyContent
:
'center'
,
title
=
{
I18n
.
t
(
'LotTransactionNumber'
)}
alignItems
:
'center'
,
value
=
{
toPriceVnd
(
props
.
lotNumber
)}
marginTop
:
HEIGHTXD
(
80
),
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
marginBottom
:
HEIGHTXD
(
150
)
/
>
}}
>
<
TextMoney
<
TouchableOpacity
onPress
=
{()
=>
{
onChangeText
=
{(
val
)
=>
{
props
.
onDelete
();
}}
}}
style
=
{[
styles
.
btn
,
{
backgroundColor
:
R
.
colors
.
red2
,
marginRight
:
WIDTHXD
(
72
)}]}
>
title
=
{
I18n
.
t
(
'FirstEscrow'
)}
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Delete'
)}
<
/Text
>
value
=
{
props
.
firstEscrow
}
<
/TouchableOpacity
>
titleStyle
=
{{
ontSize
:
getFontXD
(
39
)}}
<
TouchableOpacity
onPress
=
{()
=>
{
editable
=
{
false
}
props
.
onCalculator
();
inputStyle
=
{{
backgroundColor
:
R
.
colors
.
gray7
}}
}}
style
=
{
styles
.
btn
}
>
/
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Calculator'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'flex-end'
}}
>
<
/View
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onAdd
()
}}
style
=
{
styles
.
containerBtn
}
>
<
Icon
name
=
{
'plus'
}
size
=
{
27
}
color
=
{
R
.
colors
.
white
}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
paddingHorizontal
:
WIDTHXD
(
60
)}}
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
}}
title
=
{
I18n
.
t
(
'FirstEscrow'
)}
value
=
{
props
.
firstEscrow
}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
180
),
fontSize
:
getFontXD
(
39
),
}}
/
>
<
TextMoney
editable
=
{
false
}
title
=
{
I18n
.
t
(
'FirstEscrowTotal'
)}
value
=
{
props
.
firstEscrow
}
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
>
<
/View
>
<
View
style
=
{{
width
:
'100%'
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
position
:
'absolute'
,
bottom
:
HEIGHTXD
(
50
),
}}
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onDelete
()
}}
style
=
{[
styles
.
btn
,
{
backgroundColor
:
R
.
colors
.
red2
,
marginRight
:
WIDTHXD
(
72
)}]}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Delete'
)}
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
{
props
.
onCalculator
()
}}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtButton
}
>
{
I18n
.
t
(
'Calculator'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/ScrollView
>
<
/View
>
<
/View
>
);
);
...
@@ -116,7 +104,7 @@ const styles = StyleSheet.create({
...
@@ -116,7 +104,7 @@ const styles = StyleSheet.create({
textMessage
:
{
textMessage
:
{
fontSize
:
getFontXD
(
39
),
fontSize
:
getFontXD
(
39
),
color
:
R
.
colors
.
black
,
color
:
R
.
colors
.
black
,
marginTop
:
HEIGHTXD
(
68
)
marginTop
:
HEIGHTXD
(
68
)
,
},
},
containerBtn
:
{
containerBtn
:
{
marginHorizontal
:
WIDTHXD
(
36
),
marginHorizontal
:
WIDTHXD
(
36
),
...
...
src/Screens/Tool/EscrowCalculator/ItemEscrowCalculator.js
0 → 100644
View file @
811b48c0
import
React
from
'react'
;
import
{
StyleSheet
,
Text
,
TouchableOpacity
,
View
}
from
'react-native'
;
import
I18n
from
'../../../helper/i18/i18n'
;
import
PickerItem
from
'../../../components/Picker/PickerItem'
;
import
{
getFontXD
,
HEIGHTXD
,
toPriceVnd
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
R
from
'../../../assets/R'
;
import
TextMoney
from
'../../../components/Input/InputMoney'
;
import
Icon
from
'react-native-vector-icons/Entypo'
;
const
ItemEscrowCalculator
=
(
props
)
=>
{
return
(
<
View
style
=
{
styles
.
viewInput
}
>
<
Text
style
=
{
styles
.
textTitle
}
>
{
I18n
.
t
(
'Product'
)}
<
/Text
>
<
PickerItem
data
=
{
props
.
dataProduct
}
onValueChange
=
{(
value
,
item
)
=>
{
props
.
setProduct
(
item
);
}}
iconSize
=
{
WIDTHXD
(
40
)}
iconColor
=
{
R
.
colors
.
black
}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
props
.
setLotNumber
(
val
);
}}
title
=
{
I18n
.
t
(
'LotTransactionNumber'
)}
value
=
{
toPriceVnd
(
props
.
item
.
lotNumber
)}
titleStyle
=
{{
marginTop
:
HEIGHTXD
(
20
),
fontSize
:
getFontXD
(
39
)}}
/
>
<
TextMoney
onChangeText
=
{(
val
)
=>
{
}}
title
=
{
I18n
.
t
(
'FirstEscrow'
)}
value
=
{
props
.
item
.
firstEscrow
}
titleStyle
=
{{
ontSize
:
getFontXD
(
39
)}}
editable
=
{
false
}
inputStyle
=
{{
backgroundColor
:
R
.
colors
.
gray7
}}
/
>
<
/View
>
);
};
const
styles
=
StyleSheet
.
create
({
viewInput
:
{
marginHorizontal
:
WIDTHXD
(
36
),
marginBottom
:
WIDTHXD
(
30
),
borderWidth
:
0.3
,
borderColor
:
'#707070'
,
paddingHorizontal
:
WIDTHXD
(
24
),
paddingVertical
:
WIDTHXD
(
24
),
},
textTitle
:
{
fontSize
:
getFontXD
(
39
),
color
:
R
.
colors
.
color777
,
},
})
export
default
ItemEscrowCalculator
;
src/helper/i18/locales/en.js
View file @
811b48c0
...
@@ -248,7 +248,7 @@ export default {
...
@@ -248,7 +248,7 @@ export default {
Buy
:
'Buy'
,
Buy
:
'Buy'
,
Sale
:
'Sale'
,
Sale
:
'Sale'
,
OpenPrice
:
'Open price'
,
OpenPrice
:
'Open price'
,
CloseStatusPrice
:
'
Giá đóng trạng thái
'
,
CloseStatusPrice
:
'
Close stauts price
'
,
SlotNumber
:
'S
ố slot
'
,
SlotNumber
:
'S
lot number
'
,
ProfitLoss
:
'
Lãi/lỗ
'
,
ProfitLoss
:
'
Profit/Loss
'
,
};
};
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