{assign var="produktas" value=1}

{assign var="entry_old" value=$entry}
{assign var="entry" value=$entry_old}

 

<div class="product-card">
    <div class="pure-g derimi">
        <div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-3-5">
            <h1 class="main-title">
                {$entry->fields.pavadinimas->value.$kalba}
            </h1>
            <div>
                {$entry->fields.aprasymas->value.$kalba}
                <br>
                <br>


                {foreach from=$entry->fields key="field" item="tmp"}
                        {if $field|skipfields:"pavadinimas,nuotrauka1,aprasymas,kaina,istrauka"}
                            {assign var="skip" value =1}
                            {capture assign="det"}
                                {$entry->fields.$field->prompts.$kalba}:
                                        {if $entry->fields.$field->type == "checkboxgroup"}
                                            {foreach from=$entry->fields.$field->value_full item="v" name="opt"}
                                                {$v.$kalba}{if !$smarty.foreach.opt.last}<br/>{/if}
                                                {assign var="skip" value=0}
                                            {/foreach}
                                        {elseif $entry->fields.$field->type == "dropdown"}
                                            {assign var="ntr" value=$entry->fields.$field->value_full[0]|chklng:$kalba}
                                            {$ntr}{if $ntr}{assign var="skip" value=0}{/if}
                                        {else}
                                            {assign var="ntr" value=$entry->fields.$field->value|chklng:$kalba}
                                            {$ntr}{if $ntr}{assign var="skip" value=0}{/if}
                                        {/if}
                                        <br/>
                            {/capture}
                            {if !$skip}{$det}{/if}
                        {/if}
                    {/foreach}


            </div>
            {if $entry->fields.istrauka->value}
            <br>
            <div>
                <a href="/uploads/Products/product_{$entry->id}/{$entry->fields.istrauka->value}" target="_blank" class="ext_button f_12 uppercase green-style">
                    {#skaityti_istrauka#}
                </a>
            </div>
          {/if}
            {*cge_have_module m='CGEcommerceBase' assign='tmp'}
            {if $tmp}
                {cgecomm_form_addtocart product=$entry->id viewcartpage=$smarty.config.cart_page addtocarttemplate="add_to_cart" addindividual="0" assign="ikrepseli"}
            {/if}

            {if $entry->fields.kaina->value || $kaina}
                   <div class="price">
                     {$entry->fields.kaina->prompts.$kalba}: <strong><span id="kaina">{if $kaina}{$kaina}{else}{$entry->fields.kaina->value}{/if}</span> Eur</strong>
                   </div>

                   {$ikrepseli}




            {else}
            <br/>
            {/if*}

            {if $entry->fields.kaina->value}
                <div class="price attr_price_container">
                    {#kaina#}:
                    <span class="brown-color original">
                    {if isset($entry->fields[$akc_field]->value) && $entry->fields[$akc_field]->value}
                                <strike>{$entry->fields.kaina->value} €</strike>
                                {$entry->fields.kaina->value|calc_discount:$entry->fields[$akc_field]->value:$disc_prc} €
                            {else}
                                {$entry->fields.kaina->value} €
                            {/if}
                    </span>

                    {if is_array($unions) && count($unions) > 0}
                        {foreach from=$unions item="un"}
                            {if $un['price'] > 0}
                                {if isset($entry->fields[$akc_field]->value) && $entry->fields[$akc_field]->value}
                                    <span class="brown-color" data-union="{$un['union_id']}" style="display: none">
                                        <strike>{$un['price']} €</strike>
                                        {$un['price']|calc_discount:$entry->fields[$akc_field]->value:$disc_prc} €
                                    </span>
                                {else}
                                    <span class="brown-color" data-union="{$un['union_id']}" style="display: none">{$un['price']} €</span>
                                {/if}
                            {/if}
                        {/foreach}
                    {/if}
                </div>
            {/if}
            <br>


            {cge_have_module m='CGEcommerceBase' assign='tmp'}
            {if $tmp}
                {cgecomm_form_addtocart product=$entry->id viewcartpage=$smarty.config.cart_page addtocarttemplate="add_to_cart" addindividual="0"}
            {/if}
            <br>



        </div>
          {if $entry->fields.nuotrauka1->value|is_array && $entry->fields.nuotrauka1->value|@count > 0}
          {assign var="num" value=0}
        <div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-2-5">
            <div class="product-gallery">
                <div class="pr-gallery-container">
                    <div class="swiper-container pr-gallery">
                        <div class="swiper-wrapper">
                          {foreach from=$entry->fields.nuotrauka1->value item="tmp"}
                              {foreach from=$tmp.images item="image"}
                              {assign var="num" value=$num+1}
                            <div class="swiper-slide">
                              <a href="{$image.img}" class="fancy" rel="prod">
                                {CGSmartImage src="`$image.img`" filter_croptofit='337,481,c,1' quality=100}
                              </a>
                            </div>
                              {/foreach}
                          {/foreach}

                        </div>
                    </div>
                </div>
                {if $num > 1}
                <div class="pr-gallery-thumbs-container">
                    <div class="swiper-container pr-gallery-thumbs">
                        <div class="swiper-wrapper">
                          {foreach from=$entry->fields.nuotrauka1->value item="tmp"}
                              {foreach from=$tmp.images item="image"}
                            <div class="swiper-slide">
                              {CGSmartImage src="`$image.img`" filter_croptofit='108,153,c,1' quality=100}
                            </div>
                              {/foreach}
                          {/foreach}

                        </div>
                    </div>
                </div>
                {/if}
            </div>
        </div>
        {/if}
    </div>
    <br>
    {TxForm form=1}
</div>


{*if $entry->fields.technical->value[$kalba]['v']|@count > 1}
    <div class="simple-tabs-container">
        <ul class="simple-tabs">
            {assign var="counter" value=1}
            {foreach from=$entry->fields.technical->value[$kalba]['v'] key="dat_key" item="dat"}
                {if $dat_key !== 'nm'}
                    <li class="{if $counter==1}selected{/if}">
                        <a href="#tab{$counter}">
                            {$dat}
                        </a>
                    </li>
                    {assign var="counter" value=$counter+1}
                {/if}

            {/foreach}
        </ul>
        <div class="simple-tabs-content">
            {assign var="counter" value=1}
            {foreach from=$entry->fields.technical->value[$kalba]['t'] key="dat_key" item="dat"}
                {if $dat_key !== 'nm'}
                    <div id="tab{$counter}"{if $counter == 1} style="display: block"{/if}>
                        {$dat}
                    </div>
                    {assign var="counter" value=$counter+1}
                {/if}
            {/foreach}
        </div>
    </div>
{/if*}


{Products summarytemplate="main" cpt=$entry->id number=5 assign="susije"}
