<?
session_start();
if(!isset($_SESSION['usuario']))
{
 	echo "<script languaje='JavaScript'>";       
	echo "parent.location.href='login.php'; ";
	echo "</script>";
}
 include "clases/Pacto.class.php"; $objcur = new Pacto();
 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.convenio.value==""){
		 f.acuerdo.focus();
		 return false;
	}
	if(f.fechapacto.value==""){
		 f.fechapacto.focus();
		 return false;
	}
	if(f.estado.value==""){
		 f.estado.focus();
		 return false;
	}
	
		   f.action='controladores/PactoController.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,e){		   
			 document.form2.idpacto.value=i;
			 document.form2.convenio.value=a;
			 document.form2.fechapacto.value=f;
			 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 Pactos colectivos
          <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="67%">Pacto/Convenio</th>
                     <th width="11%">Fecha del Pacto </th>
                     <th width="12%">Estado</th>
                   </thead>
    <tbody>
    
    <tr><? //$a = $_POST["txtbuscar"]; 
		   $lista = $objcur->ListaPorConvenio("");
		   //////////////////////////////////////////////////77	
			//////////////////////////////////////////////////////////77
		   for($i=0;$i<count($lista); $i++){	
			
		?>
    <td><?=$lista[$i]["convenio"]?></td>
    <td><?=$lista[$i]["fechapacto"];?></td>
    <td><?=$lista[$i]["estado"];?></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 Pacto Colectivo</h4>
      </div>
          <div class="modal-body">
          <div class="form-group">
        <input name="convenio" type="text" size="15" class="form-control" placeholder="Ingrese pacto">
		</div>
		<div class="form-group">
		<input class="form-control " type="date" name="fechapacto" id="fechapacto" placeholder="Fecha">
		</div>
		
		<div class="form-group">
		<select name="estado" class="form-control">
		<option value="ACTIVO">ACTIVO</option>
		<option value="BAJA">BAJA</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="convenio" type="text" size="15" class="form-control" placeholder="Ingrese pacto">
		</div>
		<div class="form-group">
		<input class="form-control " type="date" name="fechapacto" id="fechapacto" placeholder="Fecha">
		</div>
		
		<div class="form-group">
		<select name="estado" class="form-control">
		<option value="ACTIVO">ACTIVO</option>
		<option value="BAJA">BAJA</option>
		</select>
		</div>		
		</div>		
		<div class="form-group">
		<input name="txtpara" type="hidden" value="M" id="txtpara">
		<input name="idpacto" type="hidden"  id="idpacto">
        </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