{extends "index.tpl"}

{block "meta-robots"}
   {if $smarty.get.search}
      <meta name="robots" content="noindex, follow">
   {else}
      {$smarty.block.parent}
   {/if}
{/block}

{block "content"}
   <div class="page-search {if !$body.searching}page-search-empty{/if}">
      {if $body.searching}
         <h1>{t}Nalezené zboží{/t}</h1>
         {$products = $body.results.products}
         <p class="m-y-1">{t}Hledaný výraz{/t}: <strong>{$body.search}</strong> |
            {t plural="Nalezeny" plural5="Nalezeno" count=$products.pager.total}Nalezena{/t}
            <strong>{$products.pager.total}&nbsp;{t plural="položky" plural5="položek" count=$products.pager.total}položka{/t}
            </strong>
         </p>

         {block "search-producer"}
            {if $body.results.producers.list}
               <h3>{t}Značky{/t}</h3>
               <ul class="list-inline search-producer">
                  {foreach $body.results.producers.list as $producer}
                     <li><a href="{url s=category IDcat=0 IDpd=$producer.id producerTitle=$producer.name}">{$producer.name}</a></li>
                  {/foreach}
               </ul>
            {/if}
         {/block}

         {block "search-categories"}
            {if $body.results.sections.list}
               <h3>{t}Kategorie{/t}</h3>
               <ul class="list-inline search-category">
                  {foreach $body.results.sections.list as $section}
                     <li><a href="{url s=redir type='category' id=$section.id}">{$section.name}</a></li>
                  {/foreach}
               </ul>
            {/if}
         {/block}

         <div id="productList" class="p-t-1" data-tooltip-wrapper>
            {if $products.list|count}
               {include "block.pager.tpl" pager=$body.pager}
               {include "block.products.tpl" products=$products.list}
               {include "block.pager.tpl" pager=$products.pager}
            {else}
               {insert_page type="EMPTY_SEARCH" exists='exists'}
               {if !$exists}
                  <div class="alert alert-info" role="alert">
                     {t}Nenalezeno žádné zboží odpovídající těmto vlastnostem{/t}
                  </div>
               {/if}
            {/if}
         </div>
      {else}
         <h1>{$body.title}</h1>
         <form name="search" method="get" action="{url s=search}" class="form-inline p-y-1 text-center search-form" role="form">
            <input type="hidden" name="s" value="search">
            <div class="form-group">
               <input type="text" name="search" value="{$body.search}" maxlength="100" class="form-control autocomplete-control" id="search" autocomplete="off"
                      title="{t}Zadejte hledaný výraz{/t}" placeholder="{t}Zadejte hledaný výraz{/t}">
               <button type="submit" class="btn btn-primary">{t}Hledat{/t}</button>
            </div>
         </form>
      {/if}

      {*
         {block 'search-articles'}
            {if $cfg.module.articles  &&  $body.searching_articles eq 1}
               <div class="content-block">
                  <h2>Nalezené články</h2>
                  {if count($body.articlesList) > 0}
                     {include "block.articles.tpl" articles=$body.articlesList}
                  {else}
                     <div class="alert alert-info" role="alert">
                        Nenalezeny žádné články
                     </div>
                  {/if}
               </div>
            {/if}
         {/block}
      *}

   </div>
{/block} 
