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:
Daniel Camargo 2013-01-18 13:56:47 -02:00
parent 87ca08699a
commit c094408ac2

View File

@ -852,17 +852,24 @@ App.cart = {
* 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.
*/
var wasTipChanged = false;
if( App.order.delivery_type == 'takeout' && App.order['pay_type'] == 'card' ){
if( typeof App.order.tipHasChanged == 'undefined' ){
$('[name="pay-tip"]').val( 0 );
App.order.tip = 0;
wasTipChanged = true;
}
} else if( App.order.delivery_type == 'delivery' && App.order['pay_type'] == 'card' ){
if( typeof App.order.tipHasChanged == 'undefined' ){
App.order.tip = 15;
$('[name="pay-tip"]').val( App.order.tip );
App.order.tip = 15; // Default value is 15
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') {
$('.delivery-minimum-error').show();