{$icons_table = [
1330 => 'sections_lezeni',
1328 => 'sections_cestovani',
19587 => 'sections_beh',
19955 => 'sections_bezecke-lyzovani',
19586 => 'sections_cyklistika',
1261 => 'sections_zimni_sporty',
19953 => 'sections_skialpinismus',
1260 => 'sections_turistika',
1250 => 'sections_volny-cas',
1249 => 'sections_aktivni-pohyb',
1349 => 'sections_kempovani',
19954 => 'sections_sjezdove-lyzovani'
] scope='global'}

{include "filter/filter.side.tpl" icons_table=$icons_table}

<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.tpl" show_label=$show_label}

   <div class="custom-filters">
      <label class="title">{t}Upřesnit výběr{/t}</label>

      {if $body.category.parents[0] == '53'}
         {foreach $body.dynamic_filter.filter->getSectionsByLevel(0, 2) as $sections}
            <div class="secondary-filter-item secondary-filter-item-sections">
               <button type="button" class="filter-label btn form-control" data-opener="[data-opener-sections-filter]">{t}Kategorie{/t}</button>
               <div class="opener-content" data-opener-sections-filter style="display: none">
                  <div>
                     {foreach $sections as $section}
                        <div class="filter-secondary-check">
                           <label class="custom-checkbox custom-control secondary-check check-{$section.id}" for="filter_section[0][2][{$section.id}]">
                              <input class="custom-control-input" type="checkbox" name="sections_filter_0"{* value="{$section.id}"*}
                                     data-filter-input="sections_filter">
                              <span class="custom-control-indicator"></span>
                              <span class="custom-control-text" title="{$section.name}">
                                 <small>(<span class="filter-count" data-filter-count="{$section.id}">{$section.count}</span>)</small>
                              </span>
                           </label>
                        </div>
                     {/foreach}
                  </div>
               </div>
            </div>
         {/foreach}
      {/if}

      {foreach $body.dynamic_filter.variations as $id_label => $label}
         {if $label@iteration == 1 and $label.values}
            {$inputId = $label.name|strip_accent}
            <div class="secondary-filter-item secondary-filter-item-1">
               <button type="button" class="filter-label btn form-control" data-opener="[data-opener-var-1]">{$label.name}</button>
               <div class="opener-content" data-opener-var-1 style="display: none">
                  <div>
                     {foreach $label.values as $id =>$value}
                        <div class="filter-secondary-check">
                           <label class="custom-control custom-checkbox secondary-check check-{$id}" for="filter_variant[{$id_label}][{$id}]">
                              <input type="checkbox" name="{$inputId}_0"{* value="{$id}"*}
                                     class="custom-control-input" data-filter-input="{$inputId}">
                              <span class="custom-control-indicator"></span>
                              <span class="custom-control-text" title="{$value.name}">
                                 <small>(<span class="filter-count" data-filter-count="{$id}">{$value.count}</span>)</small>
                              </span>
                           </label>
                        </div>
                     {/foreach}
                  </div>
               </div>

            </div>
         {/if}
      {/foreach}

      {foreach $body.dynamic_filter.parameters as $id_parameter => $parameter}
         {if $parameter.values and $id_parameter == 60 and $body.category.parents[0] != '53'}
            {$inputId = $parameter.name|strip_accent}
            <div class="secondary-filter-item secondary-filter-item-{$id_parameter}">
               <button type="button" class="filter-label btn form-control" data-opener="[data-opener-param-{$parameter.id}]">{$parameter.name}</button>
               <div class="opener-content" data-opener-param-{$parameter.id} style="display: none">
                  <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>
         {elseif $parameter.values and $id_parameter == 88}
            {$inputId = $parameter.name|strip_accent}
            <div class="secondary-filter-item secondary-filter-item-{$id_parameter}">
               <button type="button" class="filter-label btn form-control"
                       data-opener="[data-opener-param-{$parameter.id}]">{t}Barva{/t}</button>
               <div class="opener-content" data-opener-param-{$parameter.id} style="display: none">
                  <div class="secondary-filter-color">
                     {foreach $parameter.values as $value}
                        <div class="filter-secondary-check">
                           <label class="filter-param-color secondary-check check-{$value.id}" for="filter_params[{$id_parameter}][{$value.id}]" title="{$value.name}">
                              <input type="hidden" name="{$inputId}_0" {*value="{$value.id}"*}
                                      data-filter-input="{$inputId}">
                              <span {if $value.description}style="background: {$value.description};"{/if}></span>
                           </label>
                        </div>
                     {/foreach}
                  </div>
               </div>
            </div>
         {/if}
      {/foreach}

      <a href="" class="btn btn-primary btn-toggle-filters" data-toggle="filters"><i class="fc icons_filters"></i>
         <span class="desktop-version">{t}Další vlastnosti{/t}</span>
         <span class="mobile-version">{t}Upřesnit výběr{/t}</span>
      </a>
   </div>
</div>

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