<?php
include("seguranca.php"); // Inclui o arquivo com o sistema de segurança  
protegePagina(); // Chama a função que protege a página 
?>
<?php
include "conexao.php";
?>
<!DOCTYPE html>
<html lang="en">
    <head>        
        <!-- META SECTION -->
        <title>Portal dos Patrocinadores - Sistema Administrativo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        
        <link rel="icon" href="favicon.ico" type="image/x-icon" />
        <!-- END META SECTION -->
        
        <!-- CSS INCLUDE -->        
        <link rel="stylesheet" type="text/css" id="theme" href="css/theme-default.css"/>
        <!-- EOF CSS INCLUDE -->                                   
    </head>
    <body>
        <!-- START PAGE CONTAINER -->
        <div class="page-container">
            
            <?php include 'topo.php'; ?>
                <!-- END X-NAVIGATION VERTICAL -->                     
                
        
                <ul class="breadcrumb">
                    <li><a href="#">Home</a></li>                    
                    <li class="active">Grupos</li>
                </ul>
				                
                
                <!-- PAGE CONTENT WRAPPER -->
            <div class="page-content-wrap" style="min-height: 1200px;">
						
                   
					 <div class="col-md-12">
					 
					 <form action="add_grupo.php" method="post" enctype="multipart/form-data" target="_self">
                

                            <div class="panel panel-default">
                                <div class="panel-heading">                                
                                    <h3 class="panel-title">Cadastro Grupo</h3>
                                    <ul class="panel-controls">
                                        <li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
								        <li><a href="#" class="panel-fullscreen"><span class="fa fa-expand"></span></a></li>
                                    </ul>
                                    
                                                                    
                                </div>
                                <div class="panel-body">



                                 <div class="col-md-12">
                                  <div class="form-group">
                                    <label>Grupo</label>
                                    <input type="text" name="grupo" class="form-control" placeholder="Grupo" id="grupo" required="required" />
                                  </div>
                                </div>

                                </div>
                                
					<div class="panel-footer">
					   <button type="submit" class="btn btn-success pull-right"><span class="fa fa-plus"></span> Adicionar</button>
				    </div>

                                
                            </div>


				</form>
					 
					 
					 
					 
					 
					 
					 
					 
					 
				<div class="panel panel-default">
                                <div class="panel-heading">                                
                                    <h3 class="panel-title">Grupos</h3>

                                    <ul class="panel-controls">
                                        <li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
								        <li><a href="#" class="panel-fullscreen"><span class="fa fa-expand"></span></a></li>
                                    </ul>                                
                                </div>
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-actions tabledata">
                <thead>
                <tr>
                    <th>Grupo</th>
                    <th>&nbsp;</th>
                    <th>&nbsp;</th>
                  </tr>
                </thead>
                                            <tbody>
                                            <?php
                                            $sql_consult2 = $sqli->query("SELECT * FROM grupos WHERE deleted_at IS NULL ORDER BY grupo ASC");
                                            while ($dados = $sql_consult2->fetch_assoc()) {
                                                $id = $dados['id'];
                                                ?>
                                                <tr>
                                                    <td><?php echo $dados['grupo'] ?></td>
                                                    <td>
                                                        <a data-toggle="modal" data-target="#pop_edita_<?php echo $id ?>"><button class="btn btn-sm btn-success"><span class="fa fa-search"></span></button></a>
                                                    </td>
                                                    <td>
                                                        <a data-toggle="modal" data-target="#pop_excluir_<?php echo $id ?>"><button class="btn btn-sm btn-success"><span class="fa fa-trash-o"></span></button></a>
                                                    </td>
                                                </tr>


                                                <div class="modal modal-primary" id="pop_excluir_<?php echo $id ?>">
                                                    <form action="delete_grupo.php" method="post" enctype="multipart/form-data" target="_self">
                                                        <div class="modal-dialog">
                                                            <div class="modal-content">
                                                                <div class="modal-header">
                                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                        <span aria-hidden="true">×</span></button>
                                                                    <h4 class="modal-title">Excluir Grupos</h4>
                                                                </div>
                                                                <div class="modal-body">

                                                                    <div class="row">

                                                                        <div class="col-md-12">
                                                                            <p>Tem certeza que deseja excluir o Grupo <?php echo $dados['grupo'] ?>?</p>
                                                                        </div>

                                                                        <input type="hidden" value="<?php echo $id ?>" name="id"/>

                                                                    </div>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <input type="submit" class="btn btn-success pull-right" value="Sim" />
                                                                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Não</button>
                                                                </div>
                                                            </div>
                                                            <!-- /.modal-content -->
                                                        </div>
                                                        <!-- /.modal-dialog -->
                                                    </form>
                                                </div>




        <div class="modal modal-primary" id="pop_edita_<?php echo $id ?>">
            <form action="atualizar_grupo.php" method="post" enctype="multipart/form-data" target="_self">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">×</span></button>
                            <h4 class="modal-title">Editar Grupo</h4>
                        </div>
                        <div class="modal-body">

                            <div class="row">

                                <input type="hidden" value="<?php echo $id ?>" name="id" />


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Grupo</label>
                                        <input type="text" name="grupo" class="form-control" placeholder="Grupo" required="required" value="<?php echo $dados['grupo'] ?>" />
                                    </div>
                                </div>


                            </div>
                        </div>
                        <div class="modal-footer">
                            <input type="submit" class="btn btn-success pull-right" value="Atualizar" />
                            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Fechar</button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </form>
        </div>



                                                <?php
                                            }
                                            ?>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>					 
					 
					 
					 
					 
					 </div>




					
					
                </div>
                <!-- END PAGE CONTENT WRAPPER -->                
            </div>            
            <!-- END PAGE CONTENT -->

        <!-- END PAGE CONTAINER -->

        
        <!-- START PRELOADS -->
        <script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="js/plugins/jquery/jquery-ui.min.js"></script>
        <script type="text/javascript" src="js/plugins/bootstrap/bootstrap.min.js"></script>        
        <!-- END PLUGINS -->

        <!-- THIS PAGE PLUGINS -->
        <script type='text/javascript' src='js/plugins/icheck/icheck.min.js'></script>
        <script type="text/javascript" src="js/plugins/mcustomscrollbar/jquery.mCustomScrollbar.min.js"></script>
        
        <script type="text/javascript" src="js/plugins/datatables/jquery.dataTables.min.js"></script>    
        

        <!-- END PAGE PLUGINS -->         

        <!-- START TEMPLATE -->
        <script type="text/javascript" src="js/plugins.js"></script>        
        <script type="text/javascript" src="js/actions.js"></script>

        <script src="js/jquery.maskedinput.js"></script>
        <script src="js/jquery.maskMoney.js" type="text/javascript"></script>

		<script src="js/valor.js"></script>
		
		
		<script>
  $(function () {

      $('.tabledata').DataTable({
          "paging": true,
          "lengthChange": true,
          "searching": true,
          "ordering": true,
          "info": true,
          "autoWidth": true,
          "order": [[ 0, "asc" ]]
      });

  });
  </script>



        <!-- END TEMPLATE -->
    <!-- END SCRIPTS -->       
    </body>
</html>






