<?
session_start();
if(!isset($_SESSION['usuario']))
{
 	echo "<script languaje='JavaScript'>";       
	echo "parent.location.href='login.php'; ";
	echo "</script>";
}
include ("clases/Usuario.class.php"); $obju = new Usuario();
include ("clases/Afiliado.class.php"); $obja = new Afiliado();
include ("clases/Familiar.class.php"); $objf = new Familiar();

$idafi = $_REQUEST['ida'];
if($obja->BuscarPorCodigo($idafi))
   {
     $dni = $obja->getdni()."/".$obja->getruc();;
     $nombres = $obja->getnombres();
	 $apellidos = $obja->getapepat()." ".$obja->getapemat();
	 $fechanac = $obja->getfechanac();
	 $lugarnac = $obja->getlugarnac();
	 $ocupacion = $obja->getocupacion();
	 $gradoins = $obja->getgradoins();
	 $estadocivil = $obja->getestadocivil();
	 $fecha_afilia = $obja->getfecha_afilia();
	 $sangre = $obja->getsangre();
	 $foto = $obja->getfoto();
   }
 if($obju->BuscarPorAfiliado($idafi))
 {  $idusuario = $obju->getidusuario();
    $usuario = $obju->getusuario();
	$tipouser = $obju->gettipo();
 }
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <!-- This file has been downloaded from Bootsnipp.com. Enjoy! -->
    <title>Simple User Profile  - Bootsnipp.com</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" href="media/css/bootstrap.css">
	<link rel="stylesheet" href="media/css/bootstrap.min.css">
	<link rel="stylesheet" href="media/css/bootstrap-theme.css">
	<link rel="stylesheet" href="media/css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="media/css/dataTables.bootstrap.min.css">
	<link rel="stylesheet" href="media/css/fixedHeader.bootstrap.min.css">
	<link rel="stylesheet" href="media/css/responsive.bootstrap.min.css">
	 <script src="media/js/jquery-1.10.2.js"></script>
	<script src="media/js/jquery.dataTables.min.js"></script>
	<script src="media/js/dataTables.bootstrap.min.js"></script>
	<script src="media/js/dataTables.fixedHeader.min.js"></script>
	<script src="media/js/dataTables.responsive.min.js"></script>
	<script src="media/js/responsive.bootstrap.min.js"></script>
	
	<script src="media/js/jquery.min.js"></script>
    <script src="media/js/bootstrap.min.js"></script>
	
<script>
function guardar(f)
{
  if(f.clave.value=="" || f.reclave.value=="")
   {
     alert('no se puede registrar claves vacias');
	 return false;
   } else{
           if(f.clave.value == f.reclave.value)
		   {
		      f.action = 'controladores/UsuarioController.php';
			  f.submit();
			  return true;
		   }else{
		         alert('Las claves no coinciden, vuelva a intentarlo');
				 f.clave.value="";
				 f.reclave.value = "";
				 return false;
		        }
         }
}
</script>

</head>
<body>
<div class="container">
      <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 col-xs-offset-0 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 toppad" >
   
   <form name="form1" action="" method="post">
          <div class="panel panel-info">
            <div class="panel-heading">
              <h3 class="panel-title">Mis Datos de Usuario </h3>
            </div>
            <div class="panel-body">
              <div class="row">
                <div class="col-md-3 col-lg-3 " align="center"> <img alt="User Pic" src="fotos/<?=$foto;?>" class="img-circle img-responsive"> </div>
                
                <!--<div class="col-xs-10 col-sm-10 hidden-md hidden-lg"> <br>
                  <dl>
                    <dt>DEPARTMENT:</dt>
                    <dd>Administrator</dd>
                    <dt>HIRE DATE</dt>
                    <dd>11/12/2013</dd>
                    <dt>DATE OF BIRTH</dt>
                       <dd>11/12/2013</dd>
                    <dt>GENDER</dt>
                    <dd>Male</dd>
                  </dl>
                </div>-->
                <div class=" col-md-9 col-lg-9 "> 
                  <table class="table table-user-information">
                    <tbody>
                      <tr>
                        <td>Mi Usuario  :</td>
                        <td><?=$usuario;?></td>
                      </tr>
                      <tr>
                        <td>Perfil de Usuario: </td>
                        <td><?=$tipouser;?></td>
                      </tr>
                      <tr>
                        <td>Nueva Clave:</td>
                        <td><input  name="clave" type="password"></td>
                      </tr>
                      <tr>
                        <td>Repetir nueva  Clave  </td>
                        <td><input  name="reclave" type="password">
                        <input type="hidden" name="txtpara" value="AC">
                        <input type="hidden" name="idusuario" value="<?=$idusuario;?>">
                        <input type="hidden" name="idafiliado" value="<?=$idafi;?>"></td>
                      </tr>
                    </tbody>
                  </table>
                  
                <!--  <a href="#" class="btn btn-primary">My Sales Performance</a> -->
                </div>
              </div>
            </div>
                 <div class="panel-footer">
                       <a data-original-title="Broadcast Message" data-toggle="tooltip" type="button" class="btn btn-sm btn-primary" style="visibility:hidden"><i class="glyphicon glyphicon-envelope"></i></a>
                        <span class="pull-right">
                            
                             <button type="button" class="btn btn-warning"  onClick="guardar(this.form);"><span class="glyphicon glyphicon-ok-sign"></span> Actualizar</button>
							 <a href="contenido.php"  type="button" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-log-out"></i></a>
                        </span>
            </div>
            
          </div>
        </form>
  </div>
  
  
  
</div>
</div>



</div>
    
    
    
    <div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
    <script type="text/javascript">
$(document).ready(function() {
    var panels = $('.user-infos');
    var panelsButton = $('.dropdown-user');
    panels.hide();

    //Click dropdown
    panelsButton.click(function() {
        //get data-for attribute
        var dataFor = $(this).attr('data-for');
        var idFor = $(dataFor);

        //current button
        var currentButton = $(this);
        idFor.slideToggle(400, function() {
            //Completed slidetoggle
            if(idFor.is(':visible'))
            {
                currentButton.html('<i class="glyphicon glyphicon-chevron-up text-muted"></i>');
            }
            else
            {
                currentButton.html('<i class="glyphicon glyphicon-chevron-down text-muted"></i>');
            }
        })
    });


    $('[data-toggle="tooltip"]').tooltip();

    $('button').click(function(e) {
        e.preventDefault();
        //alert("This is a demo.\n :-)");
    });
});
</script>
</body>
</html>
