Commit 9ed8d5f5 authored by Trisno's avatar Trisno

add toast and alert

parent 95c37ed1
......@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import Axios from 'axios';
import MyStatusBar from './MyStatusBar';
import i18n from 'i18n-js';
import Toast from 'react-native-tiny-toast';
class Renewal extends React.Component {
constructor(props) {
......@@ -21,6 +22,23 @@ class Renewal extends React.Component {
this._getProfile();
}
_handleRenewal() {
Alert.alert(
"Renewal",
"Are you sure want to renewal ?",
[
{
text: 'No',
onPress: () => console.log('Cancel Renewal'),
style: 'cancel',
},
{
text: 'Yes', onPress: () => this._renewal()
},
],
{ cancelable: false },
)
}
_renewal() {
let params = {
......@@ -30,11 +48,12 @@ class Renewal extends React.Component {
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/renewal', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data))
this._getProfile();
this.props.navigation.navigate('HOME',{screen:'Account'});
Toast.show('Successfully Renewal')
this.props.navigation.navigate('Home', { screen: 'ACCOUNT' });
}).catch(error => {
let response = error.response.data;
// console.log(response.msg)
Alert.alert('',response.msg);
Alert.alert('', response.msg);
})
}
......@@ -80,41 +99,41 @@ class Renewal extends React.Component {
<View style={styles.body}>
<View style={styles.cont_curent_balance}>
<View style={styles.current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'#CFB368' }}>{i18n.t('currentbalance')}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('currentbalance')}</Text>
</View>
<View style={styles.value_current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'gray' }}>IDR {this.state.current_balance}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: 'gray' }}>IDR {this.state.current_balance}</Text>
</View>
</View>
<View style={styles.cont_curent_balance}>
<View style={styles.current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'#CFB368' }}>{i18n.t('renewalfees')}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('renewalfees')}</Text>
</View>
<View style={styles.value_current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'gray' }}>IDR {this.state.biaya_renewal}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: 'gray' }}>IDR {this.state.biaya_renewal}</Text>
</View>
</View>
<View style={styles.cont_curent_balance}>
<View style={styles.current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'#CFB368' }}>{i18n.t('expired')}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('expired')}</Text>
</View>
<View style={styles.value_current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'gray' }}>{this.state.expired}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: 'gray' }}>{this.state.expired}</Text>
</View>
</View>
<View style={styles.cont_curent_balance}>
<View style={styles.current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'#CFB368' }}>{i18n.t('renewuntil')}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368' }}>{i18n.t('renewuntil')}</Text>
</View>
<View style={styles.value_current_balance}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color:'gray' }}>{this.state.renew_until}</Text>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: 'gray' }}>{this.state.renew_until}</Text>
</View>
</View>
{/* <View style={styles.btn_renewal}>
<Button title="Renew" onPress={() => this._renewal()}></Button>
</View> */}
<TouchableOpacity onPress={() => this._renewal()}>
<TouchableOpacity onPress={() => this._handleRenewal()}>
<View style={styles.button}>
<Text style={{ color: 'white', fontSize: 16, textAlign: 'center', fontFamily: 'Gotham-Black' }}>{i18n.t('renew')}</Text>
</View>
......@@ -139,22 +158,22 @@ const styles = StyleSheet.create({
marginTop: 12
},
cont_curent_balance: {
flex:0.2
flex: 0.2
},
current_balance: {
flex: 1,
// backgroundColor:'cyan',
justifyContent:'center',
justifyContent: 'center',
},
value_current_balance: {
flex: 1,
marginHorizontal:30,
marginHorizontal: 30,
paddingHorizontal: 10,
paddingVertical : 5,
justifyContent:'center',
borderWidth:1,
borderColor:'gray',
borderRadius:10,
paddingVertical: 5,
justifyContent: 'center',
borderWidth: 1,
borderColor: 'gray',
borderRadius: 10,
// backgroundColor:'maroon'
},
button: {
......
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