<?php 
	include("../config/defines.php"); 
	if(!isset($_SESSION["user_id"])){ echo "<script>window.location.href = '../login';</script>"; }
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name="viewport" content="width=device-width"/>
        <meta charSet="utf-8"/>
        <title>Downloads | <?php echo $company_name; ?></title>
        <?php include($AaliLINK_IN."/functions/html/css.php"); ?>
    </head>
    <body>
        <?php include($AaliLINK_IN."/functions/html/header.php"); ?>

<section class="w3l-courses cart-page py-2">
    <div class="blog pb-5" id="courses">
        <div class="container py-lg-5 py-md-4">
            <div class='row mb-2'>
                <div class="col-md-3">
                    <div class="card" style="border: 2px solid #E25A00;">
                        <div class="card-body">
                            <h5 class="text-center" style='color: #E25A00;'>
                                <?php echo $_SESSION["user_name"]; ?> (<?php echo $_SESSION["user_type"]; ?>)
                            </h5>
                            <h6 class="text-center"><?php echo $_SESSION["user_mobile"]; ?></h6>
                            <h6 class="text-center "><?php echo $_SESSION["user_email"]; ?></h6>
                            <h6 class="text-center"><a href="<?php echo $AaliLINK; ?>/profile/update" class="badge badge-success">Update Profile</a></h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card" style="border: 2px solid #E25A00;">
                        <div class="card-body">
                            <h5 class="text-center" style='color: #E25A00;'>Deposit History</h5>
                            <h2 class="text-center deposit"></h2>
                            <h6 class="text-center"><a href="<?php echo $AaliLINK; ?>/deposit" class="badge badge-success">Deposit History</a></h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card" style="border: 2px solid #E25A00;">
                        <div class="card-body">
                            <h5 class="text-center" style='color: #E25A00;'>Orders Completed</h5>
                            <h2 class="text-center processed"></h2>
                            <h6 class="text-center">Amount Spent: <b class="deposit"></b></h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card" style="border: 2px solid #E25A00;">
                        <div class="card-body">
                            <h5 class="text-center" style='color: #E25A00;'>Orders Processing</h5>
                            <h2 class="text-center processing"></h2>
                            <h6 class="text-center">Amount To Be Spent: <b>$0.00</b></h6>
                        </div>
                    </div>
                </div>
            </div>
          
            <div class='row mb-2'>
<?php $down = mysqli_query($conn, "SELECT * FROM aalierp_deposit WHERE user_id='".$_SESSION["user_id"]."' AND dep_status='Approved'");
      while($row=mysqli_fetch_array($down)){ 
        $prod = mysqli_query($conn, "SELECT * FROM aalierp_product WHERE product_name='".$row["dep_reason"]."'");
        $roc = mysqli_fetch_assoc($prod); 
?>
                <div class="col-md-3">
                    <div class="card" style="border: 2px solid #E25A00;">
                        <div class="card-body p-3">
                            <h5 class="text-center" style='color: #E25A00;'><?php echo $roc["product_name"]; ?></h5>
                            <h6 class="text-center"><?php echo $roc["product_price"]; ?><small>Paid</small></h6>
                            <h6 class="text-center"><a href="<?php echo $roc["product_download"]; ?>" class="btn btn-success" target="_blank">Download <?php echo $roc["product_name"]; ?></a></h6>
                        </div>
                    </div>
                </div>
<?php } ?>
            </div>
        </div>
    </div>
</section>
        
        <?php include($AaliLINK_IN."/functions/html/footer.php"); ?>
        <?php include($AaliLINK_IN."/functions/html/js.php"); ?>
    </body>
</html>