Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/template/controllers/products/helpers/tree/tree.tpl admin-dev/themes/default/template/controllers/products/helpers/tree/tree_header.tpl
This commit is contained in:
+1
-1
@@ -22,4 +22,4 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<div class="pull-right">{if $actions}{foreach from=$actions item=action}{$action}{/foreach}{/if}</div>
|
<div class="pull-right">{if isset($actions)}{foreach from=$actions item=action}{$action}{/foreach}{/if}</div>
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2013 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2013 PrestaShop SA
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
<label for="node-search">{l s=$label}</label> <input type="text" id="node-search" name="node-search"{if isset($class)} class="{$class}"{/if}{if isset($categories_name)} data-provide="typeahead" data-source="[{$categories_name}]"{/if} />
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
{if $header}{$header}{/if}
|
{if isset($header)}{$header}{/if}
|
||||||
{if $nodes}
|
{if isset($nodes)}
|
||||||
<ul id="{$id}" class="nav nav-list tree">{$nodes}</ul>
|
<ul id="{$id}" class="nav nav-list tree">{$nodes}</ul>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<div class="panel-heading">{l s=$title}{if $toolbar}{$toolbar}{/if}</div>
|
<div class="panel-heading">{l s=$title}{if isset($toolbar)}{$toolbar}{/if}</div>
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
<div class="pull-right">{if $actions}{foreach from=$actions item=action}{$action}{/foreach}{/if}</div>
|
<div class="pull-right">{if isset($actions)}{foreach from=$actions item=action}{$action}{/foreach}{/if}</div>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2013 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2013 PrestaShop SA
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
<label for="node-search">{l s=$label}</label> <input type="text" id="node-search" name="node-search"{if isset($class)} class="{$class}"{/if}{if isset($data_source)} data-provide="typeahead" data-source="[{$data_source}]"{/if} />
|
||||||
@@ -29,6 +29,10 @@ interface HelperITreeToolbarButtonCore
|
|||||||
public function __toString();
|
public function __toString();
|
||||||
public function setAction($value);
|
public function setAction($value);
|
||||||
public function getAction();
|
public function getAction();
|
||||||
|
public function setAttributes($value);
|
||||||
|
public function getAttributes();
|
||||||
|
public function setClass($value);
|
||||||
|
public function getClass();
|
||||||
public function setContext($value);
|
public function setContext($value);
|
||||||
public function getContext();
|
public function getContext();
|
||||||
public function setLabel($value);
|
public function setLabel($value);
|
||||||
@@ -37,5 +41,6 @@ interface HelperITreeToolbarButtonCore
|
|||||||
public function getTemplate();
|
public function getTemplate();
|
||||||
public function setTemplateDirectory($value);
|
public function setTemplateDirectory($value);
|
||||||
public function getTemplateDirectory();
|
public function getTemplateDirectory();
|
||||||
|
public function addAttribute($name, $value);
|
||||||
public function render();
|
public function render();
|
||||||
}
|
}
|
||||||
@@ -29,15 +29,18 @@ abstract class HelperTreeToolbarButtonCore
|
|||||||
const DEFAULT_TEMPLATE_DIRECTORY = 'helpers/tree';
|
const DEFAULT_TEMPLATE_DIRECTORY = 'helpers/tree';
|
||||||
|
|
||||||
private $_action;
|
private $_action;
|
||||||
|
private $_attributes;
|
||||||
|
private $_class;
|
||||||
private $_context;
|
private $_context;
|
||||||
private $_label;
|
private $_label;
|
||||||
protected $_template;
|
protected $_template;
|
||||||
protected $_template_directory;
|
protected $_template_directory;
|
||||||
|
|
||||||
public function __construct($label, $action = null)
|
public function __construct($label, $action = null, $class = null)
|
||||||
{
|
{
|
||||||
$this->setLabel($label);
|
$this->setLabel($label);
|
||||||
$this->setAction($action);
|
$this->setAction($action);
|
||||||
|
$this->setClass($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString()
|
public function __toString()
|
||||||
@@ -56,6 +59,34 @@ abstract class HelperTreeToolbarButtonCore
|
|||||||
return $this->_action;
|
return $this->_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAttributes($value)
|
||||||
|
{
|
||||||
|
if (!is_array($value) && !$value instanceof Traversable)
|
||||||
|
throw new PrestaShopException('Data value must be an traversable array');
|
||||||
|
|
||||||
|
$this->_attributes = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAttributes()
|
||||||
|
{
|
||||||
|
if (!isset($this->_attributes))
|
||||||
|
$this->_attributes = array();
|
||||||
|
|
||||||
|
return $this->_attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setClass($value)
|
||||||
|
{
|
||||||
|
$this->_class = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClass()
|
||||||
|
{
|
||||||
|
return $this->_class;
|
||||||
|
}
|
||||||
|
|
||||||
public function setContext($value)
|
public function setContext($value)
|
||||||
{
|
{
|
||||||
$this->_context = $value;
|
$this->_context = $value;
|
||||||
@@ -108,12 +139,21 @@ abstract class HelperTreeToolbarButtonCore
|
|||||||
return $this->_template_directory;
|
return $this->_template_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addAttribute($name, $value)
|
||||||
|
{
|
||||||
|
if (!isset($this->_attributes))
|
||||||
|
$this->_attributes = array();
|
||||||
|
|
||||||
|
$this->_attributes[$name] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return $this->getContext()->smarty->createTemplate(
|
return $this->getContext()->smarty->createTemplate(
|
||||||
$this->getTemplateDirectory().$this->getTemplate(),
|
$this->getTemplateDirectory().$this->getTemplate(),
|
||||||
$this->getContext()->smarty
|
$this->getContext()->smarty
|
||||||
);
|
)->assign($this->getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _normalizeDirectory($directory)
|
private function _normalizeDirectory($directory)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class HelperTreeToolbarLinkCore extends HelperTreeToolbarButtonCore implements
|
|||||||
'link' => $this->getLink(),
|
'link' => $this->getLink(),
|
||||||
'action' => $this->getAction(),
|
'action' => $this->getAction(),
|
||||||
'label' => $this->getLabel(),
|
'label' => $this->getLabel(),
|
||||||
|
'class' => $this->getClass(),
|
||||||
'icon_class' => $this->getIconClass()
|
'icon_class' => $this->getIconClass()
|
||||||
));
|
));
|
||||||
return $template->fetch();
|
return $template->fetch();
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* 2007-2013 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Open Software License (OSL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/osl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2013 PrestaShop SA
|
||||||
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*/
|
||||||
|
|
||||||
|
class HelperTreeToolbarSearchCore extends HelperTreeToolbarButtonCore implements
|
||||||
|
HelperITreeToolbarButtonCore
|
||||||
|
{
|
||||||
|
protected $_template = 'tree_toolbar_search.tpl';
|
||||||
|
|
||||||
|
public function __construct($label, $action = null, $class = null)
|
||||||
|
{
|
||||||
|
parent::__construct($label, $action, $class);
|
||||||
|
|
||||||
|
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
||||||
|
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
||||||
|
$bo_theme = ((Validate::isLoadedObject($this->getContext()->employee)
|
||||||
|
&& $this->getContext()->employee->bo_theme) ? $this->getContext()->employee->bo_theme : 'default');
|
||||||
|
|
||||||
|
if (!file_exists(_PS_BO_ALL_THEMES_DIR_.$bo_theme.DIRECTORY_SEPARATOR
|
||||||
|
.'template'))
|
||||||
|
$bo_theme = 'default';
|
||||||
|
$this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
|
||||||
|
.'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
$template = parent::render();
|
||||||
|
$template->assign(array(
|
||||||
|
'action' => $this->getAction(),
|
||||||
|
'label' => $this->getLabel(),
|
||||||
|
'class' => $this->getClass()
|
||||||
|
));
|
||||||
|
return $template->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2377,14 +2377,22 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
public function renderAssociationsCategoriesTree()
|
public function renderAssociationsCategoriesTree()
|
||||||
{
|
{
|
||||||
$tree = new HelperTree('associated-categories-tree', Category::getNestedCategories());
|
$categories = Category::getSimpleCategories(1);
|
||||||
|
$search_source = array();
|
||||||
|
foreach ($categories as $key => $category)
|
||||||
|
$search_source[] = $category['name'];
|
||||||
|
|
||||||
|
$tree = new HelperTree('associated-categories-tree', Category::getNestedCategories());
|
||||||
|
$search = new HelperTreeToolbarSearch('Find a category:');
|
||||||
|
$search->setTemplateDirectory($this->context->smarty->getTemplateDir(0).'/controllers/products/helpers/tree')
|
||||||
|
->addAttribute('categories_name', '"'.implode('","', $search_source).'"');
|
||||||
$html = $tree->setTitle('Associated categories')
|
$html = $tree->setTitle('Associated categories')
|
||||||
->setActions(array(
|
->setActions(array(
|
||||||
new HelperTreeToolbarLink('Collapse All', '$(\'#associated-categories-tree\').tree(\'collapseAll\')', '#', 'icon-collapse-alt'),
|
new HelperTreeToolbarLink('Collapse All', '$(\'#associated-categories-tree\').tree(\'collapseAll\')', '#', 'icon-collapse-alt'),
|
||||||
new HelperTreeToolbarLink('Expand All', '$(\'#associated-categories-tree\').tree(\'expandAll\')', '#', 'icon-expand-alt'),
|
new HelperTreeToolbarLink('Expand All', '$(\'#associated-categories-tree\').tree(\'expandAll\')', '#', 'icon-expand-alt'),
|
||||||
new HelperTreeToolbarLink('Check All', 'checkAllAssociatedCategories();', '#', 'icon-check-sign'),
|
new HelperTreeToolbarLink('Check All', 'checkAllAssociatedCategories();', '#', 'icon-check-sign'),
|
||||||
new HelperTreeToolbarLink('Uncheck All', 'uncheckAllAssociatedCategories();', '#', 'icon-check-empty')
|
new HelperTreeToolbarLink('Uncheck All', 'uncheckAllAssociatedCategories();', '#', 'icon-check-empty'),
|
||||||
|
$search
|
||||||
))
|
))
|
||||||
->setTemplateDirectory($this->context->smarty->getTemplateDir(0).'/controllers/products/helpers/tree')
|
->setTemplateDirectory($this->context->smarty->getTemplateDir(0).'/controllers/products/helpers/tree')
|
||||||
->setNodeFolderTemplate('tree_node_folder_associations.tpl')
|
->setNodeFolderTemplate('tree_node_folder_associations.tpl')
|
||||||
@@ -3019,14 +3027,14 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$data->assign('accessories', $accessories);
|
$data->assign('accessories', $accessories);
|
||||||
|
|
||||||
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
|
$product->manufacturer_name = Manufacturer::getNameById($product->id_manufacturer);
|
||||||
|
|
||||||
$tab_root = array('id_category' => $root->id, 'name' => $root->name);
|
$tab_root = array('id_category' => $root->id, 'name' => $root->name);
|
||||||
|
$category_tree = $helper->renderCategoryTree($tab_root, $selected_cat, 'categoryBox', false, true, array(), false, true);
|
||||||
$helper = new Helper();
|
$helper = new Helper();
|
||||||
$data->assign(array('default_category' => $default_category,
|
$data->assign(array('default_category' => $default_category,
|
||||||
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
|
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
|
||||||
'selected_cat' => $selected_cat,
|
'selected_cat' => $selected_cat,
|
||||||
'id_category_default' => $product->getDefaultCategory(),
|
'id_category_default' => $product->getDefaultCategory(),
|
||||||
'category_tree' => $this->renderAssociationsCategoriesTree(),
|
'category_tree' => $category_tree,
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'link' => $this->context->link,
|
'link' => $this->context->link,
|
||||||
'is_shop_context' => Shop::getContext() == Shop::CONTEXT_SHOP
|
'is_shop_context' => Shop::getContext() == Shop::CONTEXT_SHOP
|
||||||
|
|||||||
+37
-37
@@ -71,9 +71,9 @@ function displayRangeType()
|
|||||||
function onShowStepCallback()
|
function onShowStepCallback()
|
||||||
{
|
{
|
||||||
$('.anchor li a').each( function () {
|
$('.anchor li a').each( function () {
|
||||||
$(this).parent('li').addClass($(this).attr('class'));
|
$(this).closest('li').addClass($(this).attr('class'));
|
||||||
});
|
});
|
||||||
$('#carrier_logo_block').prependTo($('div.content').filter(function() { return $(this).css('display') != 'none' }).children('.defaultForm').children('fieldset'));
|
$('#carrier_logo_block').prependTo($('div.content').filter(function() { return $(this).css('display') != 'none' }).find('.defaultForm').find('fieldset'));
|
||||||
resizeWizard();
|
resizeWizard();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,21 +164,21 @@ $('input[name$="range_inf[]"]').each(function(){
|
|||||||
$('#summary_zones').html('');
|
$('#summary_zones').html('');
|
||||||
$('.input_zone').each(function(){
|
$('.input_zone').each(function(){
|
||||||
if ($(this).attr('checked'))
|
if ($(this).attr('checked'))
|
||||||
$('#summary_zones').html($('#summary_zones').html() + '<li><strong>' + $(this).parent().prev().text() + '</strong></li>');
|
$('#summary_zones').html($('#summary_zones').html() + '<li><strong>' + $(this).closest().prev().text() + '</strong></li>');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Group restrictions
|
// Group restrictions
|
||||||
$('#summary_groups').html('');
|
$('#summary_groups').html('');
|
||||||
$('input[name$="groupBox[]"]').each(function(){
|
$('input[name$="groupBox[]"]').each(function(){
|
||||||
if ($(this).attr('checked'))
|
if ($(this).attr('checked'))
|
||||||
$('#summary_groups').html($('#summary_groups').html() + '<li><strong>' + $(this).parent().next().next().text() + '</strong></li>');
|
$('#summary_groups').html($('#summary_groups').html() + '<li><strong>' + $(this).closest().next().next().text() + '</strong></li>');
|
||||||
});
|
});
|
||||||
|
|
||||||
// shop restrictions
|
// shop restrictions
|
||||||
$('#summary_shops').html('');
|
$('#summary_shops').html('');
|
||||||
$('.input_shop').each(function(){
|
$('.input_shop').each(function(){
|
||||||
if ($(this).attr('checked'))
|
if ($(this).attr('checked'))
|
||||||
$('#summary_shops').html($('#summary_shops').html() + '<li><strong>' + $(this).parent().text() + '</strong></li>');
|
$('#summary_shops').html($('#summary_shops').html() + '<li><strong>' + $(this).closest().text() + '</strong></li>');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,10 +242,10 @@ function bind_inputs()
|
|||||||
$('tr.delete_range td button').off('click').on('click', function () {
|
$('tr.delete_range td button').off('click').on('click', function () {
|
||||||
if (confirm(delete_range_confirm))
|
if (confirm(delete_range_confirm))
|
||||||
{
|
{
|
||||||
index = $(this).parent('td').index();
|
index = $(this).closest('td').index();
|
||||||
$('tr.range_sup td:eq('+index+'), tr.range_inf td:eq('+index+'), tr.fees_all td:eq('+index+'), tr.delete_range td:eq('+index+')').remove();
|
$('tr.range_sup td:eq('+index+'), tr.range_inf td:eq('+index+'), tr.fees_all td:eq('+index+'), tr.delete_range td:eq('+index+')').remove();
|
||||||
$('tr.fees').each( function () {
|
$('tr.fees').each( function () {
|
||||||
$(this).children('td:eq('+index+')').remove();
|
$(this).find('td:eq('+index+')').remove();
|
||||||
});
|
});
|
||||||
rebuildTabindex();
|
rebuildTabindex();
|
||||||
}
|
}
|
||||||
@@ -271,14 +271,14 @@ $('#validate_range_button').off('click').on('click', function () {
|
|||||||
|
|
||||||
if($(this).is(':checked'))
|
if($(this).is(':checked'))
|
||||||
{
|
{
|
||||||
$(this).closest('tr').children('td').each( function () {
|
$(this).closest('tr').find('td').each( function () {
|
||||||
index = $(this).index();
|
index = $(this).index();
|
||||||
if ($('tr.fees_all td:eq('+index+')').hasClass('validated'))
|
if ($('tr.fees_all td:eq('+index+')').hasClass('validated'))
|
||||||
$(this).children('input:text').removeAttr('disabled');
|
$(this).find('input:text').removeAttr('disabled');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$(this).closest('tr').children('td').children('input:text').attr('disabled', 'disabled');
|
$(this).closest('tr').find('td').find('input:text').attr('disabled', 'disabled');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ $('#validate_range_button').off('click').on('click', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('tr.range_sup td input:text, tr.range_inf td input:text').keypress( function (evn) {
|
$('tr.range_sup td input:text, tr.range_inf td input:text').keypress( function (evn) {
|
||||||
index = $(this).parent('td').index();
|
index = $(this).closest('td').index();
|
||||||
if (evn.keyCode == 13)
|
if (evn.keyCode == 13)
|
||||||
{
|
{
|
||||||
if (validateRange(index))
|
if (validateRange(index))
|
||||||
@@ -305,7 +305,7 @@ $('#validate_range_button').off('click').on('click', function () {
|
|||||||
wait: 1000,
|
wait: 1000,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
|
|
||||||
index = $(this.el).parent('td').index();
|
index = $(this.el).closest('td').index();
|
||||||
if (validateRange(index))
|
if (validateRange(index))
|
||||||
enableRange(index);
|
enableRange(index);
|
||||||
else
|
else
|
||||||
@@ -314,7 +314,7 @@ $('#validate_range_button').off('click').on('click', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document.body).off('change', 'tr.fees_all td input').on('change', 'tr.fees_all td input', function() {
|
$(document.body).off('change', 'tr.fees_all td input').on('change', 'tr.fees_all td input', function() {
|
||||||
index = $(this).parent('td').index();
|
index = $(this).closest('td').index();
|
||||||
val = $(this).val();
|
val = $(this).val();
|
||||||
$(this).val('');
|
$(this).val('');
|
||||||
$('tr.fees').each( function () {
|
$('tr.fees').each( function () {
|
||||||
@@ -378,7 +378,7 @@ function showFees()
|
|||||||
if ($(this).index() >= 2)
|
if ($(this).index() >= 2)
|
||||||
{
|
{
|
||||||
//enable only if zone is active
|
//enable only if zone is active
|
||||||
tr = $(this).parent('tr');
|
tr = $(this).closest('tr');
|
||||||
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').attr('checked') && $('tr.fees_all td:eq('+$(this).index()+')').hasClass('validated') || $(tr).hasClass('range_sup') || $(tr).hasClass('range_inf'))
|
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').attr('checked') && $('tr.fees_all td:eq('+$(this).index()+')').hasClass('validated') || $(tr).hasClass('range_sup') || $(tr).hasClass('range_inf'))
|
||||||
$(this).find('input:text').val('').removeAttr('disabled');
|
$(this).find('input:text').val('').removeAttr('disabled');
|
||||||
|
|
||||||
@@ -397,12 +397,12 @@ function validateRange(index)
|
|||||||
$('tr.range_inf td input:text').removeClass('field_error');
|
$('tr.range_inf td input:text').removeClass('field_error');
|
||||||
|
|
||||||
is_ok = true;
|
is_ok = true;
|
||||||
range_sup = parseFloat($('tr.range_sup td:eq('+index+')').children('input:text').val().trim());
|
range_sup = parseFloat($('tr.range_sup td:eq('+index+')').find('input:text').val().trim());
|
||||||
range_inf = parseFloat($('tr.range_inf td:eq('+index+')').children('input:text').val().trim());
|
range_inf = parseFloat($('tr.range_inf td:eq('+index+')').find('input:text').val().trim());
|
||||||
|
|
||||||
if (isNaN(range_sup) || range_sup.length === 0)
|
if (isNaN(range_sup) || range_sup.length === 0)
|
||||||
{
|
{
|
||||||
$('tr.range_sup td:eq('+index+')').children('input:text').addClass('field_error');
|
$('tr.range_sup td:eq('+index+')').find('input:text').addClass('field_error');
|
||||||
is_ok = false;
|
is_ok = false;
|
||||||
displayError([invalid_range], $("#carrier_wizard").smartWizard('currentStep'));
|
displayError([invalid_range], $("#carrier_wizard").smartWizard('currentStep'));
|
||||||
}
|
}
|
||||||
@@ -414,8 +414,8 @@ function validateRange(index)
|
|||||||
}
|
}
|
||||||
else if (is_ok && range_inf >= range_sup)
|
else if (is_ok && range_inf >= range_sup)
|
||||||
{
|
{
|
||||||
$('tr.range_sup td:eq('+index+')').children('input:text').addClass('field_error');
|
$('tr.range_sup td:eq('+index+')').find('input:text').addClass('field_error');
|
||||||
$('tr.range_inf td:eq('+index+')').children('input:text').addClass('field_error');
|
$('tr.range_inf td:eq('+index+')').find('input:text').addClass('field_error');
|
||||||
is_ok = false;
|
is_ok = false;
|
||||||
displayError([invalid_range], $("#carrier_wizard").smartWizard('currentStep'));
|
displayError([invalid_range], $("#carrier_wizard").smartWizard('currentStep'));
|
||||||
}
|
}
|
||||||
@@ -446,8 +446,8 @@ function validateRange(index)
|
|||||||
|
|
||||||
if (!is_ok)
|
if (!is_ok)
|
||||||
{
|
{
|
||||||
$('tr.range_sup td:eq('+index+')').children('input:text').addClass('field_error');
|
$('tr.range_sup td:eq('+index+')').find('input:text').addClass('field_error');
|
||||||
$('tr.range_inf td:eq('+index+')').children('input:text').addClass('field_error');
|
$('tr.range_inf td:eq('+index+')').find('input:text').addClass('field_error');
|
||||||
displayError([range_is_overlapping], $("#carrier_wizard").smartWizard('currentStep'));
|
displayError([range_is_overlapping], $("#carrier_wizard").smartWizard('currentStep'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -460,14 +460,14 @@ function enableRange(index)
|
|||||||
{
|
{
|
||||||
$('tr.fees').each( function () {
|
$('tr.fees').each( function () {
|
||||||
//only enable fees for enabled zones
|
//only enable fees for enabled zones
|
||||||
if ($(this).children('td').children('input:checkbox').attr('checked') == 'checked')
|
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
|
||||||
$(this).children('td:eq('+index+')').children('input').removeAttr('disabled');
|
$(this).find('td:eq('+index+')').find('input').removeAttr('disabled');
|
||||||
});
|
});
|
||||||
$('span.fees_all').show();
|
$('span.fees_all').show();
|
||||||
$('tr.fees_all td:eq('+index+')').children('input').show().removeAttr('disabled');
|
$('tr.fees_all td:eq('+index+')').find('input').show().removeAttr('disabled');
|
||||||
$('tr.fees_all td:eq('+index+')').children('.currency_sign').show();
|
$('tr.fees_all td:eq('+index+')').find('.currency_sign').show();
|
||||||
$('tr.fees_all td:eq('+index+')').addClass('validated').removeClass('not_validated');
|
$('tr.fees_all td:eq('+index+')').addClass('validated').removeClass('not_validated');
|
||||||
$('tr.fees_all td:eq('+index+')').children('button').remove();
|
$('tr.fees_all td:eq('+index+')').find('button').remove();
|
||||||
bind_inputs();
|
bind_inputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,10 +475,10 @@ function disableRange(index)
|
|||||||
{
|
{
|
||||||
$('tr.fees').each( function () {
|
$('tr.fees').each( function () {
|
||||||
//only enable fees for enabled zones
|
//only enable fees for enabled zones
|
||||||
if ($(this).children('td').children('input:checkbox').attr('checked') == 'checked')
|
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
|
||||||
$(this).children('td:eq('+index+')').children('input').attr('disabled', 'disabled');
|
$(this).find('td:eq('+index+')').find('input').attr('disabled', 'disabled');
|
||||||
});
|
});
|
||||||
$('tr.fees_all td:eq('+index+')').children('input').attr('disabled', 'disabled');
|
$('tr.fees_all td:eq('+index+')').find('input').attr('disabled', 'disabled');
|
||||||
$('tr.fees_all td:eq('+index+')').removeClass('validated').addClass('not_validated');
|
$('tr.fees_all td:eq('+index+')').removeClass('validated').addClass('not_validated');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,7 +498,7 @@ function add_new_range()
|
|||||||
$('tr.fees_all td:last').after('<td class="border_top border_bottom"><div class="input-group"><span class="input-group-addon currency_sign" style="display:none" >'+currency_sign+'</span><input class="form-control" style="display:none" type="text" /></div></td>');
|
$('tr.fees_all td:last').after('<td class="border_top border_bottom"><div class="input-group"><span class="input-group-addon currency_sign" style="display:none" >'+currency_sign+'</span><input class="form-control" style="display:none" type="text" /></div></td>');
|
||||||
|
|
||||||
$('tr.fees').each( function () {
|
$('tr.fees').each( function () {
|
||||||
$(this).children('td:last').after('<td><div class="input-group"><span class="input-group-addon currency_sign">'+currency_sign+'</span><input class="form-control" disabled="disabled" name="fees['+$(this).data('zoneid')+'][]" type="text" /></div></td>');
|
$(this).find('td:last').after('<td><div class="input-group"><span class="input-group-addon currency_sign">'+currency_sign+'</span><input class="form-control" disabled="disabled" name="fees['+$(this).data('zoneid')+'][]" type="text" /></div></td>');
|
||||||
});
|
});
|
||||||
$('tr.delete_range td:last').after('<td><button class="btn btn-default">'+labelDelete+'</button</td>');
|
$('tr.delete_range td:last').after('<td><button class="btn btn-default">'+labelDelete+'</button</td>');
|
||||||
|
|
||||||
@@ -512,7 +512,7 @@ function add_new_range()
|
|||||||
|
|
||||||
function delete_new_range()
|
function delete_new_range()
|
||||||
{
|
{
|
||||||
if ($('#new_range_form_placeholder').children('td').length = 1)
|
if ($('#new_range_form_placeholder').find('td').length = 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ function rebuildTabindex()
|
|||||||
$('#zones_table tr').each( function ()
|
$('#zones_table tr').each( function ()
|
||||||
{
|
{
|
||||||
j = i;
|
j = i;
|
||||||
$(this).children('td').each( function ()
|
$(this).find('td').each( function ()
|
||||||
{
|
{
|
||||||
j = zones_nbr + j;
|
j = zones_nbr + j;
|
||||||
if ($(this).index() >= 2 && $(this).find('input'))
|
if ($(this).index() >= 2 && $(this).find('input'))
|
||||||
@@ -559,7 +559,7 @@ function reorderRange(current_index, new_index)
|
|||||||
{
|
{
|
||||||
$('tr.range_sup, tr.range_inf, tr.fees_all, tr.fees, tr.delete_range ').each(function () {
|
$('tr.range_sup, tr.range_inf, tr.fees_all, tr.fees, tr.delete_range ').each(function () {
|
||||||
$(this).find('td:eq('+current_index+')').each( function () {
|
$(this).find('td:eq('+current_index+')').each( function () {
|
||||||
$(this).parent('tr').find('td:eq('+new_index+')').after(this.outerHTML);
|
$(this).closest('tr').find('td:eq('+new_index+')').after(this.outerHTML);
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -574,11 +574,11 @@ function checkRangeContinuity()
|
|||||||
index = $(this).index();
|
index = $(this).index();
|
||||||
if (index > 2)
|
if (index > 2)
|
||||||
{
|
{
|
||||||
range_sup = parseFloat($('tr.range_sup td:eq('+index+')').children('input:text').val().trim());
|
range_sup = parseFloat($('tr.range_sup td:eq('+index+')').find('input:text').val().trim());
|
||||||
range_inf = parseFloat($('tr.range_inf td:eq('+index+')').children('input:text').val().trim());
|
range_inf = parseFloat($('tr.range_inf td:eq('+index+')').find('input:text').val().trim());
|
||||||
prev_index = index-1;
|
prev_index = index-1;
|
||||||
prev_range_sup = parseFloat($('tr.range_sup td:eq('+prev_index+')').children('input:text').val().trim());
|
prev_range_sup = parseFloat($('tr.range_sup td:eq('+prev_index+')').find('input:text').val().trim());
|
||||||
prev_range_inf = parseFloat($('tr.range_inf td:eq('+prev_index+')').children('input:text').val().trim());
|
prev_range_inf = parseFloat($('tr.range_inf td:eq('+prev_index+')').find('input:text').val().trim());
|
||||||
if (range_inf < prev_range_inf || range_sup < prev_range_sup)
|
if (range_inf < prev_range_inf || range_sup < prev_range_sup)
|
||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user