<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Sisplan Web | Integração GS1
    </title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.264.8.1">
    <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.264.8.1">
    <link rel="stylesheet" href="dist/css/custom.css?versao=3.264.8.1">
    <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.264.8.1">
    <link rel="stylesheet" href="dist/css/sisplan.newColorsButtons.css?versao=3.264.8.1">
    <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.264.8.1">
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.264.8.1">
    <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.264.8.1">
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.264.8.1" />
    <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.264.8.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="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.264.8.1">
</head>
<style>
    #msform {
        text-align: start;
        position: relative;
    }

    .ajustPadding {
        padding: 0px !important
    }

    .bordaProduto {
        padding-top: .5%;
        border: solid #e0e4e6;
        border-radius: 6px;
        border-width: 2px;
        margin-right: 0px !important;
    }

    .arredondarCantos {
        border-top-right-radius: 4px !important;
        border-bottom-right-radius: 4px !important;
    }

    .card {
        padding: 1.5rem;
        border-top: 2px outset #ddd;
        margin-top: 20px;
        padding-top: 20px;
    }

    .pagination {
        justify-content: end;
    }

    .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 1.0em 1.0em 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 !important;
    }

    table.dataTable thead th,
    table.dataTable tbody td,
    tabelaProdutos_info {
        text-align: left !important;
        white-space: nowrap;
    }

    .borderBottom {
        border-bottom: 1px dashed #000;
    }

    .color-green {
        color: green;
    }

    .color-red {
        color: red;
    }
</style>

<body class="hold-transition sidebar-mini layout-fixed">

    <script type="text/javascript" src="config.js"></script>
    <main class="wrapper">

        <div class="content-wrapper">
            <div class="content-header">
                <div class="col-12 text-left p-0 mt-3 mb-2">
                    <div class="card px-0 pt-4 pb-0 mt-3 mb-3">
                        <div class="flex ajustPadding">
                            <h2 class="col-3">
                                <strong class="ml-3">Integração GS1</strong>
                                <button type="button" class="btnTutorial" style="margin-top: -10px!important;" id="tutorial">
                                    <i class="fas fa-question-circle"></i>
                                </button>
                            </h2>
                        </div>
                        <div class="row">
                            <div class="col-md-12 mx-0" style="padding:0px 30px 0px 30px !important">
                                <form id="msform">
                                    <fieldset>
                                        <div class="form-card" id="formcard1">
                                            <div class="row mt-3">

                                                <div class="form-group col-3">
                                                    <label for="txtDataCadastroIni">Data Cadastro de/até </label>
                                                    <div class="input-group">
                                                        <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDataCadastroIni" value="1200-01-01" name="DataDe">
                                                        <input type="date" max="2500-12-31" class="input-default focus form-control" id="txtDataCadastroFim" value="2500-12-31" name="DataAte">
                                                    </div>
                                                </div>


                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtProduto">Código</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtProduto" name="txtProduto" class="form-control" placeholder="Codigo">
                                                        <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="btnLimpaProduto" name="btnLimpaProduto" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Coleção</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtColecao" name="txtColecao" class="form-control" placeholder="Coleção">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnColecao" name="btnColecao" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaColecao" name="btnLimpaColecao" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Marca</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtMarca" name="txtMarca" class="form-control" placeholder="Marca">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnMarca" name="btnMarca" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaMarca" name="btnLimpaMarca" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Grupo</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtGrupo" name="txtGrupo" class="form-control" placeholder="Grupo">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnGrupo" name="btnGrupo" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaGrupo" name="btnLimpaGrupo" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Linha</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtLinha" name="txtLinha" class="form-control" placeholder="Linha">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnLinha" name="btnLinha" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaMarca" name="btnLimpaMarca" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Categoria</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtCategoria" name="txtCategoria" class="form-control" placeholder="Categoria">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnCategoria" name="btnCategoria" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaCategoria" name="btnLimpaCategoria" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-3" id="tutoPedido">
                                                    <label for="txtPedido">Cor</label>
                                                    <div class="input-group">
                                                        <input type="text" autocomplete="off" class="input-default focus form-control validate" id="txtCor" name="txtCor" class="form-control" placeholder="Cor">
                                                        <div class="input-group-append">
                                                            <button class="btn bg-danger" id="btnCor" name="btnCor" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-search"></i>
                                                            </button>
                                                            <button class="btn bg-danger" id="btnLimpaCor" name="btnLimpaCor" data-button="absolute" type="button">
                                                                <i class="m-0 p-0 fas fa-trash"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-6 form mt-2" id="tipos">
                                                <fieldset class="form border-Field mb-0 pb-0">
                                                    <legend class="textoBorda mb-0 pb-0">Opções</legend>
                                                    <div class="form-row">
                                                        <div class="icheck-primary form-group form-check">
                                                            <input type="checkbox" class="form-check-input" id="cbProdAtivo">
                                                            <label class="form-check-label pr-2" for="cbProdAtivo">Somente PRODUTOS ativos</label>
                                                        </div>
                                                        <div class="icheck-primary form-group form-check">
                                                            <input type="checkbox" class="form-check-input" id="cbCoresAtivas">
                                                            <label class="form-check-label pr-2" for="cbCoresAtivas">Somente CORES ativas</label>
                                                        </div>
                                                        <div class="icheck-primary form-group form-check">
                                                            <input type="checkbox" class="form-check-input" id="cbProdSemGtin">
                                                            <label class="form-check-label pr-2" for="cbProdSemGtin">Somente PRODUTO sem GTIN</label>
                                                        </div>
                                                    </div>
                                                </fieldset>
                                            </div>
                                        </div>

                                        <div class="col-sm-12" style="margin-top: 15px">
                                            <table id="tabelaProdutos" class="table table-sm-sisp table-select table-hover text-start" width="100%">
                                                <thead>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                        </div>

                                        <div class="d-flex justify-content-end flex-wrap gap-2 mt-2 mb-2 listaBotoes ajustaBotao[2]">
                                            <button type="button" name="consultar" id="btnConsultar" class="btn btn-primary marginBtnH"><i class="fas fa-search"></i> Consultar</button>
                                            <button type="button" name="exportar" id="btnExportar" class="btn btnFiltros marginBtnH" disabled><i class="fas fa-file-export"></i> Exportar</button>
                                            <button type="button" name="informacoes" id="btnInformacoes" class="btn btn-sisp btn-secondary marginBtnH"><i class="fas fa-file-invoice"></i> Inf. Padrões</button>
                                        </div>
                                    </fieldset>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-resultado" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Resultado da Exportaçã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">
                                <div class="col-sm-12" style="margin-top: 15px">
                                    <table id="tabelaResultado" class="table table-sm-sisp table-select table-hover text-start" width="100%">
                                        <thead>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <div class="btn-group">
                                <button title="Tenta enviar novamente somente as barras que deram erro." id="btnTentarNovamente" class="btn btn-primary">
                                    <span class="fas fa-sync-alt pr-1"></span> Tentar Novamente
                                </button>
                            </div>
                            <div class="btn-group">
                                <button id="btnConfirmaResultado" class="btn btnVerde">
                                    <span class="fas fa-check pr-1"></span> Confirmar
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="modal-infos" class="modal" tabindex="-1" role="dialog">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content" id="modalBody">
                        <div class="modal-header">
                            <h4 class="modal-title">Informações Padrões GS1</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-3 form-group">
                                    <label for="txtFuncionario">Segmento</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtSegmento" name="txtSegmento" class="form-control" placeholder="Segmento">
                                    </div>
                                </div>

                                <div class="col-3 form-group">
                                    <label for="txtFamilia">Família</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtFamilia" name="txtFamilia" class="form-control" placeholder="Família">
                                    </div>
                                </div>

                                <div class="col-3 form-group">
                                    <label for="txtClasse">Classe</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtClasse" name="txtClasse" class="form-control" placeholder="Classe">
                                    </div>
                                </div>

                                <div class="col-3 form-group">
                                    <label for="txtSubclasse">Subclasse</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtSubclasse" name="txtSubclasse" class="form-control" placeholder="Subclasse">
                                    </div>
                                </div>

                                <div class="col-6 form-group">
                                    <label for="txtNomeUrl">Nome URL</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtNomeUrl" name="txtNomeUrl" class="form-control" placeholder="Nome URL">
                                    </div>
                                </div>

                                <div class="col-6 form-group">
                                    <label for="txtUrl">URL</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtUrl" name="txtUrl" class="form-control" placeholder="URL">
                                    </div>
                                </div>

                                <div class="col-3 form-group">
                                    <label for="txtTipoUrl">Tipo URL</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtTipoUrl" name="txtTipoUrl" class="form-control" placeholder="Tipo URL">
                                    </div>
                                </div>

                                <div class="col-9 form-group">
                                    <label for="txtMarca">Marca</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtMarca" name="txtMarca" class="form-control" placeholder="Marca">
                                    </div>
                                </div>

                                <div class="col-4 form-group">
                                    <label for="txtPaisOrigem">País Origem</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtPaisOrigem" name="txtPaisOrigem" class="form-control" placeholder="País Origem">
                                    </div>
                                </div>

                                <div class="col-4 form-group">
                                    <label for="txtPaisDestino">País Destino</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtPaisDestino" name="txtPaisDestino" class="form-control" placeholder="País Destino">
                                    </div>
                                </div>

                                <div class="col-4 form-group">
                                    <label for="txtUnidadePesoBruto">Unidade Peso Bruto</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtUnidadePesoBruto" name="txtUnidadePesoBruto" class="form-control" placeholder="Unidade Peso Bruto">
                                    </div>
                                </div>
                                
                                <div class="col-12 mb-2 borderBottom">
                                    <h3>
                                        <i class="fas fa-key"></i>
                                        Informações de Autenticação
                                    </h3>
                                </div>
                            
                                <div class="col-4 form-group">
                                    <label for="txtClientId">Client Id *</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtClientId" name="txtClientId" class="form-control" placeholder="CLIENT_ID">
                                    </div>
                                </div>

                                <div class="col-4 form-group">
                                    <label for="txtSecretId">Secret Id *</label>
                                    <div class="input-group">
                                        <input type="password" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtSecretId" name="txtSecretId" class="form-control" placeholder="SECRET_ID">
                                    </div>
                                </div>

                                <div class="col-4 form-group">
                                    <label for="txtCompany">Company *</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtCompany" name="txtCompany" class="form-control" placeholder="COMPANY">
                                    </div>
                                </div>

                                <div class="col-6 form-group">
                                    <label for="txtUsuario">Usuário *</label>
                                    <div class="input-group">
                                        <input type="text" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtUsuario" name="txtUsuario" class="form-control" placeholder="Usuário">
                                    </div>
                                </div>

                                <div class="col-6 form-group">
                                    <label for="txtSenha">Senha *</label>
                                    <div class="input-group">
                                        <input type="password" autocomplete="off" class="input-default focus form-control" aria-describedby="ufError" id="txtSenha" name="txtSenha" class="form-control" placeholder="Senha">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <div class="btn-group">
                                <button id="btnSalvarInfoPadrao" class="btn btnVerde">
                                    <span class="fas fa-save pr-1"></span> Salvar
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <?php include_once('../../modais.php'); ?>
    </main>

    <script src="plugins/jquery/jquery.min.js?versao=3.264.8.1"></script>
    <script src="dist/js/jquery.maskMoney.min.js?versao=3.264.8.1"></script>
    <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.264.8.1"></script>
    <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.264.8.1"></script>
    <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.264.8.1"></script>
    <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.264.8.1"></script>
    <script src="plugins/toastr/toastr.min.js?versao=3.264.8.1"></script>
    <script>
        $.widget.bridge('uibutton', $.ui.button);
    </script>
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.264.8.1"></script>
    <script src="dist/js/adminlte.min.js?versao=3.264.8.1"></script>
    <script src="dist/js/requisicoes.js?versao=3.264.8.1"></script>
    <script src="dist/js/loadingoverlay.min.js?versao=3.264.8.1"></script>
    <script src="dist/js/valida_cpf_cnpj.js?versao=3.264.8.1"></script>
    <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.264.8.1"></script>
    <script src="dist/js/dataTables.keyTable.js?versao=3.264.8.1"></script>
    <script src="dist/js/sisplan.js?versao=3.264.8.1"></script>
    <script src="utils/funcoes.js?versao=3.264.8.1"></script>
    <script src="utils/cookies.js?versao=3.264.8.1"></script>
    <script src="dist/js/driver.min.js?versao=3.264.8.1"></script>
    <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.264.8.1"></script>
    <script type="text/javascript" src="dist/js/sum().js?versao=3.264.8.1"></script>
    <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;
            sArquivo = `${BASE_URI}/pages/integracao_gs1/integracao_gs1.js?versao=3.264.8.1`;
            const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

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

            await insereJavaScriptPagina(sArquivo);

            habilitaCamposObrigatoriosTela(nomeTela);
        });
    </script>
</body>

</html>