<?php

session_start();



if($_SESSION["s_usuario"] === null){

    header("Location: ../index.php");

}


?>


<head>
<title>Anexo Koha</title>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Quicksand&amp;display=swap" rel="stylesheet">
<link href="https://www.unlpam.edu.ar/templates/gck_store/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">

<style>

body {
  font-family: 'Quicksand', sans-serif;
  color: #444444;
}
    




button.php-email-form {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    border: 0;
    background: none;
    font-size: 16px;
    padding: 0 20px;
    background: #195E9C;
    color: #fff;
    transition: 0.3s;
    border-radius: 50px;
    box-shadow: 0px 2px 15px rgb(0 0 0 / 10%);
}

button.php-email-form:hover {
    background: #1c8bbe;
}

.padron input#dni {
    border: 0;
    padding: 4px 8px;
    width: calc(100% - 100px);
}

.padron {
    margin-top: 30px;
    background: #fff;
    padding: 6px 10px;
    position: relative;
    border-radius: 50px;
    box-shadow: 0px 2px 15px rgb(0 0 0 / 6%);
    text-align: left;
}

h4 {
    font-size: 24px;
    margin: 0 0 20px 0;
    padding: 0;
    line-height: 1;
    font-weight: 600;
    color: #37517e;
}

.seccionpadron {
    padding: 50px 0;
    background: #f3f5fa;
    text-align: center;
    font-size: 15px;
    color: #444444;
}

}
</style>
<script>
function sendContact() {
		jQuery.ajax({
		url: "consultar.php",
		data:'&dni='+$("#dni").val(),
		type: "POST",
		success:function(data){
		$("#data-usuario").html(data);
		},
		error:function (){}
		});
}

</script>

</head>
<body>
    
   <?php require_once "vistas/parte_superior.php"?>
   

    <?php
        // Solo administrador
        if ($_SESSION["s_usuario"] == demo) {
        ?>
             <div class="container-xxl w-100">
                <div class="row justify-content-center">
                    <div class="col-lg-auto">            
                    <button id="btnNuevo" type="button" class="btn btn-success btnImportar" data-opcion="4" data-toggle="modal">Agregar nueva carrera</button>    
                    </div>   
                    <div class="col-lg-auto pl-0">            
                    <button id="btnImportarEst" type="button" class="btn btn-primary btnImportar" data-opcion="4" data-toggle="modal">Importar Estudiantes</button>    
                    </div>
                    <div class="col-lg-auto pl-0">            
                    <button id="btnImportarDoc" type="button" class="btn btn-success btnImportar" data-opcion="5" data-toggle="modal">Importar Docentes / No Docentes</button>    
                    </div>
                </div> 
                <div class="progress mt-3 d-none">
                    <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="" aria-valuemin="0" aria-valuemax="100"></div>
                </div> 
            </div>
        <?php
        }
        ?>

    
    <div class="seccionpadron">
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-lg-6">
            <h4>Padron UNLPam</h4>
            <div class="padron"> 
                <input type="text" name="dni" id="dni" placeholder="Ingrese DNI para realizar la búsqueda">
                <button class="php-email-form" type="submit" onClick="sendContact();">Realizar Búsqueda</button>
            </div>
            <div class="my-3">
                <div id="data-usuario"></div>
              </div>
          </div>
        </div>
      </div>
    </div>
    
    
<!--Modal para EDITAR estudiantes y docentes-->
<div class="modal fade" id="modalCRUD" 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"></h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form id="formPersonas">    
                <div class="modal-body">
                    <div class="form-group">
                    <label for="dni" class="col-form-label">Dni:</label>
                    <input type="text" class="form-control" id="dni" name="dni">
                    </div>
                    <div class="form-group">
                    <label for="nombre" class="col-form-label">Apellido y Nombre:</label>
                    <input type="text" class="form-control" id="nombre" name="nombre" autocomplete="off">
                    </div>
                    <div class="form-group">
                    <label for="email" class="col-form-label">Email:</label>
                    <input type="text" class="form-control" id="email" name="email" autocomplete="off">
                    </div>     
                    <div class="form-group">
                    <label for="telefono" class="col-form-label">Teléfono:</label>
                    <input type="text" class="form-control" id="telefono" name="telefono" autocomplete="off">
                    </div>     
                    <div class="form-group">
                    <label for="condicion" class="col-form-label">Condición:</label>
                    <input type="text" class="form-control" id="condicion" name="condicion" autocomplete="off">
                    </div>     
                    <div class="form-group">
                    <label for="estado" class="col-form-label">Estado:</label>
                    <input type="text" class="form-control" id="estado" name="estado" autocomplete="off">
                    </div>     
                    <div class="form-group">
                    <label for="carreras_cod" class="col-form-label">Carrera / Cargo:</label>
                    <input type="text" class="form-control" id="carreras_cod" name="carreras_cod" autocomplete="off">
                    </div>     

                    <input type="hidden" id="id_persona" name="id_persona" value="" autocomplete="off">    
                    <input type="hidden" id="data_cond" name="data_cond" value="" autocomplete="off">
                    <input type="hidden" id="dni_orig" name="dni_orig" value="" autocomplete="off">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-light" data-dismiss="modal">Cancelar</button>
                    <button type="submit" id="btnGuardar" class="btn btn-dark">Guardar</button>
                </div>
            </form>    
        </div>
    </div>
</div> 

<!--Modal para IMPORTAR Estudiantes y doc/no doc-->
<div class="modal fade" id="modalImportar" 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"></h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form enctype="multipart/form-data" id="formImportar" method="post">    
                <div class="modal-body">
                    <div class="form-group">
                    <label for="fileImp" class="col-form-label">Selecciona un archivo:</label>
                    <input type="file" class="form-control" id="fileImp" name="fileImp" accept=".doc,.docx,.csv,.xlsx,.xls,.xlsm,.txt,.xml" autocomplete="off">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-light" data-dismiss="modal">Cancelar</button>
                    <button type="submit" id="btnGuardar" class="btn btn-dark">Guardar</button>
                </div>
            </form>
        </div>
    </div>
</div>  
      
<!--Modal para CRUD-->
<div class="modal fade" id="carreras" 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"></h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
            </div>
        <form id="formCarreras">    
            <div class="modal-body">
                <div class="form-group">
                <label for="nombree" class="col-form-label">Nombre de la carrera:</label>
                <input type="text" class="form-control" id="nombree">
                </div>
                <div class="form-group">
                <label for="codigo" class="col-form-label">Código:</label>
                <input type="text" class="form-control" id="codigo">
                </div>                            
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-light" data-dismiss="modal">Cancelar</button>
                <button type="submit" id="btnGuardar" class="btn btn-dark">Guardar</button>
            </div>
        </form>    
        </div>
    </div>
</div>    


<?php require_once "vistas/parte_inferior.php"?>

</body>