<div class="clearfix"></div>
  <div class="content-wrapper">
    <div class="container-fluid">

      <div class="row mt-4">

        <div class="col-12 col-lg-6 col-xl-3">

          <div class="card gradient-purpink">

            <div class="card-body">

              <div class="media">

              <a href="<?php echo base_url().'admin/products_list';?>" class="media-body text-left">

                <h4 class="text-white"><?php echo $this->db->get("products")->num_rows();?></h4>

                <span class="text-white">Products Listed</span>

              </a>

			  <div class="align-self-center"><i class="fa fa-cubes fa-3x"></i></div>

            </div>

            </div>

          </div>

        </div>

		<div class="col-12 col-lg-6 col-xl-3">

          <div class="card gradient-scooter">

            <div class="card-body">

              <div class="media">

              <a href="<?php echo base_url().'admin/ContactEnquiries';?>" class="media-body text-left">

                <h4 class="text-white"><?php echo $this->db->get("contact")->num_rows();?></h4>

                <span class="text-white">Enquiries</span>

              </a>

			  <div class="align-self-center"><i class="fa fa-users fa-3x"></i></div>

            </div>

            </div>

          </div>

        </div>

        <div class="col-12 col-lg-6 col-xl-3">

          <div class="card gradient-ibiza">

            <div class="card-body">

              <div class="media">

			  <a href="<?php echo base_url().'admin/orders/Confirmed';?>" class="media-body text-left">

                <h4 class="text-white"><?php echo $this->db->get_where("orders",array("ostatus"=>"Confirmed"))->num_rows();?></h4>

                <span class="text-white">New Orders</span>

              </a>

               <div class="align-self-center"><i class="fa fa-shopping-cart fa-3x"></i></div>

            </div>

            </div>

          </div>

        </div>
        
        <div class="col-12 col-lg-6 col-xl-3">

          <div class="card gradient-purpink">

            <div class="card-body">

              <div class="media">

             

			  <a href="<?php echo base_url().'admin/orders/Completed';?>" class="media-body text-left">

                <h4 class="text-white"><?php echo $this->db->get_where("orders",array("ostatus"=>"Completed"))->num_rows();?></h4>

                <span class="text-white">Completed Orders</span>

              </a>

			  <div class="align-self-center"><i class="fa fa-users fa-3x"></i></div>

            </div>

            </div>

          </div>

        </div>

      </div><!--End Row-->
	  
      
      
	  <div class="row">

			<div class="col-lg-4">

			   <?php //if($this->session->flashdata("msg")){echo $this->session->flashdata("msg"); }?>

               <div class="card">

               		<div class="card-header">Add/Edit Banner</div>

                    <div class="card-body">

                    	<?php if($_GET['banner_id']){

								 $edit=$this->db->get_where("banner",array("banner_id"=>$_GET['banner_id']))->row();?>

								 <form action="<?php echo base_url();?>admin/update_banner" method="post" enctype="multipart/form-data">

                                    <input type="hidden" name="bid" value="<?php echo $edit->banner_id;?>" />

                                            	



                            



                                                <div class="form-group">



                                                    <label class="control-label">Banner</label>



                                                    <input type="file"  name="img" class="form-control">



                                                    <input type="hidden" name="oldimg" value="<?php echo $edit->banner_img;?>" />



                                                     <img width="100%" src="<?php echo base_url();?>assets/images/category/<?php echo $edit->banner_img;?>" class="img img-responsive">



                                                </div>
                                                
                                                <div class="form-group">
                                                	<label>Banner Heading</label>
                                                    <input type="text" name="banner_title" value="<?php echo $edit->banner_title;?>" class="form-control" />
                                                </div>
                                                <div class="form-group">
                                                	<label>Banner Text</label>
                                                    <input type="text" name="banner_desc" value="<?php echo $edit->banner_desc;?>" class="form-control" />
                                                </div>
                                                <div class="form-group">
                                                	<label>Banner Link</label>
                                                    <input type="url" name="banner_link" value="<?php echo $edit->banner_link;?>"  class="form-control" />
                                                </div><br/>



                                                <button type="submit" class="btn btn-primary btn-block">Update</button>



                                            </form>

                                 <?php }else{?>

                                 <form action="<?php echo base_url();?>admin/add_banner" method="post" enctype="multipart/form-data">


                                                <div class="form-group">



                                                    <label class="control-label">Banner</label>



                                                    <input type="file"  name="img" class="form-control">

                                                </div>
                                                <div class="form-group">
                                                	<label>Banner Heading</label>
                                                    <input type="text" name="banner_title" class="form-control" />
                                                </div>
                                                <div class="form-group">
                                                	<label>Banner Text</label>
                                                    <input type="text" name="banner_desc" class="form-control" />
                                                </div>
                                                <div class="form-group">
                                                	<label>Banner Link</label>
                                                    <input type="url" name="banner_link" class="form-control" />
                                                </div><br/>



                                                <button type="submit" class="btn btn-primary btn-block">Submit</button>



                                            </form>

                        <?php }?>
<table class="table table-condensed table-bordered">



                                    	<thead><tr><th>Banner</th><th>Title/Text</th><th>Action</th></tr></thead>



                                        <tbody>



                                        <?php $this->db->select("*");



									$this->db->from("banner");



							//$this->db->join("mcategory","mcategory.mid=banner.banner_cat","left");



									$ban=$this->db->get()->result();



									foreach($ban as $b){?>



                                    <tr><td width="150px">

                                    <img width="100%" src="<?php echo base_url();?>assets/images/category/<?php echo $b->banner_img;?>" class="img img-responsive"></td>



                                    

<td><h6 class="text-danger"><?php echo $b->banner_title;?></h6><p><?php echo $b->banner_desc;?></p></td>

                                    <td>


							 <a  href="<?php echo base_url().'admin?banner_id='.$b->banner_id;?>" class="btn btn-sm btn-warning"><i class="fa fa-edit"></i></a>
							 <a href="<?php echo $b->banner_link;?>" target="_blank" class="btn btn-sm btn-success"><i class="fa fa-share"></i></a>
                             <a href="#" id="<?php echo $b->banner_id;?>" class="btn btn-sm btn-danger banner_delete"><i class="fa fa-trash-o"></i></a></td></tr><?php }?>



                                        </tbody>



                                    </table>
                        

                    </div>

               </div>

            </div>

            

            <div class="col-lg-8">
            
               <div class="card">

               		<div class="card-header">New Order</div>

                    <div class="card-body">
                    	<table class="table table-bordered table-condensed">
                        	<thead><tr><th>S.No.</th><th>Product</th><th>Customer Details</th><th>Amount</th><th>Action</th></tr></thead>
                            <tbody>
                            <?php $i=1;foreach($apps as $app){?>
                            <tr><td><?php echo $i;?></td>
                            	<td><?php echo $app->app_day;?></td>
                            	<td><?php echo $app->app_type.' '.$app->app_amt;?></td>
                            	<td><?php echo $app->app_name.'<br/>'.$app->app_phone;?></td>
                                <td><a href="#" id="<?php echo $app->app_id;?>" class="btn btn-sm btn-danger app_delete"><i class="fa fa-trash-o"></i></a></td>
                                </tr>
                            <?php $i++;}?>
                            </tbody>
                        </table>
                    </div>
               </div>
           </div>

    </div>

    <!-- End container-fluid-->

    

    </div><!--End content-wrapper-->

   <!--Start Back To Top Button-->

    <a href="#" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>

    <!--End Back To Top Button-->

	

	<!--Start footer-->

	<footer class="footer">

      <div class="container">

        <div class="text-center">

          Copyright © 2022

        </div>

      </div>

    </footer>

	<!--End footer-->

   

  </div><!--End wrapper-->



  <!-- Bootstrap core JavaScript-->

  <script>



		$(document).ready(function(){

		$(".test_delete").click(function(e){e.preventDefault();

				if(!confirm("Sure you want to delete?")){

					  return false;

				}

				var id=$(this).attr("id");$(this).closest("tr").remove();

				$.ajax({

					 type: "POST",

					 url: '<?php echo base_url();?>admin/ajax_app_delete',

					 data: {id:id},

					 success: function(response){

						 //alert(response);

					 }

				});

			});


			$(".banner_delete").click(function(e){e.preventDefault();



				if (!confirm("Sure you want to delete?")){



				  return false;



				}



				var id=$(this).attr("id");



				$(this).closest("tr").remove();



				$.ajax({



					 type: "POST",



					 url: '<?php echo base_url();?>admin/delete_banner',



					 data: {id:id},



					 success: function(response){



						 //alert(response);



					 }



				});



			});

			

			$(".dt_delete").click(function(e){e.preventDefault();



				if (!confirm("Sure you want to delete?")){



				  return false;



				}



				var id=$(this).attr("id");



				$(this).closest("tr").remove();



				$.ajax({



					 type: "POST",



					 url: '<?php echo base_url();?>admin/dt_delete',



					 data: {id:id},



					 success: function(response){



						 //alert(response);



					 }



				});



			});



		});



		</script>

  <!-- sidebar-menu js -->

  <script src="<?php echo base_url();?>adminassets/js/sidebar-menu.js"></script>

  <!-- Custom scripts -->

  <script src="<?php echo base_url();?>adminassets/js/app-script.js"></script>

  

  <!-- Vector map JavaScript -->

  <!-- Index js -->

  <script src="<?php echo base_url();?>adminassets/js/index.js"></script>

  

</body>

</html>

