Commit 7cfd9ca1 by Giang Tran

edit escrow calculator

parent ee6cd993
...@@ -35,12 +35,15 @@ const EscrowCalculatorView = (props) => { ...@@ -35,12 +35,15 @@ 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; 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 = item.product ? parseFloat(item.lotNumber) * item.product.escrow : 0; item.firstEscrow = item.product
? parseFloat(item.lotNumber) * item.product.escrow
: 0;
props.setItemInput(item, index); props.setItemInput(item, index);
}} }}
/> />
...@@ -57,23 +60,26 @@ const EscrowCalculatorView = (props) => { ...@@ -57,23 +60,26 @@ const EscrowCalculatorView = (props) => {
</View> </View>
<View style={{paddingHorizontal: WIDTHXD(60)}}> <View style={{paddingHorizontal: WIDTHXD(60)}}>
<TextMoney <TextMoney
editable={false}
title={I18n.t('FirstEscrowTotal')}
value={props.firstEscrowTotal}
titleStyle={{
marginTop: HEIGHTXD(160),
fontSize: getFontXD(39),
}}
inputStyle={{backgroundColor: R.colors.gray7}}
/>
<TextMoney
onChangeText={(val) => { onChangeText={(val) => {
props.setFirstEscrow(val.split('.').join('')); props.setFirstEscrow(val.split('.').join(''));
}} }}
title={I18n.t('FirstEscrow')} title={I18n.t('AvailableMargin')}
value={props.firstEscrow} value={props.firstEscrow}
titleStyle={{ titleStyle={{
marginTop: HEIGHTXD(180),
fontSize: getFontXD(39), 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}>{props.message}</Text> <Text style={styles.textMessage}>{props.message}</Text>
</View> </View>
......
import React from 'react'; import React from 'react';
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'; import {
StyleSheet,
Text,
TouchableOpacity,
View,
Dimensions,
} from 'react-native';
import I18n from '../../../helper/i18/i18n'; import I18n from '../../../helper/i18/i18n';
import PickerItem from '../../../components/Picker/PickerItem'; import PickerItem from '../../../components/Picker/PickerItem';
import { import {
...@@ -12,28 +18,38 @@ import R from '../../../assets/R'; ...@@ -12,28 +18,38 @@ import R from '../../../assets/R';
import TextMoney from '../../../components/Input/InputMoney'; import TextMoney from '../../../components/Input/InputMoney';
import Icon from 'react-native-vector-icons/Entypo'; import Icon from 'react-native-vector-icons/Entypo';
const {width} = Dimensions.get('window');
const ItemEscrowCalculator = (props) => { const ItemEscrowCalculator = (props) => {
return ( return (
<View style={styles.viewInput}> <View style={styles.viewInput}>
<Text style={styles.textTitle}>{I18n.t('Product')}</Text> <View style={{flexDirection: 'row', flex: 1}}>
<PickerItem <View style={{flex: 1, marginVertical: 5}}>
data={props.dataProduct} <Text style={styles.textTitle}>{I18n.t('Product')}</Text>
onValueChange={(value, item) => { <PickerItem
props.setProduct(item); data={props.dataProduct}
}} onValueChange={(value, item) => {
iconSize={WIDTHXD(40)} props.setProduct(item);
iconColor={R.colors.black} }}
/> width={width / 2 - 30}
iconSize={WIDTHXD(40)}
iconColor={R.colors.black}
/>
</View>
<View style={{width: 20}} />
<View style={{flex: 1}}>
<TextMoney
onChangeText={(val) => {
props.setLotNumber(val);
}}
title={I18n.t('LotTransactionNumber')}
value={toPriceVnd(props.item.lotNumber)}
titleStyle={{fontSize: getFontXD(39)}}
/>
</View>
</View>
<TextMoney <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) => {}} onChangeText={(val) => {}}
title={I18n.t('FirstEscrow')} title={I18n.t('FirstEscrow')}
value={props.item.firstEscrow} value={props.item.firstEscrow}
......
...@@ -5,16 +5,27 @@ import R from '../../assets/R'; ...@@ -5,16 +5,27 @@ import R from '../../assets/R';
import {toPriceVnd} from '../../Config/Functions'; import {toPriceVnd} from '../../Config/Functions';
const TextMoney = (props) => { const TextMoney = (props) => {
const {title, onChangeText, maxLength, value, editable, titleStyle, inputStyle} = props; const {
title,
onChangeText,
maxLength,
value,
editable,
titleStyle,
inputStyle,
} = props;
return ( return (
<View style={{marginVertical: 5}}> <View style={{marginVertical: 5}}>
<Text <Text
style={[{ style={[
fontSize: getFontXD(42), {
color: R.colors.color777, fontSize: getFontXD(42),
marginBottom: 5, color: R.colors.color777,
}, titleStyle && titleStyle]}> marginBottom: 5,
},
titleStyle && titleStyle,
]}>
{title ? title : ''} {title ? title : ''}
</Text> </Text>
<TextInput <TextInput
...@@ -25,25 +36,28 @@ const TextMoney = (props) => { ...@@ -25,25 +36,28 @@ const TextMoney = (props) => {
value={toPriceVnd(value)} value={toPriceVnd(value)}
keyboardType={'number-pad'} keyboardType={'number-pad'}
onChangeText={(val) => onChangeText(val.split(',').join(''))} onChangeText={(val) => onChangeText(val.split(',').join(''))}
style={[{ style={[
height: HEIGHTXD(109), {
color: 'black', height: HEIGHTXD(109),
borderRadius: 7, color: 'black',
borderWidth: 0.7, borderRadius: 7,
borderColor: '#DBDBDB', borderWidth: 0.7,
fontSize: getFontXD(42), borderColor: '#DBDBDB',
paddingVertical: 5, fontSize: getFontXD(42),
paddingHorizontal: 10, paddingVertical: 5,
backgroundColor: 'white', paddingHorizontal: 10,
shadowColor: '#AFA9A9', backgroundColor: 'white',
shadowOffset: { shadowColor: '#AFA9A9',
width: 0, shadowOffset: {
height: 1, width: 0,
height: 1,
},
shadowOpacity: 0.25,
shadowRadius: 1.84,
elevation: 1,
}, },
shadowOpacity: 0.25, inputStyle && inputStyle,
shadowRadius: 1.84, ]}
elevation: 1,
}, inputStyle && inputStyle]}
/> />
</View> </View>
); );
......
...@@ -285,4 +285,5 @@ export default { ...@@ -285,4 +285,5 @@ export default {
Systemmaintenance: 'The system is maintenance', Systemmaintenance: 'The system is maintenance',
WaitUpdateCQG: 'Waiting Update CQG', WaitUpdateCQG: 'Waiting Update CQG',
code: 'Code', code: 'Code',
AvailableMargin: 'Available margin',
}; };
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
BUY_IN: 'Mua vào', BUY_IN: 'Mua vào',
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: 'Tổng ký quỹ ban đầu',
YouCanNotTransaction: 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', '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: YouCanTransaction:
...@@ -283,4 +283,6 @@ export default { ...@@ -283,4 +283,6 @@ export default {
FirstPriceRange: 'Giới hạn giá ban đầu', FirstPriceRange: 'Giới hạn giá ban đầu',
ExpandPriceRange: 'Giới hạn giá mở rộng', ExpandPriceRange: 'Giới hạn giá mở rộng',
code: 'Mã', code: 'Mã',
AvailableMargin: 'Ký quỹ khả dụng',
Calculator: 'Tính',
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment