{extends "account/account-wrapper.tpl"}

{block "account-content"}
   {$points = $body.active_points}

   {block "bonus-points-history"}
      {if $points}
         <div class="bonus-points bonus-points-history">
            <p>{* @formatter:off *}
            {t
            plural="Máte celkem <strong>{$points} body</strong> ve věrnostním programu."
            plural5="Máte celkem <strong>{$points} bodů</strong> ve věrnostním programu."
            count=$points pocet=$points escape=false}Máte celkem <strong>{pocet} bod</strong> ve věrnostním programu.{/t}
            {* @formatter:on *}
            </p>
         </div>
      {/if}
   {/block}

   <h2>{t}Historie bodů{/t}</h2>
   <table class="table orders-list bonus-points-table">
      <thead>
      <tr>
         <th></th>
         <th>{t}Datum{/t}</th>
         <th>{t}Body{/t}</th>
         <th>{t}Poznámka{/t}</th>
         <th>{t}Objednávka{/t}</th>
      </tr>
      </thead>

      {foreach $body.points_history as $point}
         <tr{if $point.status == "inactive"} class="inactive"{/if}>
            <td>{if $point.points > 0}<span class="fc icons_arrow-up"></span>{elseif $point.points < 0}<span class="fc icons_arrow-down"></span>{/if}</td>
            <td><span>{$point.date_created|date_format:"%d. %m. %Y"}</span></td>
            <td><strong>{if $point.points > 0 }+{/if}{$point.points}</strong></td>
            <td>
               <span>{$point.note}</span>
               {if $point.status == "inactive"}
                  <i class="bonus-points-tooltip">
                     <span class="wpj-tooltip">{t activate_time=$dbcfg.bonus_program.activate_time|default:1}K aktivaci věrnostních bodů dojde automaticky po {activate_time} dnech od vyřízení objednávky.{/t}</span>
                  </i>
               {/if}
            </td>
            <td>{if $point.id_order}<a href="{url s=orderView IDo=$point.id_order}">{$point.order_no}</a>{/if}</td>
         </tr>
         {foreachelse}
         <tr>
            <td colspan="4">{t}Prozatím nemáte žádné body.{/t}</td>
         </tr>
      {/foreach}
   </table>
   {if $body.pager.count > 1}
      {include "components/pager.tpl" pager=$body.pager}
   {/if}
{/block}
