<?
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/Ubigeo.class.php"); $objubi = new Ubigeo();

$idafi = $_REQUEST['ida'];
if($obja->BuscarPorCodigo($idafi))
   {
     $dni = $obja->getdni(); $ruc=$obja->getruc();;
     $nombres = $obja->getnombres();
	 $apepat = $obja->getapepat(); $apemat=$obja->getapemat();
	 $fechanac = date('Y-m-d', strtotime($obja->getfechanac()));
	 $lugarnac = $obja->getlugarnac(); 
	 if($objubi->BuscarPorCodigo($lugarnac))
	  {
	     $nombre = $objubi->getnombre();
	   }
	 $ocupacion = $obja->getocupacion();
	 $gradoins = $obja->getgradoins();
	 $estadocivil = $obja->getestadocivil();
	 $fecha_afilia = $obja->getfecha_afilia();
	 $sangre = $obja->getsangre();
	 $foto = $obja->getfoto();
	 $dom = $obja->getdomicilio();
	 $tc = $obja->gettipocas();
	 $aa = $obja->getareaactual();
   }
?>

<!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 type="text/javascript" src="jquery-1.2.1.pack.js"></script>
   <script type="text/javascript">
	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("autocompletarubigeo.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue,name) {
		$('#inputString2').val(thisValue);
		$('#inputString').val(name);
		setTimeout("$('#suggestions').hide();", 200);
	}
	</script>
	<style type="text/css">
	.suggestionsBox {
		position:relative;
		left: -20px;
		top: -15px;
		margin: 10px 0px 0px 0px;
		width: 300px;
		background-color: #ffffff;
		-moz-border-radius: 7px;
		-webkit-border-radius: 7px;
		border: 2px solid #ccc;	
		color: #000;
	}
	
	.suggestionList {
		margin: 0px;
		padding: 0px;
	}
	
	.suggestionList li {
		
		margin: 0px 0px 3px 0px;
		padding: 3px;
		cursor: pointer;		
	}
	
	.suggestionList li:hover {
		background-color:#F2F2F2;		
	}

#Layer1 {
	position:absolute;
	left:17px;
	top:199px;
	width:265px;
	height:29px;
	z-index:1;
}
</style>

<style>
    /* Estilo personalizado para la capa flotante */
    .capa-flotante {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 300px;
      padding: 20px;
      background-color: #BDCAD2;
      border: 1px solid #ccc;
      border-radius: 5px;
      box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
      z-index: 9999;
    }
</style>
<script>
function guardar(f)
{
  if(f.dni.value==""){
		 f.dni.focus();
		 return false;
	}
	if(f.nombres.value==""){
		 f.nombres.focus();
		 return false;
	}
	if(f.apepat.value==""){
		 f.apepat.focus();
		 return false;
	}
	if(f.apemat.value==""){
		 f.apemat.focus();
		 return false;
	}
	if(f.fechanac.value==""){
		 f.fechanac.focus();
		 return false;
	}
	if(f.lugarnac.value==""){
		 f.lugarnac.focus();
		 return false;
	}
	if(f.ocupacion.value==""){
		 f.ocupacion.focus();
		 return false;
	}
	if(f.gradoins.value==""){
		 f.gradoins.focus();
		 return false;
	}
	if(f.estadocivil.value==""){
		 f.estadocivil.focus();
		 return false;
	}
	if(f.sangre.value==""){
		 f.sangre.focus();
		 return false;
	}
		   f.action='controladores/AfiliadoController.php';
		   f.submit();
		   return true;
}
</script>

</head>
<body>
<div class="container">
      <div class="row">
        <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9 col-xs-offset-0 col-sm-offset-0 col-md-offset-3 col-lg-offset-3 toppad" >
   
   <form name="form1" action="" method="post" enctype="multipart/form-data">
          <div class="panel panel-info">
            <div class="panel-heading">
              <h3 class="panel-title">Modificar mis Datos de Afiliado </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>DNI/RUC N° :</td>
                        <td>
                        <input type="text" name="dni" value="<?=$dni;?>">
                        <input type="text" name="ruc" value="<?=$ruc;?>">
                        <input type="hidden" name="idafiliado" value="<?=$idafi;?>">
                        <input type="hidden" name="txtpara" value="M"></td>
                      </tr>
                      <tr>
                        <td>Nombres:</td>
                        <td>
                        <input type="text" name="nombres" value="<?=$nombres;?>"></td>
                      </tr>
                      <tr>
                        <td>Apellidos </td>
                        <td>
                        <input type="text" name="apepat" value="<?=$apepat;?>">
                        <input type="text" name="apemat" value="<?=$apemat;?>"></td>
                      </tr>
                   
                         <tr>
                      <tr>
                        <td>Fecha Nac. </td>
                        <td>
                        <input type="date" name="fechanac" value="<?=$fechanac;?>"> 
                        (d-m-Y) </td>
                      </tr>
                        <tr>
                        <td>Lugar Nac. </td>
                        <td>
                          <input name="txtbuscar" type="text" autocomplete="off" id="inputString" onKeyUp="lookup(this.value);" onBlur="fill();" placeholder="Seleccione ubigeo" value="<?=$nombre;?>"/>
														<div class="suggestionsBox capa-flotante" id="suggestions" style="display:none; float:left">				
															<div class="suggestionList" id="autoSuggestionsList" >
															
								&nbsp;						</div>
														</div>
														<input name="lugarnac" type="hidden"  id="inputString2" value="<?=$lugarnac;?>"></td>
                      </tr>
                      <tr>
                        <td>Ocupación</td>
                        <td>
                          
                          <input type="text" name="ocupacion" value="<?=$ocupacion;?>">                      </td>
                      </tr>
                      <tr>
                        <td>Grado de Instrucción </td>
                        <td>
                        
						<select name="gradoins">
						    <option value="<?=$gradoins;?>"><?=$gradoins;?></option>
							<option value="SUPERIOR UNIVERSITARIO">SUPERIOR UNIVERSITARIO</option>
							<option value="TECNICO PROFESIONAL">TECNICO PROFESIONAL</option>
							<option value="SECUNDARIA">SECUNDARIA</option>
							<option value="PRIMARIA">PRIMARIA</option>
                          </select>						</td>
                      </tr>
                      <tr>
                        <td>Estado civil </td>
                        <td>
                          <select name="estadocivil">
						    <option value="<?=$estadocivil;?>"><?=$estadocivil;?></option>
							<option value="SOLTERO">SOLTERO</option>
							<option value="CASADO">CASADO</option>
							<option value="VIUDO">VIUDO</option>
							<option value="DIVORSIADO">DIVORSIADO</option>
                          </select>                        </td>
                      </tr>
                      <tr>
                        <td>Fecha Afiliación </td>
                        <td>
                        <?=$fecha_afilia;?><input type="hidden" name="fechaafilia" value="<?=$fecha_afilia;?>"></td>
                      </tr>
                    <td>Grupo Sangre</td>
                        <td>
                        <input type="text" name="sangre" value="<?=$sangre;?>"></td>
                           
                      </tr><tr>
                        <td>Domicilio</td>
                        <td><input type="text" name="domicilio" value="<?=$dom;?>"></td>
                      </tr>
                      <tr>
                        <td>Tipo CAS </td>
                        <td><select name="tipocas">
							 <option value="<?=$tc;?>"><? if($tc==""){echo "Seleecionar";}else{echo $tc;}?></option>
							 <option value="INDETERMINADO">INDETERMINADO</option>
							 <option value="TRANSITORIO">TRANSITORIO</option>
							</select>	</td>
                      </tr>
                      <tr>
                        <td>Area Actual </td>
                        <td><input type="text" name="areaactual" value="<?=$aa;?>"></td>
                      </tr>
                      <tr>
                        <td>Foto</td>
                        <td><input type="file" name="file"><input type="hidden" name="MAX_FILE_SIZE" value="4000000"></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 btn-sm" onClick="guardar(this.form)"><span class="glyphicon glyphicon-ok-sign"></span>Guardar</button>
                            
                            <a href="contenido.php" data-original-title="Cerrar" data-toggle="tooltip" type="button" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-log-out"></i></a>
                        </span>
            </div>
            
          </div>
        </form>
  </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>
