<?php
include_once "../bd/funcoes.inc";
include_once "../bd/bd_produtos.inc";
include "../auxiliar/parametros.inc";
include '../idiomas/config.inc';


if ($seleciona_tabela_de_preco == 1) {
    $tabelaDePrecos = lecookie('tabelaDePrecos');
    $codusu = lecookie('codusu');

    $tabelasDePreco = getTabelasDePreco($codusu);
    foreach ($tabelasDePreco as $t) {

        if ($tabelaDePrecos == $t["codprodtabela"])
            $tabelaSelecionada = $t;
    }
?>







    <div class="btn-group">
        
        <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
            <?php echo $tabelaSelecionada['descricao']; ?>
            <span class="caret"></span>
        </button>

        <ul class="dropdown-menu">

            <?php foreach ($tabelasDePreco as $tabela) { ?>
                <li <?php if ($tabelaDePrecos == $tabela["codprodtabela"]){ echo 'style="background-color: #f2f2f2;" ';} ?>>

                        <?php if ($GLOBALS['is_venda']) {?>

                            <a href="#" onclick="setSelectedTabela('<?php echo $tabela['codprodtabela']; ?>')" data-toggle="modal" data-target="#modal-confirma-alteracao-preco-ao-selecionar-tabela">
                                <?php echo $tabela["descricao"]; ?>
                            </a>

                        <?php } else { ?>

                            <a href="#" onclick="setSelectedTabela('<?php echo $tabela['codprodtabela']; ?>');selectTabelaDePreco(false)" data-toggle="modal">
                                <?php echo $tabela["descricao"]; ?>
                            </a>

                        <?php } ?>

                </li>
            <?php } ?>
        </ul>
        
    </div>





<?php } ?>