Commit 20ab641b authored by Trisno's avatar Trisno

filter pickup

parent f7eeee7f
......@@ -65,7 +65,7 @@ class PickupName extends React.Component {
this.getOutlet()
}
getOutletDetail(id, name,address) {
getOutletDetail(id, name, address) {
let OutletChange = {
outlet_id: id,
......@@ -103,7 +103,7 @@ class PickupName extends React.Component {
Axios.post("https://excelsocrm.ravintoladev.com/crm/v2/outlet/get_list", params).then(res => {
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++) {
dataOutlets[i]['distance'] = this.distance(dataOutlets[i]['lat'], dataOutlets[i]['long']);
let address = dataOutlets[i]['address'];
......@@ -201,76 +201,82 @@ class PickupName extends React.Component {
RenderItem = ({ item }) => {
return (
<View>
{item.can_accept_order == true ? (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name,item.full_address)}>
<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>)}
{
item.pickup == true ? (
item.can_accept_order == true ? (
<View>
<TouchableOpacity onPress={() => this.getOutletDetail(item.id, item.name, item.full_address)}>
<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>
<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>
<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 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>
</TouchableOpacity>
</View>
) : (<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>
<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>
<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>
</TouchableOpacity>
</View>
</View>)}
</View>)
) : (
null
)
}
</View>
......@@ -287,7 +293,7 @@ class PickupName extends React.Component {
/> */}
<View style={styles.searchbar}>
<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" />
</View>
<View style={{ flex: 6 }}>
......@@ -302,20 +308,20 @@ class PickupName extends React.Component {
</View>
</View>
<View style={styles.body}>
{this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" />
) : (
<FlatList
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
renderItem={this.RenderItem}
keyExtractor={item => item.id}
windowSize={5}
initialNumToRender={18}
maxToRenderPerBatch={2}
onEndReachedThreshold={0.5}
/>
)}
{this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" />
) : (
<FlatList
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
renderItem={this.RenderItem}
keyExtractor={item => item.id}
windowSize={5}
initialNumToRender={18}
maxToRenderPerBatch={2}
onEndReachedThreshold={0.5}
/>
)}
</View>
</View>
)
......@@ -345,9 +351,9 @@ const styles = StyleSheet.create({
searchbar: {
flex: 0.5,
justifyContent: 'center',
top:10,
top: 10,
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