{$winner_message}

{if $prizeitemcount > 0}

<h3>{$prize_p_text}</h3>

<table cellspacing="0" class="pagetable">
    <thead>
    <tr>
        <th class="pagew10">{$number_text}</th>
        <th>{$title_text}</th>
        <th>{$action_period_text}</th> 
        <th>{$given_number_text}</th>
        <th>{$free_number_text}</th>
        <th class="pageicon">{$draw_coupon_text}</th>   
    </tr>
    </thead>
    <tbody>
    {foreach from=$prizeitems item=entry}
    
    {capture assign="cycle"}{cycle values="row1,row2"}{/capture}
    <tr class="{$cycle}" onmouseover="this.className='{$cycle}hover';" onmouseout="this.className='{$cycle}';">
        <td>{$entry->number}x</td>
        <td>{$entry->title} ({$entry->coupon_prize_id})</td>
        <td>{$entry->action_title} {*({$entry->coupon_action_id})*} / {$entry->period_title} {*({$entry->coupon_period_id})*}</td>
        <td>{$entry->given}</td>
        <td>{$entry->free}</td>
        <td>{$entry->draw_link}</td>
   </tr>
   {/foreach}
   </tbody>
</table>
{/if}

<br />

{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>
{/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}
    {capture assign="cycle"}row1{/capture}

{* header *}
{if $key == 0}
<table cellspacing="0" class="pagetable" border="0">
    <thead>
    <tr>
        <th class="pagew10">{$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>
        <th class="pageicon">{$withdraw_coupon_text}</th>
    </tr>
    </thead>
    <tbody>
{/if}
{if $key == 0 || $winneritems[$key]->period_title ne $winneritems[$prev_key]->period_title}
    <tr class="{$cycle}">
        <td colspan="9"><strong>{$winneritems[$key]->action_title} / {$winneritems[$key]->period_title}</strong></td>
    </tr>        
{/if}
{* /header *}

{* body *}
    {if $cycle == 'row1'}
            {capture assign="cycle"}row2{/capture}
    {else}
            {capture assign="cycle"}row1{/capture}
    {/if}
    <tr class="{$cycle}" onmouseover="this.className='{$cycle}hover';" onmouseout="this.className='{$cycle}';">
        <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>
        <td>{$winneritems[$key]->withdraw_link}</td>
   </tr>
{* /body *}

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

{/section}
