<?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 | Ordem de Produção</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.258.7.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.258.7.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.258.7.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.258.7.1">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <link rel="stylesheet" href="../dist/css/cadastro.css?versao=3.258.7.1">
  <link rel="stylesheet" href="../plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.258.7.1">
  <style>
    #progressbar li {
      list-style-type: none;
      font-size: 12px;
      width: 33%;
      float: left;
      position: relative;
    }

    #progressbar {
      margin-left: 0% !important;
    }

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

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

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

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

    #tabelaAgendamento_wrapper .table.dataTable thead th {
      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"></h1>
            </div>
            <div class="col-sm-6">
              <!-- <ol class="breadcrumb float-sm-right">
                
                <li class="breadcrumb-item active"><a href="../cadof">Acesso Ordem de Produção</a></li>
                <li class="breadcrumb-item active">Cadastro</li>
              </ol> -->
            </div>
          </div>
        </div>
        <!-- <div class="row justify-content-center mt-0"> -->
        <div class="col-12 text-left p-0 mt-3 mb-2">
          <div class=" card px-0 pt-4 pb-0 mt-3 mb-3" style="border:none">
            <h2>
              <strong class="ml-4">Ordem de Produção</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 class="row">
              <div class="col-md-12 mx-0">
                <form id="msform">
                  <ul id="progressbar">
                    <li class="active" id="account"><strong>Capa</strong></li>
                    <li id="payment"><strong>Parte/Fluxo</strong></li>
                    <li id="confirm" style="cursor: pointer;"><strong>Itens</strong></li>
                  </ul>
                  <fieldset>
                    <div class="form-card" id="formcard1">
                      <div class="row">
                        <div class="col-sm-12">
                          <div class="card dadosGerais">
                            <div class="row">
                              <div class="col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtTabPrazo">Período * </label>
                                <div class="input-group">
                                  <!-- <select class="js-example-programmatic js-states form-control" id="txtTabPrazo" name="txtTabPrazo" multiple="multiple">
                                  </select> -->
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTabPrazo" name="txtTabPrazo" class="form-control" placeholder="Código do Período" required>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnTabPrazo" name="btnTabPrazo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaTabPrazo" name="btnLimpaTabPrazo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12" id="ColunaOrdem">
                                <label data-error="wrong" data-success="right" for="txtNumeroOrdem">Número *</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control validate" aria-describedby="ordemError" id="txtNumeroOrdem" name="txtNumeroOrdem" class="form-control" placeholder="Número" required>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12" id="lblProgramacao">
                                <label data-error="wrong" class="labelGeral" data-success="right" for="txtProgramacao">Programação</label>
                                <div class="input-group">
                                  <input type="number" autocomplete="off" class="input-default focus form-control" id="txtProgramacao" name="txtProgramacao" class="form-control" placeholder="Número Programação">
                                </div>
                              </div>
                              <div class="col-lg-3 col-12">
                                <div class="group-default form-group">
                                  <label for="txtDtCadastro">Data Cadastro </label>
                                  <div class="relative">
                                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control validate" id="txtDtCadastro" name="txtDtCadastro" disabled>
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtPedido">Pedido</label>
                                <div class="input-group">
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtPedido" name="txtPedido" class="form-control" placeholder="Código do Pedido" required>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnPedido" name="btnPedido" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaPedido" name="btnLimpaPedido" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtProduto">Produto *</label>
                                <div class="input-group">
                                  <!-- <select class="js-example-programmatic js-states form-control" id="txtProduto" name="txtProduto" multiple="multiple">
                                  </select> -->
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtProduto" name="txtProduto" class="form-control" placeholder="Código do Produto" required>
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnProduto" name="btnProduto" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaProduto" name="btnLimpaProduto" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12">
                                <label data-error="wrong" 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> -->
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTipo" name="txtTipo" class="form-control" placeholder="Tipo" required>
                                  <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="col-lg-3 col-12">
                                <label data-error="wrong" data-success="right" for="txtMaquina">Máquina </label>
                                <div class="input-group">
                                  <!-- <select class="js-example-programmatic js-states form-control" id="txtMaquina" name="txtMaquina" multiple="multiple">
                                  </select> -->
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtMaquina" name="txtMaquina" class="form-control" placeholder="Máquina" required>
                                  <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-lg-3 col-12">
                                <div class="group-default form-group">
                                  <label for="txtDtInicio">Data Inicio </label>
                                  <div class="relative">
                                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control validate" id="txtDtInicio" name="txtDtInicio">
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-3 col-12">
                                <div class="group-default form-group">
                                  <label for="txtDtFim">Data Fim </label>
                                  <div class="relative">
                                    <input type="date" max="2500-12-31" value="2500-12-31" class="input-default focus form-control validate" id="txtDtFim" name="txtDtFim">
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-6 col-12">
                                <label data-error="wrong" data-success="right" for="txtDeposito">Depósito</label>
                                <div class="input-group">
                                  <!-- <select class="js-example-programmatic js-states form-control" id="txtDeposito" name="txtDeposito" multiple="multiple">
                                  </select> -->
                                  <input type="text" autocomplete="off" class="input-default focus form-control" id="txtDeposito" name="txtDeposito" class="form-control" placeholder="Código do Deposito">
                                  <div class="input-group-append">
                                    <button class="btn bg-danger" id="btnDeposito" name="btnDeposito" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                    <button class="btn bg-danger" id="btnLimpaDeposito" name="btnLimpaDeposito" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                  </div>
                                </div>
                              </div>
                              <div class="col-lg-12 col-12">
                                <label for="txtObs" class="form-label">Observação </label>
                                <textarea style="resize: none" class="input-default form-control" id="txtObs" cols="50" rows="4"></textarea>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <input type="button" name="avancar1" class="btn-sisp next action-button" id="avancar1" value="Avançar" />
                    <button type="button" id="btnVoltar" style="font-size:15px;" class="btn-sisp action-button-previous" data-dismiss="modal">Voltar</button>
                  </fieldset>
                  <fieldset>
                    <div class="form-card" id="formcard2">
                      <div class="card divPartes">
                        <div class="col-sm-12 table-responsive card-body">
                          <h2 class="fs-title" id="Partes">Partes do Produto</h2>
                          <table id="tabelaPartes" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div class="card divFluxo">
                        <div class="col-sm-12 table-responsive card-body" style="max-height: 350px">
                          <h2 class="fs-title" id="Fluxo">Fluxo</h2>
                          <div class="row">
                            <div class="col-3">
                              <div class="form-group form-check" sytle="padding: 0px;">
                                <input type="checkbox" class="form-check-input" id="chkFaccao" checked>
                                <label class="form-check-label pr-2" for="chkFaccao">Facção</label>
                                <!-- <input type="checkbox" class="form-check-input" id="chkDescFinalSemana" style="margin-left: 0px;">
                                <label class="form-check-label pr-2" for="chkFaccao" style="margin-left: 21px;">Desconsiderar Final de Semana</label> -->
                              </div>
                              <label data-error="wrong" data-success="right" for="txtFluxo">Fluxo *</label>
                              <!-- <input type="checkbox" id="chkFaccao" style="margin-left: 8px"> <label for="chkFaccao">Facção</label> -->
                              <div class="input-group" style="margin-bottom: 7px">
                                <input type="text" autocomplete="off" class="input-default focus form-control" id="txtFluxo" name="txtFluxo" class="form-control" placeholder="Código do Fluxo" required>
                                <div class="input-group-append">
                                  <button class="btn bg-danger" id="btnFluxo" name="btnFluxo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                                  <button class="btn bg-danger" id="btnLimpaFluxo" name="btnLimpaFluxo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                                </div>
                              </div>
                            </div>
                          </div>
                          <table id="tabelaFluxo" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                        <div class="pt-3">
                          <!-- <button class="btn action-button btn-sisp float-right" id="btnAgendamento" style="min-width: 126px"><span class="fas fa-calendar"></span> Agendamento</button> -->
                          <input type="button" name="voltar2" class="action-button" value="Agendamento" id="btnAgendamento" />
                        </div>
                      </div>
                      <input type="button" name="avancar2" class="btn-sisp next action-button" value="Avançar" id="avancar2" />
                      <input type="button" name="voltar2" class="previous action-button-previous" value="Voltar" id="voltar2" />
                  </fieldset>
                  <fieldset>
                    <div class="form-card" id="formcard3">
                      <div class="card divGrade">
                        <div class="col-sm-12 table-responsive card-body">
                          <h2 class="fs-title" id="Itens">Grade</h2>
                          <table id="tabelaGradeProduto" class="table table-sm table-select table-hover" width="100%">
                            <thead>
                            </thead>
                            <tbody>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <input type="button" name="btnGravar" class="action-button" value="Gravar" id="btnGravar" />
                    <input type="button" name="voltar3" class="previous action-button-previous" value="Voltar" id="voltar3" />
                  </fieldset>
                </form>
              </div>
            </div>
          </div>
        </div>
        <!-- </div> -->
      </div>
      <div id="modal-agendamento" class="modal" tabindex="-1" role="dialog">
        <div class="modal-dialog modal-xl" role="document">
          <div class="modal-content" id="modalBody">
            <div class="modal-header">
              <h4 class="modal-title">Agendamento</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="row">
                <div class="col-4" id="NumeroInfoTour">
                  <label data-error="wrong" data-success="right" for="txtNumero">Número </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtNumero" name="txtNumero" class="form-control" placeholder="Número Ordem de Producao" disabled>
                  </div>
                </div>
                <div class="col-lg-4 col-sm-12 col-12">
                  <div class="group-default form-group">
                    <label for="">Data Fatura Ped.</label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataFaturaPed" name="DataDe" disabled>
                    </div>
                  </div>
                </div>
                <div class="col-lg-4 col-sm-12 col-12">
                  <div class="group-default form-group">
                    <label for="">Data Ini OF</label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataIniOF" name="DataDe" disabled>
                    </div>
                  </div>
                </div>
                <div class="col-4" id="TipoProdutoInfoTour">
                  <label data-error="wrong" data-success="right" for="txtTipoProduto">Tipo Produto </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtTipoProduto" name="txtTipoProduto" class="form-control" placeholder="Tipo Produto" disabled>
                  </div>
                </div>
                <div class="col-4 col-sm-12 col-lg-4" id="ParteInfoTour">
                  <label data-error="wrong" data-success="right" for="txtParte">Parte </label>
                  <div class="input-group">
                    <input type="text" autocomplete="off" class="input-default focus form-control" id="txtParte" name="txtParte" class="form-control" 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-lg-3 col-sm-12 col-12">
                  <div class="group-default form-group">
                    <label for="">Data Despacho</label>
                    <div class="relative">
                      <input type="date" max="2500-12-31" value="1200-01-01" class="input-default focus form-control validate" id="txtDataDespacho" name="DataDe">
                    </div>
                  </div>
                </div>
                <div class="col-lg-1 col-sm-12 col-12">
                  <label for="dtEmifim" id="diaSemana" style="margin-top: 36px;"></label>
                </div>
              </div>
              <div class="d-flex justify-content-end">
                <button class="btn btn-primary btn-sisp" id="btnCalcular"><span class="fas fa-calculator"></span> Calcular</button>     
                <button class="btn btn-primary btn-sisp" id="btnBuscarFaccao"><span class="fas fa-search"></span> Buscar Facção</button>
              </div>
              <div class="col-sm-12 table-responsive card-body" style="max-height: 400px; margin-top:5px">
                <table id="tabelaAgendamento" class="table table-sm table-select table-hover" width="100%">
                  <thead>
                  </thead>
                  <tbody>
                  </tbody>
                </table>
              </div>
            </div>
            <div class="modal-footer">
              <div class="row">
                <button class="btn btn-secondary btn-sisp" id="btnConfirmar"><span class="fas fa-check"></span> Confirmar</button>     
                <button class="btn btn-primary btn-sisp" id="btnExcluir" style="background-color: #B22222; border-color: #B22222"><span class="fas fa-trash"></span> Excluir</button>     
                <button class="btn btn-primary btn-sisp" id="btnFechar"><span class="fas fa-times"></span> Fechar</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.258.7.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.258.7.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.258.7.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.258.7.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.258.7.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.258.7.1"></script>
  <script src="../dist/js/cliente/entidade.js?versao=3.258.7.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.258.7.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.258.7.1"></script>
  <script src="../utils/funcoes.js?versao=3.258.7.1"></script>
  <script src="../utils/cookies.js?versao=3.258.7.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.258.7.1"></script>
  <script src="../plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/jquery.mask.min.js?versao=3.258.7.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.258.7.1"></script>
  <script src="../plugins/moment/moment.min.js?versao=3.258.7.1"></script>
  <script type="text/javascript" src="../config.js?versao=3.258.7.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('CADOF');
      if (!temAcesso.resultado) {
        toastrAcesso(temAcesso, BASE_URI);
        return;
      }

      const permissaoUsuarioLogado = await permissaoAcessos("CADOF");

      if (permissaoUsuarioLogado.INCLUI == 'N') {
        await criaMensagemErro("Sem permissão para incluir!", () => {
          window.location.href = `${BASE_URI}/cadof`
        });
        return;
      }

      sArquivo = `${BASE_URI}/pages/cadof/cadastro_cadof/cadof.js?versao=3.258.7.1`;
      insereJavaScriptPagina(sArquivo);
    });
  </script>
</body>

</html>