Commit 18dd3607 authored by Trisno's avatar Trisno

button delivery dan pickup di highlight sesuai state

parent a4d4b682
...@@ -35,7 +35,7 @@ class Home extends React.Component { ...@@ -35,7 +35,7 @@ class Home extends React.Component {
} }
componentDidMount() { componentDidMount() {
const screenWidth = Math.round(Dimensions.get('window').width); const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({ this.setState({
slider_height: screenWidth slider_height: screenWidth
...@@ -273,41 +273,86 @@ class Home extends React.Component { ...@@ -273,41 +273,86 @@ class Home extends React.Component {
</View> </View>
<View style={styles.content}> <View style={styles.content}>
<View style={styles.card}> <View style={styles.card}>
<Card> {
<View style={{ flexDirection: 'row', justifyContent: 'center' }}> this.props.type_pickup == true ? (
{/* <TouchableOpacity style={styles.buttonDelivery} onPress={() => this._delivery()}> <Card>
<View style={{ flexDirection: 'row', justifyContent: 'center' }}>
{/* <TouchableOpacity style={styles.buttonDelivery} onPress={() => this._delivery()}>
<Text style={{ textAlign: 'center', color: '#354175', fontWeight: 'bold' }}>{i18n.t('delivery')}</Text> <Text style={{ textAlign: 'center', color: '#354175', fontWeight: 'bold' }}>{i18n.t('delivery')}</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={styles.buttonPickup} onPress={() => this._pickup()}> <TouchableOpacity style={styles.buttonPickup} onPress={() => this._pickup()}>
<Text style={{ textAlign: 'center', color: '#fff', fontWeight: 'bold' }}>{i18n.t('pickup')}</Text> <Text style={{ textAlign: 'center', color: '#fff', fontWeight: 'bold' }}>{i18n.t('pickup')}</Text>
</TouchableOpacity> */} </TouchableOpacity> */}
<TouchableOpacity style={styles.buttonDelivery} onPress={() => this._delivery()}> <TouchableOpacity style={styles.buttonDeliveryFalse} onPress={() => this._delivery()}>
<Text style={{ textAlign: 'center', color: '#354175', fontFamily: 'Gotham-Black' }}>DELIVERY</Text> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black' }}>DELIVERY</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonPickupTrue} onPress={() => this._pickup()}>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICK UP</Text>
</TouchableOpacity>
</View>
{/* <Text style={{ textAlign: 'center', fontSize: 12, }}>
{i18n.t('orderInfo')}
</Text> */}
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>
YOU WILL PICKUP YOUR ORDER AT
</Text>
{this.state.indicator == true ? (
<ActivityIndicator size="small" color="#c9af6d" />
) : (
<Text style={{ textAlign: "center", fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: '#838383' }}>
{this.props.name_outlet}
</Text>
)}
{/* <TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}>
<Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>{i18n.t('orderNow')}</Text>
</TouchableOpacity> */}
<TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>ORDER NOW</Text>
</TouchableOpacity>
</Card>
) : (
<Card>
<View style={{ flexDirection: 'row', justifyContent: 'center' }}>
{/* <TouchableOpacity style={styles.buttonDelivery} onPress={() => this._delivery()}>
<Text style={{ textAlign: 'center', color: '#354175', fontWeight: 'bold' }}>{i18n.t('delivery')}</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={styles.buttonPickup} onPress={() => this._pickup()}> <TouchableOpacity style={styles.buttonPickup} onPress={() => this._pickup()}>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICK UP</Text> <Text style={{ textAlign: 'center', color: '#fff', fontWeight: 'bold' }}>{i18n.t('pickup')}</Text>
</TouchableOpacity> </TouchableOpacity> */}
</View> <TouchableOpacity style={styles.buttonDeliveryTrue} onPress={() => this._delivery()}>
{/* <Text style={{ textAlign: 'center', fontSize: 12, }}> <Text style={{ textAlign: 'center', color: '#354175', fontFamily: 'Gotham-Black' }}>DELIVERY</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonPickupFalse} onPress={() => this._pickup()}>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICK UP</Text>
</TouchableOpacity>
</View>
{/* <Text style={{ textAlign: 'center', fontSize: 12, }}>
{i18n.t('orderInfo')} {i18n.t('orderInfo')}
</Text> */} </Text> */}
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}> <Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>
YOU WILL PICKUP YOUR ORDER AT OUR DRIVER WILL DELIVER YOUR ORDER TO
</Text> </Text>
{this.state.indicator == true ? ( {this.state.indicator == true ? (
<ActivityIndicator size="small" color="#c9af6d" /> <ActivityIndicator size="small" color="#c9af6d" />
) : ( ) : (
<Text style={{ textAlign: "center", fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: '#838383' }}> <Text style={{ textAlign: "center", fontSize: 12, top: 5, fontFamily: 'Gotham-Light', color: '#838383' }}>
{this.props.name_outlet} {this.props.home_address}
</Text> </Text>
)} )}
{/* <TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}> {/* <TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}>
<Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>{i18n.t('orderNow')}</Text> <Text style={{ textAlign: 'center', bottom: 5, color: 'white' }}>{i18n.t('orderNow')}</Text>
</TouchableOpacity> */} </TouchableOpacity> */}
<TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}> <TouchableOpacity style={styles.submitOrder} activeOpacity={.5} onPress={() => this._orderNow()}>
<Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>ORDER NOW</Text> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black', fontSize: 16 }}>ORDER NOW</Text>
</TouchableOpacity> </TouchableOpacity>
</Card> </Card>
)
}
{ {
this.state.indicator == true ? (<ActivityIndicator style={{ top: 20, justifyContent: "center" }} size="large" color="#c9af6d" />) : this.state.indicator == true ? (<ActivityIndicator style={{ top: 20, justifyContent: "center" }} size="large" color="#c9af6d" />) :
this.state.account_number === "" ? ( this.state.account_number === "" ? (
...@@ -462,7 +507,7 @@ const styles = StyleSheet.create({ ...@@ -462,7 +507,7 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
alignItems: 'center' alignItems: 'center'
}, },
buttonDelivery: { buttonDeliveryTrue: {
justifyContent: 'center', justifyContent: 'center',
height: 40, height: 40,
marginTop: 10, marginTop: 10,
...@@ -477,7 +522,22 @@ const styles = StyleSheet.create({ ...@@ -477,7 +522,22 @@ const styles = StyleSheet.create({
width: '50%', width: '50%',
top: -20, top: -20,
}, },
buttonPickup: { buttonDeliveryFalse: {
justifyContent: 'center',
height: 40,
marginTop: 10,
paddingTop: 15,
paddingBottom: 15,
marginRight: 0,
marginLeft: 0,
backgroundColor: '#838383',
borderRadius: 10,
borderWidth: 0,
borderColor: '#fff',
width: '50%',
top: -20,
},
buttonPickupTrue: {
justifyContent: 'center', justifyContent: 'center',
height: 40, height: 40,
marginTop: 10, marginTop: 10,
...@@ -492,6 +552,21 @@ const styles = StyleSheet.create({ ...@@ -492,6 +552,21 @@ const styles = StyleSheet.create({
width: '40%', width: '40%',
top: -20, top: -20,
}, },
buttonPickupFalse: {
justifyContent: 'center',
height: 40,
marginTop: 10,
paddingTop: 15,
paddingBottom: 15,
marginRight: 0,
marginLeft: -30,
backgroundColor: '#838383',
borderRadius: 10,
borderWidth: 0,
borderColor: '#fff',
width: '40%',
top: -20,
},
submitOrder: { submitOrder: {
height: 40, height: 40,
...@@ -583,6 +658,9 @@ const mapStateToProps = (state) => { ...@@ -583,6 +658,9 @@ const mapStateToProps = (state) => {
language: state.language, language: state.language,
lat: state.lat, lat: state.lat,
long: state.long, long: state.long,
type_pickup: state.type_pickup,
address: state.address,
home_address: state.home_address,
} }
} }
......
...@@ -432,12 +432,30 @@ class ShoppingCart extends React.Component { ...@@ -432,12 +432,30 @@ class ShoppingCart extends React.Component {
<TouchableOpacity style={styles.buttonPickup} onPress={() => this.checkChangeTrans('pickup')}> <TouchableOpacity style={styles.buttonPickup} onPress={() => this.checkChangeTrans('pickup')}>
<Text style={{ textAlign: 'center', color: '#fff', fontWeight: 'bold' }}>{i18n.t('pickup')}</Text> <Text style={{ textAlign: 'center', color: '#fff', fontWeight: 'bold' }}>{i18n.t('pickup')}</Text>
</TouchableOpacity> */} </TouchableOpacity> */}
<TouchableOpacity style={styles.buttonDelivery} onPress={() => this.checkChangeTrans('delivery')}> {
<Text style={{ textAlign: 'center', color: '#354175', fontFamily: 'Gotham-Black' }}>DELIVERY</Text>
</TouchableOpacity> this.props.type_pickup == true ? (
<TouchableOpacity style={styles.buttonPickup} onPress={() => this.checkChangeTrans('pickup')}> <>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICKUP</Text> <TouchableOpacity style={styles.buttonDeliveryFalse} onPress={() => this.checkChangeTrans('delivery')}>
</TouchableOpacity> <Text style={{ textAlign: 'center', color: 'white', fontFamily: 'Gotham-Black' }}>DELIVERY</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonPickupTrue} onPress={() => this.checkChangeTrans('pickup')}>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICKUP</Text>
</TouchableOpacity>
</>
) : (
<>
<TouchableOpacity style={styles.buttonDeliveryTrue} onPress={() => this.checkChangeTrans('delivery')}>
<Text style={{ textAlign: 'center', color: '#354175', fontFamily: 'Gotham-Black' }}>DELIVERY</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonPickupFalse} onPress={() => this.checkChangeTrans('pickup')}>
<Text style={{ textAlign: 'center', color: '#fff', fontFamily: 'Gotham-Black' }}>PICKUP</Text>
</TouchableOpacity>
</>
)
}
</View> </View>
<View style={{ alignItems: 'center' }}> <View style={{ alignItems: 'center' }}>
{ {
...@@ -836,7 +854,9 @@ const styles = StyleSheet.create({ ...@@ -836,7 +854,9 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center' justifyContent: 'center'
}, },
buttonDelivery: { buttonDeliveryTrue: {
justifyContent: 'center',
height: 40,
marginTop: 10, marginTop: 10,
paddingTop: 15, paddingTop: 15,
paddingBottom: 15, paddingBottom: 15,
...@@ -847,20 +867,52 @@ const styles = StyleSheet.create({ ...@@ -847,20 +867,52 @@ const styles = StyleSheet.create({
borderWidth: 0, borderWidth: 0,
borderColor: '#fff', borderColor: '#fff',
width: '50%', width: '50%',
// top: -20, top: 0,
},
buttonDeliveryFalse: {
justifyContent: 'center',
height: 40,
marginTop: 10,
paddingTop: 15,
paddingBottom: 15,
marginRight: 0,
marginLeft: 0,
backgroundColor: '#838383',
borderRadius: 10,
borderWidth: 0,
borderColor: '#fff',
width: '50%',
top: 0,
}, },
buttonPickup: { buttonPickupTrue: {
justifyContent: 'center',
height: 40,
marginTop: 10, marginTop: 10,
paddingTop: 15, paddingTop: 15,
paddingBottom: 15, paddingBottom: 15,
marginRight: 0, marginRight: 0,
marginLeft: -50, marginLeft: -30,
backgroundColor: '#354175', backgroundColor: '#354175',
borderRadius: 10, borderRadius: 10,
borderWidth: 0, borderWidth: 0,
borderColor: '#fff', borderColor: '#fff',
width: '40%', width: '40%',
// top: -20, top: 0,
},
buttonPickupFalse: {
justifyContent: 'center',
height: 40,
marginTop: 10,
paddingTop: 15,
paddingBottom: 15,
marginRight: 0,
marginLeft: -30,
backgroundColor: '#838383',
borderRadius: 10,
borderWidth: 0,
borderColor: '#fff',
width: '40%',
top: 0,
}, },
shadowEdit: { shadowEdit: {
......
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