<div class=" pb-5 page-title d-block">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <p class="h5 text-primary fw-bold">
                    Hi, <span class="text-gray"><?php echo $this->session->userdata("name");?></span>
                </p>
            </div>
        </div>
    </div>
</div>
<section class="pb-5">
		<style>
		.btn-default{background:#CCC;}
		</style>
        <div class="container-fluid">
            <div class="row g-4 mb-4">
                <div class="col-12 col-lg-4 col-xl-3">
                    <div class="card border-0">
                        <div class="card-body p-0">
                            
                            <ul class="list-unstyled">
                                <li class="d-flex justify-content-between align-items-center p-3 mb-3 rounded-5" style="background:#8efbb4;">
                                    <div class="d-flex align-items-center">
                                        <i class="cc BTC me-3 fs-3"></i>
                                        <h5 class="h6 fw-semi-bold">Wallet Balance</h5>
                                    </div>
                                    <div class="text-end">
                                        <h5 class="h6 fw-semi-bold">
                                            <?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;}?>
                                        </h5>
                                    </div>
                                </li>
                                <li class="d-flex justify-content-between align-items-center p-3 mb-3 rounded-5" style="background:#ffbb55;">
                                    <div class="d-flex align-items-center">
                                        <i class="cc LTC me-3 fs-3"></i>
                                        <h5 class="h6 fw-semi-bold">
                                            Pending Deposite
                                        </h5>
                                    </div>
                                    <div class="text-end">
                                        <h5 class="h6 fw-semi-bold">
                                             <?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();if($this->db->get_where("deposites",array("userid"=>$this->session->userdata("user")))->num_rows()>0){echo $pending->dep_amt;}else{echo 0;}?>
                                        </h5>
                                    </div>
                                </li>
                                
                            </ul>
                        </div>
                    </div>
                </div>
                <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);
				 }
			 });
		});
		
		$("#wform").submit(function(e){e.preventDefault();
			var formdata=$(this).serialize();
			$.ajax({
			 type: "POST",//dataType:'json',
			 url: '<?php echo base_url();?>home/ajax_wform_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>
				<script>
				$(document).ready(function(){
					$(".watchlist").click(function(){
						$(".allbtn").removeClass("btn-primary,btn-default");
						$(this).addClass("btn-primary");
						$(".live").addClass("btn-default");
						$(".exit").addClass("btn-default");
						$(".watchlist_div").show();
						$(".exit_div").hide();
						$(".live_trdiv").hide();
					});
					$(".live").click(function(){
						$(".allbtn").removeClass("btn-primary,btn-default");
						$(this).addClass("btn-primary");
						$(".watchlist").addClass("btn-default");
						$(".exit").addClass("btn-default");
						$(".watchlist_div").hide();
						$(".live_trdiv").show();
						$(".exit_div").hide();
					});
					$(".exit").click(function(){
						$(".allbtn").removeClass("btn-primary,btn-default");
						$(this).addClass("btn-primary");
						$(".live").addClass("btn-default");
						$(".watchlist").addClass("btn-default");
						$(".watchlist_div").hide();
						$(".live_trdiv").hide();
						$(".exit_div").show();
					});
				});
				</script>
                <div class="col-12 col-lg-12 col-xl-9">
                	<div class="text-center">
                	<div class="btn-group btn-group-justified">
                      <button type="button" class="btn btn-primary watchlist allbtn">DEPOSITE</button>
                      <button type="button" class="btn btn-default live allbtn">WITHDRAWALS</button>
                      <button type="button" class="btn btn-default exit allbtn">ADD MONEY</button>
                    </div>
                    </div>
                    <hr/>
                    <div style="position: relative;">
                        
                        <div class="watchlist_div">
                            <table class="table table-condensed table-bordered">
            <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="live_trdiv" style="display:none;">
                            
          	<form class="form-inline" action="" method="post" id="wform">
              <div class="row">
              <div class="col-md-4">
              <input type="number" class="form-control" name="wamt" placeholder="Min Withdrawal Amt 1000/-">
              </div>
              <div class="col-md-4">
              <button type="submit" class="btn btn-warning">Submit</button>
              </div>
              </div>
            </form>
			<table class="table table-condensed table-bordered">
            <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("wid","desc");$this->db->limit(100);
				  $data=$this->db->get_where("withdrawls",array("uid"=>$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->req_date));?></td>
                      <td><?php echo $d->wamt;?></td>
                      <td><?php if($d->req_status=='Pending'){echo '<span class="badge badge-warning">Pending</span>';}else
					  if($d->req_status=='Reject'){echo '<span class="badge badge-danger">Rejected</span>';}else{
					  echo '<span class="badge badge-success">Approved</span>';}?></td>
                      <td><?php echo $d->remarks;?></td>
                      <td>
                      <?php if($d->req_status=="Pending"){?>
                      <a class="btn btn-sm btn-danger wdelete" title="delete"  href="#" id="<?php echo $d->wid;?>"><i class="fa fa-times"></i> Cancel</a>
                      <?php }?></td></tr>
                  <?php $i++;}?></tbody>
                  </table>
                        </div>
                        <div class="exit_div"  style="display:none;">
                            <div class="row">
                                           	<div class="col-md-4">
                                            	<h4>Add To Wallet</h4>
                                                <form action="" method="post" id="depo_form">
                	<div class="form-group">
                    	<label>Deposit Amount</label>
                        <input type="number" class="form-control" name="amount" required />
                    </div>
                    <div class="form-group">
                    	<label>Deposit Remarks</label>
                        <textarea class="form-control" rows="3" name="depo_remarks"></textarea>
                    </div>
                    <button type="submit" class="btn btn-warning">Submit</button>
                </form>
                                            </div>
                                            <div class="col-md-4">
                                            <table class="table table-condensed table-bordered">
                <tbody>
				<?php $bank=$this->db->get("banks")->result();
					  foreach($bank as $b){?>
                      <tr bgcolor="#FFCC33"><th colspan="2"><h4><?php echo $b->bank_name;?></h4></th></tr>
                      <tr><th>Account Name</th><th><?php echo $b->acc_name;?></th></tr>
                      <tr><th>Account Number</th><th><?php echo $b->acc_number;?></th></tr>
                      <tr><th>IFSC Code</th><th><?php echo $b->ifsc_code;?></th></tr>
                      <tr><th>Account Type</th><th><?php echo $b->acc_type;?></th></tr>
                      <?php }?>
                      </tbody>
                      </table>
                                            </div>
                                            <div class="col-md-4">
                                            <h4 class="text-center text-warning">Accepted PhonePe, GooglePay and all UPI Payments</h4>
			<img class="img img-responsive" src="<?php echo base_url().'assets/qr.jpg';?>" width="100%" />
                                            </div>
                                           </div>
                        </div>
                           
                        </div>
                </div>

                
            </div>

            
        </div>
    </section>
    
<div class="copyrights bg-light-200 border-gray-light py-4">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12 col-sm-9 col-md-8">
                <p class="mb-0 text-center text-sm-start text-gray fs-6">
                    © Copyright 2021
                    <a href="3" target="_blank" class="copyright-links fw-bold text-gray ms-1 text-hover-primary">
                        Ample Commodity
                    </a>
                    I All Rights Reserved.
                </p>
            </div>
        </div>
    </div>
</div>
</div>


        </div>
    <script src="<?php echo base_url();?>newsite/dashboard.js.download"></script>
<script src="<?php echo base_url();?>newsite/validator-init.js.download"></script>
<script src="<?php echo base_url();?>newsite/waves.min.js.download"></script>
<script src="<?php echo base_url();?>newsite/scrollIt.js.download"></script>
<script src="<?php echo base_url();?>newsite/scrollit-init.js.download"></script>
<script src="<?php echo base_url();?>newsite/helpscout-init.js.download"></script>
<script src="<?php echo base_url();?>newsite/scripts.js.download"></script>
    

</body></html>