<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Sisplan Web | Cancelamento de Pedido
  </title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.2512.9.1">

  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../dist/css/custom.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../dist/css/sisplan.css?versao=3.2512.9.1">
  <link rel="stylesheet" type="text/css" href="../plugins/datatables-keytable/css/keyTable.bootstrap4.min.css?versao=3.2512.9.1">
  <!-- Toastr -->
  <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css?versao=3.2512.9.1">
  <link rel="shortcut icon" href="../favicon.ico">
  <link rel="stylesheet" type="text/css" href="../dist/css/driver.min.css?versao=3.2512.9.1" />
  <link rel="stylesheet" href="../dist/css/jquery-ui.css?versao=3.2512.9.1">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

  <link rel="stylesheet" href="../dist/css/PesquisaVariosSelect2.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../plugins/select2/css/select2.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="plugins/datatables-colreorder/css/colReorder.bootstrap4.min.css?versao=3.2512.9.1">
  <link rel="stylesheet" href="../dist/css/sisplan.newColorsButtons.css?versao=3.2512.9.1" type="text/css" />

</head>
<style>
  #msform {
    text-align: start;
    position: relative;
  }

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

  .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: 1.0em 0 0 0;
    -webkit-box-shadow: 0px 0px 0px 0px #000;
    box-shadow: 0px 0px 0px 0px #000;
  }
</style>

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

  <script type="text/javascript" src="../config.js"></script>
  <main class="wrapper">

    <?php
    include_once('../../../menu.php');
    ?>

    <div class="content-wrapper">
      <div class="content-header py-0">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h3 class="col-mb=2"></h3>
            </div>
            <div class="col-sm-6">

            </div>
          </div>
          <div class="row justify-content-center mt-0">
            <div class="col-12 p-0 mb-2">
              <div class="container-fluid">
                <div class="row mb-2">
                  <div class="col-sm-6 flex pl-1">
                    <h1 class="m-0 text-dark font-semibold" style="font-size: 1.8rem; font-weight: 500; line-height: 1.2;">Cancelamento de Pedido</h1>
                    <button title="Tutorial" class="btn btn-info btn-sm ml-2" id="tutorial">
                      <i class="fas fa-question-circle"></i>
                    </button>
                  </div>
                </div>
              </div>
              <fieldset>
                <div style="padding-left: 0rem!important; padding-right: 0rem!important;">
                  <form id="msform" name="msform">
                    <div class="collapse show" id="DadosGerais">
                      <div class="card card-body pb-0 m-0">
                        <div class="tab-pane fade show active" role="tabpanel" aria-labelledby="dados-tab">
                          <div class="form-row mb-3" id="divGeral">
                            <div class="col-md-12 col-12">
                              <div class="form-row">
                                <div class="col-1">
                                  <label for="txtNumero">Número: </label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control" aria-describedby="ufError" id="txtNumero" name="txtNumero" class="form-control" placeholder="Número">
                                    <div class="input-group-append">
                                      <button class="btn bg-danger" id="btnNumero" name="btnNumero" data-button="absolute" type="button">
                                        <i class="m-0 p-0 fas fa-search"></i>
                                      </button>
                                    </div>
                                  </div>
                                </div>
                                <div class="col-md-1 col-1">
                                  <label for="txtDescricao">Ped. Cliente:</label>
                                  <div class="relative">
                                    <input type="text" placeholder="Ped. Cliente" class="input-default focus form-control validate" pattern="[0-9]+$" id="txtPedCliente" name="txtPedCliente">
                                  </div>
                                </div>
                                <div class="col-4 col-lg-4">
                                  <label for="txtCliente">Cliente: </label>
                                  <div class="input-group">
                                    <input type="text" class="input-default focus form-control" aria-describedby="ufError" 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" type="button">
                                        <i class="m-0 p-0 fas fa-trash"></i>
                                      </button>
                                    </div>
                                  </div>
                                </div>
                                <div class="col-auto">
                                  <fieldset class="form border-Field mt-3 pb-0">
                                    <legend class="textoBorda mb-0 pb-0">Ações</legend>
                                    <div class="form-row mb-1">
                                      <div class="form-group form-check mr-2 mb-0 icheck-primary">
                                        <input type="radio" class="form-check-input" name="opcoesQtde" id="cbCancelarTotal">
                                        <label class="form-check-label" for="cbCancelarTotal">Cancelar Total</label>
                                      </div>
                                      <div class="form-group form-check mr-2 mb-0 icheck-primary">
                                        <input type="radio" class="form-check-input" name="opcoesQtde" id="cbFaturarTotal">
                                        <label class="form-check-label" for="cbFaturarTotal">Faturar Total</label>
                                      </div>
                                      <div class="form-group form-check mb-0 icheck-primary">
                                        <input type="checkbox" class="form-check-input" id="cbExcluirReserva">
                                        <label class="form-check-label" for="cbExcluirReserva">Excluir Reserva</label>
                                      </div>
                                    </div>
                                  </fieldset>
                                </div>
                                <div class="col-md-12 col-12 table-responsive mt-2">
                                  <table id="tabelaPedido" class="table table-sm-sisp table-hover table-select table-condensed">
                                  </table>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="modal-footer p-0 d-flex justify-content-between">
                        <div class="row col-3 col-lg-3 pl-0">
                          <label for="txtMotivo">Motivo: * </label>
                          <div class="input-group">
                            <input type="text" class="input-default focus form-control" aria-describedby="ufError" id="txtMotivo" name="txtMotivo" class="form-control" placeholder="Motivo">
                            <div class="input-group-append">
                              <button class="btn bg-danger" id="btnMotivo" name="btnMotivo" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                              <button class="btn bg-danger" id="btnLimpaMotivo" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                            </div>
                          </div>
                        </div>
                        <div class="sidebar-margin mt-2 pt-4">
                          <button type="button" id="btnVoltar" class="btn btn-secondary btn-sisp" data-dismiss="modal">Voltar</button>
                          <button type="button" id="btnVoltarCancelado" class="btn btn-danger">Voltar Cancelado</button>
                          <button type="button" id="btnVoltarFaturado" class="btn btn-danger">Voltar Faturado</button>
                          <button type="button" id="btnGravar" class="btn btn-sisp btnVerde" value="Gravar">Gravar</button>
                        </div>
                      </div>
                    </div>
                  </form>
                </div>
              </fieldset>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="modal fade" id="modalGeraDuplicatas" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-lg custom-modal">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title">Gerar Duplicatas</h5>
            <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-6 col-md-6 col-sm-6 p-0">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtClasseGer">Classe Gerencial: </label>
                <div class="input-group">
                  <input type="text" data-selecionado="false" size="1" class="input-default focus form-control" id="txtClasseGer" name="txtClasseGer" placeholder="Classe Gerencial">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnClasseGer" name="btnClasseGer" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaClasseGer" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="col-6 col-md-6 col-sm-6 pr-0 pb-0 pt-0">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtHistorico">Histórico: </label>
                <div class="input-group">
                  <input type="text" data-selecionado="false" size="1" class="input-default focus form-control" id="txtHistorico" name="txtHistorico" placeholder="Histórico">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnHistorico" name="btnHistorico" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaHistorico" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-6 col-md-6 col-sm-6 p-0">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtBanco">Banco: </label>
                <div class="input-group">
                  <input type="text" data-selecionado="false" size="1" class="input-default focus form-control" id="txtBanco" name="txtBanco" placeholder="Banco">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnBanco" name="btnBanco" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaBanco" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
              <div class="col-6 col-md-6 col-sm-6 pr-0 pb-0 pt-0">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtSituacao">Situação: </label>
                <div class="input-group">
                  <input type="text" data-selecionado="false" size="1" class="input-default focus form-control" id="txtSituacao" name="txtSituacao" placeholder="Situação">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnSituacao" name="btnSituacao" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaSituacao" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-6 col-md-6 col-sm-6 p-0">
                <label data-error="wrong" class="labelGeral" data-success="right" for="txtConta">Conta: </label>
                <div class="input-group mb-3">
                  <input type="text" data-selecionado="false" size="1" class="input-default focus form-control" id="txtConta" name="txtConta" placeholder="Conta">
                  <div class="input-group-append">
                    <button class="btn bg-danger" id="btnConta" name="btnConta" data-button="absolute" type="button"><i class="m-0 p-0 fas fa-search"></i></button>
                    <button class="btn bg-danger" id="btnLimpaConta" type="button"><i class="m-0 p-0 fas fa-trash"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group form-check icheck-danger">
              <input type="checkbox" class="form-check-input" name="cbGeraEmpDemo" id="cbGeraEmpDemo">
              <label class="form-check-label pr-2" for="cbGeraEmpDemo">Gerar na empresa demonstração</label>
            </div>
            <div class="col-sm-12 table-responsive card-body p-0">
              <table id="tabelaGeraDuplicatas" class="table table-sm table-select table-hover" style="white-space: nowrap;">
                <thead>
                </thead>
                <tbody>
                </tbody>
              </table>
            </div>
          </div>
          <div class="modal-footer justify-content-start">
            <button class="btn btn-primary btn-sisp" id="btnConfirmaDup">Confirmar</button>
            <button class="btn bg-gradient-danger btn-sisp" id="btnFechaModalDup" data-dismiss="modal">Cancelar</button>
          </div>
        </div>
      </div>
    </div>

    <aside class="control-sidebar control-sidebar-dark">
    </aside>
    <?php
    include_once('../../../modais.php');
    ?>
    <?php include_once('../../../menu_fiscal.php'); ?>
  </main>

  <script src="../plugins/jquery/jquery.min.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/jquery.maskMoney.min.js?versao=3.2512.9.1"></script>
  <script src="../plugins/jquery-ui/jquery-ui.min.js?versao=3.2512.9.1"></script>
  <script type="text/javascript" src="../dist/js/jquery.dataTables.js?versao=3.2512.9.1"></script>
  <script type="text/javascript" src="../dist/js/dataTables.bootstrap4.min.js?versao=3.2512.9.1"></script>
  <script src="../plugins/sweetalert2/sweetalert2.min.js?versao=3.2512.9.1"></script>
  <script src="../plugins/toastr/toastr.min.js?versao=3.2512.9.1"></script>
  <script>
    $.widget.bridge('uibutton', $.ui.button);
  </script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/adminlte.min.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/requisicoes.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/loadingoverlay.min.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/valida_cpf_cnpj.js?versao=3.2512.9.1"></script>
  <script src="../plugins/jquery-validation/jquery.validate.min.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/dataTables.keyTable.js?versao=3.2512.9.1"></script>
  <script src="../utils/cookies.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/driver.min.js?versao=3.2512.9.1"></script>
  <script type="text/javascript" src="../plugins/select2/js/select2.full.min.js?versao=3.2512.9.1"></script>
  <script src="../utils/funcoes.js?versao=3.2512.9.1"></script>
  <script src="../dist/js/sisplan.js?versao=3.2512.9.1"></script>
  <script src="plugins/datatables-colreorder/js/dataTables.colReorder.min.js?versao=3.2512.9.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;
      sArquivo = `${BASE_URI}/pages/cancelamento_pedido/cancelamento/cancelamento.js?versao=3.2512.9.1`;
      const nomeTela = ('<?php echo basename(__FILE__) ?>').replace('.php', '');

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

      const permissaoUsuarioLogado = await permissaoAcessos("CANCELAMENTO_PEDIDO");

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

      await insereJavaScriptPagina(sArquivo);

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

</html>