Commit 7f8dcb5a authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents b400f243 da2e8427
......@@ -40,7 +40,8 @@ const ActionType = {
SET_VOUCHER:'SET_VOUCHER',
SET_EDIT_NOTE:'SET_EDIT_NOTE',
SET_HOME_ADDRESS:'SET_HOME_ADDRESS',
SET_REEDEM :'SET_REEDEM'
SET_REEDEM :'SET_REEDEM',
REMOVE_VOUCHER : 'REMOVE_VOUCHER'
}
export default ActionType;
\ No newline at end of file
......@@ -579,6 +579,14 @@ const rootReducer = (state = globalState, action) => {
}
}
case ActionType.REMOVE_VOUCHER: {
return {
...state,
voucher: [],
value_voucher: ''
}
}
case ActionType.UPDATE_MENU: {
const menu = action.data.menu;
let total = 0
......
......@@ -116,7 +116,7 @@ class ShoppingCart extends React.Component {
console.log(params);
}
handleChangeVoucher() {
handleRemoveVoucher() {
this.setState({
checkedBalance: false,
checkedPoint: false,
......@@ -124,7 +124,7 @@ class ShoppingCart extends React.Component {
pointsused: 0,
balanceused: 0
})
this.props.navigation.navigate('Reward Select')
this.props.removeVoucher()
}
handleAddVoucher() {
......@@ -420,7 +420,7 @@ class ShoppingCart extends React.Component {
render() {
// console.log('496000'.replace(/,/g, ''))
// console.log(this.state.kasproBalance)
// console.log(this.props)
// console.log(this.props.order_total)
// console.log(this.props.order_item.length)
return (
......@@ -459,7 +459,7 @@ class ShoppingCart extends React.Component {
</View>
<View style={styles.header}>
<Text style={{ textAlign: 'center', fontSize: 12, fontFamily: 'Gotham-Black', color: 'grey' }}>YOUR ORDER(S)</Text>
<TouchableOpacity style={{marginRight:-8}} onPress={() => this.props.navigation.goBack()}>
<TouchableOpacity style={{ marginRight: -8 }} onPress={() => this.props.navigation.goBack()}>
<Text style={{ textAlign: 'center', fontSize: 12, color: '#CFB368', fontFamily: 'Gotham-Light' }}>+ ADD MORE</Text>
</TouchableOpacity>
</View>
......@@ -489,8 +489,8 @@ class ShoppingCart extends React.Component {
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>{this.props.voucher.reward.title}</Text>
</View>
<View style={{ flex: 0.5, alignItems: 'flex-end', marginRight: -5 }}>
<TouchableOpacity onPress={() => this.handleChangeVoucher()}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>Change Voucher</Text>
<TouchableOpacity onPress={() => this.handleRemoveVoucher()}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: '#CFB368' }}>Remove Voucher</Text>
</TouchableOpacity>
</View>
</View>
......@@ -603,7 +603,7 @@ class ShoppingCart extends React.Component {
</View>
</Card>
</TouchableOpacity>
) : (
<Card style={{ margin: 5, padding: 10, backgroundColor: 'gray' }}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
......@@ -653,7 +653,7 @@ class ShoppingCart extends React.Component {
<View style={{ paddingLeft: 20 }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Harga</Text>
</View>
<View style={{ alignItems: 'flex-end', paddingRight:20 }}>
<View style={{ alignItems: 'flex-end', paddingRight: 20 }}>
<NumberFormat decimalScale={0} value={this.props.order_total} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
......@@ -670,7 +670,7 @@ class ShoppingCart extends React.Component {
{/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.props.grabamount}</Text> */}
<NumberFormat decimalScale={0} value={this.props.grabamount} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
) : (<View style={{ paddingRight:20, paddingTop: 5, alignItems: 'flex-end' }}>
) : (<View style={{ paddingRight: 20, paddingTop: 5, alignItems: 'flex-end' }}>
<NumberFormat decimalScale={0} value={0} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>)}
</View>)}
......@@ -683,7 +683,7 @@ class ShoppingCart extends React.Component {
<View style={{ paddingLeft: 20, paddingTop: 5, }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Diskon</Text>
</View>
<View style={{ paddingRight:20, paddingTop: 5, alignItems: 'flex-end' }}>
<View style={{ paddingRight: 20, paddingTop: 5, alignItems: 'flex-end' }}>
<NumberFormat decimalScale={0} value={this.props.voucher.reward.value} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
</View>
......@@ -691,12 +691,12 @@ class ShoppingCart extends React.Component {
)
}
<View style={{ flexDirection: 'row', justifyContent: 'space-between'}}>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ marginTop: 10, paddingLeft: 20 }}>
<Text style={{ fontSize: 20, color: '#CFB368', fontFamily: 'Gotham-Black', }}>TOTAL</Text>
</View>
{this.props.type_pickup == true ? (
<View style={{ marginTop: 10, paddingRight:20, alignItems: 'flex-end' }}>
<View style={{ marginTop: 10, paddingRight: 20, alignItems: 'flex-end' }}>
{
this.props.value_voucher == '' ? (
<NumberFormat decimalScale={0} value={this.props.order_total} renderText={value => <Text style={{ fontSize: 20, color: '#CFB368', fontFamily: 'Gotham-Black' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
......@@ -832,7 +832,7 @@ const styles = StyleSheet.create({
marginVertical: 25,
marginHorizontal: 30,
borderRadius: 10,
height:40,
height: 40,
alignItems: 'center',
justifyContent: 'center'
},
......@@ -980,6 +980,9 @@ const mapDispatchToProps = (dispacth) => {
}
}),
removeVoucher: () => dispacth({
type: ActionType.REMOVE_VOUCHER
}),
}
}
......
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