Commit 26b1db78 authored by Trisno's avatar Trisno

update use balance

parent 729e7c9a
......@@ -437,7 +437,7 @@ class Auth extends React.Component {
}, title: 'RATING ORDER'
}}
/>
<Stack.Screen name="UseBalance" component={UseBalance}
<Stack.Screen name="UseBalance" component={UseBalance}
options={{
headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' },
......@@ -452,7 +452,7 @@ class Auth extends React.Component {
}, title: 'USE BALANCE'
}}
/>
<Stack.Screen name="PaymentCode" component={PaymentCode}
<Stack.Screen name="PaymentCode" component={PaymentCode}
options={{
headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' },
......@@ -523,7 +523,19 @@ class Auth extends React.Component {
{/* <Stack.Screen name="Card Activation" component={CardActivation} /> */}
<Stack.Screen name="Confirm Mobile" component={ConfirmMobile} />
<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}
options={{
headerStyle: { backgroundColor: "#CFB368" },
......
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() {
console.log(this.props)
return (
<View style={styles.container}>
<View style={styles.header}>
{/* <View style={styles.header}>
<Text style={{ textAlign: 'center', fontSize: 25 }}>Payment Code</Text>
</View>
<View>
<Text style={{ fontSize: 25, textAlign: 'center' }}>XY2313</Text>
<View style={{ borderWidth: 1, marginRight: 20, marginLeft: 20 }}></View>
</View> */}
<View style={{ marginTop: 50 }}>
<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, borderColor: '#838383' }}></View>
</View>
<View style={styles.body}>
<View style={styles.current_balance}>
<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 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 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 }}>
<Text style={{ fontSize: 20 }} >Time</Text>
</View>
<View style={{ flex: 1, margin: 10 }}>
<Text style={{ fontSize: 20 }}>0:30</Text>
</View>
</View>
<View style={styles.button}>
<Button title="Cancel Payment" color="red" />
</View>
</View> */}
<TouchableOpacity onPress={() => this.cancel()}>
<View style={styles.button}>
<Text style={{ color: 'white', fontSize: 16, fontFamily: 'Gotham-Black' }}>Cancel Payment</Text>
</View>
</TouchableOpacity>
</View>
</View>
)
......@@ -69,9 +112,22 @@ const styles = StyleSheet.create({
button: {
height: 50,
margin: 10,
backgroundColor: '#d34343',
height: 40,
marginTop: 25,
marginHorizontal: 20,
borderRadius: 10,
paddingVertical: 5,
alignItems: 'center',
justifyContent: 'center'
},
})
const mapStateToProps = (state) => {
return {
session_id: state.session_id,
}
}
})
\ No newline at end of file
export default connect(mapStateToProps)(RedeemCode);
\ 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