CQG.js 4.16 KB
Newer Older
1 2 3
import React from 'react';
import {View, Text, TouchableOpacity, Image, StyleSheet} from 'react-native';
import R from '../../../../assets/R';
Giang Tran committed
4
import {getFontXD, HEIGHTXD, WIDTHXD} from '../../../../Config/Functions';
Giang Tran committed
5 6 7
import {connect} from 'react-redux';
import AppText from '../../../../components/AppText';
import I18n from '../../../../helper/i18/i18n';
Giang Tran committed
8 9
import {useNavigation} from '@react-navigation/native';
import {PACKETCQG} from '../../../../routers/ScreenNames';
10 11

const Profile = (props) => {
Giang Tran committed
12 13 14
  const onClickCLose = () => {
    console.log('Close click');
  };
Giang Tran committed
15
  const navigation = useNavigation();
16 17
  return (
    <View style={styles.container}>
Giang Tran committed
18
      {props.user.status == 6 ? (
Giang Tran committed
19 20 21
        <View>
          <View style={styles.item}>
            <AppText i18nKey={'ContactCode'} style={styles.txtTitle}></AppText>
Giang Tran committed
22
            <Text style={styles.txtBig}>{props.user.contract_code}</Text>
Giang Tran committed
23 24 25 26 27 28 29 30 31 32 33
          </View>
          <View style={styles.item}>
            <AppText
              i18nKey={'TraddingAccountName'}
              style={styles.txtTitle}></AppText>
            <Text style={styles.txtBig}>{props.user.cqg_name}</Text>
          </View>
          <View style={styles.item}>
            <AppText
              i18nKey={'TraddingAccountNumber'}
              style={styles.txtTitle}></AppText>
Giang Tran committed
34
            <Text style={styles.txtBig}>{props.user.cqg_account}</Text>
Giang Tran committed
35
          </View>
Giang Tran committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

          <View
            style={{
              flexDirection: 'row',
              alignItems: 'center',
              justifyContent: 'space-between',
              marginTop: 50,
            }}>
            <TouchableOpacity
              onPress={() => navigation.navigate(PACKETCQG)}
              style={styles.btnLeft}>
              <AppText i18nKey={'UpdatePacket'} style={styles.txtBtn}></AppText>
            </TouchableOpacity>
            <TouchableOpacity onPress={onClickCLose} style={styles.btnRight}>
              <AppText i18nKey={'CloseAccount'} style={styles.txtBtn}></AppText>
            </TouchableOpacity>
          </View>
Giang Tran committed
53 54
        </View>
      ) : (
Giang Tran committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
        <View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
          {props.user.status == 5 ? (
            <AppText
              i18nKey={'WaitVerification'}
              style={styles.txtNoti1}></AppText>
          ) : (
            <View style={{justifyContent: 'center', alignItems: 'center'}}>
              <AppText
                i18nKey={'PopupOpenCQG'}
                style={styles.txtNoti}></AppText>
              <TouchableOpacity
                onPress={() => navigation.navigate(PACKETCQG)}
                style={styles.containerBtn}>
                <AppText
                  i18nKey={'OpenAccountCQG'}
                  style={styles.txtBtn}></AppText>
              </TouchableOpacity>
            </View>
          )}
Giang Tran committed
74 75
        </View>
      )}
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,

    paddingHorizontal: 10,
  },
  item: {
    paddingBottom: 15,
    borderBottomWidth: 1,
    borderBottomColor: '#DBDBDB',
    marginTop: 10,
  },
  txtTitle: {
    fontSize: getFontXD(42),
    color: R.colors.color777,
    marginBottom: 5,
    paddingTop: 5,
  },
Giang Tran committed
98 99 100 101 102 103 104 105 106 107 108 109
  txtNoti: {
    fontSize: getFontXD(42),
    color: R.colors.black,
    marginBottom: 5,
    textAlign: 'center',
  },
  txtNoti1: {
    fontSize: getFontXD(52),
    color: R.colors.orange,
    marginBottom: 5,
    textAlign: 'center',
  },
110 111 112
  txtBig: {
    fontSize: getFontXD(46),
  },
Giang Tran committed
113
  txtBtn: {
Giang Tran committed
114
    fontSize: getFontXD(42),
Giang Tran committed
115
    color: R.colors.white,
Giang Tran committed
116
    fontWeight: '600',
Giang Tran committed
117 118 119 120 121 122 123 124
  },
  containerBtn: {
    paddingVertical: 10,
    paddingHorizontal: 20,
    backgroundColor: R.colors.main,
    borderRadius: 5,
    marginTop: 30,
  },
Giang Tran committed
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
  btnLeft: {
    backgroundColor: R.colors.main,
    width: WIDTHXD(460),
    alignItems: 'center',
    justifyContent: 'center',
    height: HEIGHTXD(109),
    borderRadius: 5,
  },
  btnRight: {
    backgroundColor: '#E3434F',
    width: WIDTHXD(460),
    alignItems: 'center',
    justifyContent: 'center',
    height: HEIGHTXD(109),
    borderRadius: 5,
  },
141 142
});

Giang Tran committed
143 144 145 146 147 148
const mapStateToProps = (state) => {
  return {
    user: state.userReducer,
  };
};
export default connect(mapStateToProps, {})(Profile);