Commit cb10c0cd authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

memperbaiki state componernt pada home

parent cf38c699
......@@ -42,12 +42,13 @@ class Home extends React.Component {
old_balance_claimed: true,
member_since: "",
old_balance: 0,
expired:'',
card_number: ''
}
}
componentDidMount() {
this.CheckInbox()
const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({
......@@ -173,11 +174,11 @@ class Home extends React.Component {
}
// console.log(params);
Axios.post(this.props.BASE_URL + 'crm/v2/member/get_profile', params).then(res => {
console.log("data" + JSON.stringify(res) )
console.log("data" + JSON.stringify(res))
const dataCard = res.data
let point = dataCard.kaspro_point
let balance = dataCard.kaspro_balance
let expire = dataCard.expire_date
let expired = dataCard.expire_date
let account_number = dataCard.kaspro_account_number
let is_expired = dataCard.is_expired
let old_balance_claimed = dataCard.old_balance_claimed
......@@ -189,7 +190,7 @@ class Home extends React.Component {
point: point,
balance: balance,
account_number: account_number,
expire_date: expire,
expired: expired,
indicatorProfileCard: false,
is_expired: is_expired,
old_balance_claimed: old_balance_claimed,
......@@ -272,7 +273,6 @@ class Home extends React.Component {
}
}
handleClaimCredit() {
let params = {
session_id: this.props.session_id
......@@ -462,7 +462,7 @@ class Home extends React.Component {
<Text style={{ fontSize: 10, fontFamily: 'Gotham-Light' }}>{i18n.t('cardnumber')}</Text>
</View>
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light' }}> {i18n.t('expired')} {this.state.member_since}</Text>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light' }}> {i18n.t('expired')} {this.state.expired}</Text>
</View>
</View>
<View style={{ paddingHorizontal: 10 }}>
......@@ -494,7 +494,7 @@ class Home extends React.Component {
{this.state.old_balance_claimed == false ? (
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<View style={{ flex: 1, height: 80, borderRadius: 20, marginRight: 10, marginLeft: 10, justifyContent: 'center' }}>
<NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color:'#838383' }}> CREDIT : {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color: '#838383' }}> CREDIT : {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
{/* <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text> */}
<View style={{ justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.handleClaimCredit()}>
......@@ -515,7 +515,7 @@ class Home extends React.Component {
<Text style={{ fontSize: 10, fontFamily: 'Gotham-Light' }}>{i18n.t('cardnumber')}</Text>
</View>
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light' }}>{i18n.t('expired')} {this.state.expire_date}</Text>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light',color:'red' }}>{i18n.t('expired')} {this.state.expire_date}</Text>
</View>
</View>
<View style={{ paddingHorizontal: 10 }}>
......@@ -555,8 +555,7 @@ class Home extends React.Component {
{this.state.old_balance_claimed == false ? (
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<View style={{ flex: 1, height: 80, borderRadius: 20, marginRight: 10, marginLeft: 10, justifyContent: 'center' }}>
{/* <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text> */}
<NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color:'#838383' }}> CREDIT : {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text>
<View style={{ justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.handleClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
......@@ -574,16 +573,9 @@ class Home extends React.Component {
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, fontFamily: 'Gotham-Light' }}>{i18n.t('cardnumber')}</Text>
</View>
{
this.state.is_expired_date == true ? (
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light',color:'red' }}>{i18n.t('expired')} {this.state.expire_date}</Text>
</View>
):(<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light' }}>{i18n.t('expired')} {this.state.expire_date}</Text>
</View>)
}
<View style={{ flex: 0.5 }}>
<Text style={{ fontSize: 10, textAlign: 'right', fontFamily: 'Gotham-Light' }}>{i18n.t('expired')} {this.state.expire_date}</Text>
</View>
</View>
<View style={{ paddingHorizontal: 10 }}>
<Text style={{ textAlign: "center", fontSize: 30, color: '#c9af6d', fontFamily: 'Gotham-Black' }}>
......@@ -611,13 +603,13 @@ class Home extends React.Component {
<View style={styles.line2}></View>
{this.state.is_expired_date == true ? (
<View style={{ justifyContent: 'center', marginTop: 20 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Renewal')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', margin: 15 }}>RENEWAL</Text>
</View>
</TouchableOpacity>
</View>
):(null)}
<TouchableOpacity onPress={() => this.props.navigation.navigate('Renewal')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', margin: 15 }}>RENEWAL</Text>
</View>
</TouchableOpacity>
</View>
) : (null)}
</Card>
</View>
)
......
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