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

/*$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();
   }*/
?>

<!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">
    <style type="text/css">
        .user-row {
    margin-bottom: 14px;
}

.user-row:last-child {
    margin-bottom: 0;
}

.dropdown-user {
    margin: 13px 0;
    padding: 5px;
    height: 100%;
}

.dropdown-user:hover {
    cursor: pointer;
}

.table-user-information > tbody > tr {
    border-top: 1px solid rgb(221, 221, 221);
}

.table-user-information > tbody > tr:first-child {
    border-top: 0;
}


.table-user-information > tbody > tr > td {
    border-top: 0;
}
.toppad
{margin-top:20px;
}

    </style>
    <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.rspta.value==""){
		 f.rspta.focus();
		 return false;
	}

    
	
	
		   f.action='controladores/SorController.php';
		   f.submit();
		   return true;
		 
}
	</script>
	
	<script>
		  function rellenar(i,n){		   
			 document.form2.idsor.value=i;
			 document.form2.asunto.value=n;
		     //document.form2.especifica.value=a;
			 }
			 
		
		  </script>
</head>
<body>
<div class="container">
  <div class="row"></div>
  
  
  
          <div class="col-md-12">
        <h4>Sugerencias - Opiniones y Reclamos  (personales) 
		
		<a href="contenido.php"  type="button" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-log-out"></i></a></h4>
        <div class="table-responsive">

                
              <table id="mytable" class="table table-bordred table-striped">
                   
                   <thead>
                <tr><th width="3%">ID</th>
                       <th width="14%">Afiliado</th>
                       <th width="10%">Fecha </th>
                       <th width="16%">Asunto</th>
                       <th width="27%">Especificacion</th>
                       <th width="20%">respuesta</th>
                       <th width="10%">&nbsp;</th>
                </thead>
    <tbody>
    <?
	  $lista = $objf->ListarTodos();
	  for($i=0;$i<count($lista); $i++)
	  {
	    if($obja->BuscarPorCodigo($lista[$i]["idafiliado"]))
   		{
		   $lista[$i]["nombres"] = $obja->getnombres()." ".$obja->getapepat()." ".$obja->getapemat();
		}
	?>
    <tr>
    <td><?=$lista[$i]["idsor"];?></td>
    <td><?=$lista[$i]["nombres"];?></td>
    <td><?=$lista[$i]["fecha"];?></td>
    <td><?=$lista[$i]["asunto"];?></td>
    <td><?=$lista[$i]["especifica"];?></td>
    <td><?=$lista[$i]["rspta"];?></td>
    <td><p data-placement="top" data-toggle="tooltip" title="Edit"><button class="btn btn-primary btn-xs" data-id="<?=$lista[$i]["idsor"];?>" data-title="Edit" data-toggle="modal" data-target="#edit" onClick="rellenar('<?=$lista[$i]["idsor"];?>','<?=$lista[$i]["asunto"];?>');"><span class="glyphicon glyphicon-pencil"></span></button></td>
    </tr>
   <? } ?> 
    </tbody>
</table>

<div class="clearfix"></div>

                
            </div>
            
        </div>
</div>
</div>


<form name="form2" id="formularioaenviar2" action="" method="post">
<div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="edit" aria-hidden="true">
      <div class="modal-dialog">
    <div class="modal-content">
          <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
        <h4 class="modal-title custom_align" id="Heading">Respuesta S-O-R</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        <input class="form-control " type="hidden" name="idsor" placeholder="ID" >
        </div>
		<div class="form-group">
        Asunto:
        <input class="form-control " type="text" name="asunto"  placeholder="Tema o asunto" readonly="">
        </div>
       
       <div class="form-group">
       Ingrese respuesta
        <textarea name="rspta" class="form-control"></textarea>
        </div>
		<div class="form-group">
		 <input name="txtpara" type="hidden" value="M">
		 <input name="idafiliado" type="hidden" value="<?=$idafi;?>">
		</div>
      </div>
          <div class="modal-footer ">
        <button type="button" class="btn btn-warning btn-lg" style="width: 100%;" onClick="guardar(this.form);"><span class="glyphicon glyphicon-ok-sign"></span> Guardar</button>
      </div>
        </div>
    <!-- /.modal-content --> 
  </div>
      <!-- /.modal-dialog --> 
    </div>
  </form>       
    
    
    <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>
