[+] BO Customers Groups WIP

This commit is contained in:
Kevin Granger
2013-07-29 20:39:52 +02:00
parent d95a519ace
commit b95478d529
3 changed files with 75 additions and 97 deletions
@@ -28,16 +28,14 @@
{block name="label"}
{if $input['type'] == 'modules'}
<div style="{if !$form_id}display:none{/if}">
<div class="separation"></div>
<label>{l s='Module restrictions:'}</label>
<label class="control-label col-lg-3">{l s='Module restrictions:'}</label>
</div>
{elseif $input['type'] == 'group_discount_category'}
<div style="{if !$form_id}display:none{/if}">
<div class="separation"></div>
<label>{$input.label} </label>
{$smarty.block.parent}
</div>
{else}
<label>{$input.label} </label>
{$smarty.block.parent}
{/if}
{/block}
@@ -162,15 +160,18 @@
$('#category_reduction_fancybox').val('0.00');
}
</script>
<div class="margin-form">
<a class="button" href="#group_discount_category_fancybox" id="group_discount_category">{l s='Add a category discount'}</a>
<table cellspacing="0" cellpadding="0" class="table" style="margin-top:10px" id="group_discount_category_table">
<div class="col-lg-9">
<a class="btn btn-default" href="#group_discount_category_fancybox" id="group_discount_category">{l s='Add a category discount'}</a>
<table class="table" id="group_discount_category_table">
{foreach $input['values'] key=key item=category }
<tr class="alt_row" id="{$category.id_category}">
<td>{$category.path}</td>
<td>{l s='Discount: %d%%' sprintf=$category.reduction}</td>
<td>
<a href="#" onclick="deleteCategoryReduction({$category.id_category});"><img src="../img/admin/delete.gif"></a>
<a href="#" onclick="deleteCategoryReduction({$category.id_category});">
<img src="../img/admin/delete.gif">
</a>
<input type="hidden" class="category_reduction" name="category_reduction[{$category.id_category}]" value="{$category.reduction}">
</td>
</tr>
@@ -178,17 +179,18 @@
</table>
<div style="display:none" id="group_discount_category_fancybox">
<fieldset style="text-align:left"><legend><img src="../img/admin/tab-groups.gif" />{l s='New group category discount'}</legend>
<div class="hintGroup" style="font-size: 13px;">
<fieldset>
<h3><i class="icon-group"></i>{l s='New group category discount'}</h3>
<div class="hintGroup">
{l s='Caution: The discount applied to a category does not stack with the overall reduction but instead replaces it.'}
</div>
{$categoryTreeView}
<div class="alert alert-block">{l s='Only products that have this category as the default category will be affected.'}</div>
<div class="clear">&nbsp;</div>
<label>{l s='Discount (%):'}</label>
<input type="text" name="category_reduction_fancybox" id="category_reduction_fancybox" value="0.00" size="33">
<div class="clear">&nbsp;</div>
<button onclick="addCategoryReduction();" class="button">{l s='add'}</button>
<input type="text" name="category_reduction_fancybox" id="category_reduction_fancybox" value="0.00">
<button onclick="addCategoryReduction();" class="btn btn-primary">{l s='add'}</button>
</fieldset>
</div>
</div>
@@ -209,61 +211,43 @@
}).disableSelection();
});
</script>
<table cellspacing="0" cellpadding="0" class="table" style="width:600px">
<thead>
<tr>
<th style="padding-left:10px;">
{$input['label']['auth_modules']}
</th>
<th style="padding-left:10px;">
{$input['label']['unauth_modules']}
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:300px">
<ul id="sortable_module_authorize_list" class="connectedSortable" style="height:300px;overflow:auto">
<li></li>
{foreach $input['values']['auth_modules'] key=key item=module }
<li class="module_list" id="module_{$module->id}">
<input type="checkbox" style="margin-right:5px">
<img src="../modules/{$module->name}/logo.gif">
{$module->displayName}
<input type="hidden" name="modulesBoxAuth[]" value="{$module->id}">
</li>
{/foreach}
</ul>
</td>
<td style="width:300px">
<ul id="sortable_module_unauthorize_list" class="connectedSortable" style="height:300px;overflow:auto">
<li></li>
{foreach $input['values']['unauth_modules'] key=key item=module }
<li class="module_list" id="module_{$module->id}">
<input type="checkbox" style="margin-right:5px">
<img src="../modules/{$module->name}/logo.gif">
{$module->displayName}
<input type="hidden" name="modulesBoxUnauth[]" value="{$module->id}">
</li>
{/foreach}
</ul>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td style="text-align:center">
<button style="width:100%;margin-top:5px" id="authorize_list" onclick="toogleCheck(this);return false;" class="button">{l s='Select all'}</button>
<button style="width:100%;margin-top:5px;margin-bottom:5px" onclick="authorizeChecked();return false;" class="button">{l s='Unauthorize >>'}</button>
</td>
<td style="text-align:center">
<button style="width:100%;margin-top:5px"id="unauthorize_list" onclick="toogleCheck(this);return false;" class="button">{l s='Select all'}</button>
<button style="width:100%;margin-top:5px;margin-bottom:5px" onclick="unauthorizeChecked();return false;" class="button">{l s='<< Authorize'}</button>
</td>
</tr>
</tfoot>
</table>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-6">
<label>{$input['label']['auth_modules']}</label>
<ul id="sortable_module_authorize_list" class="connectedSortable list-unstyled">
{foreach $input['values']['auth_modules'] key=key item=module }
<li class="module_list" id="module_{$module->id}">
<input type="checkbox" style="margin-right:5px">
<img src="../modules/{$module->name}/logo.gif">
{$module->displayName}
<input type="hidden" name="modulesBoxAuth[]" value="{$module->id}">
</li>
{/foreach}
</ul>
<button id="authorize_list" onclick="toogleCheck(this);return false;" class="btn btn-default">{l s='Select all'}</button>
<button onclick="authorizeChecked();return false;" class="btn btn-default">{l s='Unauthorize >>'}</button>
</div>
<div class="col-lg-6">
<label>{$input['label']['unauth_modules']}</label>
<ul id="sortable_module_unauthorize_list" class="connectedSortable list-unstyled">
{foreach $input['values']['unauth_modules'] key=key item=module }
<li class="module_list" id="module_{$module->id}">
<input type="checkbox" style="margin-right:5px">
<img src="../modules/{$module->name}/logo.gif">
{$module->displayName}
<input type="hidden" name="modulesBoxUnauth[]" value="{$module->id}">
</li>
{/foreach}
</ul>
<button id="unauthorize_list" onclick="toogleCheck(this);return false;" class="btn btn-default">{l s='Select all'}</button>
<button onclick="unauthorizeChecked();return false;" class="btn btn-default">{l s='<< Authorize'}</button>
</div>
</div>
</div>
</div>
{else}
{$smarty.block.parent}
@@ -29,13 +29,14 @@
<fieldset>
<ul>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Name:'}</span> {$group->name[$language->id]}</li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Discount: %d%%' sprintf=$group->reduction}</span></li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Current category discount:'}</span>
<li><span >{l s='Name:'}</span> {$group->name[$language->id]}</li>
<li><span >{l s='Discount: %d%%' sprintf=$group->reduction}</span></li>
<li><span >{l s='Current category discount:'}</span>
{if !$categorieReductions}
{l s='None'}
{else}
<table cellspacing="0" cellpadding="0" class="table" style="margin-top:10px">
<table class="table">
{foreach $categorieReductions key=key item=category }
<tr class="alt_row">
<td>{$category.path}</td>
@@ -46,14 +47,14 @@
{/if}
</li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Price display method:'}</span>
<li><span>{l s='Price display method:'}</span>
{if $group->price_display_method}
{l s='Tax excluded'}
{else}
{l s='Tax included'}
{/if}
</li>
<li><span style="font-weight: bold; font-size: 13px; color:#000;">{l s='Show prices:'}</span> {if $group->show_prices}{l s='Yes'}{else}{l s='No'}{/if}
<li><span>{l s='Show prices:'}</span> {if $group->show_prices}{l s='Yes'}{else}{l s='No'}{/if}
</li>
</ul>
</fieldset>
+14 -21
View File
@@ -28,6 +28,7 @@ class AdminGroupsControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true ;
$this->table = 'group';
$this->className = 'Group';
$this->lang = true;
@@ -45,8 +46,7 @@ class AdminGroupsControllerCore extends AdminController
$this->fields_list = array(
'id_group' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
'align' => 'center'
),
'name' => array(
'title' => $this->l('Name'),
@@ -54,19 +54,16 @@ class AdminGroupsControllerCore extends AdminController
),
'reduction' => array(
'title' => $this->l('Discount (%)'),
'width' => 100,
'align' => 'right',
'type' => 'percent'
),
'nb' => array(
'title' => $this->l('Members'),
'width' => 25,
'align' => 'center',
'havingFilter' => true,
),
'show_prices' => array(
'title' => $this->l('Show prices'),
'width' => 120,
'align' => 'center',
'type' => 'bool',
'callback' => 'printShowPricesIcon',
@@ -74,7 +71,6 @@ class AdminGroupsControllerCore extends AdminController
),
'date_add' => array(
'title' => $this->l('Creation date'),
'width' => 150,
'type' => 'date',
'align' => 'right'
)
@@ -182,15 +178,15 @@ class AdminGroupsControllerCore extends AdminController
$genders[$gender->id] = $gender->name;
}
$customer_fields_display = (array(
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'),
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50,'icon' => $genders_icon, 'list' => $genders),
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center'),
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center','icon' => $genders_icon, 'list' => $genders),
'firstname' => array('title' => $this->l('Name'), 'align' => 'center'),
'lastname' => array('title' => $this->l('Name'), 'align' => 'center'),
'email' => array('title' => $this->l('Email address'), 'width' => 150, 'align' => 'center'),
'birthday' => array('title' => $this->l('Birth date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'date_add' => array('title' => $this->l('Register date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'email' => array('title' => $this->l('Email address'), 'align' => 'center'),
'birthday' => array('title' => $this->l('Birth date'), 'align' => 'right', 'type' => 'date'),
'date_add' => array('title' => $this->l('Register date'), 'align' => 'right', 'type' => 'date'),
'orders' => array('title' => $this->l('Orders'), 'align' => 'center'),
'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool')
'active' => array('title' => $this->l('Enabled'),'align' => 'center', 'active' => 'status','type' => 'bool')
));
$customer_list = $group->getCustomers(false, 0, 0, true);
@@ -215,34 +211,32 @@ class AdminGroupsControllerCore extends AdminController
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Customer group'),
'image' => '../img/admin/tab-groups.gif'
'icon' => 'icon-group'
),
'submit' => array(
'title' => $this->l('Save '),
'class' => 'button'
'class' => 'btn btn-primary'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name:'),
'name' => 'name',
'size' => 33,
'required' => true,
'lang' => true,
'hint' => $this->l('Forbidden characters:').' 0-9!<>,;?=+()@#"{}_$%:'
'hint' => $this->l('Forbidden characters:').' 0-9!&lt;&gt;,;?=+()@#"{}_$%:'
),
array(
'type' => 'text',
'label' => $this->l('Discount (%):'),
'name' => 'reduction',
'size' => 33,
'desc' => $this->l('Automatically apply this value as a discount on all products for members of this customer group.')
),
array(
'type' => 'select',
'label' => $this->l('Price display method:'),
'name' => 'price_display_method',
'desc' => $this->l('How prices are displayed in the order summary for this customer group.'),
'hint' => $this->l('How prices are displayed in the order summary for this customer group.'),
'options' => array(
'query' => array(
array(
@@ -259,7 +253,7 @@ class AdminGroupsControllerCore extends AdminController
)
),
array(
'type' => 'radio',
'type' => 'switch',
'label' => $this->l('Show prices:'),
'name' => 'show_prices',
'required' => false,
@@ -277,13 +271,12 @@ class AdminGroupsControllerCore extends AdminController
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Customers in this group can view prices')
'hint' => $this->l('Customers in this group can view prices')
),
array(
'type' => 'group_discount_category',
'label' => $this->l('Category discount:'),
'name' => 'reduction',
'size' => 33,
'values' => ($group->id ? $this->formatCategoryDiscountList((int)$group->id) : array())
),
array(