<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Relatório de Cotação</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.265.7.1">

  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="dist/css/custom.css?versao=3.265.7.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.265.7.1">
  <link rel="stylesheet" type="text/css" href="plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.265.7.1">
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.265.7.1" />
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.265.7.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.265.7.1" />
  <link rel="stylesheet" href="plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.265.7.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.265.7.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.265.7.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.265.7.1">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.datatables.net/select/1.6.0/css/select.dataTables.min.css">

  <style>
    .table.dataTable tbody td,
    th {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }

    .dataTables_length {
      margin-top: 0.90rem !important;
    }

    .dataTables_filter>label {
      margin-top: 0.275rem !important;
      margin-bottom: 0rem !important;
    }

    #divTabelaNotas .dataTables_scrollHeadInner table {
      width: 100% !important;
    }

    #divTabelaNotas .dataTables_scrollHeadInner {
      width: 100% !important;
    }

    .bordaCampos {
      border: solid #e0e4e6;
      border-radius: 4px;
      border-width: 2px;
      padding-top: 2%;
      padding-bottom: 0%;
    }

    .bordaCampos:first-child {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-items: center;
    }

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

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

    #btnSelecionarEmpresas {
      margin-top: 8px !important;
      height: 43px;
      width: 170px;
    }
  </style>
</head>

<body class="hold-transition sidebar-mini layout-fixed">
  <main 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">Relatório de Cotação</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">
          <div class="row card">
            <div class="col-sm-12 mt-2">
              <button class="btn btn-success btn-sisp" id="btnFiltros"><span class="fas fa-search"></span> Filtros</button>
              <button id="btnImprimir" class="btn-sisp btn btn-danger"><i class="fas fa-print"></i> Imprimir</button>
            </div>
            <div class="row">
              <div class="col-sm-6 d-flex justify-content-center align-items-center" style="height: 100%;">
                <div id="graficosNotas" class="mt-5" style="width: 100%;"></div>
              </div>
              <div class="col-sm-6 d-flex justify-content-center align-items-center" style="height: 100%;">
                <div id="graficosNotas1" class="mt-5" style="width: 100%;"></div>
              </div>
            </div>
            <div class="col-sm-12 table-responsive">
              <h5>Lista de Cotações</h5>
              <table id="tabelaCotacoes" class="table table-sm-sisp table-select table-hover" width="100%">
              </table>
            </div>
          </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 d-flex">
            <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="flex flex-wrap w-100">
              <div class="form-group col-xl-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCotacoes">Cotações:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtCotacoes" name="txtCotacoes" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCotacoes" name="btnCotacoes" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaCotacoes" name="btnLimpaCotacoes" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-xl-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCodigos">Códigos:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtCodigos" name="txtCodigos" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCodigos" name="btnCodigos" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaCodigos" name="btnLimpaCodigos" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-xl-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtFornecedores">Fornecedores:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtFornecedores" name="txtFornecedores" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnFornecedores" name="btnFornecedores" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaFornecedores" name="btnLimpaFornecedores" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-xl-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCores">Cores:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtCores" name="txtCores" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCores" name="btnCores" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaCores" name="btnLimpaCores" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-xl-3 col-12">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCentrosCusto">Centros de Custo:</label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtCentrosCusto" name="txtCentrosCusto" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCentrosCusto" name="btnCentrosCusto" data-button="absolute" type="button">
                      <i class="m-0 p-0 fas fa-search"></i>
                    </button>
                    <button class="btn bg-danger" id="btnLimpaCentrosCusto" name="btnLimpaCentrosCusto" type="button">
                      <i class="m-0 p-0 fas fa-trash"></i>
                    </button>
                  </div>
                </div>
              </div>
              <div class="form-group col-xl-3 col-6">
                <label data-error="wrong" class="labelGeral" data-success="right" for="selectSituacao">Situação:</label>
                <div class="input-group">
                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectSituacao" aria-describedby="tipoError" class="custom-select focus">
                    <option value="">Todas</option>
                    <option value="A">Pendentes</option>
                    <option value="C">Cotadas</option>
                  </select>
                </div>
              </div>
              <div class="form-group col-xl-3 col-6">
                <label data-error="wrong" class="labelGeral" data-success="right" for="selectStatus">Status liberação:</label>
                <div class="input-group">
                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectStatus" aria-describedby="tipoError" class="custom-select focus">
                    <option value="">Todos</option>
                    <option value="L">Liberado</option>
                    <option value="C">Bloqueado</option>
                  </select>
                </div>
              </div>
              <div class="form-group col-xl-3 col-6">
                <label data-error="wrong" class="labelGeral" data-success="right" for="selectNivel">Nível liberação:</label>
                <div class="input-group">
                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectNivel" aria-describedby="tipoError" class="custom-select focus">
                    <option value="T">Todos</option>
                    <option value="A">Aguardando liberação</option>
                    <option value="D">Disponível para liberação</option>
                    <option value="L">Liberado</option>
                  </select>
                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer py-0" style="padding-left: 1.25rem">
            <div class="flex col-12 justify-content-between">
              <div class="form-group mb-2">
                <label for="txtOrdem">Opção de Relatório:</label>
                <div class="d-flex align-items-center">
                  <select id="txtOrdem" class="input-default focus custom-select" style="min-width: 160px">
                  </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="flex align-items-end mb-2">
                <button class="btn btn-danger btn-sisp mr-2" id="btnLimparFiltros" style="max-height: 38px">
                  <span class="fas fa-trash"></span> Limpar Filtros
                </button>
                <button id="btnConsultar" class="btn btn-primary btn-sisp" type="button" style="max-height: 38px">
                  <span class="fas fa-search"></span> Consultar
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
    </aside><!-- /.control-sidebar -->
    <?php include_once('../../modais.php'); ?>
  </main><!-- /.wrapper -->

  <script src="plugins/jquery/jquery.min.js?versao=3.265.7.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.265.7.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.265.7.1"></script>
  <script src="plugins/sweetalert2/sweetalert2.min.js?versao=3.265.7.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.265.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.265.7.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.265.7.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.265.7.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.265.7.1"></script>
  <script src="dist/js/valida_cpf_cnpj.js?versao=3.265.7.1"></script>
  <script src="plugins/jquery-validation/jquery.validate.min.js?versao=3.265.7.1"></script>
  <script src="dist/js/dataTables.keyTable.js?versao=3.265.7.1"></script>
  <script src="dist/js/sisplan.js?versao=3.265.7.1"></script>
  <script src="utils/funcoes.js?versao=3.265.7.1"></script>
  <script src="utils/cookies.js?versao=3.265.7.1"></script>
  <script src="dist/js/driver.min.js?versao=3.265.7.1"></script>
  <script src="config.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="plugins/jszip/jszip.min.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="plugins/pdfmake/pdfmake.min.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="plugins/pdfmake/vfs_fonts.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="plugins/datatables-buttons/js/dataTables.buttons.min.js?versao=3.265.7.1"></script>
  <script type="text/javascript" src="plugins/datatables-buttons/js/buttons.html5.min.js?versao=3.265.7.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.265.7.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.265.7.1"></script>
  <script src="https://cdn.datatables.net/select/1.6.0/js/dataTables.select.min.js"></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('RELCOTACAO');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/relcotacao/relcotacao.js?versao=3.265.7.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');
      // nomeTela


      await insereJavaScriptPagina(sArquivo);

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

</body>

</html>