{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[
$(function() {
  tableToGrid("#DemandsByStatusView", {
    caption:'Заявки по статусам',
    colModel: [
      {name: "sprstatus_color", width:10, align:"center", sortable: false},
      {name: "sprstatus_name", width:100, align:"left", sortable: false},
      {name: "sprstatus_count", width:100, align:"right", sortable: false}
    ],
    width:220,
    height:"auto"
  });
});
//]]>
</script>
{/literal}

{foreach $ArrDemands as $val}
  {if $val@first}
    {$VarTotal=0}
<table id="DemandsByStatusView">
  <thead>
    <tr>
      <th id="sprstatus_color">&nbsp;</th>
      <th id="sprstatus_name">Статус</th>
      <th id="sprstatus_count">Количество</th>
    </tr>
  </thead>
  <tbody>
  {/if}
    <tr>
      <td><div style="background-color: {$val.sprstatus_color};">&nbsp;</div></td>
      <td><a class="ui-state-default" href="/{$MS_SP->Sp_PathTop}/OpDemands.php?sprstatus_id={$val.sprstatus_id}">{$val.sprstatus_name}</a></td>
      <td>{$val.cnt}{$VarTotal=$VarTotal+$val.cnt}</td>
    </tr>
  {if $val@last}
    <tr>
      <td></td>
      <td></td>
      <td><div style="font-weight: bold;">Всего: {$VarTotal}</div></td>
    </tr>
  </tbody>
</table>
  {/if}
{/foreach}