<?php include_once('../../../config.php') ?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Preço por Cor e Tamanho</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.2511.13.1">
    <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.2511.13.1">
    <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.2511.13.1" />
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2511.13.1">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.2511.13.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.2511.13.1">
    <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.2511.13.1" type="text/css" />
    <link rel="stylesheet" href="dist/css/sisplan.adjustDataTableButtons.css?versao=3.2511.13.1" type="text/css" />
    <style>
        #tabelaPreco td div button {
            padding: .0rem .5rem;
            margin: .0rem;
        }

        #tabelaPreco td {
            padding: 5px 8px !important;
        }

        .table.dataTable tbody td,
        th {
            white-space: normal;
            word-break: break-word;
            overflow: hidden;
            font-size: 12px;
        }

        #tabelaPreco_length {
            margin-top: 15px;
        }

        #btnNovoPreco,
        #btnImportarPreco,
        #btnDuplicar {
            margin-left: 6px !important;
        }

        .border-Field .textoBorda {
            font-size: 1.1em !important;
            text-align: left !important;
            width: auto;
            padding: 0 10px;
            border-bottom: none;
        }


        .border-Field {
            border: 1px solid var(--font-color) !important;
            padding: 0 0 0 1.0em !important;
            margin: 0 0 1.0em 0 !important;
            -webkit-box-shadow: 0px 0px 0px 0px #000;
            box-shadow: 0px 0px 0px 0px #000;
            border-radius: 3px;
            margin-bottom: -10px !important;
            margin-top: -10px !important;
            margin-left: 30px !important;
        }

        #btnImportarPreco {
            background-color: #474747 !important;
            border-color: #343a40 !important;
        }

        #btnRecalcularPreco {
            margin-left: 5px !important;
        }

        #btnRecalcularPreco {
            background-color: #75BE25 !important;
        }

        #txtAviso {
            margin-left: 8px;
        }

        #btnCarregar {
            width: 173px;
            height: 39px;
            margin-top: 27px;
        }

        .dataTables_scroll {
            margin-top: -5px !important;
        }

        .modal-medium {
            width: 700px
        }
    </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed">
    <div class="wrapper">
        <div class="content-wrapper">
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                        <div class="col-sm-6 flex">
                            <h1 class="m-0 text-dark">Preço por Cor e Tamanho</h1>
                            <button type="button" class="btn btn-info btn-sm ml-2" title="Tutorial" style="color: white;" id="tutorial">
                                <i class="fas fa-question-circle"></i></button>
                        </div>
                    </div>
                </div>
                <div class="container-fluid" id="tabelaPrecoForne">
                    <div class="row card">
                        <div class="col-sm-12 d-flex justify-content-between" style="margin-top: 8px; padding-left: 20px; padding-right: 20px; z-index: 9999;">
                            <div class="d-flex align-items-center mt-2">
                                <button class="btn btnFiltros btn-sisp" id="btnFiltros"><span class="fas fa-filter"></span> Filtros</button>
                                <button class="btn btn-danger btn-sisp" id="btnNovoPreco"><span class="fas fa-plus"></span> Incluir</button>
                                <button class="btn btn-danger btn-sisp" id="btnRecalcularPreco"> Recalcular</button>
                                <button class="btn btn-primary btn-sisp" disabled id="btnDuplicar" title="Necessário ter uma tabela de preço filtrada e um produto selecionado!"><span class="fas fa-copy"></span> Duplicar</button>
                                <button class="btn btn-danger btn-sisp" id="btnImportarPreco"> Importar</button>
                            </div>
                        </div>
                        <div class="col-sm-12 table-responsive card-body" style="margin-top: -15px; height: 80vh">
                            <table id="tabelaPreco" class="table table-sm table-sm-sisp table-select table-hover" width="100%">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-xl" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Filtros</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <div class="row">
                                <div class="col-lg-6  col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtTabPreco">Tabela de Preço:</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control validate" required aria-describedby="tabPrecoError" id="txtTabPreco" name="txtTabPreco" class="form-control" placeholder="Tabela de Preço">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnTabPreco" name="btnTabPreco" data-button="absolute" type="button">
                                                <i class="m-0 p-0 fas fa-search"></i>
                                            </button>
                                            <button class="btn bg-danger" id="btnExcluiTabPreco" type="button">
                                                <i class="m-0 p-0 fas fa-trash"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="group-default form-group col-sm-12 col-lg-6">
                                    <label for="">Tipo:</label>
                                    <div class="relative">
                                        <select name="" id="txtTipo" value="" class="form-group input-default">
                                            <option value="">Todos</option>
                                            <option value="P">Produto</option>
                                            <option value="M">Material</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-6  col-12 form-group" id="produtotuto">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtProduto">Produto:</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" required aria-describedby="produtoError" id="txtProduto" name="txtProduto" class="form-control" placeholder="Produto">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button">
                                                <i class="m-0 p-0 fas fa-search"></i>
                                            </button>
                                            <button class="btn bg-danger" id="btnExcluiProduto" type="button">
                                                <i class="m-0 p-0 fas fa-trash"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6  col-12 form-group" id="materialtuto">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtMaterial">Material:</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" required aria-describedby="materialError" id="txtMaterial" name="txtMaterial" class="form-control" placeholder="Material">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnMaterial" name="btnMaterial" data-button="absolute" type="button">
                                                <i class="m-0 p-0 fas fa-search"></i>
                                            </button>
                                            <button class="btn bg-danger" id="btnExcluiMaterial" type="button">
                                                <i class="m-0 p-0 fas fa-trash"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <div class="row">
                                <button class="btn btn-primary btn-sisp" id="btnConsultar"><span class="fas fa-search"></span> Consultar</button>
                                <button class="btn btn-danger btn-sisp marginBtnH" id="btnLimparFiltros"><span class="fas fa-trash"></span> Limpar Filtros</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-duplicar" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-medium" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Duplicar<span id="modal-duplicar-produto"></span></h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <div class="row">
                                <div class="col-lg-12  col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtTabPreco">Tabela de Preço: *</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control validate" required aria-describedby="tabPrecoError" id="txtTabPreco-dup" name="txtTabPreco-dup" class="form-control" placeholder="Tabela de Preço">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnTabPreco-dup" name="btnTabPreco-dup" data-button="absolute" type="button">
                                                <i class="m-0 p-0 fas fa-search"></i>
                                            </button>
                                            <button class="btn bg-danger" id="btnExcluiTabPreco-dup" type="button">
                                                <i class="m-0 p-0 fas fa-trash"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <div class="row">
                                <button class="btn btnVerde btn-sisp" id="btnConfirmarDuplicar"><span class="fas fa-check"></span> Confirmar</button>
                                <button class="btn btn-danger btn-sisp marginBtnH" id="btnCancelarDuplicar"><span class="fas fa-times"></span> Cancelar</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-recalcular-preco" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-xl" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Recalcular Preço</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <div class="row col-xl-12 col-12 mt-4">
                                <div class="form-group col-xl-3 col-12">
                                    <label data-error="wrong" data-success="right" for="txtRecalcularTabelaPreco">Tabela de Preço *</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control" id="txtRecalcularTabelaPreco" name="txtRecalcularTabelaPreco" placeholder="Tabela de Preço">
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnRecalcularTabelaPreco" name="btnRecalcularTabelaPreco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btnRecalcularLimpaTabelaPreco"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xl-9 col-12"></div>
                                <div class="form-group col-xl-2 col-12">
                                    <label data-error="wrong" data-success="right" for="rgTipoItemRecalcularPreco">Tipo</label>
                                    <select style="width:100%;" class="form-control select2 select2-danger focus" data-dropdown-css-class="select2-danger" id="rgTipoItemRecalcularPreco" class="custom-select focus">
                                        <option value="0">0 - Produto</option>
                                        <option value="1">1 - Material</option>
                                    </select>
                                </div>
                                <div class="col-lg-8 col-12 form-group" id="ProdutoInfoTour">
                                    <label id="labelRecalcularProdutoMaterial" data-error="wrong" data-success="right" for="txtRecalcularProdutoMaterial">Produto:</label>
                                    <div class="input-group">
                                        <select class="js-example-programmatic js-states form-control" id="txtRecalcularProdutoMaterial" name="txtRecalcularProdutoMaterial" multiple="multiple">
                                        </select>
                                        <div class="input-group-append">
                                            <button class="btn bg-danger" id="btnRecalcularProdutoMaterial" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                            <button class="btn bg-danger" id="btnRecalcularLimpaProdutoMaterial" name="btnRecalcularLimpaProdutoMaterial" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group col-xl-2 col-12 d-flex justify-content-start align-items-end">
                                    <button class="btn btn-primary btn-sisp" id="btnRecalcularConsultar"> Consultar</button>
                                </div>
                                <div class="col-xl-8 col-12"></div>
                                <div class="form-group col-xl-2 col-12">
                                    <label data-error="wrong" data-success="right" for="txtRecalcularDescontoPreco">Desconto %</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control text-right" maxlength="10" id="txtRecalcularDescontoPreco" name="txtRecalcularDescontoPreco" placeholder="Desconto %">
                                        <button title="Aplicar desconto nos itens abaixo" id="btnRecalcularAplicarDesconto" type="button" class="btn btn-sm btn-danger"><i class="fas fa-check"></i></button>
                                    </div>
                                </div>
                                <div class="form-group col-xl-2 col-12">
                                    <label data-error="wrong" data-success="right" for="txtRecalcularDescontoPrecoFixo">Valor Fixo $</label>
                                    <div class="input-group">
                                        <input type="text" class="input-default focus form-control text-right" maxlength="10" id="txtRecalcularDescontoPrecoFixo" name="txtRecalcularDescontoPrecoFixo" placeholder="Valor Fixo">
                                        <button title="Aplicar desconto nos itens abaixo" id="btnRecalcularAplicarDescontoFixo" type="button" class="btn btn-sm btn-danger"><i class="fas fa-check"></i></button>
                                    </div>
                                </div>
                                <div class="col-xl-12 col-12 mt-4 pt-4 table-responsive">
                                    <table id="tabelaRecalcularPreco" class="table table-sm table-select table-hover">
                                        <thead>
                                            <tr>
                                                <th>Tabela</th>
                                                <th>Desc. Tabela</th>
                                                <th>Código</th>
                                                <th>Descrição</th>
                                                <th>Preço antigo</th>
                                                <th>Preço novo</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <div class="row">
                                <button class="btn btn-danger btn-sisp" id="btnRecalcularGravar"> Gravar</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-importar-preco" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-xl" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Importar Preço</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close" title="Fechar">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                    <div class="form-row col-xl-12 col-12">
                        <div class="form-group col-xl-3 col-6">
                            <label data-error="wrong" data-success="right" for="dtPromocaoIniImportar">Data Promoção de/até: </label>
                            <div class="input-group" style="gap: 8px">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtPromocaoIniImportar" name="dtPromocaoIniImportar" class="form-control" title="INICIO da promoção">
                                <input type="date" max="2500-12-31" class="input-default focus form-control" id="dtPromocaoFimImportar" name="dtPromocaoFimImportar" class="form-control" title="FINAL da promoção">
                            </div>
                        </div>
                        <div class="form-group col-xl-2 col-6">
                            <label for="selectTipoImportar">Tipo:</label>
                            <select id="selectTipoImportar" class="input-default focus custom-select" title="Selecione se é referente a material ou produto o preço que você vai importar">
                                <option id="optionProduto" selected value="P">Produto</option>
                                <option id="optionMaterial" value="M">Material</option>
                            </select>
                        </div>
                        <div class="form-group col-xl-5 col-10">
                            <label data-error="wrong" data-success="right" for="txtArquivoImportar">Arquivo: </label>
                            <div class="input-group">
                                <input type="text" class="input-default focus form-control" id="txtArquivoImportar" name="txtArquivoImportar" title="Arquivo que será importado" placeholder="Arquivo" disabled>
                                <input type="file" id="mdModalUpload" class="d-none">
                                <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnAddArquivo" name="btnAddArquivo" type="file" for="txtArquivoImportar" title="Botão para anexar o arquivo que será importado"><i class="m-0 p-0 fas fa-folder-plus"></i> </button>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-xl-2 col-2 d-flex pr-0 justify-content-end align-items-end">
                            <button class="btn btn-primary w-100" style="max-width: 120px" id="btnCarregarImportar" title="Botão para carregar. Clicar aqui após anexar o arquivo."> Carregar</button>
                        </div>
                        <label data-error="wrong" data-success="right" style="margin-left: 5px;" for="txtArquivoImportar">Para o Funcionamento Correto da Importação, o Arquivo Excel deve conter
as informações na mesma ordem que se encontra no Grid Abaixo! </label>
                        <div class="col-xl-12 col-12 table-responsive card-body">
                            <table id="tabelaImportar" class="table table-sm table-select table-hover" width="100%">
                                <thead>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                        <div class="d-none">
                            <pre id="fileContent"></pre>
                        </div>
                    </div>
                </div>
                <div class="modal-footer px-3">
                    <div class="row col-12 justify-content-start">
                        <button class="btn btn-primary btn-sisp ml-auto" disabled id="btnConfirmarImportar"> Confirmar</button>
                    </div>
                </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php
    include_once('../../../modais.php')
    ?>
    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    </div>
    <script src="plugins/jquery/jquery.min.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.2511.13.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.2511.13.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
<<<<<<< Updated upstream
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/sisplan.js?versao=3.2511.13.1"></script>
    <script src="utils/funcoes.js?versao=3.2511.13.1"></script>
    <script src="utils/cookies.js?versao=3.2511.13.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.2511.13.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/driver.min.js?versao=3.2511.13.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.2511.13.1"></script>
    <script src="plugins/select2/js/select2.full.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="config.js?versao=3.2511.13.1"></script>
=======
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/sisplan.js?versao=3.2511.13.1"></script>
    <script src="utils/funcoes.js?versao=3.2511.13.1"></script>
    <script src="utils/cookies.js?versao=3.2511.13.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.2511.13.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/driver.min.js?versao=3.2511.13.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.2511.13.1"></script>
    <script src="plugins/select2/js/select2.full.min.js?versao=3.2511.13.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.2511.13.1"></script>
    <script type="text/javascript" src="config.js?versao=3.2511.13.1"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
>>>>>>> Stashed changes
    <script>
        $(document).ready(async function() {
            if (getCookie('usuario') == "") {
                window.location.href = `${BASE_URI}/login`;
                return;
            }

            let usuario = getCookie('usuario');
            let empresa = getCookie('empresa');

            ipInterno = IP_INTERNO;
            ipExterno = IP_EXTERNO;
            basicAuth = BASIC_AUTH;

            const temAcesso = await temAcessoTela('PRECOCORTAM');
            if (!temAcesso.resultado) {
                toastrAcesso(temAcesso, BASE_URI);
                return;
            }

            sArquivo = `${BASE_URI}/pages/precocortam/acesso_precocortam/acesso_precocortam.js?versao=3.2511.13.1`;
            insereJavaScriptPagina(sArquivo);

        });
    </script>
</body>

</html>