Commit ed6ffdf3 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

Merge branch 'master' of ssh://repo.cs.co.id:2222/wahyu/bahanoprek

# Conflicts:
#	view/RewardSelect.js
#	view/RewardsList.js
parents 15baa0ef 82e9461b
{ {
"expo": { "expo": {
"name": "Excelso_update 09.30 / 18.05.2020", "name": "Excelso_update 11.30 / 18.05.2020",
"slug": "excelso-pro", "slug": "excelso-pro",
"privacy": "public", "privacy": "public",
"sdkVersion": "36.0.0", "sdkVersion": "36.0.0",
......
This diff is collapsed.
import React from 'react'; import React from 'react';
import { View, Text, StyleSheet, Button, FlatList, Alert } from 'react-native'; import { View, Text, StyleSheet, Button, FlatList, Alert, TextInput, Image } from 'react-native';
import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler'; import { ScrollView, TouchableOpacity } from 'react-native-gesture-handler';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { CheckBox, Icon } from 'react-native-elements';
import Axios from 'axios'; import Axios from 'axios';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
import { MaterialCommunityIcons, Ionicons } from '@expo/vector-icons';
// import ravLog from '../helper/debug'; // import ravLog from '../helper/debug';
class DeliveryAddrees extends React.Component { class DeliveryAddrees extends React.Component {
...@@ -11,6 +13,8 @@ class DeliveryAddrees extends React.Component { ...@@ -11,6 +13,8 @@ class DeliveryAddrees extends React.Component {
super(props) super(props)
this.state = { this.state = {
data: [], data: [],
data_before_search: [],
search: '',
// outlet_id: '', // outlet_id: '',
// grabamount: '' // grabamount: ''
} }
...@@ -42,7 +46,8 @@ class DeliveryAddrees extends React.Component { ...@@ -42,7 +46,8 @@ class DeliveryAddrees extends React.Component {
} }
this.setState({ this.setState({
data: address data: address,
data_before_search: dataAlamat,
}) })
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
...@@ -106,6 +111,27 @@ class DeliveryAddrees extends React.Component { ...@@ -106,6 +111,27 @@ class DeliveryAddrees extends React.Component {
} }
filterData(text) {
const newData = this.state.data_before_search.filter(function (item) {
const itemData = item.name ? item.name.toUpperCase() : ''.toUpperCase();
const textData = text.toUpperCase();
return itemData.indexOf(textData) > -1;
});
if (text === '') {
this.setState({
data: this.state.data_before_search,
search: ''
})
} else {
this.setState({
data: newData,
search: text
});
}
}
onSave(address, id) { onSave(address, id) {
let setDataAddress = { let setDataAddress = {
...@@ -182,18 +208,36 @@ class DeliveryAddrees extends React.Component { ...@@ -182,18 +208,36 @@ class DeliveryAddrees extends React.Component {
renderItem = ({ item }) => { renderItem = ({ item }) => {
return ( return (
<View style={styles.list_addrees}> <View style={styles.list_addrees}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id)}> <TouchableOpacity onPress={() => this.onSave(item.address, item.id)}>
<View style={{ margin: 5, }}> <View style={{ flex: 1, flexDirection: 'row', margin: 20, }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text> <View style={{ flex: 1, marginBottom: 10, justifyContent: 'center' }}>
</View> <CheckBox
<Text style={{ margin: 5 }}> center
{item.address} checkedIcon='dot-circle-o'
</Text> uncheckedIcon='circle-o'
<Text style={{ margin: 5 }}> checked={this.state.checked}
Patokan : {item.description} checkedColor="#ccb46c"
</Text> uncheckedColor="#ccb46c"
</TouchableOpacity> />
</View> <Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>PILIH</Text>
</View>
<View style={{ flex: 3, justifyContent: 'center' }}>
<View style={{ margin: 5, }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 19, marginBottom: 5 }}>{item.name}</Text>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: 'grey', fontSize: 15, marginBottom: 5 }}>{item.address}</Text>
</View>
<View style={{ flex: 1,justifyContent:'center' }}>
<View style={{ margin: 5, }}>
<Image
style={{height:20,width:20,tintColor:'#ccb46c'}}
source={require('../assets/ellipsis-v.png')}
/>
</View>
</View>
</View>
</TouchableOpacity>
</View>
); );
} }
...@@ -202,12 +246,29 @@ class DeliveryAddrees extends React.Component { ...@@ -202,12 +246,29 @@ class DeliveryAddrees extends React.Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.body}> <View style={{ height: 45, borderRadius: 10, borderColor: '#ccb46c', borderWidth: 1, flexDirection: 'row', marginTop: 15, marginLeft: 10, marginRight: 10 }}>
{/* <ScrollView> */} <View style={{ flex: 1 }}>
<View style={styles.btn_addreess}> <MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
<Button title="Tambah Alamat" onPress={() => this.addAdreess()}></Button> </View>
<View style={{ flex: 6 }}>
<TextInput style={{ height: 45 }} placeholder="Cari Alamat"
onChangeText={text => this.filterData(text)}
onClear={text => this.filterData('')}
value={this.state.search}></TextInput>
</View> </View>
<View style={{ flex: 1, margin: 5 }}>
<Ionicons name="ios-search" size={32} color="#ccb46c" />
</View>
</View>
<View style={styles.btn_addreess}>
<TouchableOpacity onPress={() => this.addAdreess()}>
<View style={{ height: 40, borderRadius: 15, marginRight: 70, marginLeft: 70, backgroundColor: '#CFB368', justifyContent: 'center', alignContent: 'center' }}>
<Text style={{ fontFamily: 'Gotham-Black', textAlign: 'center', color: 'white', fontSize: 20 }}> + Tambah Alamat </Text>
</View>
</TouchableOpacity>
</View>
<View style={styles.listAddress}>
<FlatList <FlatList
data={this.state.data} data={this.state.data}
renderItem={this.renderItem} renderItem={this.renderItem}
...@@ -232,7 +293,7 @@ const styles = StyleSheet.create({ ...@@ -232,7 +293,7 @@ const styles = StyleSheet.create({
body: { body: {
flex: 3, flex: 3,
marginTop:10, marginTop: 10,
marginRight: 20, marginRight: 20,
marginLeft: 20, marginLeft: 20,
marginBottom: 20, marginBottom: 20,
...@@ -240,14 +301,16 @@ const styles = StyleSheet.create({ ...@@ -240,14 +301,16 @@ const styles = StyleSheet.create({
}, },
btn_addreess: { btn_addreess: {
margin: 20, margin: 10,
}, },
list_addrees: { list_addrees: {
flex: 1, flex: 1,
margin: 20, margin: 20,
borderWidth: 1, borderWidth: 1,
borderColor: 'grey',
borderRadius: 10,
} }
}) })
...@@ -347,4 +410,20 @@ export default connect(mapStateToProps, mapDispatchToProps)(DeliveryAddrees) ...@@ -347,4 +410,20 @@ export default connect(mapStateToProps, mapDispatchToProps)(DeliveryAddrees)
// renderItem={this.renderItem} // renderItem={this.renderItem}
// keyExtractor={item => item.id} // keyExtractor={item => item.id}
// /> // />
// </View> // </View>
\ No newline at end of file
// <View style={styles.body}>
// {/* <ScrollView> */}
// <View style={styles.btn_addreess}>
// <Button title="Tambah Alamat" onPress={() => this.addAdreess()}></Button>
// </View>
// <FlatList
// data={this.state.data}
// renderItem={this.renderItem}
// keyExtractor={item => item.id}
// />
// </View>
\ No newline at end of file
...@@ -126,27 +126,6 @@ class PickupName extends React.Component { ...@@ -126,27 +126,6 @@ class PickupName extends React.Component {
address = dataOutlets[i]['postal_code']; address = dataOutlets[i]['postal_code'];
} }
} }
if (dataOutlets[i]['open_time']) {
if (address !== '') {
address = address + ' ' + dataOutlets[i]['open_time'];
} else {
address = dataOutlets[i]['open_time'];
}
}
if (dataOutlets[i]['close_time']) {
if (address !== '') {
address = address + ' ' + dataOutlets[i]['close_time'];
} else {
address = dataOutlets[i]['close_time'];
}
}
if (dataOutlets[i]['can_accept_order']) {
if (address !== '') {
address = address + ' ' + dataOutlets[i]['can_accept_order'];
} else {
address = dataOutlets[i]['can_accept_order'];
}
}
dataOutlets[i]['full_address'] = address; dataOutlets[i]['full_address'] = address;
} }
this.setState({ this.setState({
...@@ -229,16 +208,14 @@ class PickupName extends React.Component { ...@@ -229,16 +208,14 @@ class PickupName extends React.Component {
<View style={{ margin: 5 }}> <View style={{ margin: 5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{flexDirection:'row'}}> <View style={{flexDirection:'row'}}>
{item.can_accept_order == true ? (<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c",top:5}}>OPEN - </Text>) {item.can_accept_order == true ? (<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c",top:5}}>OPEN : </Text>)
:(<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c"}}>CLOSED - </Text>) }<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368', fontSize: 15}}>Everyday {item.open_time} - {item.close_time}</Text> :(<Text style={{fontFamily: 'Gotham-Black',color:"#ccb46c"}}>CLOSED : </Text>) }
</View> </View>
</View> </View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368', fontSize: 15}}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2',fontFamily: 'Gotham-Light' }}> <Text style={{ margin: 5, color: '#b1b1b2',fontFamily: 'Gotham-Light' }}>
{item.full_address} {item.full_address}
</Text> </Text>
<Text style={{ margin: 5, color: '#aeaead',fontFamily: 'Gotham-Light' }}>
{item.distance} KM
</Text>
</View> </View>
<View> <View>
<CheckBox <CheckBox
...@@ -249,7 +226,7 @@ class PickupName extends React.Component { ...@@ -249,7 +226,7 @@ class PickupName extends React.Component {
checkedColor="#ccb46c" checkedColor="#ccb46c"
uncheckedColor="#ccb46c" uncheckedColor="#ccb46c"
/> />
<Text style={{textAlign:'center',color:'#ccb46c',fontFamily:'Gotham-Light' }}>PILIH</Text> <Text style={{textAlign:'center',color:'#ccb46c',fontFamily:'Gotham-Light' }}>{item.distance} KM</Text>
</View> </View>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
......
...@@ -84,9 +84,9 @@ class RewardSelect extends React.Component { ...@@ -84,9 +84,9 @@ class RewardSelect extends React.Component {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{/* <View style={styles.header}> */} <View style={styles.header}>
{/* <Text style={{ color: 'white', textAlign: 'center', fontSize: 28 }}>REWARDS E-VOUCHER</Text> */} <Text style={{ color: 'white', textAlign: 'center', fontSize: 18, fontFamily: 'Gotham-Black' }}>REWARDS E-VOUCHER</Text>
{/* </View> */} </View>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
{ {
this.state.rewardsList.map((item, key) => ( this.state.rewardsList.map((item, key) => (
...@@ -101,12 +101,12 @@ class RewardSelect extends React.Component { ...@@ -101,12 +101,12 @@ class RewardSelect extends React.Component {
</View> </View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}> <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}>
<View> <View>
<Text style={{ color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 14, textAlign: 'center' }}>{item.reward.title}</Text> <Text style={{textAlign:'left', fontSize: 12, fontFamily: 'Gotham-Black'}}>{item.reward.title}</Text>
<Text style={{ color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 14, textAlign: 'center' }}>{item.reward.subtitle}</Text> <Text style={{textAlign:'left', fontSize: 12, fontFamily: 'Gotham-Light'}}>{item.reward.subtitle}</Text>
</View> </View>
<View> <View>
<Text style={{ color: '#CFB368', textAlign: 'right', fontFamily: 'Gotham-Black', fontSize: 12 }}>Expired</Text> <Text style={{textAlign:'right', fontSize: 12, fontFamily: 'Gotham-Light'}}>Expired</Text>
<Text style={{ color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 12, textAlign: 'center' }}>{item.expire_time}</Text> <Text style={{textAlign:'right', fontSize: 12, fontFamily: 'Gotham-Light'}}>{item.expire_time}</Text>
</View> </View>
</View> </View>
</Card> </Card>
......
...@@ -51,7 +51,7 @@ class RewardsList extends React.Component { ...@@ -51,7 +51,7 @@ class RewardsList extends React.Component {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.header}> <View style={styles.header}>
<Text style={{ color: 'white', textAlign: 'center', fontSize: 28 }}>REWARDS E-VOUCHER</Text> <Text style={{ color: 'white', textAlign: 'center', fontSize: 18, fontFamily: 'Gotham-Black' }}>REWARDS E-VOUCHER</Text>
</View> </View>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
{ {
...@@ -67,12 +67,12 @@ class RewardsList extends React.Component { ...@@ -67,12 +67,12 @@ class RewardsList extends React.Component {
</View> </View>
<View style={{ flexDirection: 'row', justifyContent:'space-between', padding:10 }}> <View style={{ flexDirection: 'row', justifyContent:'space-between', padding:10 }}>
<View> <View>
<Text style={{ color:'#CFB368',fontFamily: 'Gotham-Black', fontSize: 14, textAlign: 'center'}}>{item.reward.title}</Text> <Text style={{textAlign:'left', fontSize: 12, fontFamily: 'Gotham-Black'}}>{item.reward.title}</Text>
<Text style={{ color:'#CFB368',fontFamily: 'Gotham-Black', fontSize: 14, textAlign: 'center'}}>{item.reward.subtitle}</Text> <Text style={{textAlign:'left', fontSize: 12, fontFamily: 'Gotham-Light'}}>{item.reward.subtitle}</Text>
</View> </View>
<View> <View>
<Text style={{color:'#CFB368', textAlign:'right',fontFamily: 'Gotham-Black', fontSize: 12}}>Expired</Text> <Text style={{textAlign:'right', fontSize: 12, fontFamily: 'Gotham-Light'}}>Expired</Text>
<Text style={{ color:'#CFB368',fontFamily: 'Gotham-Black', fontSize: 12, textAlign: 'center'}}>{item.expire_time}</Text> <Text style={{textAlign:'right', fontSize: 12, fontFamily: 'Gotham-Light'}}>{item.expire_time}</Text>
</View> </View>
</View> </View>
</Card> </Card>
...@@ -80,9 +80,10 @@ class RewardsList extends React.Component { ...@@ -80,9 +80,10 @@ class RewardsList extends React.Component {
</TouchableOpacity> </TouchableOpacity>
)) ))
} }
<TouchableOpacity style={{margin:20}} onPress={()=> this.props.navigation.navigate('Reward History')}> <TouchableOpacity onPress={()=> this.props.navigation.navigate('Reward History')}>
<Text style={{ color:'#CFB368', fontFamily: 'Gotham-Black', fontSize: 15, textAlign: 'center'}}>REDEEM E-VOUCHER HISTORY</Text> <Text style={{ textAlign: 'center', color: '#CFB368', fontSize: 12, fontFamily: 'Gotham-Black' }}>REDEEM E-VOUCHER HISTORY</Text>
</TouchableOpacity> </TouchableOpacity>
<View style={{height:15}}/>
</ScrollView> </ScrollView>
</View> </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