<section id="breadcrumb-section" class="breadcrumb-section clearfix" style="background-image: url(assets/images/breadcrumb-bg.jpg);">
<div class="overlay-black">
<div class="container">
<h2 class="page-title">Deposite</h2>
</div>
</div>
</section>
<div class="breadcrumb-list">
<div class="container">
<ul>
<li class="breadcrumb-item"><a href="<?php echo base_url();?>">Home</a></li>
<li class="breadcrumb-item active">Deposite</li>
</ul>
</div>
</div>


<section id="service-section" class="service-section sec-ptb-100 clearfix">
<div class="container">
<div class="row">

<div class="col-lg-3 col-md-12 col-sm-12">
<div class="sidebar-section">

<div class="service-menu mb-30">
<h2 class="sidebar-title">Quick Links</h2>
<ul>
<li>
    <a href="<?php echo base_url();?>dashboard">Dashboard</a>
</li>
<li class="active">
    <a href="#">Deposite</a>
</li>
<li>
    <a href="<?php echo base_url();?>withdrawls">Withdrawl</a>
</li>
<li>
    <a href="<?php echo base_url();?>transactions">Transactions</a>
</li>
<li>
    <a href="<?php echo base_url();?>account">My Profile</a>
</li>
<li>
    <a href="<?php echo base_url();?>logout">Logout</a>
</li>
</ul>
</div>
</div>
</div>


<div class="col-lg-9 col-md-12 col-sm-12">
<div class="service-details">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="servicev2 mb-30">
<div class="contant">
<h4 class="service-title title-small mb-15">
<span>
<i class="fa fa-inr"></i>
</span>
<a href="#"><?php 	$this->db->order_by("trid","desc");

					$chk=$this->db->get_where("transaction",array("userid"=>$this->session->userdata("user")));

					if($chk->num_rows()>0){

                    $l=$chk->row();

                    echo $wallet=$l->left_amt;}else{echo $wallet=0;}?></a>
</h4>
<p>Wallet Balance
</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="servicev2 mb-30">
<div class="contant">
<h4 class="service-title title-small mb-15">
<span>
<i class="ion-stats-bars"></i>
</span>
<?php $this->db->select_sum('dep_amt');  

					  $this->db->where("dep_status","Pending"); 

					  $this->db->where("userid",$this->session->userdata("user"));

					  $chk= $this->db->get('deposites');

					 // echo $chk->num_rows();

					  $pending=$chk->row();?>
<a href="#">₹<?php if($this->db->get_where("deposites",array("userid"=>$this->session->userdata("user")))->num_rows()>0){echo $pending->dep_amt;}else{echo 0;}?>/-</a>
</h4>
<p>Pending Deposites</p>
</div>
</div>
</div>

</div>

<ul class="nav nav-pills" id="pills-tab" role="tablist">

<li class="nav-item">

<a class="nav-link active linkin" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Deposite List</a>

</li>

<li class="nav-item">

<a class="nav-link linkin" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">New Deposite</a>

</li>
<li class="nav-item">

<a class="nav-link linkin" id="pills-profile2-tab" data-toggle="pill" href="#pills-profile2" role="tab" aria-controls="pills-profile2" aria-selected="false">Our Bank Details</a>

</li>
</ul>

<div class="tab-content" id="pills-tabContent" style="margin-top:10px;">
			
          <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
          <table id="fullMcxPriceTable" class="table table-condensed table-bordered" style="width:100%">
            <thead><tr><th>S.No.</th><th>Date</th><th>Amount</th><th>Status</th><th>Remarks</th><th>Action</th></tr></thead>
            <tbody>
          	<?php $this->db->order_by("depid","desc");$this->db->limit(100);
				  $data=$this->db->get_where("deposites",array("userid"=>$this->session->userdata("user")))->result();
				  $i=1;foreach($data as $d){?>
                  <tr><td><?php echo $i;?></td>
                  	  <td><?php echo date("d-m-Y",strtotime($d->dep_submit_date));?></td>
                      <td><?php echo $d->dep_amt;?><br/><span class="badge badge-info"><?php echo $d->dep_remarks;?></span></td>
                      <td><?php if($d->dep_status=='Pending'){echo '<span class="badge badge-warning">Pending</span>';}else
					  if($d->dep_status=='Reject'){echo '<span class="badge badge-danger">Rejected</span>';}else{
					  echo '<span class="badge badge-success">Approved</span>';}?></td>
                      <td><?php echo $d->admin_remarks;?></td>
                      <td>
                      <?php if($d->dep_status=="Pending"){?>
                      <a class="btn btn-sm btn-danger depdelete" title="delete"  href="#" id="<?php echo $d->depid;?>"><i class="fa fa-times"></i> Cancel</a>
                      <?php }?></td></tr>
                  <?php $i++;}?></tbody>
                  </table>
          </div>

          <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">

          <div class="row">
          	<div class="col-md-6">
<h4 class="text-danger">Deposite Amount</h4>
<form action="" method="post" id="depo_form">
	<div class="form-group">
    	<input type="text" class="inputted-amount" name="amount" required value="5000">
    	<textarea name="depo_remarks" placeholder="Deposite Remarks" class="form-control" rows="3"></textarea>
    </div>
    <button type="submit" class="btn btn-warning">Add Funds</button>
</form>
</div>

          	<div class="col-md-6">
            	<h4 class="text-warning">Scan & Pay on QR</h4>
                
			<img class="img img-responsive" src="<?php echo base_url().'assets/qr.jpg';?>" width="100%" />
            </div>
          </div>
<div class="history-table-tbody">

 <?php $trades=$this->db->get_where("buysell",array("status!="=>"EXIT","uid"=>$this->session->userdata("user")))->result();	

			 		  $i=1;foreach($trades as $tr){?>

                        <section class="card pull-up">
                    
                            <div class="card-content">
                    
                                <div class="card-body">
                    
                                    <div class="col-12">
                    
                                        <div class="row" id="<?php echo $tr->bsid;?>">
                    
                                            
                    
                                        </div>
                    
                                    </div>
                    
                                </div>
                    
                            </div>
                    
                        </section>

      <?php }?>

</div>

          </div>
          
          
          <div class="tab-pane fade" id="pills-profile2" role="tabpanel" aria-labelledby="pills-profile2-tab">
          <table class="table table-condensed table-bordered" style="background:#d4cbff;">
                <tbody>
				<?php $bank=$this->db->get("banks")->result();
					  foreach($bank as $b){?>
                      <tr><th bgcolor="#7f5be9" style="color:#fff;"><?php echo $b->bank_name;?></th></tr>
                      <tr><td><small>Account Name</small><br/><b class="text-primary"><?php echo $b->acc_name;?></b></td></tr>
                      <tr><td><small>Account Number</small><br/><b class="text-primary"><?php echo $b->acc_number;?></b></td></tr>
                      <tr><td><small>IFSC Code</small><br/><b class="text-primary"><?php echo $b->ifsc_code;?></b></td></tr>
                      <tr><td><small>Account Type</small><br/><b class="text-primary"><?php echo $b->acc_type;?></b></td></tr>
                      <?php }?>
                      </tbody>
                      </table>
          </div>
    
</div>



                                

</div>
</div>

</div>
</div>
</section>
<script>



	$(document).ready(function(){
		//alert("adsf");
		$("#depo_form").submit(function(e){e.preventDefault();
			var formdata=$(this).serialize();
			//alert(formdata);
			$.ajax({
			 type: "POST",//dataType:'json',
			 url: '<?php echo base_url();?>home/ajax_depo_submit',
			 data: {formdata:formdata},
			 success: function(res){//alert(res.target);
					alert(res);
				 }
			 });
		});
		
		
		$(".depdelete").click(function(e){e.preventDefault();



		if (!confirm("Sure you want to cancel deposite request?")){



				  return false;



				}



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



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



			$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>home/depdelete',



							 data: {id:id},



							 success: function(response){



								 //alert(response);



							 }



							 });



		});

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



		if (!confirm("Sure you want to cancel withdrawal request?")){



				  return false;



				}



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



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



			$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>home/wdelete',



							 data: {id:id},



							 success: function(response){



								 //alert(response);



							 }



							 });



		});

	});



</script>