<!DOCTYPE html>
<html lang="es">

<head>
  <%- include('../../tools/head'); %>
</head>

<body id="page-top">
  <!-- Page Wrapper -->
  <div id="wrapper">

    <!-- Sidebar -->
    <%- include('../../tools/sidebarAdmin'); %>
    <!-- End of Sidebar -->

    <!-- Content Wrapper -->
    <div id="content-wrapper" class="d-flex flex-column">
      <!-- Main Content -->
      <div id="content">

        <!-- Topbar -->
        <%- include('../../tools/topbar'); %>
        <!-- End of Topbar -->

        <!-- Begin Page Content -->
        <div class="container-fluid">

          <div class="container">
            <div class="card o-hidden border-0 shadow-lg my-5">
              <div class="card-body p-0">
                <!-- Nested Row within Card Body -->
                <div class="p-5">
                  <div class="text-center">
                    <h1 class="h4 text-gray-900 mb-4">CONFIGURACIÓN</h1>
                  </div>

                  <div id="accordion">

                    <div class="card">
                      <div class="card-header" id="headingOne">
                        <h5 class="mb-0">
                          <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                            Cronograma de Actividades
                          </button>
                        </h5>
                      </div>
                      <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
                        <div class="card-body">
                          <div class="card text-center">
                            <form onsubmit="configDateCron(event)" action="/coordinacion/Settings/Cronograma/<%= settings[0]._id %>" method="POST">
                              <div class="card-body">
                                <div class="form-group row">
                                  <div class="col-sm-6">
                                    <label for="cronMin" class="form-label">Dia Minimo:</label>
                                    <input type="number" class="form-control" name="cronMin" id="cronMin" min="1" max="31" value="<%= settings[0].cronogramaStart %>">
                                  </div>
                                  <div class="col-sm-6">
                                    <label for="cronMax" class="form-label">Dia Maximo:</label>
                                    <input type="number" class="form-control" name="cronMax" id="cronMax" min="2" max="31" value="<%= settings[0].cronogramaEnd %>">
                                  </div>
                                </div>
                              </div>
                              <button class="btn btn-primary btn-user btn-block" type="submit">
                                Confirmar
                              </button>
                            </form>
                          </div>
                        </div>
                      </div>
                    </div>

                    <div class="card">
                      <div class="card-header" id="headingTwo">
                        <h5 class="mb-0">
                          <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapse2" aria-expanded="false" aria-controls="collapse2">
                            Informe Mensual
                          </button>
                        </h5>
                      </div>
                      <div id="collapse2" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
                        <div class="card-body">
                          <div class="card text-center">
                            <form onsubmit="configDateInf(event)" action="/coordinacion/Settings/InformeMens/<%= settings[0]._id %>" method="POST">
                              <div class="card-body">
                                <div class="form-group row">
                                  <div class="col-sm-6">
                                    <label for="infMin" class="form-label">Dia Minimo:</label>
                                    <input type="number" class="form-control" name="infMin" id="infMin" min="1" max="31" value="<%= settings[0].infMensStart %>">
                                  </div>
                                  <div class="col-sm-6">
                                    <label for="infMax" class="form-label">Dia Maximo:</label>
                                    <input type="number" class="form-control" name="infMax" id="infMax" min="2" max="31" value="<%= settings[0].infMensEnd %>">
                                  </div>
                                </div>
                              </div>
                              <button class="btn btn-primary btn-user btn-block" type="submit">
                                Confirmar
                              </button>
                            </form>
                          </div>
                        </div>
                      </div>
                    </div>

                  </div>
                </div>
              </div>
            </div>
          </div>

        </div>
        <!-- /.container-fluid -->

      </div>
      <!-- End of Main Content -->

      <!-- Footer -->
      <%- include('../../tools/footer'); %>
      <!-- End of Footer -->

    </div>
    <!-- End of Content Wrapper -->

  </div>
  <!-- End of Page Wrapper -->

  <!-- Scroll to Top Button-->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <!-- Logout Modal-->
  <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">Salida</h5>
          <button class="close" type="button" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">×</span>
          </button>
        </div>
        <div class="modal-body">Seleccione "Cerrar
          sesión" a continuación si está listo para
          finalizar su sesión actual.</div>
        <div class="modal-footer">
          <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancelar</button>
          <a class="btn btn-primary" href="/coordinacion/logout">Cerrar Sesión</a>
        </div>
      </div>
    </div>
  </div>

  <!-- Bootstrap core JavaScript-->
  <script src="/vendor/jquery/jquery.min.js"></script>
  <script src="/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Core plugin JavaScript-->
  <script src="/vendor/jquery-easing/jquery.easing.min.js"></script>

  <!-- Custom scripts for all pages-->
  <script src="/js/sb-admin-2.min.js"></script>

  <!-- Validations -->
  <script type="text/JavaScript" src="/js/Coordinador/formularios.js"></script>

  <!-- Alert -->
  <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>

  <script>
    $(window).bind("load", function() {
      var nav = document.getElementById("nav5");
      nav.className += "  active";
    });
  </script>

  <% if(typeof alert !="undefined" ) { %>
  <script type="text/JavaScript">
    Swal.fire({
      title: '<%= alert[0].alertTitle %>',
      text:'<%= alert[0].alertMessage %>',
      icon:'<%= alert[0].alertIcon %>',
      showConfirmButton: <%= alert[0].showConfirmButton %>,
      timer: <%= alert[0].timer %>
    }).then(()=>{
      window.location = '<%= alert[0].ruta %>'
    })
  </script>
  <% } %>

</body>

</html>