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

Menambahkan fungsi use balance

parent 5ee9d456
......@@ -181,12 +181,20 @@ class Account extends React.Component {
}
}
_useBalance() {
if (this.props.in_payment) {
this.props.navigation.navigate('Redeem Code')
} else {
handleuseBalance() {
let params = {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + 'crm/v2/point/check', params).then(res => {
if (res.data.in_process_redeem == false) {
this.props.navigation.navigate('UseBalance')
} else {
this.props.navigation.navigate('Redeem Code')
}
}).catch(error => {
let response = error.response.data
Alert.alert(error, response.msg)
})
}
render() {
......@@ -325,7 +333,7 @@ class Account extends React.Component {
</Card>
</TouchableOpacity>
<View style={{ width: 5 }}></View>
<TouchableOpacity style={{ marginBottom: 5, margin: 3 }} onPress={() => this._useBalance()}>
<TouchableOpacity style={{ marginBottom: 5, margin: 3 }} onPress={() => this.handleuseBalance()}>
<Card style={{ height: 120, width: 155 }}>
<View style={{ height: 50, alignItems: 'center', padding: 10, flex: 1 }}>
<Image
......
......@@ -44,8 +44,8 @@ class Home extends React.Component {
}
componentDidMount() {
this.CheckInbox()
console.log("INI BASE_URL : " + this.props.BASE_URL)
const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({
slider_height: screenWidth
......@@ -190,8 +190,6 @@ class Home extends React.Component {
old_balance_claimed: old_balance_claimed,
member_since: member_since
})
console.log("INI HASIL RESPON NYA :" + JSON.stringify(res))
}).catch(error => {
let response = error.response.data
// Alert.alert('',response.msg);
......@@ -229,13 +227,20 @@ class Home extends React.Component {
})
}
_useBalance() {
if (this.props.in_payment) {
this.props.navigation.navigate('Redeem Code')
} else {
handleuseBalance() {
let params = {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + 'crm/v2/point/check', params).then(res => {
if (res.data.in_process_redeem == false) {
this.props.navigation.navigate('UseBalance')
} else {
this.props.navigation.navigate('Redeem Code')
}
}).catch(error => {
let response = error.response.data
Alert.alert(error, response.msg)
})
}
_pickup() {
......@@ -265,13 +270,11 @@ class Home extends React.Component {
let params = {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + '/crm/v2/card/claim_old_balance', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/card/claim_old_balance', params).then(res => {
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
}).catch(error => {
let response = error.response.data
Alert.alert(error,response.msg)
console.log("INI RESPON CLAMI"+JSON.stringify(error))
Alert.alert(error, response.msg)
})
}
......@@ -602,45 +605,23 @@ class Home extends React.Component {
</View>
)
}
<View style={{ flexDirection: 'row', flex: 1 }}>
<TouchableOpacity
// style={styles.submitUpgradePemium}
activeOpacity={.5}
onPress={() => this.props.navigation.navigate('TopUpInfo')}
>
<View style={{
flex: 0.5,
height: 40,
top: 20,
margin: 5,
marginLeft: -10,
paddingVertical: 12,
paddingRight: 10,
paddingLeft: 10,
borderRadius: 10,
backgroundColor: '#CFB368',
}}>
<View style={{ flexDirection: 'row', flex: 1,height:40,marginTop:40}}>
<View style={{justifyContent:'center',flex:1}}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('TopUpInfo')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('topup')}</Text>
</View>
</TouchableOpacity>
<TouchableOpacity
onPress={() => this._useBalance()}>
<View style={{
flex: 0.5,
height: 40,
top: 20,
margin: 5,
marginRight: -10,
paddingVertical: 12,
paddingHorizontal: 24,
borderRadius: 10,
backgroundColor: '#CFB368',
}}>
</View>
<View style={{justifyContent:'center',flex:1}}>
<TouchableOpacity onPress={() => this.handleuseBalance()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('usebalance')}</Text>
</View>
</TouchableOpacity>
</View>
<View style={{ height: 60 }}></View>
</View>
<View style={{ height: 40 }}></View>
</View>
</View>
</ScrollView>
......
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