{extends_parent}

{block "cartbox-delivery-payments"}
   <div class="cart-box {block "cartbox-class"}{/block}">
       {foreach $payments as $id => $payment}
           {if $payment.name|strstr:'historicka'}{continue}{/if}

           {if !$payment.class->hasCartTemplate()}

               {* todo disablovat v JS aby slo projit kosikem bez js *}
              <div class="cart-box-row payment-item payment-item-{$payment.class.class|lower} {if $payment.disabled}disabled{/if}
               {if $payment.exception}disabled exception{/if} {if $body.payment_id == $id or ($tpl_vars.delivery_collapsible and $payments|count == 1)}selected{/if}" data-cart="item"
                   data-tracking-click-delivery-type='{get_gtm_data encode=true type='ecommerce' method='AddPaymentInfo' data=['payment' => $payment]}' >

                 <label for="pay{$id}" class="delivery-content custom-radio custom-control">
                    <input type="radio" name="payment_id" value="{$id}" id="pay{$id}" class="custom-control-input"
                           {if !$payment.exception}{if $body.payment_id == $id or ($tpl_vars.delivery_collapsible and $payments|count == 1)}checked{/if}{else}disabled data-exception="1"{/if}
                            {if $payment.disabled}disabled{/if}>
                    <span class="custom-control-indicator"></span>
                     {if $payment.photo}
                        <span class="img">{photo photo=$payment.photo alt=$payment.name}</span>
                     {/if}

                    <span class="name">
                        {$payment.name}
                       <span data-reload="payment_exception_{$id}">
                           {if $payment.exception}
                               {block "exception-message"}
                                  <span class="subtitle">{$payment.exception->getShortMessage()}</span>
                               {/block}
                           {/if}
                       </span>
                    </span>

                     {block "delivery-payments-price"}
                        <span class="price">
                           <span data-reload="payment_price_{$id}">
                               {$paymentPrice = $view->getPaymentPrice($id)}
                               {if $paymentPrice != null}
                                   {if $paymentPrice.value_with_vat->isPositive()}
                                       {$paymentPrice.value_with_vat_no_rounding|format_price:"ceil=no;decimal=dynamic"}
                                   {else}
                                       {t}zdarma{/t}
                                   {/if}
                               {/if}
                           </span>
                        </span>
                     {/block}
                 </label>

                  {if $payment.cart_description}
                     <div class="payment_description" id="payment_description_{$payment.id}" style="display:none">
                         {$payment.cart_description nofilter}
                     </div>
                  {/if}
              </div>
           {else}
               {$special_payment = true}
              <div class="payment-item-{$payment.class.class|lower|strip_accent} {if $payment.disabled}disabled{/if}
            {if $payment.exception}disabled exception{/if}" data-cart="item">
                  {get_smarty assign='smarty_object'}
                  {$payment.class->getCartTitle($smarty_object) nofilter}
              </div>
           {/if}
       {/foreach}
   </div>
{/block}
