<?php 	
    include_once('../../config.php');   	
    include_once(ABS_PATH.'/admin/login_check.php'); 
	
            
            if(isset($_POST['update']))
            {
                
                if($_FILES['Slip']['name']!='')
                { 
                    
                    $target_file = ABS_PATH.'/uploads/';  
                    $name =  explode(".",$_FILES['Slip']['name']);
                    $FileName = mt_rand().'.'.end($name);     
                    $target_file .=  $FileName;   
                    move_uploaded_file($_FILES["Slip"]["tmp_name"], $target_file);  
                    
                    $stmt=$conn->prepare("update    pw__withdrwacsh set status=:status, upFile=:upFile where id=:id  ");  
                    $stmt->bindValue(':status', $_POST['Status'] , PDO::PARAM_STR);
                    $stmt->bindValue(':upFile', $FileName , PDO::PARAM_STR);
                    $stmt->bindValue(':id', $_REQUEST['id'] , PDO::PARAM_INT);
                    $stmt->execute();  
                }else{
                     
                    $stmt=$conn->prepare("update    pw__withdrwacsh set status=:status   where id=:id   ");  
                    $stmt->bindValue(':status', $_POST['Status'] , PDO::PARAM_STR); 
                     $stmt->bindValue(':id', $_REQUEST['id'] , PDO::PARAM_INT);
                    $stmt->execute();  
                } 
                header("Location: walletRst.php");
                die;
            }     
                        
            $stmt=$conn->prepare("select  * from   pw__withdrwacsh where id=:id ");  
            $stmt->bindValue(':id', $_REQUEST['id'] , PDO::PARAM_STR);
            $stmt->execute(); 
            $AllUsers = $stmt->fetch(PDO::FETCH_OBJ); 
include ABS_PATH.'/admin/header.php';      
?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
	}); 
  
	$(document).ready(function()
	{   

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


	});
 


</script>
		 
		 <div class="col-md-10">

	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3> Update Status </h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='walletRst.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete="off"> 
								 
								 
								 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Status</label>
								    <div class="col-sm-3">
								     <select  class="form-control" name="Status">
								         <option value="1" <?php if($AllUsers->status==1) echo "selected"; ?>>Paid</option>
								         <option value="0" <?php if($AllUsers->status==0) echo "selected"; ?>>Unpaid</option>
								     </select>
								    </div>
								 </div>
								 <hr>
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Add Slip</label>
								    <div class="col-sm-3">
								      <input name="Slip"  type="file" class="form-control">
								    </div>
								 </div>
								 <hr>
								   
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Add User</label>
										<div class="col-sm-10">
										  <input type="submit"    class="btn btn-primary"  name="update" value="Update Status">
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


	  		<!--  Page content -->
		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    