<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Cadastro de Operações</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.255.7.1">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css?versao=3.255.7.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.255.7.1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.255.7.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.255.7.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.255.7.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.255.7.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.255.7.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.255.7.1">
  <link rel="stylesheet" href="https://cdn.datatables.net/select/1.5.0/css/select.dataTables.min.css">

  <style>
    /* #tabelaProcessos_wrapper div div div .dataTables_scrollBody {
      max-height: 220px;
    } */

    .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;
    }

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

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

    .inputInvisivel {
      min-width: 0px;
      text-align: end;
      width: auto;
      font-weight: bold;
    }

    .bordaProduto {
      padding: 10px;
      border: solid #e0e4e6;
      border-radius: 4px;
      border-width: 2px;
    }

    /* .dataTables_info span {
      display: none;
    } */

    .legendaTempos {
      font-size: 1.275rem;
    }
  </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 justify-content-center 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">
                          <strong class="ml-2">Cadastro de Operações</strong>
                          <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="d-flex flex-row justify-content-center">
                  <div class="col-12 mx-0">
                    <nav class="col-lg-12">
                      <div class="nav nav-tabs d-flex flex-nowrap" id="nav-tab" role="tablist" style="text-decoration: none; max-width: none!important; white-space: nowrap!important; overflow-x: auto!important; overflow-y: hidden">
                        <a class="nav-link abaLink active" id="tabOperacao" data-toggle="tab" href="#divOperacao" role="tab" aria-controls="divOperacao" aria-selected="true">Operação</a>
                        <a class="nav-link abaLink d-none" id="tabMicroOperacoes" data-toggle="tab" href="#divMicroOperacoes" role="tab" aria-controls="divMicroOperacoes" aria-selected="false">Micro Operações</a>
                      </div>
                    </nav>
                    <div class="tab-content col-lg-12 px-0" id="nav-tabContent">
                      <div id="divOperacao" class="tab-pane fade show active" role="tabpanel" aria-labelledby="tabOperacao">
                        <form id="msform" class="text-left">
                          <fieldset class="d-flex justify-content-center">
                            <div class="px-2 mx-4 py-0 col-12" id="formcard1">
                              <div id="tutorial-step1">
                                <div class="flex flex-wrap ml-2 my-2" style="gap: 8px">
                                  <div class="icheck-primary flex align-items-center">
                                    <input type="checkbox" class="form-check-input" id="cbAtivo1">
                                    <label class="form-check-label" for="cbAtivo1">Ativo</label>
                                  </div>
                                  <div class="icheck-primary flex align-items-center">
                                    <input type="checkbox" class="form-check-input" id="cbGerarKanban">
                                    <label class="form-check-label" for="cbGerarKanban">Gera Kanban</label>
                                  </div>
                                  <div class="icheck-primary flex align-items-center">
                                    <input type="checkbox" class="form-check-input" id="cbApontamentoProducao">
                                    <label class="form-check-label" for="cbApontamentoProducao">Apontamento Produção</label>
                                  </div>
                                </div>
                                <div class="form-row col-12" id="stepForm1">
                                  <div class="col-xl-1 col-lg-1 col-md-1 col-4 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtCodigo">Código:</label>
                                    <input type="text" class="input-default focus form-control" id="txtCodigo" name="txtCodigo" placeholder="Código">
                                  </div>
                                  <div class="col-xl-2 col-lg-2 col-md-3 col-8 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="txtDescricao" placeholder="Descrição">
                                  </div>
                                  <div class="col-xl-3 col-lg-3 col-md-4 col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtParte">Parte:</label>
                                    <div class="input-group">
                                      <input type="text" class="input-default focus form-control" id="txtParte" name="txtParte" placeholder="Parte">
                                      <div class="input-group-append">
                                        <button class="btn bg-danger" id="btnParte" name="btnParte" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                        <button class="btn bg-danger" id="btnLimpaParte" name="btnLimpaParte" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="col-xl-3 col-lg-3 col-md-4 col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtMaquina">Máquina:</label>
                                    <div class="input-group">
                                      <input type="text" class="input-default focus form-control" id="txtMaquina" name="txtMaquina" placeholder="Máquina">
                                      <div class="input-group-append">
                                        <button class="btn bg-danger" id="btnMaquina" name="btnMaquina" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                        <button class="btn bg-danger" id="btnLimpaMaquina" name="btnLimpaMaquina" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="col-xl col-lg col-md-2 col-6 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="selectTipo">Tipo:</label>
                                    <select class="input-default focus form-control" data-dropdown-css-class="select2-danger" id="selectTipo" aria-describedby="tipoError" class="custom-select focus">
                                      <option value="Normal" selected>Normal</option>
                                      <option value="Micro-Operações">Micro-operações</option>
                                      <option value="Cronômetro">Cronômetro</option>
                                    </select>
                                  </div>
                                  <div class="col-xl-auto col-lg col-md-2 col-6 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtAlteracao">Alteração:</label>
                                    <input type="date" class="input-default focus form-control" value="<?php echo date('Y-m-d'); ?>" id="txtAlteracao" name="txtAlteracao">
                                  </div>
                                  <div class="col-xl-6 col-lg-6 col-md-4 col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtObservacao">Observação:</label>
                                    <input type="text" class="input-default focus form-control" id="txtObservacao" name="txtObservacao" placeholder="Observação">
                                  </div>
                                  <div class="col-xl-6 col-lg-6 col-md-4 col-12 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtComplemento">Complemento:</label>
                                    <input type="text" class="input-default focus form-control" id="txtComplemento" name="txtComplemento" placeholder="Complemento">
                                  </div>
                                </div>
                                <div class="form-row col-12" id="stepForm3">
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtRotacao">Rotação:</label>
                                    <input type="text" class="input-default focus form-control text-right integerFormat" id="txtRotacao" name="txtRotacao" placeholder="0" maxlength="3">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtTempoHora">Tempo Hora:</label>
                                    <input type="text" class="input-default focus form-control text-right" id="txtTempoHora" name="txtTempoHora" placeholder="00:00:00">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtInterferencia">% Interferência:</label>
                                    <input type="text" class="input-default focus form-control text-right duasCasasDecimaisCurrencyFormat" id="txtInterferencia" name="txtInterferencia" placeholder="0,00">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtConcessoes">Concessões:</label>
                                    <input type="text" class="input-default focus form-control text-right duasCasasDecimaisCurrencyFormat" id="txtConcessoes" name="txtConcessoes" placeholder="0,00">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtValor">Valor:</label>
                                    <input type="text" class="input-default focus form-control text-right tresCasasDecimaisCurrencyFormat" id="txtValor" name="txtValor" placeholder="0,000">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtTempo">Tempo:</label>
                                    <input type="text" class="input-default focus form-control text-right quatroCasasDecimaisCurrencyFormat" id="txtTempo" name="txtTempo" placeholder="0,0000">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtTempoTotal">Tempo Total:</label>
                                    <input type="text" class="input-default focus form-control text-right quatroCasasDecimaisCurrencyFormat" id="txtTempoTotal" name="txtTempoTotal" placeholder="0,0000">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtComprimento">Comprimento:</label>
                                    <input type="text" class="input-default focus form-control text-right duasCasasDecimaisCurrencyFormat" id="txtComprimento" name="txtComprimento" placeholder="0,00">
                                  </div>
                                  <div class="col-xl-1 col-sm col-3 form-group">
                                    <label data-error="wrong" class="labelGeral" data-success="right" for="txtQuantidade">Quantidade:</label>
                                    <input type="text" class="input-default focus form-control text-right integerFormat" id="txtQuantidade" name="txtQuantidade" placeholder="0">
                                  </div>
                                </div>
                                <div class="flex justify-content-end form-group px-3" style="gap: 8px">
                                  <button type="button" class="btn btn-secondary btn-sisp" id="btnVoltar" style="max-height: 38px">Voltar</button>
                                  <button type="button" class="btn btn-danger btn-sisp" id="btnGravar" style="max-height: 38px">Gravar</button>
                                </div>
                              </div>
                            </div>
                          </fieldset>
                        </form>
                      </div>
                      <div id="divMicroOperacoes" class="tab-pane fade" role="tabpanel" aria-labelledby="tabMicroOperacoes">
                        <div class="col-12 table-responsive card-body" style="max-height: 300px">
                          <table id="tabelaMicroOperacoes" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </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.255.7.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.255.7.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.255.7.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.255.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.255.7.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.255.7.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.255.7.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.255.7.1"></script>
  <script src="../utils/funcoes.js?versao=3.255.7.1"></script>
  <script src="../utils/cookies.js?versao=3.255.7.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/jquery.mask.min.js?versao=3.255.7.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.255.7.1"></script>
  <script type="text/javascript" src="../config.js?versao=3.255.7.1"></script>
  <script src="https://cdn.datatables.net/select/1.5.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>
    $(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('OPERACAO_TEMPOS');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

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

      await insereJavaScriptPagina(sArquivo);

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

</body>

</html>