
<?php include('../config/setup.php'); ?>
<?php 

if(isset($_POST['infra_add'])){
    $title = $_POST['infra_title'];
    $desc = $_POST['infra_desc'];
    $addsugcatephoto=$_FILES['infra_image']['name'];
    $addsubphoto="../../img/events/".$addsugcatephoto;
    // $addsubphoto="../../img/infrastructure/".$addsugcatephoto;
    move_uploaded_file($_FILES["infra_image"]["tmp_name"],$addsubphoto);
    $maincate=date('Y-m-d');
    $sql = "INSERT INTO infrastructure(infra_title,infra_desc,infra_img)VALUES('$title','$desc','$addsugcatephoto')";
    $addsubcate=mysqli_query($config,$sql);	
    if($addsubcate==false){
        echo "<script>window.location.href='infrastructure.php?erro=0';</script>".mysqli_error();	 
    }
    else{ 
        echo "<script>window.location.href='infrastructure.php';</script>";	 
    }
}

if($_GET['delinfra'] == 700 ){
    $del_id = $_GET['delinfraid'];
    $sql = "DELETE FROM infrastructure WHERE infra_id = '$del_id' ";
    if($config->query($sql) === TRUE){
        echo "<script>window.location.href='infrastructure.php';</script>";	 
    }
    else{ 
        echo "<script>window.location.href='infrastructure.php?erro=0';</script>";	 	 
    }
}




?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title><?php 
            
            $leename=mysqli_query($config,"select Name,Name_status from lee_master");
            while($lee=mysqli_fetch_array($leename))
            {
                 $namestatus=$lee[1];
if($namestatus == 1)
{
    echo  $lee[0];
}else{
    echo "Need Name";

}

            }
            
            ?>  </title>
	<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport' />
	<link rel="icon" href="<?php 
            
            $inro_logo=mysqli_query($config,"select Logo_Path,logo_status from lee_master");
            while($logo=mysqli_fetch_array($inro_logo))
            {
                 $logstatus=$logo[1];
if($logstatus == 1)
{
	
	 $ms=substr($logo[0],3);
				//   echo  $ms;
				echo "../../photos/logo/favicon.ico";
	
     
}else{
    echo "../../photos/logo/no_logo.png";

}

            }
            
            ?>" type="image/x-icon"/>
	
	 	 
	<!-- Fonts and icons -->
	<script src="../assets/js/plugin/webfont/webfont.min.js"></script>
	<script>
		WebFont.load({
			google: {"families":["Lato:300,400,700,900"]},
			custom: {"families":["Flaticon", "Font Awesome 5 Solid", "Font Awesome 5 Regular", "Font Awesome 5 Brands", "simple-line-icons"], urls: ['../assets/css/fonts.min.css']},
			active: function() {
				sessionStorage.fonts = true;
			}
		});
	</script>
 
	<!-- CSS Files -->
	<link rel="stylesheet" href="../assets/css/bootstrap.min.css">
	<link rel="stylesheet" href="../assets/css/atlantis.min.css">
	<!-- CSS Just for demo purpose, don't include it in your project -->
	<link rel="stylesheet" href="../assets/css/demo.css">
	<!-- <script src='https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.0.5/tinymce.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'> -->
    <style>
        @media (min-width: 576px){
        .modal-dialog {
            max-width: unset; 
            }
        }
    </style>
</script><script  src="notes/script.js"></script>


</head>
<body>
	<div class="wrapper">
		<div class="main-header">
			<!-- Logo Header -->
			<?php include('logo.php');?>
			<!-- End Logo Header -->

			<!-- Navbar Header -->
			<?php include('topbar.php');?>
			 <!-- End Navbar -->
		</div>
		<!-- Sidebar -->
			<?php include('sidebar.php');?>
		
		
		<div class="main-panel">
			<div class="content">
				<div class="page-inner">
					<div class="page-header">
						<h4 class="page-title">Events</h4>	 
						<!--<h4 class="page-title">Infrastructure</h4>	 -->
					</div>
					<div class="row">
						<div class="container">
							<div class="col-md-12">

								<form action="infrastructure.php" method="post" enctype="multipart/form-data">		
									<div class="form-group">
										<label for="">Title</label>
										<input type="text" class="form-control mb-3" name="infra_title" id="" >
										

										<label for="email2">Description &nbsp; (Avoid this symbol ( ' ))</label>
										<textarea name="infra_desc" style="width:100%;"></textarea><br>	 
										
									</div> 
									<div class="form-group">
										<label for="email2">Add Image (Image size 1920px X 600px )</label>
										<input type="file" class="form-control mb-3"  id="email" name="infra_image">
									</div>
									<div class="form-group">
										<button class="btn btn-success" type="submit" name="infra_add">Submit</button>
									</div>
								</form>
								
							</div>
						</div>
						
					
						<div class="col-md-12">
						    <div class="container">
						        <div class="card">
						            <div class="card-body">
						            
    						            <div class="table-responsive">
    										<table id="basic-datatables" class="display table table-striped table-hover" >
    											<thead>
    												<tr>
    													<th>S.No</th>
    													<th>Image</th>
    													<th>Title</th>
    													<th>Description</th>
    													<th>Action</th>
    												</tr>
    											</thead>
            									<tbody>
        											<?php 
        											$pro=1;
        											$pro_photo=mysqli_query($config,"select * from infrastructure");
        											while($infra=mysqli_fetch_object($pro_photo))
        											{
        											?>
    												<tr>
    													<td><?php echo $pro;?></td>
    									                <td><img src="../../img/events/<?php echo $infra->infra_img; ?>" style="width: 125px;height: 102px;padding:10px 0;"> </td>
                                                        <td><?php echo $infra->infra_title;?></td>
                                                        <td><?php echo $infra->infra_desc;?></td>
    													<td>
                                                            <a href="infra_edit.php?editinfraid=<?php echo $infra->infra_id;?>&editinfra=700" class="btn btn-primary"> <i class="fas fa-pencil-alt"></i>  </a>
                                                            <a href="infrastructure.php?delinfraid=<?php echo $infra->infra_id;?>&delinfra=700" class="btn btn-danger" onclick="return confirm('Are you confirm to delete this?');"> <i class="fas fa-trash"></i>  </a>
                                                        </td>
                                                    </tr>

										        	<?php $pro++;} ?>
												
											    </tbody>
										    </table>
						                </div>
						            </div>
						        </div>
						    </div>  
						</div>
						
						<!--<div class="container">-->
						<!--	<div class="col-md-12">-->

						<!--		<form action="infrastructure1.php" method="post" enctype="multipart/form-data">		-->
						<!--			<div class="form-group">-->
						<!--				<label for="">Title</label>-->
						<!--				<input type="text" class="form-control mb-3" name="infra_title" id="" >-->
										

						<!--				<label for="email2">Description &nbsp; (Avoid this symbol ( ' ))</label>-->
						<!--				<textarea name="infra_desc" style="width:100%;"></textarea><br>	 -->
										
						<!--			</div> -->
						<!--			<div class="form-group">-->
						<!--				<label for="email2">Add Image (Image size 1920px X 600px )</label>-->
						<!--				<input type="file" class="form-control mb-3"  id="email" name="infra_image">-->
						<!--			</div>-->
						<!--			<div class="form-group">-->
						<!--				<button class="btn btn-success" type="submit" name="infra_edit">Submit</button>-->
						<!--			</div>-->
						<!--		</form>-->
								
						<!--	</div>-->
						<!--</div>-->
						
					</div>
				</div>
			</div>

				<?php include('footer.php');?>	
		</div>
		<!-- End Custom template -->
	</div>
<script type="text/javascript" src="richtext.js"></script> 
  <script type="text/javascript">
 
        bkLib.onDomLoaded(function() { 
            nicEditors.allTextAreas();
            new nicEditor({fullPanel : true}).panelInstance('area1');
            });
  </script>
	<!--   Core JS Files   -->
 	<script src="../assets/js/core/jquery.3.2.1.min.js"></script>
	<script src="../assets/js/core/popper.min.js"></script>
	<script src="../assets/js/core/bootstrap.min.js"></script>
	<!-- jQuery UI -->
	<script src="../assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
	<script src="../assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
	
	<!-- jQuery Scrollbar -->
	<script src="../assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
	<!-- Datatables -->
	<script src="../assets/js/plugin/datatables/datatables.min.js"></script>
	<!-- Atlantis JS -->
	<script src="../assets/js/atlantis.min.js"></script>
	<!-- Atlantis DEMO methods, don't include it in your project! -->
	<script src="../assets/js/setting-demo2.js"></script>
	<script >
		$(document).ready(function() {
			$('#basic-datatables').DataTable({
			});

		 
 
			 
		});
	</script>
</body>
</html>