<?php
include"initialize_page.php";

?>
<!DOCTYPE html>
<html lang="en">

<head>
  
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

	<title>User Sliders Management</title>

	<!-- Bootstrap core CSS -->
	<link rel="stylesheet" href="assets/css/bootstrap/bootstrap.css" /> 

	<!-- datatables Styling  -->
    <link rel="stylesheet" href="assets/css/plugins/datatables/jquery.dataTables.css" />
    
    <!-- Fonts  -->
    <link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700,300' rel='stylesheet' type='text/css'>
    
    <!-- Base Styling  -->
    <link rel="stylesheet" href="assets/css/app/app.v1.css" />

	<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
		
	<script type="text/javascript">
	 $(document).ready(function() {
    $("#mainsignupi").on('submit',(function(e) {
e.preventDefault();

$.ajax({
url: "controller.php", // Url to which the request is send
type: "POST",             // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false,       // The content type used when sending data to the server.
cache: false,             // To unable request pages to be cached
processData:false,        // To send DOMDocument or non processed data file it is set to false
success: function(data)   // A function to be called if request succeeds
{
	//alert(data);
	if(data=="empty")
	{
	alert("Please fill  all fields..");	
	}
	
	if(data=="done")
	{
		alert("Added successfully..");
		window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/slider2.php';
	}
	if(data=="wrongfile")
	{
	alert("Wrong File..");	
	}
	if(data=="errorfile")
	{
	alert("Error in File..");	
	}
}
});
}));
});
	
	</script>
   <script type="text/javascript">
   
   function deletefun(id)
		            {
						 var r=confirm("Are you sure to Delete??");
  if(r==true)
  {
  $.post("controller.php", {id:id, q:"delete_slider1"} , function(data)
  {
	window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/slider2.php';  
  });
  
   	
		
		}
						
					}
   
   </script>
   
   
</head>
<body>

 <div class="modal fade" id="modal-form" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel">Add Slider</h4>
          </div><form role="form" method="post" action="" id="mainsignupi">
          <input type="hidden" name="q" value="add_new_slider1">
         
          <div class="modal-body">
            
            	   
                     <div class="form-group">
                    <label for="exampleInputEmail1">Heading</label>
                    <input type="text" class="form-control"  name="ad_head" required>
                  </div>
                  <div class="form-group">
                    <label for="exampleInputEmail1">Image</label>
                    <input type="file" class="form-control"   name="file" required>
                  </div>
                  
               
                  
                  
             
            
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <input type="submit" class="btn btn-primary" value="Add" name="sub">   </form>
          </div>
        </div>
      </div>
    </div>
	

    

    
    
    
	<?php    include"xleftmenu.php"; ?>
    
    <section class="content">
    	
         <?php  include"xheader.php";  ?>
        <!-- Header Ends -->
        
        
        <div class="warper container-fluid">
        	
            <div class="page-header"><h1>User Sliders Management <?php //echo time();  ?></h1></div>
            
       
            
                <div class="panel panel-default">
                  
                       <div align="right" style="margin-right:10px;margin-top:4px;">
                    <button type="button" class="btn btn-success btn-circle btn-flat" data-toggle="modal" data-target="#modal-form">Add </button>
                   </div>
                   
                    <div class="row">
                    <div class="col-md-12">
                    <div class="panel-body">
                   
<table class="table table-striped table-bordered" id="basic-datatable" width="100%">
        <thead>
            <tr>
                <th>Sr</th>
                <th>Slider Image	</th>
             
                <th>Heading</th>
               
                 <th>Action</th>
              
            </tr>
        </thead>
        <tbody>
                            
                             <?php
						  $sr=1;
						 
						  
						      $data_q=mysqli_query($con,"SELECT * FROM x_slider1 ORDER by x_id DESC");  
							  
							
							   
			while($data_array=mysqli_fetch_array($data_q))
			{
				
			?>
                <tr class="odd gradeX">
              
                
                
             
                 
                
                    
                       <td><?php echo $sr;  ?></td>
                      
                  <td><img src="../images/<?php echo $data_array['x_image'];  ?>" style="height:40px;width:40px;" ></td>
                
                     <td><?php echo $data_array['x_heading'];  ?></td>
                <td><button class="btn btn-danger" onClick="deletefun(<?php echo $data_array['x_id'];  ?>)">Delete</button></td>
               
               
                                 
                </tr>
			<?php
            
            $sr++;
            }
            ?>  
</tbody>
</table>

</div></div>
</div></div>
</div>
<!-- Warper Ends Here (working area) -->


<footer class="container-fluid footer">
Copyright &copy; <?php    echo date('Y');  ?>
</footer>


</section>
<!-- Content Block Ends Here (right box)-->



<!-- JQuery v1.9.1 -->
			<script src="assets/js/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
            
            <!-- Bootstrap -->
            <script src="assets/js/bootstrap/bootstrap.min.js"></script>
            
            <!-- NanoScroll -->
            <script src="assets/js/plugins/nicescroll/jquery.nicescroll.min.js"></script>
            
            
            <!-- Data Table -->
            <script src="assets/js/plugins/datatables/jquery.dataTables.js"></script>
            <script src="assets/js/plugins/datatables/DT_bootstrap.js"></script>
            <script src="assets/js/plugins/datatables/jquery.dataTables-conf.js"></script>
            
            
            <!-- Custom JQuery -->
            <script src="assets/js/app/custom.js" type="text/javascript"></script>
            
            
            
            <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
            
            ga('create', 'UA-56821827-1', 'auto');
            ga('send', 'pageview');
            
            </script>
</body>
</html>
