<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Fluxo de Aprovação</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css?versao=3.263.17.1">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.263.17.1">
  <!--e1Google Font: Source Sans Pro -->
  <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/fontawesome-free/css/all.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.263.17.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.263.17.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.263.17.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.263.17.1">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.263.17.1">
  <link rel="stylesheet" href="https://cdn.datatables.net/select/1.6.0/css/select.dataTables.min.css">
  <link rel="stylesheet" href="../dist/css/PesquisaVariosSelect2.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/select2/css/select2.min.css?versao=3.263.17.1">
  <link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.263.17.1">

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

    .content-wrapper {
      margin-left: 0px !important;
    }

    .main-header,
    .main-sidebar {
      display: none;
    }

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

    .pagination {
      justify-content: end !important;
    }

    .dataTables_wrapper .row {
      margin-right: 0 !important;
      margin-left: 0 !important;
    }

    .placeholder-lowercase::placeholder {
      text-transform: none;
    }

    #progressbar {
      box-sizing: border-box;
    }

    #progressbar li {
      list-style-type: none;
      font-size: 12px;
      width: 100%;
      float: left;
      position: relative
    }

    .main-container {
      display: block;
      text-align: center;
      position: relative;
      margin-top: 20px;
      unicode-bidi: isolate;


      fieldset:not(:first-of-type) {
        display: none;
      }
    }

    .step-container {
      text-align: left;
      padding: 20px 10px 30px 10px;
      width: 100%;
      margin-bottom: 20px;
      position: relative;
      color: var(--font-color);
      z-index: 2;
      background: var(--card-color);
      border-radius: 8px;
    }

    .card {
      box-shadow: none !important;
      border-radius: 0 !important;
      margin-bottom: 0 !important;
    }

    .card-header {
      box-shadow: 0px 1px rgb(0 0 0 / 20%) !important;
    }

    .card-header {
      border-bottom: 1px dashed #ddd;
      box-shadow: none !important;
    }

    .fa-angle-right,
    .fa-angle-down {
      color: #343a40;
    }

    .dataTables_wrapper .col-sm-12 {
      padding-left: 0 !important;
      padding-right: 0 !important;
    }

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

    .border-field {
      border: 1px solid var(--font-color) !important;
      padding: 1rem !important;
      -webkit-box-shadow: 0px 0px 0px 0px #000;
      box-shadow: 0px 0px 0px 0px #000;
      border-radius: 3px !important;
    }

    .separator {
      border-left: 1px solid #dee2e6;
    }
  </style>

</head>

<body class="hold-transition sidebar-mini layout-fixed">
  <main class="wrapper">
    <?php
    include_once('../../../menu.php');
    ?>
    <div class="wrapper">


      <div id="myModal" class="modal" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 id="myModalLabel" class="modal-title"></h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
              <p id="myModalText"></p>
            </div>
            <div class="modal-footer">
              <button id="btnYes" type="button" class="btn btn-primary">Sim</button>
              <button id="btnNo" type="button" class="btn btn-secondary" data-dismiss="modal">Não</button>
            </div>
          </div>
        </div>
      </div>

      <div class="content-wrapper">
        <section class="content">
          <div class="content-header p-0">
            <div class="container-fluid">
              <div class="row mb-2">
                <div class="col-sm-6 flex">
                </div>
                <div class="col-sm-6">
                </div>
              </div>
            </div>
            <div class="row mt-0">
              <div class="col-12 p-0 mt-3 mb-2">
                <div class="card p-0 mb-0">
                  <div class="card-header d-flex p-0 ml-4 align-items-start" style="border: none!important;box-shadow:none!important; gap: 10px;">
                    <div class="flex flex-column">
                      <div class="flex my-2">
                        <h2 class="mb-0 text-center flex align-items-center">
                          <span class="ml-2">Fluxo de Aprovação</span>
                          <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>
                        </h2>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="row mx-0 px-0">
                  <div class="col-12 mx-0 px-4">
                    <div id="msform">
                      <ul id="progressbar">
                        <li class="active" id="account"><strong>Geral</strong></li>
                      </ul>
                      <p>Preencha os dados e clique em gravar</p>
                      <fieldset id="fieldset1">
                        <div class="step-container">
                          <div class="flex flex-wrap">
                            <form id="formPrincipal" class="flex flex-wrap col-7 align-content-start">
                              <input type="text" class="input-default focus form-control d-none" id="txtId">
                              <div class="col-xl-4 col-6 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtDescricao">Descrição:</label>
                                <input type="text" class="input-default focus form-control" id="txtDescricao" name="descricao" placeholder="Descrição">
                              </div>
                              <div class="col-xl-4 col-6 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="selectEtapa">Etapa:</label>
                                <div class="input-group">
                                  <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectEtapa" aria-describedby="tipoError" class="custom-select focus">
                                    <option value="SOL">Solicitações de compra</option>
                                    <option value="COT">Cotações de compra</option>
                                    <option value="COM">Ordens de compra</option>
                                  </select>
                                </div>
                              </div>
                              <div class="col-xl-4 d-none d-xl-block"></div>
                              <div class="col-xl-2 col-6 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtValorMinimo">Valor mínimo:</label>
                                <input type="text" class="input-default focus form-control text-right campoFloat" id="txtValorMinimo" name="valorMinimo" placeholder="0.00">
                              </div>
                              <div class="col-xl-2 col-6 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtValorMaximo">Valor máximo:</label>
                                <input type="text" class="input-default focus form-control text-right campoFloat" id="txtValorMaximo" name="valorMaximo" placeholder="0.00">
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtCentroCusto">Centro de custo:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtCentroCusto" name="txtCentroCusto" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnCentroCusto" name="btnCentroCusto" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaCentroCusto" name="btnLimpaCentroCusto" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtTipo">Tipo:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtTipo" name="txtTipo" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnTipo" name="btnTipo" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaTipo" name="btnLimpaTipo" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtGrupoMaterial">Grupo de material:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtGrupoMaterial" name="txtGrupoMaterial" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnGrupoMaterial" name="btnGrupoMaterial" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaGrupoMaterial" name="btnLimpaGrupoMaterial" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtGrupoProduto">Grupo de produto:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtGrupoProduto" name="txtGrupoProduto" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnGrupoProduto" name="btnGrupoProduto" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaGrupoProduto" name="btnLimpaGrupoProduto" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtGrupoServico">Grupo de serviço:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtGrupoServico" name="txtGrupoServico" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnGrupoServico" name="btnGrupoServico" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaGrupoServico" name="btnLimpaGrupoServico" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                              <div class="form-group col-xl-4 col-12">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtSubgrupoMaterial">Subgrupo de material:</label>
                                <div class="input-group">
                                  <select class="js-example-programmatic js-states form-control" id="txtSubgrupoMaterial" name="txtSubgrupoMaterial" multiple="multiple">
                                  </select>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnSubgrupoMaterial" name="btnSubgrupoMaterial" data-button="absolute" type="button">
                                      <i class="m-0 p-0 fas fa-search"></i>
                                    </button>
                                    <button class="btn bg-danger" id="btnLimpaSubgrupoMaterial" name="btnLimpaSubgrupoMaterial" type="button">
                                      <i class="m-0 p-0 fas fa-trash"></i>
                                    </button>
                                  </div>
                                </div>
                              </div>
                            </form>
                            <form class="flex flex-wrap col-5 separator align-content-start" id="formAprovador">
                              <input type="text" class="input-default focus form-control d-none" id="txtIdAprovador">
                              <div class="col-xl-7 col-12 form-group">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtAprovador">Aprovador:</label>
                                <div class="input-group">
                                  <input type="text" class="input-default focus form-control controleAprovador" disabled id="txtAprovador" name="aprovador" placeholder="Aprovador">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger controleAprovador" disabled id="btnAprovador" name="btnAprovador" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger controleAprovador" disabled id="btnLimpaAprovador" name="btnLimpaAprovador" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-xl-5 col-12 form-group flex justify-content-start align-items-end" style="gap: 15px">
                                <button type="button" class="btn btn-primary btn-sisp" id="btnIncluirAprovador" style="max-height: 38px">Incluir</button>
                                <button type="submit" class="btn btn-primary btn-sisp d-none" id="btnConfirmarAprovador" style="max-height: 38px">Confirmar</button>
                                <button type="button" class="btn btn-danger btn-sisp d-none" id="btnDesistirAprovador" style="max-height: 38px">Desistir</button>
                              </div>
                              <div class="col mb-1">
                                <button type="button" class="btn btn-primary" id="btnSubirOrdem"><i class="fas fa-arrow-up"></i></button>
                                <button type="button" class="btn btn-primary" id="btnDescerOrdem"><i class="fas fa-arrow-down"></i></button>
                              </div>
                              <div class="col-12">
                                <h4 class="text-md">Aprovadores</h4>
                                <div class="table-responsive">
                                  <table id="tabelaAprovadores" class="table table-select table-hover" width="100%">
                                    <thead>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                  </table>
                                </div>
                              </div>
                            </form>
                            <div class="col-12">
                              <div class="flex flex-wrap col-12 justify-content-end" style="gap: 15px;">
                                <button type="button" class="btn btn-secondary btn-sisp" id="btnVoltar" style="max-height: 38px">Voltar</button>
                                <button type="submit" form="formPrincipal" class="btn btn-danger btn-sisp" id="btnGravar" style="max-height: 38px">Gravar</button>
                              </div>
                            </div>
                          </div>
                        </div>
                      </fieldset>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
    </div>
  </main>

  <aside class="control-sidebar control-sidebar-dark">
  </aside>
  <script src="../plugins/jquery/jquery.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.263.17.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.263.17.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.263.17.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.263.17.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.263.17.1"></script>
  <script src="../utils/funcoes.js?versao=3.263.17.1"></script>
  <script src="../utils/cookies.js?versao=3.263.17.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/jquery.mask.min.js?versao=3.263.17.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.263.17.1"></script>
  <script type="text/javascript" src="../config.js?versao=3.263.17.1"></script>
  <script src="https://cdn.datatables.net/select/1.6.0/js/dataTables.select.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.16/jquery.mask.min.js"></script>
  <script src="../plugins/select2/js/select2.full.min.js?versao=3.263.17.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('FLUXO_APROVACAO_COMPRAS');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

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

      await insereJavaScriptPagina(sArquivo);

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

</body>

</html>