fixed #656
The problem was fixed. The tip value was being changed but it was not recalculating the total with the new tip value.
This commit is contained in:
parent
87ca08699a
commit
c094408ac2
@ -852,17 +852,24 @@ App.cart = {
|
|||||||
* the default tip will be 15% (variable App.order.tip).
|
* the default tip will be 15% (variable App.order.tip).
|
||||||
* If the user had changed the tip value the default value will be chosed one.
|
* If the user had changed the tip value the default value will be chosed one.
|
||||||
*/
|
*/
|
||||||
|
var wasTipChanged = false;
|
||||||
if( App.order.delivery_type == 'takeout' && App.order['pay_type'] == 'card' ){
|
if( App.order.delivery_type == 'takeout' && App.order['pay_type'] == 'card' ){
|
||||||
if( typeof App.order.tipHasChanged == 'undefined' ){
|
if( typeof App.order.tipHasChanged == 'undefined' ){
|
||||||
$('[name="pay-tip"]').val( 0 );
|
|
||||||
App.order.tip = 0;
|
App.order.tip = 0;
|
||||||
|
wasTipChanged = true;
|
||||||
}
|
}
|
||||||
} else if( App.order.delivery_type == 'delivery' && App.order['pay_type'] == 'card' ){
|
} else if( App.order.delivery_type == 'delivery' && App.order['pay_type'] == 'card' ){
|
||||||
if( typeof App.order.tipHasChanged == 'undefined' ){
|
if( typeof App.order.tipHasChanged == 'undefined' ){
|
||||||
App.order.tip = 15;
|
App.order.tip = 15; // Default value is 15
|
||||||
$('[name="pay-tip"]').val( App.order.tip );
|
wasTipChanged = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( wasTipChanged ){
|
||||||
|
$('[name="pay-tip"]').val( App.order.tip );
|
||||||
|
// Forces the recalculation of total because the tip was changed.
|
||||||
|
totalText = '$' + this.total();
|
||||||
|
}
|
||||||
|
|
||||||
if (App.restaurant.meetDeliveryMin() && App.order.delivery_type == 'delivery') {
|
if (App.restaurant.meetDeliveryMin() && App.order.delivery_type == 'delivery') {
|
||||||
$('.delivery-minimum-error').show();
|
$('.delivery-minimum-error').show();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user