Commit e1aaba3a authored by William Goszal's avatar William Goszal 🚴

buat user gak bisa klik tombol claim balance saat sudah diklik

parent 480476cb
...@@ -16,6 +16,7 @@ import session from '../function/session'; ...@@ -16,6 +16,7 @@ import session from '../function/session';
import requestParams from '../helper/requestParams'; import requestParams from '../helper/requestParams';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
import CustomIosStatusBar from './CustomIosStatusBar'; import CustomIosStatusBar from './CustomIosStatusBar';
import Spinner from 'react-native-loading-spinner-overlay';
class Home extends React.Component { class Home extends React.Component {
...@@ -25,6 +26,7 @@ class Home extends React.Component { ...@@ -25,6 +26,7 @@ class Home extends React.Component {
super(props); super(props);
this.state = { this.state = {
spinner: false,
data_baner: [], data_baner: [],
images: [], images: [],
point: "", point: "",
...@@ -42,12 +44,15 @@ class Home extends React.Component { ...@@ -42,12 +44,15 @@ class Home extends React.Component {
member_since: "", member_since: "",
old_balance: 0, old_balance: 0,
expired: '', expired: '',
card_number: '' card_number: ''
} }
} }
componentDidMount() { componentDidMount() {
this.loadAll()
}
loadAll(){
this.CheckInbox() this.CheckInbox()
const screenWidth = Math.round(Dimensions.get('window').width); const screenWidth = Math.round(Dimensions.get('window').width);
...@@ -186,6 +191,7 @@ class Home extends React.Component { ...@@ -186,6 +191,7 @@ class Home extends React.Component {
let params = Object.assign(requestParams, { let params = Object.assign(requestParams, {
session_id: this.props.session_id, session_id: this.props.session_id,
}) })
this.setState({indicatorProfileCard: true})
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 => {
const dataCard = res.data const dataCard = res.data
...@@ -296,12 +302,16 @@ class Home extends React.Component { ...@@ -296,12 +302,16 @@ class Home extends React.Component {
let params = Object.assign(requestParams, { let params = Object.assign(requestParams, {
session_id: this.props.session_id, 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')) this.setState({spinner: false})
this.componentDidMount() this._account()
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
}).catch(error => { }).catch(error => {
let response = error.response.data this.setState({spinner: false})
Alert.alert(error, response.msg) this._account()
let response = error.response.data
Alert.alert(error, response.msg)
}) })
} }
...@@ -316,7 +326,12 @@ class Home extends React.Component { ...@@ -316,7 +326,12 @@ class Home extends React.Component {
style: 'cancel', style: 'cancel',
}, },
{ {
text: i18n.t('alertyes'), onPress: () => this.handleClaimCredit() text: i18n.t('alertyes'), onPress: () => {
this.setState({spinner: true})
this.setState({old_balance_claimed: true}) /** set jadi true dulu buat hilangkan bagian claim credit */
this.setState({indicatorProfileCard: true}) /** atau sekalian dibuat loading aja bagian profilecardnya */
this.handleClaimCredit()
}
}, },
], ],
{ cancelable: false }, { cancelable: false },
...@@ -333,6 +348,8 @@ class Home extends React.Component { ...@@ -333,6 +348,8 @@ class Home extends React.Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Spinner visible={this.state.spinner} textContent={'Loading...'} textStyle={{ color: "white" }} />
{Platform.OS === 'ios' ? ( {Platform.OS === 'ios' ? (
<CustomIosStatusBar color='#CFB368' /> <CustomIosStatusBar color='#CFB368' />
) : ( ) : (
...@@ -481,6 +498,7 @@ class Home extends React.Component { ...@@ -481,6 +498,7 @@ class Home extends React.Component {
</Card> </Card>
) )
} }
{ {
this.state.indicatorProfileCard == true ? ( this.state.indicatorProfileCard == true ? (
<View style={styles.card}> <View style={styles.card}>
...@@ -489,6 +507,7 @@ class Home extends React.Component { ...@@ -489,6 +507,7 @@ class Home extends React.Component {
</Card> </Card>
</View> </View>
) : ) :
//jika member belum punya account kaspro //jika member belum punya account kaspro
this.state.account_number == "" ? ( this.state.account_number == "" ? (
<View style={styles.card}> <View style={styles.card}>
......
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