Commit 887cbbe4 authored by Trisno's avatar Trisno

update state component

parent a32e5c35
......@@ -50,7 +50,7 @@ class Account extends React.Component {
old_balance_claimed: false,
old_balance: 0,
is_expired: false,
card_number:"",
card_number: "",
}
}
......@@ -131,7 +131,9 @@ class Account extends React.Component {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + 'crm/v2/card/claim_old_balance', params).then(res => {
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
// Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
Toast.show(i18n.t('alertclaimcredit'))
this._getProfile()
}).catch(error => {
let response = error.response.data
Alert.alert(error, response.msg)
......@@ -148,7 +150,7 @@ class Account extends React.Component {
}
Axios.post(this.props.BASE_URL + 'crm/v2/member/get_profile', params).then(res => {
console.log("INI DATANYA : " +JSON.stringify(res))
console.log("INI DATANYA : " + JSON.stringify(res))
const dataCard = res.data
console.log(dataCard)
let email = dataCard.email
......@@ -165,6 +167,7 @@ class Account extends React.Component {
let is_expired = dataCard.is_expired
let card_number = dataCard.card_number
if (kaspro === "") {
let cardProps = {
......@@ -183,28 +186,49 @@ class Account extends React.Component {
let account_number = dataCard.card_number
let setCardNumberProps = {
card_number : account_number
card_number: account_number
}
this.props.setCardNumber(setCardNumberProps)
this.setState({
email: email,
points: point,
img_card: img_card,
member_since: member_since,
balance: balance,
account_number: account_number,
img_card: img_card,
expire_date: expire,
premium: premium,
full_name: full_name,
indicator: false,
old_balance_claimed: old_balance_claimed,
old_balance: old_balance,
is_expired: is_expired,
card_number:card_number
})
if (old_balance == 0) {
this.setState({
email: email,
points: point,
img_card: img_card,
member_since: member_since,
balance: balance,
account_number: account_number,
img_card: img_card,
expire_date: expire,
premium: premium,
full_name: full_name,
indicator: false,
old_balance_claimed: true,
old_balance: old_balance,
is_expired: is_expired,
card_number: card_number
})
} else {
this.setState({
email: email,
points: point,
img_card: img_card,
member_since: member_since,
balance: balance,
account_number: account_number,
img_card: img_card,
expire_date: expire,
premium: premium,
full_name: full_name,
indicator: false,
old_balance_claimed: old_balance_claimed,
old_balance: old_balance,
is_expired: is_expired,
card_number: card_number
})
}
}).catch(error => {
// const { navigation } = this.props
......@@ -361,7 +385,7 @@ class Account extends React.Component {
{
this.state.is_expired ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Renewal')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, marginTop:20, justifyContent: 'center' }}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, marginTop: 20, justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', margin: 15 }}>RENEWAL</Text>
</View>
</TouchableOpacity>
......@@ -372,7 +396,7 @@ class Account extends React.Component {
<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: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10, color:'#838383' }}>CREDIT : Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10, color: '#838383' }}>CREDIT : Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<View style={{ justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.onClickClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
......
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