{* factory_template_winner *}

<hr />

{capture assign="nr_of_items"}{$winneritems|@count}{/capture}
{capture assign="nr_of_items_min"}{math equation="x - 1" x=$winneritems|@count}{/capture}

{if $nr_of_items}
<h3>{$winner_p_text}</h3><br />
{/if}

{section name="i" start="0" loop=$nr_of_items step="1"}
    {assign var=prev_key value=$smarty.section.i.index-1}
    {assign var=key value=$smarty.section.i.index}
    {assign var=next_key value=$smarty.section.i.index+1}


{* header *}
{if $key == 0}
<table cellspacing="2" cellspacing="2" border="0" width="99%">
    <thead>
    <tr>
        <th>{$prize_code_text}</th>
        <th>{$title_text}</th>
        <th>{$name_text}</th>
        {* <th>{$email_text}</th> *}
        {* <th>{$phone_text}</th> *}
        <th>{$coupon_code_text}</th>
    </tr>
    </thead>
    <tbody>
{/if}
{if $key == 0 || $winneritems[$key]->period_title ne $winneritems[$prev_key]->period_title}
    <tr>
        <td colspan="6"><strong>{$winneritems[$key]->action_title} / {$winneritems[$key]->period_title}</strong></td>
    </tr>        
{/if}
{* /header *}

{* body *}
    <tr bgcolor="{cycle values="#888888,#999999"}">
        <td>{$winneritems[$key]->prize_code}</td>  
        <td>{$winneritems[$key]->prize_title}</td>
        <td>{$winneritems[$key]->first_name} {$winneritems[$key]->last_name}</td>
        {* <td><a href="mailto:{$winneritems[$key]->email}">{$winneritems[$key]->email}</a></td> *}
        {* <td>{$winneritems[$key]->dashed_phone}</td> *}
        <td>{$winneritems[$key]->dashed_coupon_code}</td>
   </tr>
{* /body *}

{* footer *}
{if $key == $nr_of_items_min}   
    </tbody>
</table>
{/if}
{* footer *}

{/section}

<hr />

{* /factory_template_winner *}