<?php
session_start();
if(!isset($_SESSION['user'])){
    header("Location: /frozenfood/");
    exit;
}
include 'koneksi.php';

$username = $_SESSION['user'];
$totalBelanja = mysqli_fetch_assoc(mysqli_query($conn,
    "SELECT SUM(total) as total FROM orders WHERE username='$username'"
))['total'];
?>
<!DOCTYPE html>
<html>
<head>
    <title>Pembayaran QRIS</title>
    <style>
        body{
            font-family:Arial;
            background:#f4f6f9;
            text-align:center;
            padding:40px;
        }
        .box{
            width:450px;
            margin:auto;
            background:white;
            padding:30px;
            border-radius:12px;
            box-shadow:0 4px 15px rgba(0,0,0,0.1);
        }
        img{
            width:250px;
            border-radius:10px;
        }
        .btn{
            display:inline-block;
            margin-top:20px;
            padding:12px 20px;
            background:#28a745;
            color:white;
            text-decoration:none;
            border-radius:8px;
        }
    </style>
</head>
<body>

<div class="box">
    <h2>💳 Pembayaran QRIS</h2>
    <p>Total yang harus dibayar:</p>
    <h3>Rp <?php echo number_format($totalBelanja); ?></h3>

    <img src="images/qris.jpg" alt="QRIS">

    <p>Silakan scan QRIS di atas untuk melakukan pembayaran</p>

    <a href="upload_bukti.php" class="btn">📤 Upload Bukti Pembayaran</a>
    <a href="/frozenfood/cart.php" class="btn" style="background:#007bff; margin-right:10px;">
        ⬅️ Kembali ke Keranjang
    </a>
</div>

</body>
</html>