<?
session_start();
if(!isset($_SESSION['usuario']))
{
 	echo "<script languaje='JavaScript'>";       
	echo "parent.location.href='login.php'; ";
	echo "</script>";
}
 include "clases/Acuerdos.class.php"; $objcur = new Acuerdos();
 include "clases/Afiliado.class.php"; $obj = new Afiliado();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <!-- This file has been downloaded from Bootsnipp.com. Enjoy! -->
    <title>USUARIOS</title>
        <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>
		$(document).ready(function() {
		var table = $('#example').DataTable( {
			responsive: true
		} ); 
			new $.fn.dataTable.FixedHeader( table );
		 });
   </script> 
    <style type="text/css">
        
    </style>
   
</head>
<body>

<script>
function guardar(f)
{   if(f.acuerdo.value==""){
		 f.acuerdo.focus();
		 return false;
	}
	if(f.fecha.value==""){
		 f.fecha.focus();
		 return false;
	}
	if(f.publicado.value==""){
		 f.publicado.focus();
		 return false;
	}
	
		   f.action='controladores/AcuerdoController.php';
		   f.submit();
		   return true;
		 
}
function editar(f)
{   if(f.numdoc.value==""){
		 f.numdoc.focus();
		 return false;
	}
	if(f.usuario.value==""){
		 f.usuario.focus();
		 return false;
	}
	if(f.clave.value==""){
		 f.clave.focus();
		 return false;
	}
	if(f.tipo.value==""){
		 f.tipo.focus();
		 return false;
	}
	
		   f.action='controladores/UsuarioController.php';
		   f.submit();
		   return true;
		
}

function eliminar(f)
{   
		   f.action='controladores/UsuarioController.php';
		   f.submit();
		   return true;
		 
}
$(document).ready(function() {
  $('a[data-toggle=modal], button[data-toggle=modal]').click(function () {
    var data_id = '';
	var data_des= '';
    if (typeof $(this).data('id') !== 'undefined') {
      data_id = $(this).data('id');	   
    }
    $('#idusuario').val(data_id);
  })
});
</script>
 <script>
		  function rellenar(i,a,f,p,e){		   
			 document.form2.idacuerdo.value=i;
			 document.form2.acuerdo.value=a;
			 document.form2.fecha.value=f;
			 document.form2.publicado.value=p;
			 document.form2.estado.value=e;
			 }	
			 
		function elimina(e){
		  document.form3.idusuario.value=e; 
		}
		
		function reiniciarClave(id)
		{
		   document.f1.action="controladores/UsuarioController.php?idusuario="+id+"&txtpara=RE";
		   document.f1.submit();
		   return true;
		}
		
		function reportar(id)
		{
      	 // location.href ='votos.php?idacuerdo='+id;
		  location.href ='reportevotos.php?idacuerdo='+id;
		}
		  </script>
<div class="container">
	<div class="row">
		
        
        <div class="col-md-12">
		
        <h4>Lista de Acuerdos 
          <button class="btn btn-success btn-xs" data-title="AGREGAR" data-toggle="modal" data-target="#nuevo" ><span class="glyphicon glyphicon-plus"></span> Agregar</button><a href="contenido.php" class="close" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></h4>
		
        <div class="table-responsive">

            
              <table width="100%" class="table table-striped table-bordered nowrap" id="example">
                   
                   <thead>
                   <tr><th width="3%">ID</th>
                    <th width="63%">Acuerdo</th>
                     <th width="7%">Fecha</th>
                     <th width="9%">Publicado</th>
                     <th width="9%">Estado</th>
                     <th width="4%">Edit</th>
                     <th width="2%">Ver</th>
                     <th width="3%">excel</th>
                   </thead>
    <tbody>
    
    <tr><? //$a = $_POST["txtbuscar"]; 
		   $lista = $objcur->ListaTotal();
		   //////////////////////////////////////////////////77	
			//////////////////////////////////////////////////////////77
		   for($i=0;$i<count($lista); $i++){	
			
		?>
    <td><?=$lista[$i]["idacuerdo"];?></td>
    <td><?=$lista[$i]["acuerdo"]?></td>
    <td><?=$lista[$i]["fecha"];?></td>
    <td><?=$lista[$i]["publicado"];?></td>
    <td><?=$lista[$i]["estado"];?></td>
    <td><p data-placement="top" data-toggle="tooltip" title="Edit">
	    <button class="btn btn-primary btn-xs" data-id="<?=$lista[$i]["idacuerdo"];?>" data-title="Edit" data-toggle="modal" data-target="#edit" onClick="rellenar('<?=$lista[$i]["idacuerdo"];?>','<?=$lista[$i]["acuerdo"];?>','<?=$lista[$i]["fecha"];?>','<?=$lista[$i]["publicado"];?>','<?=$lista[$i]["estado"];?>');"><span class="glyphicon glyphicon-pencil"></span></button>
        </td>
    <td><a href="reportevotos.php?idacuerdo=<?=$lista[$i]["idacuerdo"];?>" target="_blank" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-list"></span></a>
	 <!--    <button class="btn btn-default btn-xs" data-id="<?=$lista[$i]["idacuerdo"];?>" data-title="Edit" onClick="reportar('<?=$lista[$i]["idacuerdo"];?>');"><span class="glyphicon glyphicon-list"></span></button> -->   </td>
    <td><a href="rptvotos.php?idacuerdo=<?=$lista[$i]["idacuerdo"];?>" target="_blank" class="btn btn-success btn-xs"><span class="glyphicon glyphicon-list"></span></a></td>
    </tr>
    <?
		  }
		?>
    </tbody>
</table>

<div class="clearfix">

</div>

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

<form name="form1" action="" method="post">

<div class="modal fade" id="nuevo" tabindex="-1" role="dialog" aria-labelledby="nuevo" 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">Registro de Acuerdo</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        <input name="acuerdo" type="text" size="15" class="form-control" placeholder="Ingrese Acuerdo">
		</div>
		<div class="form-group">
		<input class="form-control " type="text" name="fecha" id="fecha" placeholder="Fecha">
		</div>
		<div class="form-group">
		<select name="publicado" class="form-control">
		<option value="">Publicado</option>
		 <option value="SI">SI</option>
		 <option value="NO">NO</option>
		</select>
		</div>
		<div class="form-group">
		<select name="estado" class="form-control">
		<option value="REGISTRADO">REGISTRADO</option>
		</select>
		</div>		
		<div class="form-group">
		<input name="txtpara" type="hidden" value="R" id="txtpara">
        </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>   
 
 <form name="form2" 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">Actualizacion de Acuerdo</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        <input name="acuerdo" type="text" size="15" class="form-control" placeholder="Ingrese Acuerdo">
		</div>
		<div class="form-group">
		<input class="form-control " type="text" name="fecha" id="fecha" placeholder="Fecha">
		</div>
		<div class="form-group">
		<select name="publicado" class="form-control">
		
		 <option value="SI">SI</option>
		 <option value="NO">NO</option>
		</select>
		</div>
		<div class="form-group">
		<select name="estado" class="form-control">
		<option value="REGISTRADO">REGISTRADO</option>
		<option value="APROBADO">APROBADO</option>
		<option value="RECHAZADO">RECHAZADO</option>
		</select>
		</div>		
		<div class="form-group">
		<input name="txtpara" type="hidden" value="M" id="txtpara">
		<input name="idacuerdo" type="hidden"  id="idacuerdo">
        </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> 
    
 <script type="text/javascript">
$(document).ready(function(){
$("#mytable #checkall").click(function () {
        if ($("#mytable #checkall").is(':checked')) {
            $("#mytable input[type=checkbox]").each(function () {
                $(this).prop("checked", true);
            });

        } else {
            $("#mytable input[type=checkbox]").each(function () {
                $(this).prop("checked", false);
            });
        }
    });
    
    $("[data-toggle=tooltip]").tooltip();
});

</script>
</body>
</htm