<div class="clearfix"></div>

  <div class="content-wrapper">

    <div class="container-fluid">

     <div class="row pt-2 pb-2">

        <div class="col-sm-9">

		    <h4 class="page-title">Manage Pre Bookings</h4>

	   </div>

     </div>

     <div class="row">

			

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

               <div class="card">

                    <div class="card-header">Listed Pre Bookings</div>

                    <div class="card-body">


                    <table class="table table-condensed table-bordered" id="default-datatable">

        	<thead><tr><th>S.No.</th><th>Product</th><th>Name</th><th>Booking Details</th><th>Payment Details</th><th>Action</th></tr></thead>

            <tbody>

            	<?php $i=1;foreach($books as $cat){?>

                <tr><td width="80px"><?php echo $i;?></td>

                <td width="100px">
                <img  width="100%" src="<?php echo base_url();?>assets/images/products/<?php echo $cat->img;?>" class="img img-responsive"></td>
<td>
                <?php echo $cat->title;?><br/><b class="text-success"><?php echo date("d-M-Y",strtotime($cat->pre_date));?></b></td>
                <td><?php echo $cat->pre_name.'<br/><b>'.$cat->pre_mob.'</b><br/>'.$cat->pre_city.' '.$cat->pre_pincode;?></td>
                <td><?php echo $cat->pre_amt;?>/-<br/>
                	<span class="badge badge-warning"><?php echo $cat->pre_trans_id;?></span><br/>
                    <span class="badge badge-dark"><?php echo $cat->pre_pay_status;?></span></td>
                    <td>
                <a href="<?php echo $cat->pre_bid;?>" class="btn btn-sm btn-danger book_delete"><i class="fa fa-trash-o"></i></a><br/>
                <select class="book_status" id="<?php echo $cat->pre_bid;?>">
                	<option value="">Pending</option>
                	<option value="Completed" <?php if($cat->pre_status=="Completed"){echo "selected";}?>>Completed</option>
                	<option value="Cancelled" <?php if($cat->pre_status=="Cancelled"){echo "selected";}?>>Cancelled</option>
                </select><br/>
                <textarea class="book_remarks" id="<?php echo $cat->pre_bid;?>" rows="3"><?php echo $cat->pre_bremarks;?></textarea>
                
                </td>
</tr>
                <?php $i++;}?>

                <!--<tr><td><button type="submit" class="btn btn-success btn-md">Sort</button></td><td></td><td></td><td></td></tr>-->

            </tbody>

        </table></form>

                    </div>

                    

               </div>                  

            </div>

            

        </div><!--End Row-->

	  

	  <!--End Row-->



    </div>

    <!-- End container-fluid-->

    

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

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

    <a href="javaScript:void();" 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-->

	

	<!-- simplebar js -->

     <script src="<?php echo base_url();?>adminassets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js"></script>

  <script src="<?php echo base_url();?>adminassets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js"></script>



    <script>

	$(document).ready(function(){ 
		$(".book_status").change(function(){
			var id=$(this).attr("id");
			var v=$(this).val();
			$.ajax({

							 type: "POST",

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

							 data: {id:id,v:v},

							 success: function(response){

								 //alert(response);

							 }

							 });
		});
		$(".book_remarks").keyup(function(){
			var id=$(this).attr("id");
			var v=$(this).val();
			$.ajax({

							 type: "POST",

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

							 data: {id:id,v:v},

							 success: function(response){

								 //alert(response);

							 }

							 });
		});
		$('#default-datatable').DataTable();

		


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

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

				  return false;

				}

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

			$.ajax({

							 type: "POST",

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

							 data: {id:id},

							 success: function(response){

								 //alert(response);

							 }

							 });

		});

	});

</script>

	

  <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>

