<?php   
	include_once("../view/header-footer/header.php");  
?>  
  
 <script>
                            function updateLick(id)
                            { 
                                window.location = "p2pRequest.php?id="+id+"&utrEntr="+$("#utrEntr").val();
                            }
 </script> 
  
  
   <!-- Features -->
   <div class="innerDeader">
      <div class="container">
          <a href="javascript:void(0);" id="go-back" class="goBack PaySound">
           <img src="<?php echo ROOTPATH;?>/images/Arrow 1.svg" alt="back">
       </a>
          <h4>P2P Request </h4>
     </div>    
   </div>
   <div class="innerBody">
       <div class="container">
         <di class="tableBox">
            <table>
                
                <tr>
                        <th   style="width:auto">S No.</th>
                        
                        <th   style="width:auto">Name</th>  
                        
                        <th   style="width:auto">Id</th>  
                        
                        <th   style="width:auto">Amount</th>  
                        
                        <th   style="width:auto">Date</th>  
                        
                        <th   style="width:auto">Action</th> 
                        
                        <th   style="width:auto">UTR</th> 
                        <th   style="width:auto">By</th> 
                        
                        <th   style="width:auto">Update</th> 
                        
                        
                  
                        
                </tr>  
                
                    <?php 
                                $sr = 1;
                                foreach($Result as $dmm) 
                                {         
                                    $stmt=$conn->prepare("select  * from  UI__Rgst  where cuurentId=:cuurentId");   
                                    $stmt->bindValue(':cuurentId',   $dmm->custId, PDO::PARAM_STR);  
                                    $stmt->execute();  
                                    $Result1 = $stmt->fetch(PDO::FETCH_OBJ);  
                                ?>   
                     <tr>
                                <td><?php echo $sr++;?></td>
                                <td><?php echo $Result1->nm;?> </td>
                                <td><?php echo $Result1->cuurentId;?></td>  
                                <td>&#8377;<?php echo $dmm->amt;?></td>    
                                <td><?php echo $dmm->Tdate;?></td>   
                                <td>
                                    
                                        <?php if($dmm->AccRej==2) echo "Rejected"; else if($dmm->utr=="") { ?>
                                         <a href="p2pRequest.php?accPtId=<?php echo $dmm->id;?>"> Accept</a> 
                                            / 
                                         <a href="p2pRequest.php?rejectPtId=<?php echo $dmm->id;?>"> Reject</a>
                                         <?php }else { ?>
                                            Action Completed
                                         <?php }    ?>
                                </td>     
                                    
                                <td> <input type="text"  name="utrEntr"  value="<?php echo $dmm->utr;?>" id="utrEntr" <?php if( ($dmm->AccRej==0) || ($dmm->AccRej==2) ) echo "disabled";?> /> </td>    
                                <td> 
                                
                                        <?php if($dmm->AgnetTxn==1) echo "Agent";else echo "User"; ?> 
                                </td>    
                                <td>
                                    
                                    <?php if(($dmm->AccRej==1) && ($dmm->utr==""))  { ?> 
                                                <a href="javascript:void(0);" onclick="updateLick(<?php echo $dmm->id;?>);" > Update</a>
                                    <?php } ?>      
                                    
                                </td>     
                                
						    	</tr>
                    <?php                
                                } 
                               
                	?>  
              </table>
         </div>
       </div>
   </div>
     
</div>
 
<?php 
  include_once("../view/header-footer/footer.php");  
    unset($_SESSION['TpMsg']);