<div class="modal modal-forma-pagamento"   tabindex="-1" role="dialog">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class='modal-header'>
            <h4 class="modal-title">Formas de pagamento</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class='fa fa-times'></i></span></button>
            </div>
            <div class="modal-body">
                <ul class="nav nav-tabs" id="tabPaynav" role="tablist">
                    <?php
                    $x = 0;
                    foreach (CONF_GATEWAY as $gates):
                                            
                        ?>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link <?= ($x == 1 ? 'active' : '') ?>" id="<?= $gates['method'] ?>-tab" data-toggle="tab" data-target="#<?= $gates['method'] ?>" type="button" role="tab" aria-controls="<?= $gates['method'] ?>" aria-selected="false">
                                <img src='<?= SITE ?>dist/image/<?= $gates['cover'] ?>' height='20'>&nbsp;<?= getMethod($gates['method'])[1] ?>
                            </button>
                        </li>
                        <?php
                         $x++;
                    endforeach;
                    ?>
                </ul> 
                <div class="tab-content" id="tabPayContent">
                    <?php
                    $x = 0;
                    foreach (CONF_GATEWAY as $gates):
                                            
                        ?>
                        <div class="tab-pane fade show <?= ($x == 1 ? ' active' : '') ?>" id="<?= $gates['method'] ?>" role="tabpanel" aria-labelledby="<?= $gates['method'] ?>-tab">
                            <div class="row">
                                <div class='col-lg-7 '>
                                    <div class=' parcelamento-content'>
                                        <?php if ($gates['descount']): ?>
                                            <button class="btn btn-outline-success"><?= $gates['descount'] ?>% de desconto</button>
                                        <?php endif; ?>
                                        <?php
                                        $desconto = 0;
                                        if(!empty(CONF_INSTANT_PRICE['descount'])):
                                        $desconto = Porcentagem("XN", tofloat($ProdutoPrice), CONF_INSTANT_PRICE['descount']);
                                        endif;
                                        $instant_desconto = str_price($desconto);
                                        $instant_price = (tofloat($ProdutoPrice) - $desconto);
                                        $no_bandeira = ['credit_card','debit_card'];
                                        if (!in_array($gates['method'],$no_bandeira)):
                                            echo "<img src='" . SITE . "dist/image/{$gates['cover']}' title='{$gates['name']}' height='30' alt='{$gates['name']}'>";
                                            echo "<div class='ModalPriceProduto'>Pague apenas: <span class='PriceProduto'>R$ " . $instant_price . "</span></div><br>";
                                        else:
                                            if ($gates['brands']):
                                                $bandeiras = explode("|", $gates['brands']);
                                            echo "<br><small class='text-center'>Bandeiras aceitas</small>";
                                                echo '<ul class="bandeiras-cartao">';
                                                foreach (getBrands() as $cards):
                                                    if(in_array($cards['id'],$bandeiras)):
                                                    echo "<img src='" . SITE . $cards['brand']."' height='20' title='{$cards['name']}' alt='{$cards['name']}'>";
                                                    endif;
                                                endforeach;
                                                echo '</ul>';
                                            endif;
                                        endif;
                                        ?>
                                    </div>
                                </div>
                                <div class='col-lg-5 '>
                                    <div class='parcelamento-description'>

                                        <?php
                                        switch ($gates['method']):
                                            case "credit_card":
                                                echo '<ul class="parcelas-cartao">';
                                                echo "<li ><span><b>Número de parcelas</b></span> <span><b>Valor da Parcela</b></span></li>";
                                                foreach (produtoParcelamento($ProdutoPrice, $ProdutoMaxParcela, $ProdutoMaxParcelaJuros) as $parcela):
                                                    echo "<li ><span><b>".($parcela['parcela']==1?"À Vista":"{$parcela['parcela']}x")."</b></span> <span>R$ " . str_price_usa($parcela['valor']) . " (Total: <b>".str_price($parcela['total'])."</b>)</span></li>";
                                                endforeach;
                                                echo '</ul>';
                                                break;
                                        endswitch;
                                        ?>

                                    </div>
                                </div>
                            </div>
                        </div>


                        <?php
                        $x++;
                    endforeach;
                    ?>
                </div>
            </div>
            <div class='modal-footer'>
                <small>*Favor consultar as condições de pagamento na página de pagamento</small>
            </div>
        </div>
    </div>
</div>