From 30c9156a418603f77229d5f1edf49053c01864d3 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 12 Aug 2013 14:56:49 +0200 Subject: [PATCH] [-] BO : fixed bug #PSCFV-10091 - you can now enable all zone in one clic --- .../admin/AdminCarrierWizardController.php | 1 + js/admin_carrier_wizard.js | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index c5a331648..a9e80e669 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -109,6 +109,7 @@ class AdminCarrierWizardControllerCore extends AdminController 'wizard_steps' => $this->wizard_steps, 'validate_url' => $this->context->link->getAdminLink('AdminCarrierWizard'), 'carrierlist_url' => $this->context->link->getAdminLink('AdminCarriers').'&conf='.((int)Validate::isLoadedObject($carrier) ? 4 : 3), + 'multistore_enable' => Shop::isFeatureActive(), 'wizard_contents' => array( 'contents' => array( 0 => $this->renderStepOne($carrier), diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index ced186044..8bff3eeae 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -454,12 +454,24 @@ function validateRange(index) return is_ok; } +function enableZone(index) +{ + $(this).children('td:eq('+index+')').children('input').removeAttr('disabled'); +} + +function disableZone(index) +{ + $(this).children('td:eq('+index+')').children('input').attr('disabled', 'disabled'); +} + + + function enableRange(index) { $('tr.fees').each( function () { //only enable fees for enabled zones if ($(this).children('td').children('input:checkbox').attr('checked') == 'checked') - $(this).children('td:eq('+index+')').children('input').removeAttr('disabled'); + enableZone(index); }); $('span.fees_all').show(); $('tr.fees_all td:eq('+index+')').children('input').show().removeAttr('disabled'); @@ -474,7 +486,7 @@ function disableRange(index) $('tr.fees').each( function () { //only enable fees for enabled zones if ($(this).children('td').children('input:checkbox').attr('checked') == 'checked') - $(this).children('td:eq('+index+')').children('input').attr('disabled', 'disabled'); + disableZone(index); }); $('tr.fees_all td:eq('+index+')').children('input').attr('disabled', 'disabled'); $('tr.fees_all td:eq('+index+')').removeClass('validated').addClass('not_validated'); @@ -602,7 +614,18 @@ function getCorrectRangePosistion(current_inf, current_sup) function checkAllZones(elt) { if($(elt).is(':checked')) + { $('.input_zone').attr('checked', 'checked'); + $('.fees input:text').each( function () { + index = $(this).parent().index(); + if ($('tr.fees_all td:eq('+index+')').hasClass('validated')) + $(this).removeAttr('disabled'); + }) + } else + { $('.input_zone').removeAttr('checked'); + $('.fees input:text').attr('disabled', 'disabled').val(''); + } + } \ No newline at end of file