<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 Influencers</h4>

	   </div>

     </div>

     <div class="row">

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

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

               <div class="card">

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

                    <div class="card-body">

                           <?php if($this->uri->segment(3)){?>

                            <form  action="<?php echo base_url();?>admin/add_influs/<?php echo $this->uri->segment(3);?>" method="post" enctype="multipart/form-data">
								  <div class="row">
                                  <div class="col-md-4">
                                  <div class="form-group ">

                                    <label for="email">Name</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_name;?>" name="influ_name">

                                  </div>
                                  
                                  <div class="form-group ">

                                    <label for="email">Mobile</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_mob;?>" name="influ_mob">

                                  </div>
                                  
                                  <div class="form-group ">

                                    <label for="email">Email</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_email;?>" name="influ_email">

                                  </div>
                                  <div class="row">
                                  <div class="form-group col-md-4">

                                    <label for="email">Promo Code</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_code;?>" name="influ_code">

                                  </div>
                                  
                                  <div class="form-group col-md-4">

                                    <label for="email">Discount(%)</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_discount;?>" name="influ_discount">

                                  </div>
                                  <div class="form-group col-md-4">

                                    <label for="email">Margin(%)</label>

                                    <input type="text" required class="form-control" value="<?php echo $edit->influ_margin;?>" name="influ_margin">

                                  </div>
                                  </div>

                                 
                                  <div class="form-group ">

                                    <label for="email">Youtube URL</label>

                                    <input type="text" class="form-control" value="<?php echo $edit->influ_url;?>" name="influ_url">

                                  </div>
                                  <div class="form-group">

                                    <label for="email">Address</label>
                                    
                                    <textarea class="form-control" rows="3" name="influ_address"><?php echo $edit->influ_address;?></textarea>
                                  </div>
                                  </div>
                                  <div class="col-md-4">
                                  
                                  <h4 class="text-danger">Bank Details</h4>
                                  <div class="form-group">

                                    <label for="email">Bank Name</label>

                                    <input type="text" class="form-control" name="influ_bank" value="<?php echo $edit->influ_bank;?>">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">A/c. Number</label>

                                    <input type="text" class="form-control" name="influ_acc_no" value="<?php echo $edit->influ_acc_no;?>">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">Account Holder Name</label>

                                    <input type="text" class="form-control" name="influ_bank_name" value="<?php echo $edit->influ_bank_name;?>">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">IFSC Code</label>

                                    <input type="text" class="form-control" name="influ_ifsc" value="<?php echo $edit->influ_ifsc;?>">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">Account Type</label>

                                    <input type="text" class="form-control" name="influ_acc_type" value="<?php echo $edit->influ_acc_type;?>">

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

                                  <button type="submit" class="btn btn-success" >Update Details </button>

                                </form>

                              <?php }else{?>

                                <form  action="<?php echo base_url();?>admin/add_influs" method="post" enctype="multipart/form-data">
								  <div class="row">
                                  <div class="col-md-4">
                                  <div class="form-group ">

                                    <label for="email">Name</label>

                                    <input type="text" required class="form-control" name="influ_name">

                                  </div>
                                  
                                  <div class="form-group ">

                                    <label for="email">Mobile</label>

                                    <input type="text" required class="form-control" name="influ_mob">

                                  </div>
                                  
                                  <div class="form-group ">

                                    <label for="email">Email</label>

                                    <input type="text" required class="form-control" name="influ_email">

                                  </div>
                                  <div class="row">
                                  <div class="form-group col-md-4">

                                    <label for="email">Promo Code</label>

                                    <input type="text" required class="form-control" name="influ_code">

                                  </div>
                                  
                                  <div class="form-group col-md-4">

                                    <label for="email">Discount(%)</label>

                                    <input type="text" required class="form-control" name="influ_discount">

                                  </div>
                                  <div class="form-group col-md-4">

                                    <label for="email">Margin(%)</label>

                                    <input type="text" required class="form-control" name="influ_margin">

                                  </div>
                                  </div>

                                 
                                  <div class="form-group ">

                                    <label for="email">Youtube URL</label>

                                    <input type="text" class="form-control" name="influ_url">

                                  </div>
                                  <div class="form-group">

                                    <label for="email">Address</label>
                                    
                                    <textarea class="form-control" rows="3" name="influ_address"></textarea>
                                  </div>
                                  </div>
                                  <div class="col-md-4">
                                  
                                  <h4 class="text-danger">Bank Details</h4>
                                  <div class="form-group">

                                    <label for="email">Bank Name</label>

                                    <input type="text" class="form-control" name="influ_bank">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">A/c. Number</label>

                                    <input type="text" class="form-control" name="influ_acc_no">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">Account Holder Name</label>

                                    <input type="text" class="form-control" name="influ_bank_name">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">IFSC Code</label>

                                    <input type="text" class="form-control" name="influ_ifsc">

                                  </div>
                                  <div class="form-group ">

                                    <label for="email">Account Type</label>

                                    <input type="text" class="form-control" name="influ_acc_type">

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

                                  <button type="submit" class="btn btn-success" >Add </button>

                                </form>

                                <?php }?>

                    </div>

                    

               </div>                  

            </div>

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

               <div class="card">

                    <div class="card-header">Listed Influencers</div>

                    <div class="card-body">


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

        	<thead><tr><th>S.Np.</th><th>Name</th><th>Code/Discount</th><th>Bank Details</th><th>Action</th></tr></thead>

            <tbody>

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

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

                

                <td><?php echo $cat->influ_name;?><br/>
				<span class="badge badge-primary"><?php echo $cat->influ_mob;?></span><br/>
				<span class="badge badge-info"><?php echo $cat->influ_email;?></span></td>
                
                <td><?php echo $cat->influ_code;?><br/>
				<span class="badge badge-warning">Discount <?php echo $cat->influ_discount;?>% off</span><br/>
				<span class="badge badge-warning">Margin <?php echo $cat->influ_margin;?>%</span></td>
				<td>
                <b>Bank - <?php echo $cat->influ_bank;?></b><br/>
                <b>Ac/No. - <?php echo $cat->influ_acc_no;?></b><br/>
                <b>IFSC - <?php echo $cat->influ_ifsc;?></b>
                </td>
                <td>

                <?php if($cat->influ_status==""){$st="Disable";}else{$st="Enable";}?>
  <a target="_blank" href="<?php echo base_url().'admin/influ_orders/'.$cat->influ_id;?>" class="btn btn-sm btn-primary"><?php echo $this->db->get_where("orders",array("oinflu_id"=>$cat->influ_id))->num_rows();?> Orders</a>
                <a href="<?php echo $cat->influ_id;?>" class="btn btn-sm btn-default enable"><?php echo $st;?></a>

                <a href="<?php echo base_url();?>admin/influs/<?php echo $cat->influ_id;?>" class="btn btn-sm btn-warning"><i class="fa fa-edit"></i></a>

                	<a href="<?php echo $cat->influ_id;?>" class="btn btn-sm btn-danger catdelete"><i class="fa fa-trash-o"></i></a></td>

                <?php $i++;}?></tr>

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

            </tbody>

        </table>

                    </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(){ 

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

		$(".in_trend").click(function(){

		var id=$(this).val();

		var v="";

		if ($(this).is(':checked')) {

			var v=$(this).val();

		}

		//alert(v);

		$.ajax({

		 type: "POST",

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

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

		 success: function(response){

			// alert(response);

		 }

		 });

	});

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

			var st=$(this).text();

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

			if(st=="Enable"){

			$(this).text("Disable");

			}else{

			$(this).text("Enable");	

			}

			$.ajax({

							 type: "POST",

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

							 data: {id:id,st:st},

							 success: function(response){

								 //alert(response);

							 }

							 });

		});

		$(".catdelete").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/influ_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>

