<!-- BEGIN {$smarty.template} -->

{include file="search_products.tpl.html"}

{if (count($rows) == 0)}
<div>
{t}No products matching your search criteria were found.{/t}<br />
{if $perm_products}[ <a href="add_product.php">{t}Add product{/t}</a> ]{/if}
</div>
{else}

{include file="delete_product.tpl.js"}

<table class="stdtable" cellspacing="0">
  <tr>
    <td class="header" colspan="4"> {t}Products{/t} </td>
    <td class="headeraction" colspan="3"> [ <a href="add_product.php">{t}Add product{/t}</a> ] </td>
  </tr>
  <tr>
    <th> {t}Product code{/t} </th>
    <th> {t}Name{/t} </th>
    <th class="number"> {t}Price{/t} </th>
    <th class="number"> {t}Consumption{/t} </th>
    <th class="number"> {t}On stock{/t} </th>
    <th> {t}Category{/t} </th>
    <th> {t}Actions{/t} </th>
  </tr>

  {section name=products loop=$rows}
  <tr class="{cycle values="odd,even"}">
    <td> <a href="product.php?id={$rows[products].prod_id}">{$rows[products].prod_code|wash|default:"&nbsp;"}</a> </td>
    <td> {$rows[products].prod_name|wash|default:"&nbsp;"} </td>
    <td class="number"> {$rows[products].prod_price|wash|default:"&nbsp;"} </td>
    <td class="number"> {$rows[products].prod_consumption|wash|default:"&nbsp;"} </td>
    <td class="number"> {$rows[products].prod_stock|wash|default:"&nbsp;"} </td>
    <td> {$rows[products].prcat_title|wash|default:"&nbsp;"} </td>

    <td class="actions"> {strip}
      <a href="product.php?id={$rows[products].prod_id}"><img src="img/phpaga/view.png" height="16" width="16" border="0" alt="{t}View{/t}" title="{t}View{/t}"></a>
      {if ($perm_products)}
      <a href="edit_product.php?id={$rows[products].prod_id}"><img src="img/phpaga/edit.png" height="16" width="16" border="0" alt="{t}Edit{/t}" title="{t}Edit{/t}"></a>
      <a class="ptr" onclick="confirm_delete_product({$rows[products].prod_id}, '{$rows[products].prod_code|phpaga_popup_sanitizestr} - {$rows[products].prod_name|phpaga_popup_sanitizestr}');"><img src="img/phpaga/delete.png" height="16" width="16" border="0" alt="{t}Delete{/t}" title="{t}Delete{/t}"></a>
      {/if}
      {/strip}
    </td>

  </tr>
  {/section}

  {if (strlen($BROWSE))}
  <tr>
    <td class="browse" colspan="7"> {$BROWSE} </td>
  </tr>
  {/if}
</table>

{/if}

<!-- END {$smarty.template} -->
