Commit 20ab641b authored by Trisno's avatar Trisno

filter pickup

parent f7eeee7f
...@@ -65,7 +65,7 @@ class PickupName extends React.Component { ...@@ -65,7 +65,7 @@ class PickupName extends React.Component {
this.getOutlet() this.getOutlet()
} }
getOutletDetail(id, name,address) { getOutletDetail(id, name, address) {
let OutletChange = { let OutletChange = {
outlet_id: id, outlet_id: id,
...@@ -103,7 +103,7 @@ class PickupName extends React.Component { ...@@ -103,7 +103,7 @@ class PickupName extends React.Component {
Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => { Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => {
let dataOutlets = res.data.outlets; let dataOutlets = res.data.outlets;
console.log("INI ADALAH DATA OUTLETS : " + JSON.stringify(dataOutlets)) // console.log("INI ADALAH DATA OUTLETS : " + JSON.stringify(dataOutlets))
for (let i = 0; i < dataOutlets.length; i++) { for (let i = 0; i < dataOutlets.length; i++) {
dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']); dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']);
let address = dataOutlets[i]['address']; let address = dataOutlets[i]['address'];
...@@ -201,76 +201,82 @@ class PickupName extends React.Component { ...@@ -201,76 +201,82 @@ class PickupName extends React.Component {
RenderItem = ({ item }) => { RenderItem = ({ item }) => {
return ( return (
<View> <View>
{item.can_accept_order == true ? ( {
<View> item.pickup == true ? (
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name,item.full_address)}> item.can_accept_order == true ? (
<View style={{ flexDirection: 'row', flex: 1 }}> <View>
<View style={{top:10}}> <TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name, item.full_address)}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" /> <View style={{ flexDirection: 'row', flex: 1 }}>
</View> <View style={{ top: 10 }}>
<View style={styles.list_addrees}> <MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
<View style={{ margin: 5 }}> </View>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text> <View style={styles.list_addrees}>
<View style={{ flexDirection: 'row' }}> <View style={{ margin: 5 }}>
{item.can_accept_order == true ? (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c", top: 5 }}>OPEN </Text>) <Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
: (<Text style={{ fontFamily: 'Gotham-Black', color: "#ccb46c" }}>CLOSED </Text>)} <View style={{ flexDirection: 'row' }}>
{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>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View>
<View>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
checkedColor="#ccb46c"
uncheckedColor="#ccb46c"
/>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text>
</View> </View>
</View> </View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text> </TouchableOpacity>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View>
<View>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
checkedColor="#ccb46c"
uncheckedColor="#ccb46c"
/>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text>
</View>
</View>
</TouchableOpacity>
</View>
) : (<View>
<View>
<TouchableOpacity onPress={() => Alert.alert('','Mohon Maaf Outlet Tutup !')}>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View style={{top:10}}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
</View>
<View style={styles.list_addrees}>
<View style={{ margin: 5 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<View style={{ flexDirection: 'row' }}>
{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>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View> </View>
) : (<View>
<View> <View>
<CheckBox <TouchableOpacity onPress={() => Alert.alert('', 'Mohon Maaf Outlet Tutup !')}>
center <View style={{ flexDirection: 'row', flex: 1 }}>
checkedIcon='dot-circle-o' <View style={{ top: 10 }}>
uncheckedIcon='circle-o' <MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
checked={this.state.checked} </View>
checkedColor="#ccb46c" <View style={styles.list_addrees}>
uncheckedColor="#ccb46c" <View style={{ margin: 5 }}>
/> <Text style={{ fontFamily: 'Gotham-Black', color: 'grey', fontSize: 20 }}>{item.name}</Text>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text> <View style={{ flexDirection: 'row' }}>
{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>)}
</View>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#CFB368' }}> Opening Hours : {item.open_time} - {item.close_time}</Text>
<Text style={{ margin: 5, color: '#b1b1b2', fontFamily: 'Gotham-Light' }}>
{item.full_address}
</Text>
</View>
<View>
<CheckBox
center
checkedIcon='dot-circle-o'
uncheckedIcon='circle-o'
checked={this.state.checked}
checkedColor="#ccb46c"
uncheckedColor="#ccb46c"
/>
<Text style={{ textAlign: 'center', color: '#ccb46c', fontFamily: 'Gotham-Light' }}>{item.distance} KM</Text>
</View>
</View>
</TouchableOpacity>
</View> </View>
</View>
</TouchableOpacity>
</View>
</View>)} </View>)
) : (
null
)
}
</View> </View>
...@@ -287,7 +293,7 @@ class PickupName extends React.Component { ...@@ -287,7 +293,7 @@ class PickupName extends React.Component {
/> */} /> */}
<View style={styles.searchbar}> <View style={styles.searchbar}>
<View style={{ height: 45, borderRadius: 10, borderColor: '#ccb46c', borderWidth: 1, flexDirection: 'row' }}> <View style={{ height: 45, borderRadius: 10, borderColor: '#ccb46c', borderWidth: 1, flexDirection: 'row' }}>
<View style={{ flex: 1,top:5 }}> <View style={{ flex: 1, top: 5 }}>
<MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" /> <MaterialCommunityIcons name="map-marker" size={32} color="#ccb46c" />
</View> </View>
<View style={{ flex: 6 }}> <View style={{ flex: 6 }}>
...@@ -302,20 +308,20 @@ class PickupName extends React.Component { ...@@ -302,20 +308,20 @@ class PickupName extends React.Component {
</View> </View>
</View> </View>
<View style={styles.body}> <View style={styles.body}>
{this.state.indicator == true ? ( {this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" /> <ActivityIndicator size="large" color="#c9af6d" />
) : ( ) : (
<FlatList <FlatList
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])} data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
renderItem={this.RenderItem} renderItem={this.RenderItem}
keyExtractor={item => item.id} keyExtractor={item => item.id}
windowSize={5} windowSize={5}
initialNumToRender={18} initialNumToRender={18}
maxToRenderPerBatch={2} maxToRenderPerBatch={2}
onEndReachedThreshold={0.5} onEndReachedThreshold={0.5}
/> />
)} )}
</View> </View>
</View> </View>
) )
...@@ -345,9 +351,9 @@ const styles = StyleSheet.create({ ...@@ -345,9 +351,9 @@ const styles = StyleSheet.create({
searchbar: { searchbar: {
flex: 0.5, flex: 0.5,
justifyContent: 'center', justifyContent: 'center',
top:10, top: 10,
marginRight: 20, marginRight: 20,
marginLeft:20, marginLeft: 20,
} }
}) })
......
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