Commit 8f273cc7 by Nguyễn Thị Thúy

complete calculator escrow and profit loss

parents 26a17b11 6d4f2337
import I18n from '../helper/i18/i18n'
export const RadioBuySale = [
{label: I18n.t('Buy'), value: 0},
{label: I18n.t('Sale'), value: 1}
]
import React, {useEffect, useState} from 'react';
import EscrowCalculatorView from './EscrowCalculatorView';
const EscrowCalculator = (props) => {
const [dataProduct, setDataProduct] = useState([])
const setProduct = (item) => {
}
return (
<EscrowCalculatorView
dataProduct={dataProduct}
setProduct={setProduct}
/>
);
};
export default EscrowCalculator;
import React, {Component} from 'react';
import {View, Text} from 'react-native';
const CaculatedDeposit = (props) => {
return (
<View>
<Text>CaculatedDeposit</Text>
</View>
);
};
export default CaculatedDeposit;
import React, {Component} from 'react';
import {View, Text} from 'react-native';
const CaculatedStopLoss = (props) => {
return (
<View>
<Text>CaculatedStopLoss</Text>
</View>
);
};
export default CaculatedStopLoss;
import React, {Component, useState} from 'react';
import {View, Text} from 'react-native';
import CalculatorProfitLossView from './CalculatorProfitLossView';
import EscrowCalculatorView from '../EscrowCalculator/EscrowCalculatorView';
import {RadioBuySale} from '../../../Config/constants';
const CalculatorProfitLoss = (props) => {
const [dataProduct, setDataProduct] = useState([
{
id: 0,
name: 'Ngô',
},
{
id: 1,
name: 'Đậu tương',
}]);
const [product, setProduct] = useState(null);
const [transactionType, setTransactionType] = useState(RadioBuySale[0].value);
const [dataCalculator, setDataCalculator] = useState([
{
name: 'Ngô',
status: 'Mua',
slot_number: 6,
profit_loss_usd: 639324325,
profit_loss_vnd: 1234349235455,
},
{
name: 'Đậu tương',
status: 'Bán',
slot_number: 6,
profit_loss_usd: 639324325,
profit_loss_vnd: 1234349235455,
},
{
name: 'Bạc',
status: 'Mua',
slot_number: 6,
profit_loss_usd: 639324325,
profit_loss_vnd: 1234349235455,
},
]);
const [lotTransactionNUmber, setLotTransactionNUmber] = useState(0);
const [openPrice, setOpenPrice] = useState(0);
const [closeStatusPrice, setCloseStatusPrice] = useState(0);
const onCalculator = () => {
};
const onDelete = () => {
};
const setLotNUmber = (text) => {
setLotTransactionNUmber(text.split(',').join(''));
};
const setOpenPriceEvent = (text) => {
setOpenPrice(text.split(',').join(''));
};
const setCloseStatusEvent = (text) => {
setCloseStatusPrice(text.split(',').join(''));
};
return (
<CalculatorProfitLossView
dataProduct={dataProduct}
setProduct={setProduct}
dataCalculator={dataCalculator}
onCalculator={onCalculator}
onDelete={onDelete}
setTransactionType={setTransactionType}
setLotNUmber={setLotNUmber}
lotTransactionNUmber={lotTransactionNUmber}
openPrice={openPrice}
setOpenPrice={setOpenPriceEvent}
closeStatusPrice={closeStatusPrice}
setCloseStatusPrice={setCloseStatusEvent}
/>
);
};
export default CalculatorProfitLoss;
import React, {Component} from 'react';
import {View, Text, StyleSheet, TouchableOpacity, FlatList, ScrollView} from 'react-native';
import HeaderBack from '../../../components/Header/HeaderBack';
import {getFontXD, HEIGHTXD, toPriceVnd, WIDTHXD} from '../../../Config/Functions';
import I18n from '../../../helper/i18/i18n';
import PickerItem from '../../../components/Picker/PickerItem';
import R from '../../../assets/R';
import RadioForm from 'react-native-simple-radio-button';
import {RadioBuySale} from '../../../Config/constants';
import TextMoney from '../../../components/Input/InputMoney';
import ItemPrice from '../../Home/ItemPrice';
import ItemCalculator from './ItemCalculator';
const CalculatorProfitLossView = (props) => {
return (
<View style={{flex: 1, flexDirection: 'column', backgroundColor: 'white'}}>
<HeaderBack title={'CalculatorProfitLoss'} isWhite={true}/>
<ScrollView>
<View style={{paddingHorizontal: WIDTHXD(60), paddingVertical: HEIGHTXD(60)}}>
<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}
/>
<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>
<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>
</View>
);
};
const styles = StyleSheet.create({
viewInput: {
marginHorizontal: WIDTHXD(36),
marginTop: WIDTHXD(69),
marginBottom: WIDTHXD(44),
borderWidth: 0.3,
borderColor: '#707070',
paddingHorizontal: WIDTHXD(24),
paddingVertical: WIDTHXD(24),
},
textTitle: {
fontSize: getFontXD(39),
color: R.colors.color777,
},
row: {
height: HEIGHTXD(109),
width: '100%',
justifyContent: 'space-between',
marginVertical: 5,
},
btn: {
width: WIDTHXD(428),
height: HEIGHTXD(120),
justifyContent: 'center',
alignItems: 'center',
backgroundColor: R.colors.main,
borderRadius: 5,
},
txtButton: {
color: R.colors.white,
fontSize: getFontXD(48),
},
});
export default CalculatorProfitLossView;
import React, {useState, useEffect} from 'react';
import {
View,
TouchableOpacity,
Text,
LayoutAnimation,
StyleSheet
} from 'react-native';
import R from '../../../assets/R';
import Ionicons from 'react-native-vector-icons/Ionicons';
import {getFontXD, getLineHeightXD, HEIGHTXD, toPriceVnd, WIDTHXD} from '../../../Config/Functions';
import I18n from '../../../helper/i18/i18n';
import TextField from '../../../components/TextField';
const ItemCalculator = (props) => {
const [expanded, setExpanded] = useState(true);
const changeLayout = () => {
LayoutAnimation.configureNext({
duration: 500,
create: {
type: LayoutAnimation.Types.spring,
property: LayoutAnimation.Properties.scaleY,
springDamping: 1.7,
},
update: {
type: LayoutAnimation.Types.spring,
springDamping: 1.7,
},
});
setExpanded(!expanded)
};
return (
<View style={[styles.container, {marginBottom: props.isLastItem? HEIGHTXD(100) : HEIGHTXD(30)}]}>
<TouchableOpacity
onPress={() => changeLayout()}
style={[styles.flexTitle, { borderBottomWidth: expanded === true ? 0.3 : 0, paddingHorizontal: WIDTHXD(30) }]}
>
<Text style={styles.title}>{props.item.name}</Text>
{expanded === true ? (
<Ionicons
name='chevron-up'
size={WIDTHXD(50)}
style={{ marginRight: WIDTHXD(25) }}
color={R.colors.iconGray}
/>
) : (
<Ionicons
name='chevron-down'
size={WIDTHXD(50)}
style={{ marginRight: WIDTHXD(25) }}
color={R.colors.iconGray}
/>
)}
</TouchableOpacity>
{expanded ?
<View style={{paddingVertical: HEIGHTXD(20)}}>
<TextField
title={I18n.t('Status')}
content={props.item.status}
styleContent={{color: R.colors.green}}
/>
<TextField
title={I18n.t('SlotNumber')}
content={props.item.slot_number}
/>
<TextField
title={`${I18n.t('ProfitLoss')} (USD)`}
content={toPriceVnd(props.item.profit_loss_usd)}
/>
<TextField
title={`${I18n.t('ProfitLoss')} (VNĐ)`}
content={toPriceVnd(props.item.profit_loss_vnd)}
/>
</View>
: null
}
</View>
)
}
export default ItemCalculator
const styles = StyleSheet.create({
container: {
backgroundColor: R.colors.white,
borderColor: R.colors.borderGray,
borderWidth: 0.3,
marginHorizontal: WIDTHXD(40),
marginBottom: HEIGHTXD(30)
},
flexTitle: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingVertical: HEIGHTXD(20),
borderBottomColor: R.colors.borderGray,
},
title: {
fontSize: getFontXD(36),
lineHeight: getLineHeightXD(56),
color: R.colors.black,
},
})
import React, {Component} from 'react';
import {View, Text} from 'react-native';
const ConvertUnit = (props) => {
return (
<View>
<Text>ConvertUnit</Text>
</View>
);
};
export default ConvertUnit;
import React, {useEffect, useState} from 'react';
import EscrowCalculatorView from './EscrowCalculatorView';
const EscrowCalculator = (props) => {
const [dataProduct, setDataProduct] = useState([
{
id: 0,
name: 'Ngô',
},
{
id: 1,
name: 'Đậu tương',
}])
const [product, setProduct] = useState(null)
const [lotNumber, setLotNumber] = useState(null)
const [firstEscrow, setFirstEscrow] = useState(null)
const setLotNumberEvent = (text) => {
setLotNumber(text.split(',').join(''));
setFirstEscrow(text.split(',').join(''));
};
const onCalculator = () => {
}
const onDelete = () => {
}
const onAdd = () => {
}
return (
<EscrowCalculatorView
dataProduct={dataProduct}
setProduct={setProduct}
lotNumber={lotNumber}
firstEscrow={firstEscrow}
setLotNumber={setLotNumberEvent}
onCalculator={onCalculator}
onDelete={onDelete}
onAdd={onAdd}
/>
);
};
export default EscrowCalculator;
import React from 'react';
import {StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
import {getFontXD, getWidth, HEIGHTXD, WIDTHXD} from '../../Config/Functions';
import R from '../../assets/R';
import I18n from '../../helper/i18/i18n';
import PickerItem from '../../components/Picker/PickerItem';
import TextMoney from '../../components/Input/InputMoney';
import {ADDMETHODPAY} from '../../routers/ScreenNames';
import HeaderBack from '../../../components/Header/HeaderBack';
import {getFontXD, getWidth, HEIGHTXD, toPriceVnd, WIDTHXD} from '../../../Config/Functions';
import R from '../../../assets/R';
import I18n from '../../../helper/i18/i18n';
import PickerItem from '../../../components/Picker/PickerItem';
import TextMoney from '../../../components/Input/InputMoney';
import {ADDMETHODPAY} from '../../../routers/ScreenNames';
import Icon from 'react-native-vector-icons/Entypo';
const EscrowCalculatorView = (props) => {
......@@ -29,17 +29,18 @@ const EscrowCalculatorView = (props) => {
<TextMoney
onChangeText={(val) => {
props.setLotNumber(val)
}}
title={I18n.t('LotTransactionNumber')}
value={1000}
titleStyle={{color: R.colors.black, marginTop: HEIGHTXD(20), fontSize: getFontXD(39)}}
value={toPriceVnd(props.lotNumber)}
titleStyle={{marginTop: HEIGHTXD(20), fontSize: getFontXD(39)}}
/>
<TextMoney
onChangeText={(val) => {
}}
title={I18n.t('FirstEscrow')}
value={1000}
titleStyle={{color: R.colors.black, fontSize: getFontXD(39)}}
value={props.firstEscrow}
titleStyle={{ontSize: getFontXD(39)}}
editable={false}
inputStyle={{backgroundColor: R.colors.gray7}}
/>
......@@ -47,6 +48,7 @@ const EscrowCalculatorView = (props) => {
<View style={{flexDirection: 'row', justifyContent: 'flex-end'}}>
<TouchableOpacity
onPress={() => {
props.onAdd()
}}
style={styles.containerBtn}>
<Icon name={'plus'} size={27} color={R.colors.white}/>
......@@ -57,20 +59,17 @@ const EscrowCalculatorView = (props) => {
onChangeText={(val) => {
}}
title={I18n.t('FirstEscrow')}
value={1000}
value={props.firstEscrow}
titleStyle={{
color: R.colors.black,
marginTop: HEIGHTXD(180),
fontSize: getFontXD(39),
}}
/>
<TextMoney
onChangeText={(val) => {
}}
editable={false}
title={I18n.t('FirstEscrowTotal')}
value={1000}
titleStyle={{color: R.colors.black, marginTop: HEIGHTXD(20), fontSize: getFontXD(39)}}
value={props.firstEscrow}
titleStyle={{marginTop: HEIGHTXD(20), fontSize: getFontXD(39)}}
inputStyle={{backgroundColor: R.colors.gray7}}
/>
<Text style={styles.textMessage}>Bn có th giao dch các hp đồng k trên vi mc ký qu
......@@ -85,10 +84,12 @@ const EscrowCalculatorView = (props) => {
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>
......@@ -110,7 +111,7 @@ const styles = StyleSheet.create({
},
textTitle: {
fontSize: getFontXD(39),
color: R.colors.black,
color: R.colors.color777,
},
textMessage: {
fontSize: getFontXD(39),
......
import React, {Component} from 'react';
import {View, Text} from 'react-native';
const ExchangeRate = (props) => {
return (
<View>
<Text>ExchangeRate</Text>
</View>
);
};
export default ExchangeRate;
......@@ -97,6 +97,13 @@ const images = {
iconTriangleDown: require('./images/iconTriangleDown.png'),
iconSort: require('./images/iconSort.png'),
imagePicker: require('./images/imagePicker.png'),
caculatedDeposit: require('./images/caculatedDeposit.png'),
CaculatedProfitLoss: require('./images/CaculatedProfitLoss.png'),
caculatedStopLoss: require('./images/caculatedStopLoss.png'),
convertUnit: require('./images/convertUnit.png'),
exchangeRate: require('./images/exchangeRate.png'),
iconTool: require('./images/iconTool.png'),
};
export default images;
......@@ -14,6 +14,11 @@ import AsyncStorage from '@react-native-community/async-storage';
import DeviceInfo from 'react-native-device-info';
import {
ESCROWCALCULATOR,
CACULATEDPROFITLOSS,
CACULATEDSTOPLOSS,
CONVERTUNIT,
EXCHANGERATE,
AccountVerification,
METHODPAY,
SERVICECUSTOMER,
......@@ -119,6 +124,47 @@ const menus = [
},
],
},
{
id: '9',
title: 'Tool',
icon: R.images.iconTool,
screen: CONTRACT,
active: false,
children: [
{
title: 'CaculatedDeposit',
icon: R.images.caculatedDeposit,
screen: ESCROWCALCULATOR,
id: '91',
},
{
id: '92',
title: 'CaculatedProfitLoss',
icon: R.images.CaculatedProfitLoss,
screen: CACULATEDPROFITLOSS,
},
{
id: '93',
title: 'CaculatedStopLoss',
icon: R.images.caculatedStopLoss,
screen: CACULATEDSTOPLOSS,
},
{
id: '94',
title: 'ConvertUnit',
icon: R.images.convertUnit,
screen: CONVERTUNIT,
},
{
id: '95',
title: 'ExchangeRate',
icon: R.images.exchangeRate,
screen: EXCHANGERATE,
},
],
},
{
id: '8',
title: 'Support',
......
......@@ -8,10 +8,11 @@ import R from '../assets/R';
import {getFontXD, HEIGHTXD, WIDTHXD} from '../Config/Functions';
const TextField = (props) => {
const {styleContent} = props
return (
<View style={[styles.row, { paddingVertical: WIDTHXD(15) }]}>
<Text style={styles.title}>{props.title}</Text>
<Text style={styles.content}>{props.content}</Text>
<Text style={[styles.content, styleContent && {styleContent}]}>{props.content}</Text>
</View>
)
}
......
......@@ -237,4 +237,18 @@ export default {
FirstEscrow: 'First escrow (VNĐ)',
FirstEscrowTotal: 'First escrow total (VNĐ)',
Calculator: 'Calculator',
Tool: 'Tool',
CaculatedDeposit: 'Caculated deposit',
CaculatedProfitLoss: 'Caculated profit loss',
CaculatedStopLoss: 'Caculated stop loss',
ConvertUnit: 'Convert unit',
ExchangeRate: 'Exchange rate',
CalculatorProfitLoss: 'Calculator profit and loss',
Buy: 'Buy',
Sale: 'Sale',
OpenPrice: 'Open price',
CloseStatusPrice: 'Giá đóng trạng thái',
SlotNumber: 'Số slot',
ProfitLoss: 'Lãi/lỗ',
};
......@@ -239,4 +239,17 @@ export default {
FirstEscrow: 'Ký quỹ ban đầu (VNĐ)',
FirstEscrowTotal: 'Tổng ký quỹ ban đầu (VNĐ)',
Calculator: 'Tính',
Tool: 'Công cụ',
CaculatedDeposit: 'Tính ký quỹ',
CaculatedProfitLoss: 'Tính lãi lỗ',
CaculatedStopLoss: 'Tính giá cắt lỗ',
ConvertUnit: 'Chuyển đổi đơn vị',
ExchangeRate: 'Quy đổi tỷ giá',
CalculatorProfitLoss: 'Tính lãi lỗ',
Buy: 'Mua',
Sale: 'Bán',
OpenPrice: 'Giá mở cửa',
CloseStatusPrice: 'Giá đóng trạng thái',
SlotNumber: 'Số slot',
ProfitLoss: 'Lãi/lỗ',
};
......@@ -70,3 +70,9 @@ export const REGISTEROTP = 'REGISTEROTP';
export const OTPWALLET = 'OTPWALLET';
export const ESCROWCALCULATOR = 'ESCROWCALCULATOR';
export const CACULATEDDEPOSIT = 'CACULATEDDEPOSIT';
export const CACULATEDPROFITLOSS = 'CACULATEDPROFITLOSS';
export const CACULATEDSTOPLOSS = 'CACULATEDSTOPLOSS';
export const CONVERTUNIT = 'CONVERTUNIT';
export const EXCHANGERATE = 'EXCHANGERATE';
......@@ -48,7 +48,13 @@ import DetailHistory from '../Screens/Action/History/DetailHistory';
import ProductDetail from '../Screens/Transaction/ProductDetail/ProductDetail';
import RegisterOTP from '../Screens/Authen/RegisterOTP';
import OTPWallet from '../Screens/Action/Wallet/OTPWallet';
import EscrowCalculator from '../Screens/EscrowCalculator/EscrowCalculator';
import EscrowCalculator from '../Screens/Tool/EscrowCalculator/EscrowCalculator';
import CaculatedDeposit from '../Screens/Tool/CaculatedDeposit';
import CaculatedProfitLoss from '../Screens/Tool/CalculatorProfitLoss/CalculatorProfitLoss';
import CaculatedStopLoss from '../Screens/Tool/CaculatedStopLoss';
import ConvertUnit from '../Screens/Tool/ConvertUnit';
import ExchangeRate from '../Screens/Tool/ExchangeRate';
import * as ScreenName from './ScreenNames';
......@@ -66,11 +72,27 @@ function MyStack(props) {
}}
headerMode={'none'}
initialRouteName={ScreenName.AUTHEN}>
<Stack.Screen
name={ScreenName.CACULATEDDEPOSIT}
component={CaculatedDeposit}
/>
<Stack.Screen
name={ScreenName.CACULATEDPROFITLOSS}
component={CaculatedProfitLoss}
/>
<Stack.Screen
name={ScreenName.CACULATEDSTOPLOSS}
component={CaculatedStopLoss}
/>
<Stack.Screen name={ScreenName.CONVERTUNIT} component={ConvertUnit} />
<Stack.Screen name={ScreenName.EXCHANGERATE} component={ExchangeRate} />
<Stack.Screen name={ScreenName.LOGINSCREEN} component={Login} />
<Stack.Screen name={ScreenName.OTPWALLET} component={OTPWallet} />
<Stack.Screen name={ScreenName.HISTORYDETAIL} component={DetailHistory} />
<Stack.Screen name={ScreenName.LEGALDOCUMENT} component={LegaDocument} />
<Stack.Screen name={ScreenName.NOTIFICATION} component={Notification} />
<Stack.Screen name={ScreenName.REGISTEROTP} component={RegisterOTP} />
<Stack.Screen name={ScreenName.LEGALBUSINESS} component={Business} />
......
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