{$closed = $body.payment_id|strpos:"`$payment.id`-" !== 0}

{foreach $object->getAvailableMethods() as $name => $method}
   {$method_id = "{$id}-{$name}"}
   <div class="cart-box-row payment-item payment-item-gp payment-item-{$name|lower|strip_accent}
         {if $method@index >= $tpl_vars.online_payment_visible_items and $closed}hidden" style="display: none;{/if}">
      <label for="pay{$method_id}" class="delivery-content custom-radio custom-control">
         <input type="radio" name="payment_id" value="{$method_id}" class="custom-control-input" id="pay{$method_id}"
                {if $body.payment_id == $method_id}checked{/if}>
         <span class="custom-control-indicator"></span>
         {block "gopay-img"}
            <span class="img"><img src="{$method.image}" title="{$method.name}" alt="{$method.name}"
                                   style="width: 75px; height: auto;"></span>
         {/block}
         <span class="name"><strong>{block "method-name"}{$method.name}{/block}</strong></span>
         <span class="price">
            <span data-reload="payment_price_{$method_id}">
                {block "payment-price"}
                   {if $payment.price.value_with_vat->isPositive()}
                      {$payment.price.value_with_vat|format_price}
                   {else}
                      {t}zdarma{/t}
                   {/if}
                {/block}
            </span>
         </span>
      </label>
   </div>
   {if $method@index == ($tpl_vars.online_payment_visible_items - 1) and $closed and !$method@last}
      <div class="cart-box-row payment-item thepay-method payments-list">
         <p>
            <strong>{t}Platba online pomocí GoPay{/t}</strong>
            {t}Vyberte si z možností platby online{/t}
         </p>
         <div>
            {foreach $object->getAvailableMethods() as $name => $method}
               {if $method@index > ($tpl_vars.online_payment_visible_items - 1) and $method@index < 5}
                  <img src="{$method.image}" title="{$method.name}" alt="{$method.name}" class="payment-item-small">
               {/if}
            {/foreach}
         </div>
         <div>
            <a href="" class="more" id="gopay-more"
               title="{t}Zobrazit více platebních metod{/t}">{t}vybrat platbu{/t}</a>
         </div>
      </div>
   {/if}
{/foreach}

<script>
   wpj.onReady.push(function() {
      $('body').on('click', '#gopay-more', function() {

         $(this).closest('.payments-list').hide();
         $('.payment-item.hidden').removeClass('hidden').fadeIn();

         return false;
      });
   });
</script>
