// Fix accordion for bootsrap and better bulk action for warehouse

This commit is contained in:
Jerome Nadaud
2013-09-24 17:18:37 +02:00
parent a175e603ef
commit 0247550a0a
2 changed files with 26 additions and 59 deletions
@@ -36,9 +36,7 @@
<p>{l s='Please choose the warehouses associated with this product. You must also select a default warehouse. '}</p>
</div>
<div class="row">
<a class="btn btn-default confirm_leave" href="{$link->getAdminLink('AdminWarehouses')|escape:'htmlall':'UTF-8'}&addwarehouse">
<i class="icon-plus-sign"></i> {l s='Create a new warehouse'}
</a>
<a class="btn btn-link confirm_leave" href="{$link->getAdminLink('AdminWarehouses')|escape:'htmlall':'UTF-8'}&addwarehouse">{l s='Create a new warehouse'} <i class="icon-external-link-sign"></i></a>
</div>
<div class="row">
<div class="panel-group" id="warehouse-accordion">
@@ -51,12 +49,15 @@
</div>
<div id="warehouse-{$warehouse['name']}" class="panel-collapse collapse{if $smarty.foreach.data.first} in{/if}">
<div class="panel-body">
<table cellpadding="10" cellspacing="0" class="table">
<tr>
<th width="100">{l s='Stored'}</th>
<th>{l s='Product'}</th>
<th width="150">{l s='Location (optional)'}</th>
</tr>
<table class="table">
<thead>
<tr>
<th class="fixed-width-xs" align="center"><span class="title_box">{l s='Stored'}</span></th>
<th><span class="title_box">{l s='Product'}</span></th>
<th><span class="title_box">{l s='Location (optional)'}</span></th>
</tr>
</thead>
<tbody>
{foreach $attributes AS $index => $attribute}
{assign var=location value=''}
{assign var=selected value=''}
@@ -67,7 +68,7 @@
{/if}
{/foreach}
<tr {if $index is odd}class="alt_row"{/if}>
<td><input type="checkbox"
<td class="fixed-width-xs" align="center"><input type="checkbox"
name="check_warehouse_{$warehouse['id_warehouse']}_{$attribute['id_product']}_{$attribute['id_product_attribute']}"
{if $selected == true}checked="checked"{/if}
value="1" />
@@ -79,17 +80,15 @@
size="20" />
</td>
</tr>
{/foreach}
<tr>
<td colspan="3">&nbsp;</td>
</tr>
{if $attributes|@count gt 1}
<tr>
<td><input type="checkbox" class="check_all_warehouse" value="check_warehouse_{$warehouse['id_warehouse']}" /></td>
<td colspan="2"><i>{l s='Mark all products as stored in this warehouse.'}</i></td>
</tr>
{/if}
{/foreach}
</table>
{if $attributes|@count gt 1}
<button type="button" class="btn btn-default check_all_warehouse" value="check_warehouse_{$warehouse['id_warehouse']}"><i class="icon-check-sign"></i> {l s='Mark / Unmark all products as stored in this warehouse.'}</button>
<!--<tr>
<td><input type="checkbox" class="check_all_warehouse" value="check_warehouse_{$warehouse['id_warehouse']}" /></td>
<td colspan="2"><i></i></td>
</tr>-->
{/if}
</div>
</div>
</div>
+7 -39
View File
@@ -1320,25 +1320,6 @@ product_tabs['Suppliers'] = new function(){
//manage default supplier check
self.manageDefaultSupplier();
});
// @TODO: a better way to fix the accordion wrong size bug when the selected page is this page
setTimeout(function() {
$('#suppliers_accordion').accordion({
collapsible: true,
autoHeight: true,
heightStyle: "content"
});
}, 1000);
// Resize the accordion once the page is visible because of the bug with accordions initialized
// inside a display:none block not having the correct size.
$('#suppliers_accordion').parents('.product-tab-content').bind('displayed', function(){
$('#suppliers_accordion').accordion({
collapsible: true,
autoHeight: true,
heightStyle: "content"
});
});
};
}
@@ -1418,9 +1399,9 @@ product_tabs['Warehouses'] = new function(){
this.onReady = function(){
$('.check_all_warehouse').click(function() {
var check = $(this);
//get all checkboxes of current warehouse
var checkboxes = $('input[name*="'+check.val()+'"]');
var checkboxes = $('input[name*="'+$(this).val()+'"]');
var checked = false;
for (i=0; i<checkboxes.length; i++)
{
@@ -1433,27 +1414,14 @@ product_tabs['Warehouses'] = new function(){
else
{
item.attr("checked", true);
checked = true;
}
}
});
// @TODO: a better way to fix the accordion wrong size bug when the selected page is this page
setTimeout(function() {
$('#warehouse_accordion').accordion({
collapsible: true,
autoHeight: true,
heightStyle: "content"
});
}, 1000);
// Resize the accordion once the page is visible because of the bug with accordions initialized
// inside a display:none block not having the correct size.
$('#warehouse_accordion').parents('.product-tab-content').bind('displayed', function(){
$('#warehouse_accordion').accordion({
collapsible: true,
autoHeight: true,
heightStyle: "content"
});
if (checked)
$(this).find('i').removeClass('icon-check-sign').addClass('icon-check-empty');
else
$(this).find('i').removeClass('icon-check-empty').addClass('icon-check-sign');
});
};
}