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

{block "title"}
   <h1>{$view->getTitle()}</h1>
{/block}

{block "account-content"}
   <table class="table table-shopping-lists">
      <thead>
      <tr>
         <th>{t}Název{/t}</th>
         <th>{t}Počet položek{/t}</th>
         <th>{t}Datum vytvoření{/t}</th>
         <th></th>
      </tr>
      </thead>
      <tbody>
      {foreach $body.lists as $list}
         <tr>
            <td>
               <a href="{path('kupshop_shoppinglist_shoppinglist_showshoppinglistproducts', ['listId'=>$list.id])}">
                  {$list.name|default:"{t}bez názvu{/t}"}
               </a>
            </td>
            <td>{$list.pocet}</td>
            <td>{$list.date|date_format:"%d. %m. %Y"}</td>

            <td class="link">
               {*<a href="{path('kupshop_shoppinglist_shoppinglist_addentirelisttocart', ['listId'=>$list.id])}">
                  <span class="fc icons_cart"></span>
               </a>*}
               <a data-wpj-focus="{path('kupshop_content_focus_focuslazy', ['template' => 'shopping-list-share', 'listId'=>$list.id, 'listHash'=>$list.hash, 'listName' => $list.name|default:"{t}bez názvu{/t}"])}" href="">
                  <span class="fc icons_share"></span>
               </a>
               {if $list.label == 'favorites'}
                  <a disabled style="pointer-events: none; opacity: .2;">
               {else}
                  <a data-wpj-focus="{path("kupshop_content_focus_focuslazy", ['template' => 'shopping-list-rename','listId' => $list.id, 'listName' => $list.name|default:"{t}bez názvu{/t}"])}"
                  href="" data-wpj-focus-remove-on-close="1">
               {/if}
                  <span class="fc icons_edit"></span>
               </a>
               {if $list.label == 'favorites'}
                  <a disabled style="pointer-events: none; opacity: .2;">
               {else}
                  <a href="{path('kupshop_shoppinglist_shoppinglist_remove', ['id'=>$list.id])}"
                           data-list-delete="{$list.name|default:"{t}bez názvu{/t}"}"
                           data-info-message="{t}Opravdu chcete smazat seznam{/t}">
               {/if}
                  <span class="fc icons_trash"></span>
               </a>
            </td>
         </tr>
         {foreachelse}
         <tr>
            <td colspan="4">{t}Prozatím nemáte žádné seznamy.{/t}</td>
         </tr>
      {/foreach}
      </tbody>
   </table>
   {$url = path('kupshop_shoppinglist_shoppinglist_createshoppinglist')}
   <button type="button" class="btn btn-primary" data-focus-opener="shopping-list">{t}Vytvořit nový seznam{/t}</button>
   {include "focus/focus.add-shopping-list.tpl" class="shopping-list" onlyCreate=true}
{/block}

{block "js-entry" append}
   {encore_entry_script_tags entry='shopping_list'}
{/block}
