<?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 | Liberação Ordem de Compra</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 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.264.8.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.264.8.1">
  <link rel="stylesheet" href="dist/css/select.bootstrap.min.css?versao=3.264.8.1" />
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.264.8.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.264.8.1">
  <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 rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.264.8.1">
  <link rel="stylesheet" type="text/css" href="dist/css/sisplan.newColorsButtons.css?versao=3.264.8.1" />
  <style>
    .radioStyle {
      border: solid #e0e4e6;
      border-radius: 4px;
      border-width: 2px;
      padding: 7.25px;
      height: 136px;
    }

    .campoSel {
      display: inline-block;
      position: absolute;
      width: 22px;
      height: 22px;
      border: 1px solid #D3CFC8;
      border-radius: 0;
    }

    .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 0 1.0em !important;
      margin: 0 0 0 0 !important;
      -webkit-box-shadow: 0px 0px 0px 0px #000;
      box-shadow: 0px 0px 0px 0px #000;
      border-radius: 3px !important;
    }

    .table.dataTable tbody td,
    .table.dataTable thead {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }

    .table.dataTable tr td,
    .table.dataTable tr td,
    .table.dataTable th {
      padding: 4px 12px;
    }

    .card {
      padding: 1.5rem;
      border-top: 2px outset #ddd;
      box-shadow: none !important;
      margin-top: 20px;
      padding-top: 20px;
    }

    #legendas {
      flex-direction: row;
      flex-wrap: wrap;
    }

    .quadrado {
      width: 20px;
      margin-right: 5px;
      height: 20px;
    }
  </style>
</head>

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

    <div class="content-wrapper">
      <section class="content">
        <div class="content-header">
          <div class="container-fluid">
            <div class="row mb-2">
              <div class="col-sm-6 flex">
              </div>
              <div class="col-sm-6">
                <!-- <ol class="breadcrumb float-sm-right">
                  
                  <li class="breadcrumb-item active">Liberação O.C</li>
                </ol> -->
              </div><!-- /.col -->
              <div class="container-fluid" id="grad1">
                <div class="row justify-content-center mt-0">
                  <div class="col-12">
                    <div class="card mb-0 px-0">
                      <div class="card-header" style="border: none!important;box-shadow:none!important;">
                        <h2 class="m-0 pl-2">Análise Cotação
                          <button title="Tutorial" type="button" class="btn btn-info btn-sm ml-2" style="color: white;" id="tutorial">
                            <i class="fas fa-question-circle"></i>
                          </button>
                        </h2>
                      </div>
                      <div class="container-fluid">
                        <div class="row card-body" id="abaGeral">
                          <form id="form" class="col-12">
                            <div id="tutorialFiltros" class="row card-body p-0">
                              <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="txtMateriais">Materiais:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtMateriais" name="txtMateriais" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnMateriais" name="btnMateriais" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaMateriais" name="btnLimpaMateriais" 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 class="form-row col-12 pr-1 align-items-end mb-1">
                                <div class="form-group col-auto mb-0" style="min-width: 240px">
                                  <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" type="button">
                                      <i class="fas fa-check"></i>
                                    </button>
                                  </div>
                                </div>
                                <div class="flex flex-column col-auto">
                                  <div class="flex flex-nowrap">
                                    <button class="btn btn-info btn-sm dropdown-toggle flex align-items-center mb-0" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                      <h4 class="my-1 text-lg">
                                        Ações
                                      </h4>
                                    </button>
                                    <div class="dropdown-menu">
                                      <button class="dropdown-item" type="button" title="Liberar Selecionados" id="btnLiberarSelecionados">Liberar Selecionados</button>
                                      <button class="dropdown-item" type="button" title="Bloquear Selecionados" id="btnBloquearSelecionados">Bloquear Selecionados</button>
                                      <button class="dropdown-item" type="button" title="Gerar Ordem de Compra" id="btnGerarOrdemCompra">Gerar Ordem de Compra</button>
                                      <button class="dropdown-item" type="button" title="Imprimir" id="btnImprimir">Imprimir</button>
                                    </div>
                                  </div>
                                </div>
                                <div class="form-group col-auto mb-0">
                                  <fieldset class="border-Field px-2">
                                    <legend class="textoBorda mb-0">Legendas</legend>
                                    <div class="d-flex pb-2" id="legendas">
                                      <div style="margin: 5px 10px 0px 0px" class="d-flex align-items-center">
                                        <div class="quadrado" style="background: var(--hover-color);">
                                        </div>
                                        <span>Qtde cotada = qtde O.C.</span>
                                      </div>
                                      <div style="margin: 5px 10px 0px 0px" class="d-flex align-items-center">
                                        <div class="quadrado" style="background: #3CB371;">
                                        </div>
                                        <span>Melhor cotação</span>
                                      </div>
                                    </div>
                                  </fieldset>
                                </div>
                                <div class="button-group ml-auto">
                                  <button type="button" class="btn btn-primary btn-sisp" id="btnConsultar"><i class="fas fa-search"></i> Consultar</button>
                                </div>
                              </div>
                              <div class="form-row col-12 pr-1">
                                <div class="flex flex-column col-12 pr-0">
                                  <div class="table-responsive">
                                    <table id="tabelaCotacoes" class="table table-select table-hover" width="100%">
                                      <thead>
                                      </thead>
                                      <tbody>
                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                              </div>
                              <div class="form-row col-12 pr-1">
                                <div class="flex flex-column col-12 pr-0">
                                  <h5 class="mb-0">Últimas Compras</h5>
                                  <div class="table-responsive">
                                    <table id="tabelaUltimasCompras" class="table table-select table-hover" width="100%">
                                      <thead>
                                      </thead>
                                      <tbody>
                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                              </div>
                              <div class="form-row col-12 justify-content-end pr-1 mt-2">
                                <div class="d-flex">
                                  <button type="button" class="btn btnVerde btn-sisp" id="btnGravar"><i class="fas fa-save"></i> Gravar</button>
                                </div>
                              </div>
                            </div>
                          </form>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>
  <?php
  include_once('../../modais.php');
  include_once('./modal_manutencao.php');
  include_once('./modal_gerar_ordem_compra.php');
  include_once('../../modals/modal_itens_nao_efetivados.php');
  ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <script src="plugins/jquery/jquery.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/jquery-ui/jquery-ui.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="plugins/jquery-validation/jquery.validate.min.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/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/driver.min.js?versao=3.264.8.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.264.8.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.264.8.1"></script>
  <script type="text/javascript" src="config.js?versao=3.264.8.1"></script>
  <script src="./pages/analise_cotacao/modal_manutencao.js?versao=3.264.8.1" defer></script>
  <script src="https://cdn.datatables.net/select/1.6.0/js/dataTables.select.min.js"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.264.8.1"></script>
  <script src="./pages/analise_cotacao/modal_manutencao.js?versao=3.264.8.1" defer></script>
  <script src="./pages/analise_cotacao/modal_gerar_ordem_compra.js?versao=3.264.8.1" defer></script>
  <script type="text/javascript" src="./modals/modal_itens_nao_efetivados.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;

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

      sArquivo = `${BASE_URI}/pages/analise_cotacao/analise_cotacao.js?versao=3.264.8.1`;
      insereJavaScriptPagina(sArquivo);

    });
  </script>
</body>

</html>