<?php 
	include_once("../view/header-footer/InnerHeader.php");   
	include_once("leftMenu.php");   
?>  
<script> 
$(document).ready(function()
{   
 
              
        jQuery.validator.addMethod("lettersonly", function(value, element) 
        {
            return this.optional(element) || /^[a-z0-9\_\s]+$/i.test(value); 
        }, "Use alphanumaric & _ only"); 
        
        $( "#cuurentId" ).change(function() 
        {
            
              $.ajax({	
                    type: "POST",
                    url: URL+"/ajax/validation.php",
                    data: {TopUpDatacheck:1,Data:$(this).val()},
                    beforeSend: function(){ 
                    },
                    success: function(data)
                        {   
                            if(data==1)
                                 $("#AvailbleId").html("<span style='color:green;'>Valid Id  &#x2713</span>");
                            else  if(data==3) {
                                $("#cuurentId").val('');
                                 $("#AvailbleId").html("<span style='color:red;'>Invalid</span>"); 
                            }
                            else  if(data==2) {
                                $("#cuurentId").val('');
                                 $("#AvailbleId").html("<span style='color:red;'>Not Available X</span>");      
                            }
                        }
                    });
               
             
        });
        
        
         $( "#TopPin" ).change(function() 
        {
               
              $.ajax({	
                    type: "POST",
                    url: URL+"/ajax/validation.php",
                    data: {CheckDataPin:1,Data:$(this).val()},
                    beforeSend: function(){ 
                    },
                    success: function(data)
                        {    
                            var Data = JSON.parse(data);  
                            if(Data['Status']==1) 
                            {
                                 $("#MPINDetails").html("<span style='color:green;'>Valid PIN  Of Rs "+Data['Data']+" &#x2713 </span>");
                                 
                                 var newStr = Data['Data'].replace(',','')
                                 $("#TpMt").val(parseInt(newStr));  
                            }
                            else    {
                                 $("#MPINDetails").html("<span style='color:red;'>Invalid PIN</span>");      
                                 $("#TopPin").val('');
                            }
                        }
                    });  
               });   
 

	$("#_frm").validate({
		
		errorElement:'div',
		rules:{ 
		 
			Fund:{
				required:true   	
			}  
		},
		messages:{ 
		    
			Fund:{
				required:"Enter Fund" 
			} 
			 
		}
	}); 
}); 

</script>    


 
 <div class="page-wrapper">
<div class="page-content"><script type="text/javascript" src="./topup_files/jquery.min.js(1).download"></script>
<div class="container pages">
<div class="row pt-2 pb-2">
<div class="col-sm-12">
<ol class="breadcrumb">
    Available Fund 
    <?php 
        echo "Rs ".($totalTrade);//(-($totalWithdrwa));
    ?>
    <br>
    Withdraw Available In Between : 7:00 AM TO 10:00 AM
<li class="breadcrumb-item active" aria-current="page">  
	<?php 
            if(isset($_SESSION['Regis']))  
            {
                if($_SESSION['Regis']=='Failed')
                    echo $_SESSION['Regis'];
                else
                    echo "Withdraw Successful  &#x2713"; 
            }
	?>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="card card-body card-bg-1">

<form id="_frm" method="post" autocomplete="off">
 
 

<div class="form-group">
<label for="" class="text-dark ">Witdraw Fund</label>
<input type="number"  name="Fund"  class="form-control"  id="TopPin" placeholder="Enter Fund"   <?php  if(!isset($_SESSION['Proceed']))  { ?> required <?php }?> > 
</div>

<br>


<div class="form-group">
<label for="" class="text-dark ">USDT(TRC20)</label>
<input type="text"   value="<?php echo $user->Bname;?>"  class="form-control" disabled > 
</div>





<?php 
    if(!isset($_SESSION['Proceed'])) 
    {
?>

<div class="user_form_row_data  ">
<div class="user_submit_button mb-2 mt-2">
<input type="submit" class="user_btn_button btn-remove"   value="Proceed" name="Proceed" >
</div>
</div>



<?php } else { ?>   


<div class="form-group">
<label for="" class="text-dark ">Final Withdraw</label>
<input type="text"   value="<?php echo $_SESSION['Proceed'];?>"  class="form-control" disabled > 
</div>

<div class="user_form_row_data  ">
<div class="user_submit_button mb-2 mt-2">
<input type="submit" class="user_btn_button btn-remove"   value="Withdraw Fund" name="submit" >
<input type="hidden" class="user_btn_button btn-remove" value="<?php echo $_SESSION['Proceed'];?>"   name="MyFinalWithdraw" >
<input type="hidden" class="user_btn_button btn-remove" value="<?php echo $_SESSION['OrigailProceed'];?>"   name="OrigailProceed" >  
</div>
</div>
<?php  } ?>

</form>

</div>
</div>
</div>
</div>
<script>
   ( function($) {
  $(".btn-remove").click(function() {  
    $(this).css("display", "none");      
  });
} ) ( jQuery );
</script>
</div>  
</div>    
<?php 
	include_once("../view/header-footer/footer.php");    
	unset($_SESSION['Regis']);
	unset($_SESSION['Proceed']);
?>  