{include "filter/filter.side.tpl"}

<div class="filter-top">
   {if !$tpl_vars.filter_sorting}
      {$tpl_vars.filter_sorting = [
      ['id' => "", "name" => "{t}Doporučujeme{/t}"],
      ['id' => "-3", 'name' => "{t}Nejdražší{/t}"],
      ['id' => "3", 'name' => "{t}Nejlevnější{/t}"],
      ['id' => "-5", 'name' => "{t}Nejprodávanější{/t}"]
      ]}
   {/if}
   {include "filter/filter.sort.radio.tpl" show_label=$show_label}

   <div class="custom-filters">
      <p class="uptitle filter-top-col">{t}Upřesnit výběr{/t}</p>
      {$count = 0}
      {foreach $body.dynamic_filter.parameters as $id_parameter => $parameter}
         {if $parameter.values and $parameter.value_type != "float" and $count < 2}
            {$inputId = $parameter.name|strip_accent}
            <div class="secondary-filter-item secondary-filter-item-{$id_parameter} filter-top-col">
               <button type="button" class="filter-label btn form-control" data-opener="[data-opener-param-{$parameter.id}-f]">{$parameter.name}</button>
               <div class="opener-content" data-opener-param-{$parameter.id}-f>
                  <div>
                     {foreach $parameter.values as $value}
                        <div class="filter-secondary-check">
                           <label class="custom-control custom-checkbox secondary-check check-{$value.id} activity-filter-item"
                                  for="filter_params[{$id_parameter}][{$value.id}]">
                              <i class="fc icons_{$icons_table[$value.id]}"></i>
                              <input type="hidden" name="{$inputId}_0"{* value="{$value.id}"*}
                                     class="custom-control-input" data-filter-input="{$inputId}">
                              <span class="custom-control-indicator"></span>

                              <span class="custom-control-text" title="{$value.name}{if $parameter.unit} {$parameter.unit}{/if}">
                                       <small>(<span class="filter-count" data-filter-count="{$value.id}">{$value.count}</span>)</small>
                                  </span>
                           </label>
                        </div>
                     {/foreach}
                  </div>
               </div>
            </div>
            {$count = $count + 1}
         {/if}
      {/foreach}
      {$selectedProducers = $body.dynamic_filter.filterParams->getProducers()}
      {if $body.dynamic_filter.producers.values}
         {$indexed = $body.category.producers_indexing == 'Y'}
         <div class="secondary-filter-item secondary-filter-item-producers filter-top-col">
            <button type="button" class="filter-label btn form-control" data-opener="[data-opener-producers-f]">{t}Výrobce{/t}</button>
            <div class="opener-content" data-opener-producers-f>
               <div>
                  {foreach $body.dynamic_filter.producers.values as $producer}
                     <div class="filter-secondary-check">
                        <label class="custom-control custom-checkbox secondary-check check-{$producer.id} {if in_array($producer.id, $selectedProducers)} checked{/if}" for="filter_producer_{$producer.id}"
                               title="{$producer.name}">
                           <input type="hidden" name="{$producer.id}_0" value="{$producer.id}"
                                  data-filter-input="vyrobce"/>
                           <span class="custom-control-indicator"></span>
                           <span class="custom-control-text">
                              {$producer.name}
                              <small>(<span class="filter-count" data-filter-count="{$producer.id}">{$producer.count}</span>)</small>
                           </span>
                        </label>
                     </div>
                  {/foreach}
               </div>
            </div>
         </div>
      {/if}

      <div class="filter-top-col">
         <a href="" class="btn btn-secondary btn-toggle-filters" data-toggle="filters">
            <span class="fc icons_filter"></span>{t}Další vlastnosti{/t}
         </a>
      </div>
   </div>
</div>

{if $isB2BUser}
   <div class="filter-b2b-wrapper">
      <div class="filter-list-projection">
         <p>{t}Zobrazení{/t}</p>
         <div class="btn-group">
            <input type="radio" name="show" value="2" id="sh2" {if $body.listShow == 2}checked{/if}
                   data-filter-input="{t}zobrazeni{/t}">
            <label for="sh2" title="{t}Seznam{/t}">
               <i class="fc icons_list_projection-list"></i>
            </label>
            <input type="radio" name="show" value="1" id="sh1" {if $body.listShow == 1}checked{/if}
                   data-filter-input="{t}zobrazeni{/t}">
            <label for="sh1" title="{t}Karty{/t}">
               <i class="fc icons_list_projection-cells"></i>
            </label>
         </div>
      </div>
   </div>
{/if}

{if !$hide_reset}
   {include "filter/filter.reset.tpl"}
{/if}
