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


$id_empreendimento = $_GET["idempreendimento"];



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


<head>
	<meta charset="utf-8" />
	<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" />
	<!-- ================== 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>
	<link href="assets/plugins/dropzone/min/dropzone.min.css" rel="stylesheet" />
	<!-- ================== 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 in page-sidebar-fixed page-header-fixed">

		<?php include "topo.php"; ?>

		<div id="content" class="content">


			<!-- begin page-header -->
			<h1 class="page-header">Anexar Arquivos</h1>
			<!-- end page-header -->
			
			<!-- begin row -->

             	<div class="row">
           
                <!-- end col-2 -->
                <!-- begin col-10 -->
			    <div class="col-md-10">
                    <!-- begin panel -->
                    <div class="panel panel-inverse" data-sortable-id="form-dropzone-1">
                        <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">Anexar Arquivos</h4>
                        </div>
                        <div class="panel-body">
                            <div id="dropzone">
                                <form id="drop" action="empreendimento_grava_anexo.php?id_empreendimento=<?= $id_empreendimento ?>" class="dropzone needsclick" id="demo-upload">
                                    <div class="dz-message needsclick" >
                                        <strong>Arraste os arquivos para anexar ou Clique e escolha o diretorio</strong><br />
                                        <span class="dz-note needsclick">
                                            
                                        </span>
                             
                                      
                                    </div>	
                                                                                                        
                                </form>


                            </div>
                        </div>
                    </div>
                    <!-- end panel -->
			    </div>
                <!-- end col-10 -->
            </div>
         
             <div class="row">

            	<div class="col-md-10">
    			<!-- 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">Anexos cadastrados</h4>
    				</div>

    				<div class="panel-body">
    					<table id="data-table" class="table table-striped table-bordered">
    						<thead>
    							<tr>
    								<th>Anexo</th>
    								<th>Ação</th>
    						</thead>
    						<tbody>

        
    			 
           

            			

              <?php

              include "conexao.php";
  

               $query_anexo = "SELECT * FROM empreendimento_anexo WHERE empreendimentocadastro_id = $id_empreendimento";


               $executa_anexo = mysqli_query ($db,$query_anexo) or die (mysqli_error($db));

               while ($buscar_anexo = mysqli_fetch_assoc($executa_anexo)) {//--verifica se são amigos

               	   $id_anexo        = $buscar_anexo['idanexo_empreendimento'];

                   $url_anexo       = $buscar_anexo['url_anexo'];

                  if($url_anexo != ''){}

               ?>    	

                 <tr class="odd gradeX">

                   <td>

                     <a href="<?= $url_anexo?>"><i class="fa fa-file" aria-hidden="true"></i></a>

                   </td>

                   	<td>	


                   <a class = "excluir_anexo" data-url="<?= $id_anexo?>" ><span class="badge badge-danger">Excluir Anexo</span></a></td>




                 </tr>
            	  
              <?php }?>

           
              











              


            	
            	

                            




</tbody>

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

</div>

</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/apps.min.js"></script>
	<!-- ================== BEGIN PAGE LEVEL JS ================== -->
    <script src="assets/plugins/dropzone/min/dropzone.min.js"></script>
	<script src="assets/js/apps.min.js"></script>
	<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
	<!-- ================== END PAGE LEVEL JS ================== -->
	

	   <script>

		   Dropzone.options.drop = {

		    success: function(file,response){

		    	window.location.reload();

		         }
		    };

	  </script>

	<script>
		$(document).ready(function() {
			App.init();
			TableManageButtons.init();
		});


		$(document).on("click", ".excluir_anexo", function(){

			let id_anexo = $(this).attr("data-url");

			


			 $.ajax({

               url: "empreendimento_grava_anexo.php",

               type: "POST",

               datatype: "json",

               data: "id_anexo=" + id_anexo,
 
               success: function(data){


                  window.location.reload();


               }

 

			 })


            return false;
		})

	</script>

</body>

</html>
