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