<?php 
error_reporting(0);
ini_set(“display_errors”, 0 );
include "protege_professor.php";

	if(isset($_POST["empreendimento_id"])){
		$empreendimento_id = $_POST["empreendimento_id"];
		$imobiliaria_id    = $_POST["imobiliaria_id"];

		include "conexao.php";

	 $insere = mysqli_query($db, "INSERT INTO sem_roleta (empreendimento_id, imobiliaria_id) values ('$empreendimento_id', '$imobiliaria_id')");
	}


?>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="pt-br">
<!--<![endif]-->


<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" /> <!-- TESTE DE ACENTOS -->
	<title>Immobile | Business</title>
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	
	<!-- ================== BEGIN BASE CSS STYLE ================== -->
	<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/css/animate.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/css/style.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/css/style-responsive.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/css/theme/default.css" rel="stylesheet" id="theme" />

	<!--  inclusao para select dinamico
 -->    <link href="https://immobilebusiness.com.br/admin/assets/plugins/select2/dist/css/select2.min.css" rel="stylesheet" />
          <link href="https://immobilebusiness.com.br/admin/assets/css/multiple-select.css" rel="stylesheet"/>
	<!-- ================== END BASE CSS STYLE ================== -->
	
	<!-- ================== BEGIN PAGE LEVEL STYLE ================== -->
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/css/dataTables.bootstrap.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/css/buttons.bootstrap.min.css" rel="stylesheet" />
	<link href="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Responsive/css/responsive.bootstrap.min.css" rel="stylesheet" />
	<!-- ================== END PAGE LEVEL STYLE ================== -->
	
	<!-- ================== BEGIN BASE JS ================== -->
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/pace/pace.min.js"></script>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>
	<!-- ================== END BASE JS ================== -->
</head>
<body>

	<!-- begin #page-loader -->
	<div id="page-loader" class="fade"><span class="spinner"></span></div>
	<!-- end #page-loader -->
	
	<!-- begin #page-container -->
	<div id="page-container" class="fade page-header-fixed page-sidebar-fixed">
		<!-- begin #header -->
		
		<?php 
		include "topo.php";
		//echo $_SERVER['HTTP_REFERER']; 

		?>


		
		<!-- begin #content -->
		<div id="content" class="content">
			<!-- begin breadcrumb -->
			
			
			
			


				<!-- begin row -->
				<div class="row">
					<!-- begin col-2 -->

					<!-- end col-2 -->
					<!-- begin col-10 -->
					<div class="col-md-12">
						<div class="panel panel-inverse m-b-0">
							<div class="panel-heading">
								<div class="panel-heading-btn">
									<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
									<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
									<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
									<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
								</div>
								<h4 class="panel-title">Sem Roleta <small></small></h4>
							</div>
							<div class="panel-body">
								<form action="sem_roleta.php" method="POST">
									
									<div>
										<fieldset>
											<legend class="pull-left width-full">Remover Imobiliarias/ Corretores da Roleta</legend>
											<!-- begin row -->
											<div class="row">
												<!-- begin col-4 -->
											
												<!-- end col-4 -->
													<!-- VALUE É O TOKEN PARA CADA ORIGEM 
														<input type="hidden" name="origem" value="4">-->

														<!-- begin col-4 -->
													
														<div class="col-md-6">
															                    <label class="control-label">Empreendimento</label>

															<div class="form-group">
																 <select class="form-control" name="empreendimento_id">
                        <option value="Todos">Todos</option>
                          <?php

                               include "conexao.php";

                                  $query_amigo = "SELECT * FROM empreendimento_cadastro";

                                      $executa_query = mysqli_query($db, $query_amigo);
                                      while ($buscar_amigo = mysqli_fetch_assoc($executa_query)) { //--verifica se são amigos

                              $idempreendimento  = $buscar_amigo['idempreendimento_cadastro'];
                              $descricao_empreendimento = $buscar_amigo["descricao_empreendimento"];

                          ?>
                          <option value="<?php echo $idempreendimento ?>"> <?php echo $descricao_empreendimento ?> </option>
                        <?php } ?>
                      </select>
															</div>
														</div>


     	<div class="col-md-6">
     		                    <label class="control-label">Imobiliaria</label>

															<div class="form-group">
																 <select class="form-control" name="imobiliaria_id" id="imobiliaria_id">
                        <option value="Todos">Todos</option>
                          <?php

                               include "conexao.php";

                                  $query_amigo = "SELECT * FROM cliente
                                      INNER JOIN cliente_tipo ON cliente_tipo.idcliente = cliente.idcliente
                                      WHERE (idtipo = 11 or idtipo = 8 or idtipo = 18) group by cliente.idcliente order by nome_cli Asc";

                                      $executa_query = mysqli_query($db, $query_amigo) or die("Erro ao listar empreendimento");
                                      while ($buscar_amigo = mysqli_fetch_assoc($executa_query)) { //--verifica se são amigos

                                        $idcliente             = $buscar_amigo['idcliente'];
                                        $nome_cli              = $buscar_amigo["nome_cli"];
                                        $cpf_cli              = $buscar_amigo["cpf_cli"];

                          ?>
                          <option value="<?php echo $idcliente ?>"> <?php echo $nome_cli ?> </option>
                        <?php } ?>
                      </select>
															</div>
														</div>


											



													</div>


						

<!-- #$#$#$#$#$#$#$$#$#$#$#$#$#$#$##$#$$#$#$#$#$#$#$#$#$#$$#$#-->




											
										</fieldset>
									</div>

									<div>
										<fieldset>

											<div class="row">

												<br/>                                                                                               
												<div class="form-group">
													<div class="col-md-9">
														<button type="submit" class="btn btn-sm btn-primary">Cadastrar</button>	
														<!-- #modal-dialog -->

													</div>
												</div>
											</div>
										</fieldset>
									</div>
								</form>
							</div>

						</div>
					</div>






<div class="col-md-12">
              <!-- begin panel -->
              <div class="panel panel-inverse">
                <div class="panel-heading">
                  <div class="panel-heading-btn">
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                    <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                  </div>
                  <h4 class="panel-title">Imobiliaria / Corretor - Sem Roleta</h4>
                </div>

                <div class="panel-body">
                  <table id="data-table" class="table table-striped table-bordered">
                    <thead>
                      <tr>
                        <th>Código</th>
                        <th>Empreendimento</th>                       
                        <th>Imobiliaria /Corretor</th>
                        <th></th>
                      </tr>
                    </thead>
                    <tbody>

                      <?php                         

                          include "conexao.php";                


             				$query_amigo = "SELECT * FROM sem_roleta  
             				INNER JOIN cliente ON sem_roleta.imobiliaria_id = cliente.idcliente 
             				INNER JOIN empreendimento_cadastro ON sem_roleta.empreendimento_id = empreendimento_cadastro.idempreendimento_cadastro";
                          
                          $executa_query = mysqli_query($db, $query_amigo);


                          while ($buscar_amigo = mysqli_fetch_assoc($executa_query)) { //--verifica se são amigos

                            $idsem_roleta     = $buscar_amigo['idsem_roleta'];
                            $nome_cli         = $buscar_amigo["nome_cli"];
                            $idcliente         = $buscar_amigo["idcliente"];
                            $idempreendimento_cadastro         = $buscar_amigo["idempreendimento_cadastro"];
                            $descricao_empreendimento      = $buscar_amigo["descricao_empreendimento"];
                           
                            ?>


                        <tr class="odd gradeX">
                          <td><?php echo $idsem_roleta ?></td>
                          <td><?php echo $descricao_empreendimento ?></td>
                          <td><?php echo $nome_cli ?></td>
                          <td>
                          	
                          	<a href="excluir_sem_roleta.php?idcliente=<?php echo $idcliente ?>&empreendimento_id=<?php echo $idempreendimento_cadastro ?>"> <span class="label label-danger">Excluir</span></a>

                          </td>
                        

                         
                        </tr>
                      <?php } ?>
                    </tbody>
                  </table>
                </div>
              </div>
              <!-- end panel -->
            </div>
















				</div>

				<!-- end #content -->
			</div>



			<!-- begin scroll to top btn -->
			<a href="javascript:;" class="btn btn-icon btn-circle btn-success btn-scroll-to-top fade" data-click="scroll-top"><i class="fa fa-angle-up"></i></a>
			<!-- end scroll to top btn -->
		</div>
		<!-- end page container -->

		<!-- ================== BEGIN BASE JS ================== -->
		<script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
		<script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
		<script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
		<script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
	<!--[if lt IE 9]>
		<script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/html5shiv.js"></script>
		<script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/respond.min.js"></script>
		<script src="https://immobilebusiness.com.br/admin/assets/crossbrowserjs/excanvas.min.js"></script>
	<![endif]-->
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-cookie/jquery.cookie.js"></script>
	<!-- ================== END BASE JS ================== -->

	<!-- ================== BEGIN PAGE LEVEL JS ================== -->
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/js/jquery.dataTables.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/media/js/dataTables.bootstrap.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/dataTables.buttons.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.bootstrap.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.flash.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/jszip.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/pdfmake.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/vfs_fonts.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.html5.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Buttons/js/buttons.print.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/plugins/DataTables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/js/table-manage-buttons.demo.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/js/ui-modal-notification.demo.min.js"></script>
	<script src="https://immobilebusiness.com.br/admin/assets/js/apps.min.js"></script>


	<script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/ionRangeSlider/js/ion-rangeSlider/ion.rangeSlider.min.js"></script>
 <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/masked-input/masked-input.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script>
<script src="https://immobilebusiness.com.br/admin/assets/plugins/password-indicator/js/password-indicator.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-combobox/js/bootstrap-combobox.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
<script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-tagsinput/bootstrap-tagsinput-typeahead.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/plugins/jquery-tag-it/js/tag-it.min.js"></script>
   <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-daterangepicker/moment.js"></script>
    <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
   <script src="https://immobilebusiness.com.br/admin/assets/plugins/select2/dist/js/select2.min.js"></script>
     <script src="https://immobilebusiness.com.br/admin/assets/plugins/bootstrap-eonasdan-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
  <script src="https://immobilebusiness.com.br/admin/assets/js/form-plugins.demo.min.js"></script>
	<!-- ================== END PAGE LEVEL JS ================== -->
	<script type="text/javascript"> 

	document.getElementById('menucrm').style.display="block";

</script>
	<script>	

		$(document).ready(function() {
			App.init();
			TableManageButtons.init();
			Notification.init();
			FormPlugins.init();

		});
	</script>

	
	

</body>


</html>
