Commit 9ff85470 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

add

parent c13a6ea2
...@@ -50,7 +50,7 @@ class Account extends React.Component { ...@@ -50,7 +50,7 @@ class Account extends React.Component {
old_balance_claimed: false, old_balance_claimed: false,
old_balance: 0, old_balance: 0,
is_expired: false, is_expired: false,
card_number: "", card_number:"",
} }
} }
...@@ -131,9 +131,7 @@ class Account extends React.Component { ...@@ -131,9 +131,7 @@ class Account extends React.Component {
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')) Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
Toast.show(i18n.t('alertclaimcredit'))
this._getProfile()
}).catch(error => { }).catch(error => {
let response = error.response.data let response = error.response.data
Alert.alert(error, response.msg) Alert.alert(error, response.msg)
...@@ -150,7 +148,7 @@ class Account extends React.Component { ...@@ -150,7 +148,7 @@ class Account extends React.Component {
} }
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 => {
console.log("INI DATANYA : " + JSON.stringify(res)) console.log("INI DATANYA : " +JSON.stringify(res))
const dataCard = res.data const dataCard = res.data
console.log(dataCard) console.log(dataCard)
let email = dataCard.email let email = dataCard.email
...@@ -167,7 +165,6 @@ class Account extends React.Component { ...@@ -167,7 +165,6 @@ class Account extends React.Component {
let is_expired = dataCard.is_expired let is_expired = dataCard.is_expired
let card_number = dataCard.card_number let card_number = dataCard.card_number
if (kaspro === "") { if (kaspro === "") {
let cardProps = { let cardProps = {
...@@ -186,49 +183,28 @@ class Account extends React.Component { ...@@ -186,49 +183,28 @@ class Account extends React.Component {
let account_number = dataCard.card_number let account_number = dataCard.card_number
let setCardNumberProps = { let setCardNumberProps = {
card_number: account_number card_number : account_number
} }
this.props.setCardNumber(setCardNumberProps) this.props.setCardNumber(setCardNumberProps)
if (old_balance == 0) { this.setState({
this.setState({ email: email,
email: email, points: point,
points: point, img_card: img_card,
img_card: img_card, member_since: member_since,
member_since: member_since, balance: balance,
balance: balance, account_number: account_number,
account_number: account_number, img_card: img_card,
img_card: img_card, expire_date: expire,
expire_date: expire, premium: premium,
premium: premium, full_name: full_name,
full_name: full_name, indicator: false,
indicator: false, old_balance_claimed: old_balance_claimed,
old_balance_claimed: true, old_balance: old_balance,
old_balance: old_balance, is_expired: is_expired,
is_expired: is_expired, card_number:card_number
card_number: card_number
})
})
} else {
this.setState({
email: email,
points: point,
img_card: img_card,
member_since: member_since,
balance: balance,
account_number: account_number,
img_card: img_card,
expire_date: expire,
premium: premium,
full_name: full_name,
indicator: false,
old_balance_claimed: old_balance_claimed,
old_balance: old_balance,
is_expired: is_expired,
card_number: card_number
})
}
}).catch(error => { }).catch(error => {
// const { navigation } = this.props // const { navigation } = this.props
...@@ -385,7 +361,7 @@ class Account extends React.Component { ...@@ -385,7 +361,7 @@ class Account extends React.Component {
{ {
this.state.is_expired ? ( this.state.is_expired ? (
<TouchableOpacity onPress={() => this.props.navigation.navigate('Renewal')}> <TouchableOpacity onPress={() => this.props.navigation.navigate('Renewal')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, marginTop: 20, justifyContent: 'center' }}> <View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, marginTop:20, justifyContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', margin: 15 }}>RENEWAL</Text> <Text style={{ fontFamily: 'Gotham-Black', color: 'white', fontSize: 16, textAlign: 'center', margin: 15 }}>RENEWAL</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
...@@ -396,7 +372,7 @@ class Account extends React.Component { ...@@ -396,7 +372,7 @@ class Account extends React.Component {
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
<View style={{ flex: 1, height: 80, borderRadius: 20, marginRight: 10, marginLeft: 10, justifyContent: 'center' }}> <View style={{ flex: 1, height: 80, borderRadius: 20, marginRight: 10, marginLeft: 10, justifyContent: 'center' }}>
{/* <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text> */} {/* <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10 }}>CREDIT : {this.state.old_balance} </Text> */}
<NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10, color: '#838383' }}>CREDIT : Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} /> <NumberFormat decimalScale={0} value={this.state.old_balance} renderText={value => <Text style={{ fontSize: 14, fontFamily: 'Gotham-Light', textAlign: 'center', marginBottom: 10, color:'#838383' }}>CREDIT : Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<View style={{ justifyContent: 'center' }}> <View style={{ justifyContent: 'center' }}>
<TouchableOpacity onPress={() => this.onClickClaimCredit()}> <TouchableOpacity onPress={() => this.onClickClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}> <View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
......
...@@ -147,70 +147,6 @@ function HandleInbox({ navigation }) { ...@@ -147,70 +147,6 @@ function HandleInbox({ navigation }) {
function HomePage({ navigation }) { function HomePage({ navigation }) {
return ( return (
<Tab.Navigator tabBar={props => <BottomNavigation {...props} />} <Tab.Navigator tabBar={props => <BottomNavigation {...props} />}
// screenOptions={({ route }) => ({
// tabBarIcon: ({ focused, color, size }) => {
// let iconName;
// if (route.name === 'HOME') {
// iconName = focused ? 'ios-home' : 'ios-home'
// } else if (route.name === 'MENU') {
// iconName = focused ? 'ios-paper' : 'ios-paper';
// } else if (route.name === 'REWARDS') {
// iconName = focused ? 'ios-gift' : 'ios-gift';
// } else if (route.name === 'ORDER') {
// iconName = focused ? 'md-cart' : 'md-cart';
// } else if (route.name === 'OUTLETS') {
// iconName = focused ? 'ios-cafe' : 'ios-cafe';
// } else if (route.name === 'ACCOUNT') {
// iconName = focused ? 'account' : 'account';
// return <MaterialCommunityIcons name={iconName} size={size} color={color} />
// }
// // You can return any component that you like here!
// return <Ionicons name={iconName} size={size} color={color} />;
// },
// })}
// screenOptions={({ route }) => ({
// tabBarIcon: ({ focused, color, size }) => {
// let iconName;
// console.log('name', route.name)
// console.log('focused', focused)
// console.log('color', color)
// console.log('size', size)
// // console.log('nav', navigation)
// if (route.name === 'HOME') {
// // iconName = focused ? 'ios-home' : 'ios-home'
// return <Image source={require('../assets/icon/icon-home.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// } else if (route.name === 'MENU') {
// // iconName = focused ? 'ios-paper' : 'ios-paper';
// return <Image source={require('../assets/icon/icon-menu.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// } else if (route.name === 'REWARDS') {
// // iconName = focused ? 'ios-gift' : 'ios-gift';
// return <Image source={require('../assets/icon/icon-rewards.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// } else if (route.name === 'ORDER') {
// // iconName = focused ? 'md-cart' : 'md-cart';
// return <Image source={require('../assets/icon/icon-order.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// } else if (route.name === 'OUTLETS') {
// // iconName = focused ? 'ios-cafe' : 'ios-cafe';
// return <Image source={require('../assets/icon/icon-outlets.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// } else if (route.name === 'ACCOUNT') {
// // iconName = focused ? 'account' : 'account';
// return <Image source={require('../assets/icon/icon-account.png')} style={{ height: 50, width: 50 }} tintColor={focused ? '#CFB368' : 'gray'} />
// }
// // You can return any component that you like here!
// return <Ionicons name={iconName} size={size} color={color} />;
// },
// })}
// tabBarOptions={{ activeTintColor: '#CFB368', inactiveTintColor: 'gray', showLabel: false }}
> >
<Tab.Screen name="HOME" component={Home} /> <Tab.Screen name="HOME" component={Home} />
<Tab.Screen name="MENU" component={MenuSelection} /> <Tab.Screen name="MENU" component={MenuSelection} />
...@@ -219,8 +155,6 @@ function HomePage({ navigation }) { ...@@ -219,8 +155,6 @@ function HomePage({ navigation }) {
<Tab.Screen name="OUTLETS" component={Outlets} /> <Tab.Screen name="OUTLETS" component={Outlets} />
<Tab.Screen name="ACCOUNT" component={Account} /> <Tab.Screen name="ACCOUNT" component={Account} />
</Tab.Navigator> </Tab.Navigator>
); );
} }
const Stack = createStackNavigator(); const Stack = createStackNavigator();
...@@ -237,7 +171,6 @@ class Auth extends React.Component { ...@@ -237,7 +171,6 @@ class Auth extends React.Component {
{ {
this.props.session_id === '' ? ( this.props.session_id === '' ? (
<> <>
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} /> <Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="Setting" component={SettingUrl} options={{ <Stack.Screen name="Setting" component={SettingUrl} options={{
headerStyle: { backgroundColor: "#CFB368" }, headerStyle: { backgroundColor: "#CFB368" },
...@@ -298,7 +231,7 @@ class Auth extends React.Component { ...@@ -298,7 +231,7 @@ class Auth extends React.Component {
}} /> }} />
</> </>
) : this.props.pageEmailConfirmation === true ? ( ) : this.props.pageEmailConfirmation == true ? (
<> <>
<Stack.Screen name="Email Confirmation" component={EmailConfirmation} options={{ <Stack.Screen name="Email Confirmation" component={EmailConfirmation} options={{
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
...@@ -319,7 +252,7 @@ class Auth extends React.Component { ...@@ -319,7 +252,7 @@ class Auth extends React.Component {
{/* <Stack.Screen name="Home" component={Home} options={{ headerShown: false }} /> */} {/* <Stack.Screen name="Home" component={Home} options={{ headerShown: false }} /> */}
<Stack.Screen name="Home" component={HomePage} <Stack.Screen name="Home" component={HomePage}
options={{ options={{
headerShown: false, headerShown: true,
headerRight: props => <HandleInbox {...props} />, headerRight: props => <HandleInbox {...props} />,
title: 'TODAY PROMOTION', title: 'TODAY PROMOTION',
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
...@@ -356,7 +289,6 @@ class Auth extends React.Component { ...@@ -356,7 +289,6 @@ class Auth extends React.Component {
<Stack.Screen name="Home" component={HomePage} <Stack.Screen name="Home" component={HomePage}
options={{ options={{
headerShown: false, headerShown: false,
headerRight: props => <HandleInbox {...props} />,
title: 'TODAY PROMOTION', title: 'TODAY PROMOTION',
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' }, headerTitleContainerStyle: { alignContent: 'center' },
...@@ -367,7 +299,6 @@ class Auth extends React.Component { ...@@ -367,7 +299,6 @@ class Auth extends React.Component {
textAlign: 'center' textAlign: 'center'
} }
}} /> }} />
<Stack.Screen name="Profile" component={ProfilePage} <Stack.Screen name="Profile" component={ProfilePage}
options={{ options={{
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
......
...@@ -16,18 +16,19 @@ import Toast from 'react-native-tiny-toast'; ...@@ -16,18 +16,19 @@ import Toast from 'react-native-tiny-toast';
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import { Badge } from 'react-native-elements'; import { Badge } from 'react-native-elements';
import NumberFormat from 'react-number-format'; import NumberFormat from 'react-number-format';
import { Button } from 'native-base';
let version = info.expo.version let version = info.expo.version
let buildNumber = info.expo.android.versionCode let buildNumber = info.expo.android.versionCode
class Home extends React.Component { class Home extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
data_baner: [], data_baner: [],
images: [], images: [],
balance: "",
point: "", point: "",
account_number: "", account_number: "",
my_lat: 0, my_lat: 0,
...@@ -47,6 +48,8 @@ class Home extends React.Component { ...@@ -47,6 +48,8 @@ class Home extends React.Component {
} }
} }
componentDidMount() { componentDidMount() {
this.CheckInbox() this.CheckInbox()
...@@ -278,13 +281,14 @@ class Home extends React.Component { ...@@ -278,13 +281,14 @@ class Home extends React.Component {
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 => {
Toast.show(i18n.t('alertclaimcredit')) Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
this._account() this.componentDidMount()
}).catch(error => { }).catch(error => {
let response = error.response.data let response = error.response.data
Alert.alert(error, response.msg) Alert.alert(error, response.msg)
}) })
} }
onClickClaimCredit() { onClickClaimCredit() {
Alert.alert( Alert.alert(
...@@ -305,7 +309,14 @@ class Home extends React.Component { ...@@ -305,7 +309,14 @@ class Home extends React.Component {
} }
render() { render() {
const {navigation} = this.props
navigation.setOptions({
headerRight: () => (
<Text style={{color:'red'}}>hahah</Text>
),
})
return ( return (
<View style={styles.container}> <View style={styles.container}>
<StatusBar /> <StatusBar />
<ScrollView> <ScrollView>
...@@ -637,28 +648,28 @@ class Home extends React.Component { ...@@ -637,28 +648,28 @@ class Home extends React.Component {
</Card> </Card>
</View> </View>
) )
} }
<View style={{ flexDirection: 'row', flex: 1, height: 40, marginTop: 40 }}> <View style={{ flexDirection: 'row', flex: 1, height: 40, marginTop: 40 }}>
<View style={{ justifyContent: 'center', flex: 1 }}> <View style={{ justifyContent: 'center', flex: 1 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('TopUpInfo')}> <TouchableOpacity onPress={() => this.props.navigation.navigate('TopUpInfo')}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}> <View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('topup')}</Text> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('topup')}</Text>
</View>
</TouchableOpacity>
</View>
<View style={{ justifyContent: 'center', flex: 1 }}>
<TouchableOpacity onPress={() => this.onClickClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('usebalance')}</Text>
</View>
</TouchableOpacity>
</View>
</View> </View>
<View style={{ height: 40 }}></View> </TouchableOpacity>
</View>
</View> </View>
</ScrollView> <View style={{ justifyContent: 'center', flex: 1 }}>
<TouchableOpacity onPress={() => this.onClickClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 14 }}>{i18n.t('usebalance')}</Text>
</View>
</TouchableOpacity>
</View>
</View>
<View style={{ height: 40 }}></View>
</View> </View>
</View>
</ScrollView>
</View>
) )
} }
} }
......
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