{* Smarty template *}
{assign var="buttonsNumber" value="0"}
{if $allowedUpdateCommodity}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedCreateCommodity}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedViewCommodity}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedUpdateCommodity}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedDeleteCommodity}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{assign var="columnsNumber" value=2}
{math assign="totalCells" equation="x+y+1" x=$columnsNumber y=$buttonsNumber}
<table border="0" cellpadding="0" cellspacing="0" class="grid" id="commodityList">
<tr class="filter">
<form action="{buildUrl}" method="GET">
{initFilters}
<td></td>
<td>
{textFilter colon='title'}
</td>
<td>
{textFilter colon='orderNumber'}
</td>
<td align="center" colspan="{$buttonsNumber}"><input type="submit" value="{message key='common.button.filter'}" class="form_filter_button noTopBottomMargin"></td>
</form>
</tr>
<tr>
<th class="selectAllButtonCell"><input type="button" value="{message key='common.button.selectAll'}" onClick="checkAll(document.forms['massDeleteForm']);" class="form_button noTopBottomMargin"></th>
<th>{message key='commodity.form.title'}</th>
<th>{message key='commodity.form.orderNumber'}</th>
<th colspan="{$buttonsNumber}"></th>
</tr>
{if !$dataIsEmpty}
<form name="massDeleteForm" action="index.php" method="GET" onSubmit="return validateMassDelete(document.forms['massDeleteForm'], '{message escapeSingleQuotes=true key='commodity.error.nothingSelected'}') && confirmMassDelete('{message escapeSingleQuotes=true key='commodity.form.confirmMassDelete'}');">
<input type="hidden" name="action" value="massDeleteCommodities">
{foreach name="mainLoop" from=$data item=commodity}
{cycle name="commodities" values="oddRow,evenRow" assign=parity}
<tr class="{$parity}" onMouseOver="onMouseOverRow(this)" onMouseOut="onMouseOutRow(this)">
<td align="center" valign="center"><input type="checkbox" name="checked[{$commodity->id}]"></td>
<td>{$commodity->title|escape}</td>
<td>{$commodity->order_number|escape}</td>
{if $allowedUpdateCommodity}
<td class="gridIcon">
{if !$smarty.foreach.mainLoop.first || $offset > 0}
<a href="{buildUrl action='liftCommodity' id=$commodity->id}" title="{message key='commodity.form.lift'}">
<img src="images/up.gif" border="0" alt="{message key='commodity.form.lift'}">
</a>
{else}
<img src="images/upDisabled.gif" border="0" alt="{message key='commodity.form.lift'}">
{/if}
{if !$smarty.foreach.mainLoop.last || !$isLastPage}
<a href="{buildUrl action='lowerCommodity' id=$commodity->id}" title="{message key='commodity.form.lower'}">
<img src="images/down.gif" border="0" alt="{message key='commodity.form.lower'}">
</a>
{else}
<img src="images/downDisabled.gif" border="0" alt="{message key='commodity.form.lower'}">
{/if}
</td>
{/if}
{if $allowedCreateCommodity}
<td class="gridIcon">
<a href="{buildUrl action='callCreateCommodity' id=$commodity->id}" title="{message key='commodity.form.clone'}">
<img src="images/copy.gif" border="0" alt="{message key='commodity.form.clone'}">
</a>
</td>
{/if}
{if $allowedViewCommodity}
<td class="gridIcon">
<a href="{buildUrl action='viewCommodity' id=$commodity->id}" title="{message key='commodity.form.view'}">
<img src="images/view.gif" border="0" alt="{message key='commodity.form.view'}">
</a>
</td>
{/if}
{if $allowedUpdateCommodity}
<td class="gridIcon">
<a href="{buildUrl action='callUpdateCommodity' id=$commodity->id}" title="{message key='commodity.form.update'}">
<img src="images/edit.gif" border="0" alt="{message key='commodity.form.update'}">
</a>
</td>
{/if}
{if $allowedDeleteCommodity}
<td class="gridIcon">
<a href="{buildUrl action=deleteCommodity id=$commodity->id}" title="{message key='commodity.form.delete'}" onClick="return confirm('{message escapeSingleQuotes=true key='commodity.form.confirmDelete'}');">
<img src="images/delete.gif" border="0" alt="{message key='commodity.form.delete'}">
</a>
</td>
{/if}
</tr>
{/foreach}
{else}
<tr>
<td class="tfoot" colspan="{$totalCells}" align="center">
<em>{message key='commodity.message.nothing'}</em>
</td>
</tr>
{/if}
</form>
</table>
{include file="after_grid.tpl"}
{if $allowedCreateCommodity}
{buildUrl action=callCreateCommodity assign=createUrl}
{message key='common.button.create' assign='createMsg'}
{button title=$createMsg url=$createUrl class="form_button"}
{/if}