Commit 26b1db78 authored by Trisno's avatar Trisno

update use balance

parent 729e7c9a
...@@ -523,7 +523,19 @@ class Auth extends React.Component { ...@@ -523,7 +523,19 @@ class Auth extends React.Component {
{/* <Stack.Screen name="Card Activation" component={CardActivation} /> */} {/* <Stack.Screen name="Card Activation" component={CardActivation} /> */}
<Stack.Screen name="Confirm Mobile" component={ConfirmMobile} /> <Stack.Screen name="Confirm Mobile" component={ConfirmMobile} />
<Stack.Screen name="Balance" component={Balance} /> <Stack.Screen name="Balance" component={Balance} />
<Stack.Screen name="Redeem Code" component={RedeemCode} /> <Stack.Screen name="Redeem Code" component={RedeemCode}
options={{
headerStyle: { backgroundColor: "#CFB368" },
headerBackTitleStyle: { color: 'white' },
headerTintColor: '#fff',
headerTitleAlign: 'center',
headerTitleStyle: {
fontFamily: 'Gotham-Black',
color: 'white',
fontSize: 20,
},
title: 'REDEEM CODE'
}} />
<Stack.Screen name="Transaction History" component={TransactionHistory} <Stack.Screen name="Transaction History" component={TransactionHistory}
options={{ options={{
headerStyle: { backgroundColor: "#CFB368" }, headerStyle: { backgroundColor: "#CFB368" },
......
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, Button } from 'react-native'; import { View, Text, TextInput, StyleSheet, Button, TouchableOpacity, Alert, } from 'react-native';
import { connect } from 'react-redux';
import Axios from 'axios';
class RedeemCode extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
cancel() {
let params = {
session_id: this.props.session_id,
}
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/point/refund', params).then(res => {
console.log(res.data)
Alert.alert('', 'Berhasil dibatalkan')
this.props.navigation.navigate('Home', { screen: 'HOME' });
}).catch(error => {
let response = error.response.data
if (response.code === "EMPTY_PIN") {
Alert.alert('Error', response.msg)
} else {
let response = error.response.data;
Alert.alert('', response.msg);
}
})
}
export default class RedeemCode extends React.Component {
render() { render() {
console.log(this.props)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.header}> {/* <View style={styles.header}>
<Text style={{ textAlign: 'center', fontSize: 25 }}>Payment Code</Text> <Text style={{ textAlign: 'center', fontSize: 25 }}>Payment Code</Text>
</View> </View> */}
<View> <View style={{ marginTop: 50 }}>
<Text style={{ fontSize: 25, textAlign: 'center' }}>XY2313</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 26, textAlign: 'center' }}>{this.props.route.params.redeemCode}</Text>
<View style={{ borderWidth: 1, marginRight: 20, marginLeft: 20 }}></View> <View style={{ borderWidth: 1, marginRight: 20, marginLeft: 20, borderColor: '#838383' }}></View>
</View> </View>
<View style={styles.body}> <View style={styles.body}>
<View style={styles.current_balance}> <View style={styles.current_balance}>
<View style={{ flex: 1, margin: 10 }}> <View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20 }} >Current Balance</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#838383' }} >Balance</Text>
</View> </View>
<View style={{ flex: 1, margin: 10 }}> <View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20 }}>xxxxxxxxxxx</Text> <Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#838383' }}>{this.props.route.params.balanceUsed}</Text>
</View> </View>
</View> </View>
<View style={styles.redeem}> <View style={styles.current_balance}>
<View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#838383' }} >Points</Text>
</View>
<View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20, fontFamily: 'Gotham-Black', color: '#838383' }}>{this.props.route.params.pointUsed}</Text>
</View>
</View>
{/* <View style={styles.redeem}>
<View style={{ flex: 1, margin: 10 }}> <View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20 }} >Time</Text> <Text style={{ fontSize: 20 }} >Time</Text>
</View> </View>
<View style={{ flex: 1, margin: 10 }}> <View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20 }}>0:30</Text> <Text style={{ fontSize: 20 }}>0:30</Text>
</View> </View>
</View> </View> */}
<TouchableOpacity onPress={() => this.cancel()}>
<View style={styles.button}> <View style={styles.button}>
<Button title="Cancel Payment" color="red" /> <Text style={{ color: 'white', fontSize: 16, fontFamily: 'Gotham-Black' }}>Cancel Payment</Text>
</View> </View>
</TouchableOpacity>
</View> </View>
</View> </View>
) )
...@@ -69,9 +112,22 @@ const styles = StyleSheet.create({ ...@@ -69,9 +112,22 @@ const styles = StyleSheet.create({
button: { button: {
height: 50, backgroundColor: '#d34343',
margin: 10, height: 40,
marginTop: 25,
marginHorizontal: 20,
borderRadius: 10,
paddingVertical: 5,
alignItems: 'center',
justifyContent: 'center'
},
})
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
} }
}
}) export default connect(mapStateToProps)(RedeemCode);
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
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