{if $fold}

<div class="navigator">
    <div class="previous">
        {if $previous_id}
            <a href="/admin/emails/{$previous_id}">
        {/if}
        <img src="/_image/previous.png" {if !$previous_id}class="grayscale"{/if}>
        {if $previous_id}
            </a>
        {/if}
    </div>
    <div class="next">
        {if $next_id}
            <a href="/admin/emails/{$next_id}">
        {/if}
        <img src="/_image/previous.png" {if !$next_id}class="grayscale"{/if}>
        {if $next_id}
            </a>
        {/if}
    </div>
</div>

{/if}

<div style="overflow-x:auto;">
    <table class="email log">
        <tr>
            <th class="left">#ID</th>
            <th class="left">Címzett</th>
            <th class="left">Kiküldés dátuma</th>
            <th class="left">Tárgy</th>
            <th class="left">Üzenet</th>
            <th class="left">Hibaüzenet</th>
        </tr>
        {foreach $el_array as $log}
            <tr class="email-log{if $log->get_el_exception()} delete{else} tick{/if}" data-log-id="{$log->get_el_id()}">
                <td>#{$log->get_el_id()}</td>
                <td>{$log->get_el_to_name()}<br>&lt;{$log->get_el_to_email()}&gt;</td>
                <td>{$log->get_el_sent_date()}</td>
                <td>{$log->get_el_subject()}</td>
                <td>{$log->get_el_message()|truncate:50}</td>
                <td>{$log->get_el_exception()|truncate:50}</td>
            </tr>
        {/foreach}
    </table>

</div>

<div class="navigator">
    <div class="previous">
        {if $previous_id}
            <a href="/admin/emails/{$previous_id}">
        {/if}
        <img src="/_image/previous.png" {if !$previous_id}class="grayscale"{/if}>
        {if $previous_id}
            </a>
        {/if}
    </div>
    <div class="next">
        {if $next_id}
            <a href="/admin/emails/{$next_id}">
        {/if}
        <img src="/_image/previous.png" {if !$next_id}class="grayscale"{/if}>
        {if $next_id}
            </a>
        {/if}
    </div>
</div>

<script type="text/javascript">
    $('table.email.log tr.email-log').click(function() {
        window.location.href = '/admin/email/'+$(this).data('log-id');
    });
</script>
