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

add

parent c13a6ea2
......@@ -50,7 +50,7 @@ class Account extends React.Component {
old_balance_claimed: false,
old_balance: 0,
is_expired: false,
card_number: "",
card_number:"",
}
}
......@@ -131,9 +131,7 @@ class Account extends React.Component {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + 'crm/v2/card/claim_old_balance', params).then(res => {
// Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
Toast.show(i18n.t('alertclaimcredit'))
this._getProfile()
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
}).catch(error => {
let response = error.response.data
Alert.alert(error, response.msg)
......@@ -150,7 +148,7 @@ class Account extends React.Component {
}
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
console.log(dataCard)
let email = dataCard.email
......@@ -167,7 +165,6 @@ class Account extends React.Component {
let is_expired = dataCard.is_expired
let card_number = dataCard.card_number
if (kaspro === "") {
let cardProps = {
......@@ -186,49 +183,28 @@ class Account extends React.Component {
let account_number = dataCard.card_number
let setCardNumberProps = {
card_number: account_number
card_number : account_number
}
this.props.setCardNumber(setCardNumberProps)
if (old_balance == 0) {
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: true,
old_balance: old_balance,
is_expired: is_expired,
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
})
}
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 => {
// const { navigation } = this.props
......@@ -385,7 +361,7 @@ class Account extends React.Component {
{
this.state.is_expired ? (
<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>
</View>
</TouchableOpacity>
......@@ -396,7 +372,7 @@ class Account extends React.Component {
<Card style={{ padding: 10, margin: 10, alignContent: '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> */}
<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' }}>
<TouchableOpacity onPress={() => this.onClickClaimCredit()}>
<View style={{ height: 40, borderRadius: 10, backgroundColor: '#CFB368', marginRight: 20, marginLeft: 20, justifyContent: 'center' }}>
......
......@@ -147,70 +147,6 @@ function HandleInbox({ navigation }) {
function HomePage({ navigation }) {
return (
<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="MENU" component={MenuSelection} />
......@@ -219,8 +155,6 @@ function HomePage({ navigation }) {
<Tab.Screen name="OUTLETS" component={Outlets} />
<Tab.Screen name="ACCOUNT" component={Account} />
</Tab.Navigator>
);
}
const Stack = createStackNavigator();
......@@ -237,7 +171,6 @@ class Auth extends React.Component {
{
this.props.session_id === '' ? (
<>
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="Setting" component={SettingUrl} options={{
headerStyle: { backgroundColor: "#CFB368" },
......@@ -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={{
headerStyle: { backgroundColor: '#CFB368' },
......@@ -319,7 +252,7 @@ class Auth extends React.Component {
{/* <Stack.Screen name="Home" component={Home} options={{ headerShown: false }} /> */}
<Stack.Screen name="Home" component={HomePage}
options={{
headerShown: false,
headerShown: true,
headerRight: props => <HandleInbox {...props} />,
title: 'TODAY PROMOTION',
headerStyle: { backgroundColor: '#CFB368' },
......@@ -356,7 +289,6 @@ class Auth extends React.Component {
<Stack.Screen name="Home" component={HomePage}
options={{
headerShown: false,
headerRight: props => <HandleInbox {...props} />,
title: 'TODAY PROMOTION',
headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' },
......@@ -367,7 +299,6 @@ class Auth extends React.Component {
textAlign: 'center'
}
}} />
<Stack.Screen name="Profile" component={ProfilePage}
options={{
headerStyle: { backgroundColor: '#CFB368' },
......
......@@ -16,18 +16,19 @@ import Toast from 'react-native-tiny-toast';
import i18n from 'i18n-js';
import { Badge } from 'react-native-elements';
import NumberFormat from 'react-number-format';
import { Button } from 'native-base';
let version = info.expo.version
let buildNumber = info.expo.android.versionCode
class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
data_baner: [],
images: [],
balance: "",
point: "",
account_number: "",
my_lat: 0,
......@@ -47,6 +48,8 @@ class Home extends React.Component {
}
}
componentDidMount() {
this.CheckInbox()
......@@ -278,13 +281,14 @@ class Home extends React.Component {
session_id: this.props.session_id
}
Axios.post(this.props.BASE_URL + 'crm/v2/card/claim_old_balance', params).then(res => {
Toast.show(i18n.t('alertclaimcredit'))
this._account()
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
this.componentDidMount()
}).catch(error => {
let response = error.response.data
Alert.alert(error, response.msg)
})
}
onClickClaimCredit() {
Alert.alert(
......@@ -305,7 +309,14 @@ class Home extends React.Component {
}
render() {
const {navigation} = this.props
navigation.setOptions({
headerRight: () => (
<Text style={{color:'red'}}>hahah</Text>
),
})
return (
<View style={styles.container}>
<StatusBar />
<ScrollView>
......@@ -637,28 +648,28 @@ class Home extends React.Component {
</Card>
</View>
)
}
<View style={{ flexDirection: 'row', flex: 1, height: 40, marginTop: 40 }}>
<View style={{ justifyContent: 'center', flex: 1 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('TopUpInfo')}>
<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>
</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 style={{ flexDirection: 'row', flex: 1, height: 40, marginTop: 40 }}>
<View style={{ justifyContent: 'center', flex: 1 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('TopUpInfo')}>
<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>
</View>
<View style={{ height: 40 }}></View>
</View>
</TouchableOpacity>
</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>
</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