{ifmodule PRODUCERS}
{if $body.dynamic_filter.producers and !$body.producer.id}
   {$body.dynamic_filter.producers = $dynamic_filter->getProducers() scope="global"}
{/if}

{ifmodule INDEXED_FILTER}
{$selectedProducers = $body.dynamic_filter.filterParams->getProducers()}
{/ifmodule}

{if $body.dynamic_filter.producers.values}
   {$indexed = $body.category.producers_indexing == 'Y'}
   {$enable_filter_search = false}
   {if $body.dynamic_filter.producers.values|count > 7}
      {$enable_filter_search = true}
   {/if}

   <div {if $focus}class="tab-pane{if !$filterFocusTabIsActive} active{/if}" id="znacky" role="tabpanel"
        {else}class="filter-row filter-producers"{/if}>
      {if $filter_openers}
         <button type="button" class="filter-label" data-opener="[data-opener-producers]">{t}Značky{/t}</button>
      {else}
         <p class="filter-label">{t}Značky{/t}</p>
      {/if}
      <div {if $filter_openers}class="opener-content"
           data-opener-producers{/if}{if $focus} data-simplebar data-simplebar-auto-hide="true"{/if}>
         {if $enable_filter_search}
            <div class="filter-search-input-wrapper" data-filter-search="producers">
               <label for="producers-search" class="fc icons_search"></label>
               <input type="text" name="producers-search" class="form-control filter-search-input" placeholder="{t}Vyhledejte psaním{/t}"
                      data-role="search-input-producers" id="producers-search">
               <span data-role="clear-producers" class="fc icons_close filter-clear" style="display:none;"></span>
            </div>
            <p data-role="show-all-producers" style="display: none" class="filter-notfound">{t}Zobrazit vše{/t}</p>
         {/if}

         <div{if $enable_filter_search} class="filter-scrollbar" data-role="search-list-producers"{/if}>
            {foreach $body.dynamic_filter.producers.values|sortby:"name" as $producer}
               <label class="custom-control custom-checkbox" for="filter_producer_{$producer.id}"
                      title="{$producer.name}">
                  <input type="checkbox" name="dynamic_filter[producerIds][]" value="{$producer.id}"
                         id="filter_producer_{$producer.id}" class="custom-control-input" data-filter-input="vyrobce"
                         {if in_array($producer.id, $selectedProducers)}checked{/if}>
                  <span class="custom-control-indicator"></span>

                  <span class="custom-control-text">
                             {if $indexed and $urlGenerator}
                                {$generated = $urlGenerator->getProducerUrl($producer.id, $producer.filter_url)}
                                <a href="{$generated.url}">{$producer.name}</a>
                             {else}
                                {$producer.name}
                             {/if}

                            <small>(<span class="filter-count" data-filter-count="{$producer.id}">{$producer.count}</span>)</small>
                         </span>
               </label>
            {/foreach}
         </div>
      </div>
   </div>
{/if}
{/ifmodule}
