diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index d2bb9f401..c58d0b7b5 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -474,7 +474,8 @@ function validateRange(index) function enableZone(index) { $('tr.fees').each( function () { - $(this).find('td:eq('+index+')').children('input').removeAttr('disabled'); + if ($(this).find('td:eq(1)').children('input[type=checkbox]:checked').length) + $(this).find('td:eq('+index+')').children('input').removeAttr('disabled'); }); } @@ -492,12 +493,18 @@ function enableRange(index) if ($(this).children('td').children('input:checkbox').attr('checked') == 'checked') enableZone(index); }); + $('tr.fees_all td:eq('+index+')').addClass('validated').removeClass('not_validated'); + if ($('.zone input[type=checkbox]:checked').length) + enableGlobalFees(index); + bind_inputs(); +} + +function enableGlobalFees(index) +{ $('span.fees_all').show(); $('tr.fees_all td:eq('+index+')').children('input').show().removeAttr('disabled'); $('tr.fees_all td:eq('+index+')').children('.currency_sign').show(); - $('tr.fees_all td:eq('+index+')').addClass('validated').removeClass('not_validated'); - $('tr.fees_all td:eq('+index+')').children('button').remove(); - bind_inputs(); + } function disableRange(index) @@ -636,7 +643,8 @@ function checkAllZones(elt) { $('.input_zone').attr('checked', 'checked'); $('.fees input:text').each( function () { - index = $(this).parent().index(); + index = $(this).closest('td').index(); + enableGlobalFees(index); if ($('tr.fees_all td:eq('+index+')').hasClass('validated')) { $(this).removeAttr('disabled');