{extends "index.tpl"}

{block "meta-robots"}
   <meta name="robots" content="noindex, nofollow">
{/block}

{block "google_tag_manager"}
   {include 'block.analytics.gtm.tpl' pageType='search'}
{/block}

{block "content"}
   <div class="page-search">
      {if $body.searching}
         <div class="search-wrapper">
            <h1>{t}Nalezené zboží{/t}</h1>

            {$products = $body.results.products}
            {$total = $products.pager.total}
            <p class="m-y-1">{t}Hledaný výraz{/t}: <strong>{$body.search}</strong> | {t pocet=$total escape=False}Nalezeno <strong>{pocet} položek</strong>{/t}</p>

            {if $body.results.sections.list}
               <h4>{t}Kategorie{/t}</h4>
               <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}

            {if $body.results.producers.list}
               <h4>{t}Značky{/t}</h4>
               <ul class="list-inline search-producer">
                  {foreach $body.results.producers.list as $producer}
                     <li><a href="{url s=category IDpd=$producer.id producerTitle=$producer.name}">{$producer.name}</a></li>
                  {/foreach}
               </ul>
            {/if}
         </div>
         <div id="productList" class="p-t-1" data-tooltip-wrapper>
            {if count($products.list) gt 0}
               <div class="hidden-lg-down p-b-2">
                  {include "components/pager.tpl" pager=$body.results.products.pager}
               </div>
               {include "block.products.tpl" products=$body.results.products.list}
               {include "components/pager.tpl" pager=$body.results.products.pager}
            {else}
               <div class="alert alert-info" role="alert">
                  {t}Nenalezeno žádné zboží odpovídající těmto vlastnostem{/t}
               </div>
            {/if}
         </div>
      {else}
         <div class="search-wrapper">
            <h1>{$body.title}</h1>
            <form name="search" method="get" action="{url s=search}" class="form-horizontal p-t-1 search-form" role="form">
               <div class="form-group row">
                  <input type="hidden" name="s" value="search">
                  <div class="col-xxs-12 col-sm-9 p-b-1">
                     <input type="text" name="search" value="{$body.search}" class="form-control" placeholder="{t}Hledaný výraz{/t}">
                  </div>
                  <div class="col-xxs-12 col-sm-3 p-b-1">
                     {block "search-button"}
                        <input type="submit" class="btn btn-primary btn-primary--green btn-block" name="submit" value="{t}Hledat{/t}">
                     {/block}
                  </div>
               </div>
            </form>
         </div>
      {/if}

   </div>
{/block} 
