{extends "index.tpl"}

{block "body"}
   <div style="max-width: 700px; margin: 30px auto 0;">
      <h1 class="m-b-2">Seznam emailů a SMS</h1>

      {include "block.messages.tpl"}

      {if $body.emails != false}
         {foreach $body.emails|array_reverse:true as $id =>$email}
            {if !isset($email.number_id)}
               <p><a href="{$id}" style="font-size: 1.2em;font-weight: 700;">{$email.subject|default:"bez_predmetu"}</a> - {$email.time|date_format:"%R %d.%m.%y"}</p>
               <ul>
                  <li><b>Od:</b> {$email.from}</li>
                  <li><b>Pro:</b> {$email.to}</li>
                   {if $email.cc}
                  <li><b>Cc:</b> {$email.cc}</li>
                  {/if}
                  {if $email.bcc}
                  <li><b>Bcc:</b> {$email.bcc}</li>
                  {/if}
                  {if $email.replyTo}
                  <li><b>Reply-To:</b> {$email.replyTo}</li>
                  {/if}
                  {if $email.id}
                  <li><b>Id:</b> {$email.id}</li>
                  {/if}
                  {if $email.attachment}
                     <li><strong>Přílohy:</strong>
                        <ul>
                           {foreach $email.attachment as $attachment_id => $attach}
                               <li><a href="{$id}/attachment/{$attachment_id}" target="_blank">{$attach.2}</a></li>
                           {/foreach}
                        </ul>
                     </li>
                  {/if}
               </ul>
            {else}
               <ul>
                  <li>
                     <b>SMS: </b>{$email.time}
                     <ul>
                        <li><b>Number ID:</b> {$email.number_id}</li>
                        <li><b>Pro:</b> {$email.to}</li>
                        <li><b>Text:</b> {$email.body}</li>
                     </ul>
                  </li>
               </ul>
            {/if}

         {/foreach}
      {/if}
   </div>
{/block}
