{* @compiler:inline-only *}
{function renderVariationSizes}
   <div class="size-convertion-tabs {$tabType}-tabs" data-tabs="{$tabType}">
      {foreach $conversionTypes as $conversionType}
         <a href="#{$tabType}-tabs-{$conversionType|strip_accent}" class="nav-link{if $conversionType@first} active{/if}"
            data-tab-target="#tabs-{$conversionType|strip_accent}" data-tabs="nav">
            {$conversionType|upper}
         </a>
         <div class="size-convertion-tab-pane{if $conversionType@first} active{/if}" id="{$tabType}-tabs-{$conversionType|strip_accent}"
              data-tabs="content">
            <div>
               {foreach $label.values as $id => $value}
                  {if $value.conversion_type != $conversionType}
                     {continue}
                  {/if}
                  <div class="filter-secondary-check">
                     <label
                        class="custom-control size-convertion-control custom-checkbox{if $secondaryCheck} secondary-check check-{$value.conversion_id}{/if}"
                        for="filter_variant_size_convertion[{$label.convertor}][{$id}]">
                        {if $secondaryCheck}
                           <input type="checkbox" name="{$inputId}_0"
                                  class="custom-control-input" data-filter-input="{$inputId}">
                        {else}
                           <input type="checkbox" name="dynamic_filter[variationsSizeConvertion][{$label.convertor}][value][]"
                                  value="{$value.conversion_id}"
                                  id="filter_variant_size_convertion[{$label.convertor}][{$id}]" class="custom-control-input"
                                  data-filter-input="{$inputId}"
                                  {foreach $selectedVariationsSizeConvertion[$label.convertor].value as $selectedId}{if $selectedId == $value.conversion_id}checked{break}{/if}{/foreach}
                                  data-tracking-filter='{get_gtm_data encode=true type='ecommerce' method='ApplyFilterVariations' data=['id' => $id, 'label' => $label]}'>
                        {/if}

                        <span class="custom-control-indicator"></span>
                        <span class="custom-control-text"{if $secondaryCheck} title="{$conversionType|upper} {$value.name}"{/if}>
                           {if $indexed and $urlGenerator and !$secondaryCheck}
                              {$generated = $urlGenerator->getVariationUrl($id_label, $value.conversion_id, $value.filter_url)}
                              <a href="{$generated.url}"><span>{$conversionType|upper} </span>{$value.name}</a>
                           {elseif !$secondaryCheck}
                              <span>{$conversionType|upper} </span>{$value.name}
                           {/if}
                           <small>(<span class="filter-count" data-filter-count="{$id}">{$value.count}</span>)</small>
                        </span>
                     </label>
                  </div>
               {/foreach}
            </div>
         </div>
      {/foreach}
   </div>
{/function}

{function renderVariationColors}
   <div class="d-flex">
      {foreach $conversionTypes as $conversionType}
         {foreach $label.values as $id => $value}
            {if $value.conversion_type != $conversionType}
               {continue}
            {/if}
            <div class="filter-secondary-check">
               <label
                  class="filter-param-color size-convertion-control{if $secondaryCheck} secondary-check check-{$value.conversion_id}{/if}"
                  for="filter_variant_size_convertion[{$label.convertor}][{$id}]">
                  {if $secondaryCheck}
                     <input type="checkbox" name="{$inputId}_0"
                            class="custom-control-input" data-filter-input="{$inputId}">
                  {else}
                     <input type="checkbox" name="dynamic_filter[variationsSizeConvertion][{$label.convertor}][value][]"
                            value="{$value.conversion_id}"
                            id="filter_variant_size_convertion[{$label.convertor}][{$id}]" class="custom-control-input"
                            data-filter-input="{$inputId}"
                            {foreach $selectedVariationsSizeConvertion[$label.convertor].value as $selectedId}{if $selectedId == $value.conversion_id}checked{break}{/if}{/foreach}
                            data-tracking-filter='{get_gtm_data encode=true type='ecommerce' method='ApplyFilterVariations' data=['id' => $id, 'label' => $label]}'>
                  {/if}

                  <span
                     class="custom-control-text"{if $secondaryCheck} title="{$conversionType|upper} {$value.name}"{/if}{if $value.conversion_value_description} style="background: {$value.conversion_value_description};" {/if}>
                     {if $indexed and $urlGenerator and !$secondaryCheck}
                        {$generated = $urlGenerator->getVariationUrl($id_label, $value.conversion_id, $value.filter_url)}
                        <a href="{$generated.url}"><span>{$value.name}</span></a>
                     {elseif !$secondaryCheck}
                        <span>{$value.name}</span>
                     {/if}
                  </span>

                  {*
                     ID v data-filter-count pouziva metoda filter.MultiItem.updateCount() ve wpj.indexedFilter.js
                  *}
                  <span style="display: none;">(<small data-filter-count="{$id}">{$value.count}</small>)</span>
               </label>
            </div>
         {/foreach}
      {/foreach}
   </div>
{/function}

{if $id_convertor}
   {get_convertor_types id_convertor=$id_convertor assign='conversionTypes'}
{/if}

{block "filter-conversion-content"}
   <div
      class="{if $focus || $isPrimary}filter-row filter-variations filter-variations-size-convertion{else}secondary-filter-item secondary-filter-item-1{/if}">
      {if $filter_openers}
         <button type="button" class="filter-label{if !($focus || $isPrimary)} btn form-control{/if}"
                 data-opener="[data-opener-var-size-convertion-{$id_convertor}]">{$label.name}</button>
         <div class="opener-content opener-content-size-convertion" data-opener-var-size-convertion-{$id_convertor}>
            {if $isColorConvertor} {* todo convertor type? *}
               {renderVariationColors tabType='size-convertion-filter'}
            {else}
               {renderVariationSizes tabType='size-convertion-filter'}
            {/if}
         </div>
      {else}
         <p class="filter-label">{$label.name}</p>
         <div>
            {renderVariationSizes tabType='size-convertion-filter-focus'}
         </div>
      {/if}
   </div>
{/block}

