<?php include("header.php");
 include("side.php");
 include("../db.php");
extract($_GET);
if(isset($submit)){
	date_default_timezone_set("Asia/Calcutta");
 $tdate = date("h:i:s d-m-Y ");

	$sql=mysqli_query($conn,"UPDATE `widthdraw` SET `status`='$status', `tid`='$tid', `tdate`='$tdate' WHERE id='$id'");
	$alert='<div class="alert alert-success alert-dismissible">
  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
  <strong>Success!</strong> Save Record.
</div>';
}
?>
<!-- ?status=Successful&tid=2341234124324234&id=9&submit=
 --> 
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid">
                        <h2 class="mt-30 page-title">Payment Request</h2>
                        <ol class="breadcrumb mb-30">
                            <li class="breadcrumb-item"><a href="index.php">Dashboard</a></li>
                            <li class="breadcrumb-item active">Payment Request</li>
                        </ol>
                        <div class="row">
							<div class="col-lg-4 col-md-6">
								<div class="left-side-tabs">
									<div class="dashboard-left-links">
										<?php
									$sql=mysqli_query($conn,"SELECT w.id, p.shops_id, w.gateway, w.number, w.balance, w.status, w.date, p.direct_pv FROM pv p JOIN widthdraw w ON p.shops_id=w.shops_id WHERE w.id='$id'");
													$sn='1';
													while($row=mysqli_fetch_object($sql)){
														$gateway=$row->gateway;
														?>
																									
										<a  class="user-item active"><i class="fas fa-rupee-sign"></i>Current Balance : <?=$row->direct_pv;?></a>
										<a  class="user-item "><i class="fa fa-credit-card"></i><?=$gateway;?></a>
										<a  class="user-item "><i class="fas fa-rupee-sign"></i><?=$row->balance;?></a>
										<a  class="user-item "><i class="fas fa-id-card"></i><?=$row->number;?></a>
										<a class="user-item "><i class="far fa-clock"></i><?php echo  get_time_ago(strtotime($row->date) );?></a>
										<?php } ?>
									</div>
								</div>
								<img src="../images/transaction.jpg" style="width: 100%">
							</div>
							<div class="col-lg-8 col-md-6">
								<div class="card card-static-2 mb-30">
									<div class="card-title-2">
										<h4><?=$gateway;?> Transaction detail</h4> 
									</div>
									<?php if(isset($alert)){ echo $alert; } ?>
									<div class="card-body-table">
										<div class="news-content-right pd-20">
											<div class="row">
												<div class="col-lg-12">
													<form action="" method="get">
													<div class="form-group">
														<label class="form-label">Transaction Complete*</label>
														<select id="status" name="status" class="form-control" required/>
															<option selected="">Successful</option>
															<option >Failed</option>
														</select>
													</div>
													
													<div class="form-group">
														<label class="form-label">Enter transaction ID / Order ID*</label>
														<input type="text" class="form-control" value="" placeholder="Enter transaction ID" name="tid" title="Enter transaction ID" required/>
													</div>
													<input type="hidden" name="id" value="<?=$id;?>">
													<button class="save-btn hover-btn" name="submit" type="submit">Save Record</button>
												</form>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
                        </div>
                    </div>
                </main>
             <?php include("footer.php"); ?>