<?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 | Orçamento de Cortina</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.263.26.1">
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.263.26.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.263.26.1">
  <link rel="stylesheet" href="dist/css/sisplan.css?versao=3.263.26.1">
  <link rel="stylesheet" type="text/css" href="dist/css/dataTables.bootstrap4.min.css?versao=3.263.26.1" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="plugins/toastr/toastr.min.css?versao=3.263.26.1">
  <link rel="stylesheet" type="text/css" href="dist/css/driver.min.css?versao=3.263.26.1" />
  <link rel="stylesheet" href="dist/css/PesquisaVariosSelect2.css?versao=3.263.26.1">
  <link rel="stylesheet" href="plugins/select2/css/select2.min.css?versao=3.263.26.1">
  <link rel="stylesheet" href="plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.263.26.1">
  <link rel="stylesheet" href="dist/css/jquery-ui.css?versao=3.263.26.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.263.26.1">

  <style>
    #tabelaOrcamento,
    #tabelaItens,
    #tabelaSubItens {
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
  </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">Orçamento de Cortina</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="divTabelaConsignado">
          <div class="card px-2">
            <div class="card-body">
              <div class="col-sm-12 pl-0">
                <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="btnIncluir"><span class="fas fa-plus"></span> Incluir</button>
                <button class="btn btn-sisp btn-primary" id="btnImprimir"><i class="fas fa-print"></i> Imprimir</button>
              </div>
              <div class="col-sm-12 table-responsive pl-0">
                <h5 class="mb-0 mt-1">Lista de Orçamentos</h5>
                <table id="tabelaOrcamento" class="table table-sm-sisp table-select table-hover" width="100%">
                  <thead>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          <div class="card-deck">
            <div class="card col-sm-12 col-lg-7">
              <div class="card-body">
                <div class="table-responsive pt-0">
                  <h5 class="mb-0 mt-1">Lista de Itens</h5>
                  <table id="tabelaItens" class="table table-sm-sisp table-select table-hover" width="100%">
                    <thead>
                    </thead>
                    <tbody>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>

            <div class="card col-sm-12 col-lg-5">
              <div class="card-body">
                <div class="table-responsive pt-0">
                  <h5 class="mb-0 mt-1">Lista de Sub Itens</h5>
                  <table id="tabelaSubItens" class="table table-sm-sisp table-select table-hover" width="100%">
                    <thead>
                    </thead>
                    <tbody>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div id="modal-filtros" class="modal" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-md" 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">
            <!-- <fieldset class="form border-Field p-0" style="margin-top: 16px !important;">
              <legend class="textoBorda pb-0 mb-0">Opções</legend>
              <div class="form-group">
                <div class="icheck-primary d-inline"><input type="radio" checked id="rdTodos" name="rdListar" value="0"><label for="rdTodos">Todos</label></div>
                <div class="icheck-primary d-inline"><input type="radio" id="rdPendente" name="rdListar" value="1"><label for="rdPendente">Pendente</label></div>
                <div class="icheck-primary d-inline"><input type="radio" id="rdEmitido" name="rdListar" value="2"><label for="rdEmitido">Emitido</label></div>
                <div class="icheck-primary d-inline"><input type="radio" id="rdCancelado" name="rdListar" value="3"><label for="rdCancelado">Cancelado</label></div>
              </div>
            </fieldset> -->
            <div class="row" style="margin-top: 1.4%;">
              <div class="group-default form-group col-12">
                <label for="dtEntregaDe">Entrega De/ Até: </label>
                <div class="input-group">
                  <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="dtEntregaDe" name="dtEntregaDe">
                  <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control validate" id="dtEntregaAte" name="dtEntregaAte">
                </div>
              </div>
              <!-- <div class="group-default form-group col-6">
                <label for="dtAcerto">Data Acerto De/ Até: </label>
                <div class="input-group">
                  <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="dtAcertoIni" name="dtAcertoIni">
                  <input type="date" max="2500-12-31" value="2500-12-01" class="input-default focus form-control validate" id="dtAcertoFim" name="dtAcertoFim">
                </div>
              </div> -->
            </div>

            <!-- <div class="row">
              <div class="col-12" id="DocId">
                <label data-error="wrong" data-success="right" for="txtConsignado">ID Documento </label>
                <div class="input-group">
                  <select class="js-example-programmatic js-states form-control" id="txtConsignado" name="txtConsignado" multiple="multiple">
                  </select>
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnConsignado" name="btnConsignado" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaConsignado" name="btnLimpaConsignado" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
            </div> -->
            <div class="row">
              <div class="col-12" id="Cliente">
                <label data-error="wrong" data-success="right" for="txtCliente">Cliente </label>
                <div class="input-group">
                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtCliente" name="txtCliente" class="form-control" placeholder="Cliente">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnCliente" name="btnCliente" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaCliente" name="btnLimpaCliente" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="col-12" id="Vendedor">
                <label data-error="wrong" data-success="right" for="txtVendedor">Vendedor </label>
                <div class="input-group">
                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtVendedor" name="txtVendedor" class="form-control" placeholder="Vendedor">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnVendedor" name="btnVendedor" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaVendedor" name="btnLimpaVendedor" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <!-- <div class="col-6" id="Status">
                <label data-error="wrong" data-success="right" for="txtStatus">Status </label>
                <div class="input-group">
                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtStatus" name="txtStatus" class="form-control" placeholder="Status">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnStatus" name="btnStatus" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaStatus" name="btnLimpaStatus" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div> -->
              <!-- <div class="col-lg-6 form-group">
                <label data-error="wrong" data-success="right" for="txtTabPreco">Tabela de Preço: </label>
                <div class="input-group">
                  <input type="text" class="input-default focus form-control" id="txtTabPreco" name="txtTabPreco" placeholder="Tabela de Preço">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnTabPreco" name="btnTabPreco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaTabPreco" name="btnLimpaTabPreco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div> -->
            </div>
          </div>
          <div class="modal-footer justify-content-start pl-0">
            <div class="row col-12 ml-0">
              <!-- <div class="col-md-4 col-sm-4 col-12">
                <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-12 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 id="modalEditarOrcamento" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-xl">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title">Editar Orçamento</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
          <div class="modal-body py-0">
            <div class="row">
              <div class="col-sm-12 table-responsive">
                <table id="tabelaEditarOrcamento" class="table display nowrap" style="width:100%; margin-top:0 !important">
                  <thead>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <div class="row">
              <div class="col-sm-12">
                <button id="btnFechar" class="btn btn-sisp btn-danger mr-2" data-dismiss="modal"> Fechar </button>
                <button id="btnConfirmar" class="btn btn-sisp btn-primary"> Confirmar </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <?php
  include_once('../../../modais.php');
  ?>
  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  </div>
  <script src="plugins/jquery/jquery.min.js?versao=3.263.26.1"></script>
  <script type="text/javascript" src="dist/js/jquery.dataTables.js?versao=3.263.26.1"></script>
  <script type="text/javascript" src="dist/js/dataTables.bootstrap4.min.js?versao=3.263.26.1"></script>
  <script src="plugins/jquery-ui/jquery-ui.min.js?versao=3.263.26.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.263.26.1"></script>
  <script src="dist/js/adminlte.min.js?versao=3.263.26.1"></script>
  <script src="dist/js/sisplan.js?versao=3.263.26.1"></script>
  <script src="utils/funcoes.js?versao=3.263.26.1"></script>
  <script src="utils/cookies.js?versao=3.263.26.1"></script>
  <script src="dist/js/requisicoes.js?versao=3.263.26.1"></script>
  <script src="dist/js/loadingoverlay.min.js?versao=3.263.26.1"></script>
  <script src="dist/js/driver.min.js?versao=3.263.26.1"></script>
  <script src="plugins/toastr/toastr.min.js?versao=3.263.26.1"></script>
  <script type="text/javascript" src="dist/js/sum().js?versao=3.263.26.1"></script>
  <script type="text/javascript" src="config.js?versao=3.263.26.1"></script>
  <script src="plugins/select2/js/select2.full.min.js?versao=3.263.26.1"></script>
  <script src="dist/js/jquery.maskMoney.min.js?versao=3.263.26.1"></script>
  <script src="dist/js/jquery.mask.min.js?versao=3.263.26.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.263.26.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('ORCAMENTO_CORTINA');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      sArquivo = `${BASE_URI}/pages/orcamento_cortina/acesso_orcamento_cortina/acesso_orcamento_cortina.js?versao=3.263.26.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>