<?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 | Acesso Alteração Pedido B2B</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.258.7.1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,600,700,400italic' rel='stylesheet' type='text/css'>
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.258.7.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.258.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.258.7.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.258.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.258.7.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.258.7.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.258.7.1">
  <style>
    #tabelaAplicacaoPCP td div button {
      padding: .0rem .5rem;
      margin-top: .1rem;
      margin-bottom: .2rem;
    }

    #tabelaAplicacaoPCP td {
      padding: 0 !important;
      padding-left: 10px !important;
    }
  </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">Alteração Pedido B2B</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 class="col-sm-6">
            </div>
          </div>
        </div>
        <div class="container-fluid" id="tabelAlteracaoPedidoB2B">
          <div class="row card">
            <div class="col-sm-12 mt-3">
              <button class="btn btn-success btn-sisp" id="btnFiltros"><span class="fas fa-search"></span> Filtros</button>
              <!-- <button class="btn btn-danger btn-sisp" id="btnNovoTemplate" onclick='window.location.href = "altpedidosb2b/create";'><span class="fas fa-plus"></span> Incluir</button> -->
              <button id="btnImprimir" class="btn-sisp btn btn-danger"><i class="fas fa-print"></i> Imprimir</button>
            </div>
            <div class="col-sm-12 table-responsive card-body">
              <h5 class="mb-5">Lista de Pedidos B2B</h5>
              <table id="tabelaAlteracaoPedidoB2B" class="table table-sm table-select table-hover" width="100%"></table>
              <thead>
                <tr></tr>
              </thead>
              <tbody>
                <tr></tr>
              </tbody>
            </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" style="margin-top: 1.4%;">
                  <div class="group-default form-group col-3">
                    <label for="txtDataEmiDe">Data Cadastro De: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataEmiDe" name="DataDe">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataEntregaDe">Data Entrega De: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataEntregaDe" name="DataDe">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataFaturaDe">Data Fatura De: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataFaturaDe" name="DataDe">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataSaidaDe">Data Saída De: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataSaidaDe" name="DataDe">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataEmiAte">Até: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control validate" id="txtDataEmiAte" name="DataAte">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataEntregaAte">Até: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control validate" id="txtDataEntregaAte" name="DataAte">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataFaturaAte">Até: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control validate" id="txtDataFaturaAte" name="DataAte">
                    </div>
                  </div>
                  <div class="group-default form-group col-3">
                    <label for="txtDataSaidaAte">Até: </label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control validate" id="txtDataSaidaAte" name="DataAte">
                    </div>
                  </div>
                </div>

                <div class="row">

                  <div class="col-lg-9">
                    <label data-error="wrong" data-success="right" for="txtPedidoConsulta">Pedido: </label>
                    <div class="input-group col-12" style="padding-left: 0px;">
                      <input type="text" class="input-default col-lg-2 col-12 focus form-control" id="txtPedidoConsulta" name="txtPedidoConsulta" class="form-control" placeholder="Pedido">
                      <button class="btn bg-danger" id="btn-PedidoConsulta" name="btn-PedidoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                      <input type="text" id="txtListaPedidos" class="form-group col-lg-12 col-12 input-default focus form-control" placeholder="Lista de Pedidos" disabled>
                      <button class="btn bg-danger" id="btn-limpa-PedidoConsulta" name="btn-limpa-PedidoConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                    </div>
                  </div>

                  <div class="col-lg-3 pl-5 pt-4">
                    <button class="btn btn-danger btn-sisp" type='button' id="btnSelecionarEmpresas">Selecionar Empresas</button>   
                  </div>

                </div>

                <div class="row" style="margin-top: 1.4%;">
                  <div class="col-4" id="ClienteConsulta">
                    <label data-error="wrong" data-success="right" for="txtClienteConsulta">Cliente: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtClienteConsulta" name="txtClienteConsulta" class="form-control" placeholder="Cliente">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-ClienteConsulta" name="btn-ClienteConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-ClienteConsulta" name="btn-limpa-ClienteConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="RepresentanteConsulta">
                    <label data-error="wrong" data-success="right" for="txtRepresentanteConsulta">Representante: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtRepresentanteConsulta" name="txtRepresentanteConsulta" class="form-control" placeholder="Representante">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-RepresentanteConsulta" name="btn-RepresentanteConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-RepresentanteConsulta" name="btn-limpa-RepresentanteConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="StatusConsulta">
                    <label data-error="wrong" data-success="right" for="txtStatusConsulta">Status: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtStatusConsulta" name="txtStatusConsulta" class="form-control" placeholder="Status">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-StatusConsulta" name="btn-StatusConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-StatusConsulta" name="btn-limpa-StatusConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>
                </div>

                <div class="row" style="margin-top: 1.4%;">
                  <div class="col-4" id="TabPrecoConsulta">
                    <label data-error="wrong" data-success="right" for="txtTabPrecoConsulta">Tabela de Preço: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTabPrecoConsulta" name="txtTabPrecoConsulta" class="form-control" placeholder="Tabela de preço">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-TabPrecoConsulta" name="btn-TabPrecoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-TabPrecoConsulta" name="btn-limpa-TabPrecoConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="ColecaoConsulta">
                    <label data-error="wrong" data-success="right" for="txtColecaoConsulta">Coleção: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtColecaoConsulta" name="txtColecaoConsulta" class="form-control" placeholder="Coleção">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-ColecaoConsulta" name="btn-ColecaoConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-ColecaoConsulta" name="btn-limpa-ColecaoConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="TipoProdConsulta">
                    <label data-error="wrong" data-success="right" for="txtTipoProdConsulta">Tipo Produto: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTipoProdConsulta" name="txtTipoProdConsulta" class="form-control" placeholder="Tipo produto">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-TipoProdConsulta" name="btn-TipoProdConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-TipoProdConsulta" name="btn-limpa-TipoProdConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                </div>

                <div class="row" style="margin-top: 1.4%;">
                  <div class="col-4" id="GrupoPedConsulta">
                    <label data-error="wrong" data-success="right" for="txtGrupoPedConsulta">Grupo Pedido: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtGrupoPedConsulta" name="txtGrupoPedConsulta" class="form-control" placeholder="Grupo pedido">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-GrupoPedConsulta" name="btn-GrupoPedConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-GrupoPedConsulta" name="btn-limpa-GrupoPedConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="GrupoProdConsulta">
                    <label data-error="wrong" data-success="right" for="txtGrupoProdConsulta">Grupo Produto: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtGrupoProdConsulta" name="txtGrupoProdConsulta" class="form-control" placeholder="Grupo produto">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-GrupoProdConsulta" name="btn-GrupoProdConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-GrupoProdConsulta" name="btn-limpa-GrupoProdConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                  <div class="col-4" id="TipoVendaConsulta">
                    <label data-error="wrong" data-success="right" for="txtTipoVendaConsulta">Tipo Venda: </label>
                    <div class="input-group">
                      <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTipoVendaConsulta" name="txtTipoVendaConsulta" class="form-control" placeholder="Tipo Venda">
                      <div class="input-group-append">
                        <button class="btn bg-danger" id="btn-TipoVendaConsulta" name="btn-TipoVendaConsulta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                        <button class="btn bg-danger" id="btn-limpa-TipoVendaConsulta" name="btn-limpa-TipoVendaConsulta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                      </div>
                    </div>
                  </div>

                </div>

                <div class="row" style="margin-top: 1.4%;">
                  <div class="group-default form-group col-4">
                    <label for="">Financeiro: </label>
                    <div class="relative">
                      <select name="" id="txtBloqFinConsulta" value="" class="form-group input-default">
                        <option value="">Todos</option>
                        <option value="1">Liberados</option>
                        <option value="0">Bloqueados</option>
                      </select>
                    </div>
                  </div>
                  <div class="group-default form-group col-4">
                    <label for="">Comercial: </label>
                    <div class="relative">
                      <select name="" id="txtBloqComConsulta" value="" class="form-group input-default">
                        <option value="">Todos</option>
                        <option value="1">Liberados</option>
                        <option value="0">Bloqueados</option>
                      </select>
                    </div>
                  </div>
                  <div class="group-default form-group col-4">
                    <label for="">Situação: </label>
                    <div class="relative">
                      <select name="" id="txtSituacaoConsulta" value="" class="form-group input-default">
                        <option value="">Todos</option>
                        <option value="P">Pendentes</option>
                        <option value="F">Faturados</option>
                      </select>
                    </div>
                  </div>
                </div>
              </div>

              <div class="modal-footer d-flex align-items-end">
                <div class="row col-12 ml-0">
                  <div class="col-lg-4 col-sm-6 col-md-6 ml-0 pl-0">
                    <label for="txtOrdem">Opção de Relatório:</label>
                    <div class="relative d-flex align-items-center">
                      <select id="txtOrdem" class="input-default focus custom-select">
                      </select>
                      <button class="btn btn-sm btn-success ml-2 btnEdicaoRelatorio" title="Edição de ordenações">
                        <i class="fas fa-check"></i>
                      </button>
                    </div>
                  </div>
                  <div class="col-6 col-lg-8 d-flex justify-content-end align-items-end pr-0">
                    <div class="d-flex">
                      <button class="btn btn-primary btn-sisp mr-2" id="btnLimparFiltros" style="background-color: #B22222; border-color: #B22222">
                        <span class="fas fa-trash"></span> Limpar Filtros
                      </button>
                      <button id="btnConsultar" class="btn btn-primary btn-sisp" type="button">
                        <span class="fas fa-search"></span> Consultar
                      </button>
                    </div>
                  </div>
                </div>
              </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.258.7.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.258.7.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.258.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/sisplan.js?versao=3.258.7.1"></script>
  <script src="utils/funcoes.js?versao=3.258.7.1"></script>
  <script src="utils/cookies.js?versao=3.258.7.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.258.7.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.258.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.258.7.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="config.js?versao=3.258.7.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.258.7.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;

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

      sArquivo = `${BASE_URI}/pages/altpedidoB2B/acesso_altpedidoB2B/acesso_altpedidoB2B.js?versao=3.258.7.1`;
      insereJavaScriptPagina(sArquivo);

    });
  </script>
</body>

</html>