<?php
		require_once 'singles.php';

$emptyArray=array();

	$q="select * from trans where email = '$mail' and type='withdraw' order by id desc";
	$r= mysqli_query($conn,$q);
	while($qr= mysqli_fetch_assoc($r)){
		$status=$qr['status'];
		$dt = strtotime($qr['created_at']);
	
		$desc = '<div class="table-description">
		<div class="icon">
			<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" icon-name="arrow-down-left
				" class="lucide lucide-arrow-down-left"><line x1="17" y1="7" x2="7" y2="17"></line><polyline points="17 17 7 17 7 7"></polyline></svg>
		</div>
		<div class="description">
			<strong>'.ucwords($qr['description']).'</strong>        <div class="date"> '.date('M d Y h:i',$dt).'</div>
		</div>
	</div>';
		

		$amount = '<strong class="red-color">-'.$qr['amount'].' USD</strong>';
		
		if(strtolower($status) == 'pending'){
			$status = '<div class="site-badge warnning">Pending</div>';
		}elseif(strtolower($status) == 'success'){
			$status = '<div class="site-badge success">Success</div>';
		}elseif(strtolower($status) == 'canceled' || strtolower($status) == 'cancel' || strtolower($status) == 'cancelled' ){

			$status = '<div class="site-badge primary-bg">Canceled</div>';

		}else{$status = '<div class="site-badge warnning">Pending</div>';}

		$arr = array('description'=>$desc, 'tnx'=>$qr['trans_id'], 'amount'=> $amount, 'status'=> $status, 'method'=> strtoupper($qr['method']), 'charge'=>$qr['fee']);
		array_push($emptyArray, $arr);
	}

	$p = array('data'=>$emptyArray);
	 $plans_obj2 =  (json_encode($p));
	 
	 print($plans_obj2);
		

?>