<div class="breadcrumb-oitila db-breadcrumb">
                <div class="container">
                    <div class="row justify-content-lg-around">
                        <div class="col-xl-6 col-lg-7 col-md-5 col-sm-6 col-8">
                            <div class="part-txt">
                                <h1>Withdrawals</h1>
                                <ul>
                                    <li>home</li>
                                    <li>Withdraw Funds From Account</li>
                                </ul>
                            </div>
                        </div>
                        <div class="col-xl-6 col-lg-5 col-md-7 col-sm-6 col-4 d-flex align-items-center">
                            <div class="db-user-profile">
                                <div class="part-data">
                                    <span class="name"><?php echo $this->session->userdata("name");?></span>
                                    <ul>
                                        <li>
                                            <span class="text">ClientID</span>
                                            <span class="number"><?php echo 'CL00'.$this->session->userdata("user");?></span>
                                        </li>
                                        <li>
                                            <span class="text">Balance</span>
                                            <span class="number"><?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;}?></span>
                                        </li>
                                    </ul>
                                </div>
                                <div class="part-img">
                                    <img src="<?php echo base_url();?>frontend/assets/img/member-1.jpg" alt="">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- breadcrumb end -->

            <!-- account begin -->
            <div class="user-dashboard">
                <div class="container">

                    <div class="dashboard-menu">
                        <nav>
                            <ul>
                                <li class="nav-item">
                                    <a class="nav-link" href="<?php echo base_url();?>dashboard">Dashboard</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="<?php echo base_url();?>deposite">Deposite</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link active" href="#">Withdrawls</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="<?php echo base_url();?>transactions">Transactions</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="<?php echo base_url();?>account">My Profile</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" href="<?php echo base_url();?>logout">Logout</a>
                                </li>
                            </ul>
                        </nav>
                    </div>

                    <div class="user-statics">
                        <div class="row">
                        	<div class="col-xl-4 col-lg-4 col-md-4">
                                <h3 class="title"> Withdraw Your Funds</h3>
                                <div class="last-step">
                                    <div class="payment-method-list row">
                                        <div class="col-xl-12 col-lg-12 col-sm-12">
                                            <div class="available-balance-el">
                                                <span class="title">Wallet Balance</span>
                                                <ul>
                                                    <li class="available">
                                                        <span class="text">Available: </span>
                                                        <span class="amount">₹<?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;}?></span>
                                                    </li>
                                                    <li class="pending">
                                                        <span class="text">Pending: </span>
                                                        <span class="amount">₹0</span>
                                                    </li>
                                                </ul>
                                                 <?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();
                    $wallet=$l->left_amt;if($wallet>1000){?>
                                                <div class="oit-width-1">
                                                	<label>Enter Your Amount</label>
          	<form class="form-inline" action="" method="post" id="wform">
                                                        <span class="currency-symbol" id="basic-addon1">₹</span>
                                                        <input type="text" class="inputted-amount" required name="wamt" value="1000">
                                                        <button type="submit" class="btn btn-warning" style="margin-top:5px;">Withdraw</button>
                                                    </form>
                                                    <?php }}?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        	<div class="col-xl-8 col-lg-8 col-md-8">
                                <h3 class="title"> My Withdrawals</h3>
                                    <table id="fullMcxPriceTable" class="display misco-data-table" style="width:100%">
                                <thead><tr bgcolor="#d4cbff"><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>
                </div>
            </div>
           	<script>
			$(document).ready(function(){
				$("#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);
						 }
					 });
				});
				
				$(".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>
            