{extends "focus/focus.base.tpl"}

{block "focus-content"}
    {if !$product}
        {$product = $body.product}
    {/if}
   <div class="focus-wrapper category-quickbuy">
      <div class="product-top">
         <div>
            <h3 class="heading-reset title">
                {$product.title nofilter}
            </h3>
         </div>
      </div>
       {if $product.variations|count > 1}
          <div class="variations-content">
             <p class="description">Vyberte balení</p>
             <form action="{url s=cart}" method="get" data-buy-form class="catalog-buy-form" data-filter="noreload">
                <input type="hidden" name="act" value="add">
                <input type="hidden" value="1" name="redir">
                <input type="hidden" name="IDproduct" value="{$product.id}">
                <input type="hidden" name="No" value="1">
                 {foreach $product.variations.variations as $variation}
                     {calc_product_discount product=$product variation=$variation assign='discount'}
                    <input name="IDvariation" type="radio" value="{$variation.id}" id="var_{$variation.id}"
                           data-filter="noreload"
                           {if $variation@iteration == 1}checked{/if}>
                    <label for="var_{$variation.id}"
                           class="variation-item {if $soldout}soldout {if findModule('watchdog')}watchdog{else}disable{/if}{/if}">
                       <div class="photo">
                           {$variationPhoto = false}
                           {foreach $variation.photos as $photo}
                               {$variationPhoto = $photo}
                               {break}
                           {/foreach}

                           {if $variationPhoto}
                              <div class="color-variation">
                                 <img src="{get_photo photo=$variationPhoto size='product_variations'}"
                                      alt="{$product.title} {$variation.value_1}" width="54" height="54"
                                      class="img-responsive">
                              </div>
                           {/if}
                       </div>

                       <div class="price-block-variation price-variation">
                          <p class="value">{$variation.title}</p>
                          <div class="price-submit">
                              {if $discount.discount->asFloat() >= 1}
                                 <p class="price-common red-text"
                                    data-price-common>{$variation.productPrice|format_price}</p>
                              {else}
                                 <p class="price">{$variation.productPrice|format_price}</p>
                              {/if}
                          </div>
                       </div>

                       <div class="discount">
                           {if $discount.discount->isPositive()}
                              <span class="flag flag-discount">{t discount=$discount.discount->asFloat()|round}-{discount}%{/t}</span>
                           {/if}
                       </div>
                    </label>
                 {/foreach}
                <button type="submit" class="btn btn-insert" data-close
                        data-submit-btn{if $dbcfg.analytics.google_tag_manager.active_fe_events == 'Y'} data-tracking-clickAddToCart='{get_gtm_data encode=true type='ecommerce' method='ClickAddToCart' data=['product' => $product, 'listType' => $listType, 'listId' => $listId]}'{/if}>
                    {$submit_text|default:"{t}Vložit do košíku{/t}" nofilter}
                </button>
             </form>

          </div>
       {/if}
   </div>
{/block}
