<?php include('casa/setup.casa.php');
include('inc_scripts.php'); 
$title = 'Iniciar Sesión';
echo "<title>".AppName.' - '.$title."</title>";
?>
<style>
body{
	background:green;
}	
.btn{
	font-weight:bold;
}
</style>
</head>
<body>
	<form><br>
	<div class="wrapper">		
			<div class="content">				
				<div class="page-inner">										
					<div class="row">
						<div class="col-md-4"></div>
						<div class="col-md-4">
							<div class="card">
								<div class="card-body">
									<div class="row">	
										<div class="col-md-12 col-lg-12">																						
											<div class="form-group form-floating-label">
											<center>
												<?php echo '<img src="'.PATH_HOME.'assets/img/logo2.jpg" alt="Logo '.AppName.'" width="99%">'; ?>											
												<input type="hidden" id='txtHora' disabled> <input type="hidden" id='txtFecha' disabled>
											</center>
											</div>			
											<div class="form-group form-floating-label">
												<input id="txtUser" type="text" class="form-control input-border-bottom" required>												
												<label for="txtUser" class="placeholder">Usuario:</label>
											</div>																																
											<div class="form-group form-floating-label">
												<input id="txtPass" type="password" class="form-control input-border-bottom" required>
												<label for="txtPass" class="placeholder">Contraseña:<span onclick='VerPW()' class="fas fa-eye-slash" style='margin:15px 0 0 7px;'></span></label>																														
											</div>
										</div>	
									</div>
								</div>
								<div class="card-action">
									<center>
										<div id='res'></div>
											<input type='reset' class="btn btn-danger" value=" REINICIAR ">
											<input type='submit' class="btn btn-primary" value="INICIAR SESIÓN">	
									</center>
															
								</div>
							</div>
						</div>
						<div class="col-md-4"></div>
					</div>
				</div>
			</div>
			<?php include('inc_pie.php');?>		 
	</div></form>
	
</body>
</html>
<script>
$(document).ready(function(){    	
    var tiempo = new Date();
    //fecha
    var mes =(tiempo.getMonth()+1);
        if(mes<10) mes = '0'+mes;
    var dia =tiempo.getDate();
        if(dia<10) dia='0'+dia;
    var ano = tiempo.getFullYear();
    var fecha = ano+'-'+mes+'-'+dia;
    //hora
    let hh = tiempo.getHours();
        if(hh<10) hh = '0'+hh;
    let mm = tiempo.getMinutes();
        if(mm<10) mm = '0'+mm;
    let ss = tiempo.getSeconds();
        if(ss<10) ss = '0'+ss;
    let hora = hh+':'+mm+':'+ss;

    $('#txtFecha').val(fecha);
    $('#txtHora').val(hora);
});	
$('form').on('submit', function(event) {
  event.preventDefault();

  $.post('<?php echo PATH_HOME.'indlogin/'.md5(uniqid()); ?>',{
    'uss': $('#txtUser').val(),
    'pss': $('#txtPass').val(),
	'txtFecha': $('#txtFecha').val(),
	'txtHora': $('#txtHora').val(),	 
    'coder': '<?php echo md5(uniqid()); ?>'
  },function(data){
    $('#res').html(data);
  });
  
});

let sw=true;
function VerPW(){
	if(sw){
		$("#txtPass").attr("type", "text");
		sw=false;
	}else{
		$("#txtPass").attr("type", "password");
		sw=true;
	}		
}

</script>