Commit e5ab7e7b authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents 0ae635bc 6766c621
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity } from 'react-native'; import { View, Text, TextInput, StyleSheet, Button, ScrollView, Alert, TouchableOpacity } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
...@@ -96,28 +96,37 @@ class CardActivation extends React.Component { ...@@ -96,28 +96,37 @@ class CardActivation extends React.Component {
token: this.state.token token: this.state.token
} }
Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/activate', params).then(res => { Axios.post('https://excelsocrm.ravintoladev.com/crm/v2/card/activate', params).then(res => {
Alert.alert("Kartu anda berhasil di aktifkan"); Alert.alert(
this.setState({ "",
spinner: false, "Kartu anda berhasil di aktifkan",
}) [
this.props.navigation.reset({ { text: "OK", onPress: () =>
index: 0, {
routes: [{ name: 'Home' }], this.setState({spinner: false})
}) this.props.navigation.reset({
index: 0,
routes: [{ name: 'Home' }],
})
}
}
],
);
}).catch(error => { }).catch(error => {
this.setState({
spinner: false,
})
let response = error.response.data; let response = error.response.data;
Alert.alert('',response.msg); Alert.alert(
'',
response.msg,
[
{ text: "OK", onPress: () => this.setState({spinner: false}) }
],
);
}) })
} }
render() { render() {
return ( return (
<View style={styles.container}> <ScrollView style={styles.container}>
<Spinner <Spinner
visible={this.state.spinner} visible={this.state.spinner}
textContent={'Loading...'} textContent={'Loading...'}
...@@ -153,7 +162,7 @@ class CardActivation extends React.Component { ...@@ -153,7 +162,7 @@ class CardActivation extends React.Component {
this.state.timer === 0 ? ( this.state.timer === 0 ? (
<TouchableOpacity onPress={() => this.ResendToken()}> <TouchableOpacity onPress={() => this.ResendToken()}>
<View style={{ height: 40, borderRadius: 20, backgroundColor: '#CFB368', margin: 20, justifyContent: 'center' }}> <View style={{ height: 40, borderRadius: 20, backgroundColor: '#CFB368', margin: 20, justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 20, textAlign: 'center', margin: 15 }}>Resend Token</Text> <Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 20, textAlign: 'center' }}>Resend Token</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) : (null)} ) : (null)}
...@@ -166,7 +175,7 @@ class CardActivation extends React.Component { ...@@ -166,7 +175,7 @@ class CardActivation extends React.Component {
onChangeText={card_number => this.setState({ card_number })} onChangeText={card_number => this.setState({ card_number })}
value={this.state.card_number} value={this.state.card_number}
keyboardType='numeric' keyboardType='numeric'
/> />
</View> </View>
</View> </View>
<View style={styles.field_email}> <View style={styles.field_email}>
...@@ -188,7 +197,7 @@ class CardActivation extends React.Component { ...@@ -188,7 +197,7 @@ class CardActivation extends React.Component {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
</View> </ScrollView>
) )
} }
} }
......
...@@ -21,8 +21,14 @@ import { ...@@ -21,8 +21,14 @@ import {
} from 'react-native' } from 'react-native'
import MyStatusBar from './MyStatusBar'; import MyStatusBar from './MyStatusBar';
const jobs = ["Pilih", "Siswa", "Mahasiswa", "Karyawan", "Pengusaha", "Lainnya"];
const jobs = ["Pilih", "Siswa", "Mahasiswa", "Karyawan", "Pengusaha", "Lainnya"] const _jobs = [
{label: "Siswa", value: "Siswa"},
{label: "Mahasiswa", value: "Mahasiswa"},
{label: "Karyawan", value: "Karyawan"},
{label: "Pengusaha", value: "Pengusaha"},
{label: "Lainnya", value: "Lainnya"}
];
class UpgradePremium extends React.Component { class UpgradePremium extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
...@@ -298,16 +304,25 @@ class UpgradePremium extends React.Component { ...@@ -298,16 +304,25 @@ class UpgradePremium extends React.Component {
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368', textAlign: 'center' }}>Pekerjaan</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368', textAlign: 'center' }}>Pekerjaan</Text>
</View> </View>
<View style={{ marginHorizontal: 40, borderColor: 'gray', borderWidth: 1, borderRadius: 10, top: 10 }}> <View style={{ marginHorizontal: 40, borderColor: 'gray', borderWidth: 1, borderRadius: 10, top: 10 }}>
<Picker {Platform.OS === 'ios' ? (
mode="dropdown" <RNPickerSelect onValueChange={(value) => this.setState({ pekerjaan: value })}
selectedValue={this.state.pekerjaan} items={_jobs}
style={{ height: 40, width: '100%' }} placeholder={{ label: '-- Select --' }}
onValueChange={(itemValue, itemIndex) => this.setState({ pekerjaan: itemValue })}> style={{inputIOSContainer: {paddingVertical: 10, alignItems: 'center'}}}
{jobs.map((itemValue, itemIndex) => { />
return (<Picker.Item label={itemValue} value={itemValue} key={itemIndex} />) ) : (
})} <Picker
mode="dropdown"
selectedValue={this.state.pekerjaan}
style={{ height: 40, width: '100%' }}
onValueChange={(itemValue, itemIndex) => this.setState({ pekerjaan: itemValue })}>
{jobs.map((itemValue, itemIndex) => {
return (<Picker.Item label={itemValue} value={itemValue} key={itemIndex} />)
})}
</Picker>
)}
</Picker>
</View> </View>
<View style={styles.textLabel, { top: 20 }}> <View style={styles.textLabel, { top: 20 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368', textAlign: 'center' }}>KTP</Text> <Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#CFB368', textAlign: 'center' }}>KTP</Text>
......
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