<?php
session_start();
require_once('conexion.php');
if (isset($_SESSION['usu_nombre']))
{
  require_once('include/sesiones.php');
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php
        include ('head.php');
    ?>
  </head>
<body>
<?php
  $inicio="";
  $M_inventario="";
  $M_contactos="";
  $M_compras="";
  $M_ventas="";
  $M_pedidos="";
  $M_pos="";
  $R_reportes="";

  include ('menu.php');
?> 
    

<div class="main">
    <div class="col-md-2">
        <div class="widget stacked">
            <div class="widget-content">
                <div class="shortcuts">
                    <div class="col-md-6">
                        <a href="A_perfil.php" class="shortcut ">
                            <i class="shortcut-icon fa fa-cogs"></i>
                            <span class="shortcut-label"><strong>INFORMACION</strong></span>
                        </a>
                    </div>
                    <div class="col-md-6">
                        <a href="A_info_ingreso.php" class="shortcut active">
                            <i class="shortcut-icon fas fa-user-lock"></i>
                            <span class="shortcut-label"><strong>CONTRASEÑA</strong></span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-10 ">
<?php
    $us=mysqli_query($con,"SELECT * FROM usuario WHERE usu_id='$usu_id'  and empresa_emp_id='$empresa'  ") or die(mysqli_error($con));
    $usu=mysqli_fetch_array($us);
 ?> 
        <div id="resultado"></div>
        <div class="panel panel-default">
            <div class="panel-body">
                <h1 class="panel-title pull-left" style="font-size:20px;">INFORMACION DE INGRESO</h1>
            </div>
        </div>
        
        <div class="panel panel-default">
            <div class="panel-body">
                <form class="form-horizontal" id="mod_usu" name="mod_usu" action=""  method="post"  enctype="multipart/form-data">
               <div class="col-lg-6 ">
                        <label for="First_name">Usuario</label>
                        <input type="hidden" class="form-control" name="usu_id" value="<?php echo $usu['usu_id']; ?>" >
                        <input type="text" class="form-control" name="usu_username" value="<?php echo $usu['usu_username']; ?>" >
                        <label for="Last_name">Contraseña</label>
                        <input type="text" class="form-control" name="clave" id="clave" value="">
                        <label for="Last_name">Repite la contraseña:</label>
                        <input type="text" class="form-control" name="clave_conf" id="clave_conf" value="">
                  <BR>      
                  <div class=" pull-right">
                    <a href="inicio.php" class="btn btn-default"><i class="fa fa-fw fa-times" aria-hidden="true"></i> Cancelar</a>
                    <button type="submit" id="modificar" value="modificar" name="modificar" class="btn btn-primary"><i class="fa fa-fw fa-check" aria-hidden="true"></i> Actualizar</button>
                </div> 
                </div>
               
                 </form>   
            </div>
        </div>
    </div> <!-- /main -->
</div>
<script>



$( "#mod_usu" ).submit(function( event ) {
$('#modificar').attr("disabled", true);
 var formData = new FormData($("#mod_usu")[0]);
  var ruta = "php_usuarios/editar_clave.php";
   $.ajax({
      type: "POST",
      url: ruta,
      data: formData,
      contentType: false,
      processData: false, 
        beforeSend: function(objeto){
         $('#resultado').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
      success: function(datos){
      $("#resultado").html(datos);
      $('#modificar').attr("disabled", false);
      }
  });

  event.preventDefault();
})



</script>
<style type="text/css">

input[type="file"]#imagen {
 width: 0.1px;
 height: 0.1px;
 opacity: 0;
 overflow: hidden;
 position: absolute;
 z-index: -1;
 }

label[for="imagen"] {
 font-size: 14px;
 font-weight: 600;
 color: #fff;
 background-color: #106BA0;
 display: inline-block;
 cursor: pointer;
 padding: 5px 40px ;
 width: fit-content;
 text-align: center;
 }
</style>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<?php
  include ('php_caja/caja_abrir.php');
  include ('script.php');
?>

  </body>
</html>

<?php
}
else
{
    echo '<script>location.href = "index.php";</script>';
}
?>