<?php $__env->startSection('title', 'Status Pembayaran'); ?>

<?php $__env->startSection('content'); ?>
<div class="container py-4">
    
    <h5 class="fw-bold text-center mb-3">STATUS PEMBAYARAN</h5>

    
    <div class="card shadow-sm mb-4">
        <div class="card-body">
            <h6 class="fw-semibold mb-2">Rincian Order</h6>
            <p class="mb-1"><strong>Order ID:</strong> <?php echo e($order['uoid']); ?></p>
            <p class="mb-1"><strong>Nama:</strong> <?php echo e($order['nama']); ?></p>
            <p class="mb-1"><strong>No HP:</strong> <?php echo e($order['phone']); ?></p>
            <p class="mb-1"><strong>Alamat:</strong><br> <?php echo e($order['address']); ?></p>
            <p class="mb-1"><strong>Kota:</strong> <?php echo e($order['kota']); ?></p>
            <p class="mb-1"><strong>Total:</strong> Rp<?php echo e(number_format($order['total'], 0, ',', '.')); ?></p>
        </div>
    </div>

    
    <div class="alert <?php echo e($order['paymentStatus'] === 'paid' ? 'alert-success' : 'alert-warning'); ?>">
        <strong>Status:</strong>
        <?php echo e($order['paymentStatus'] === 'paid' ? 'Sudah Dibayar ✅' : 'Belum Dibayar ❌'); ?>

    </div>

    
    <?php if($order['paymentStatus'] !== 'paid'): ?>
        <div class="d-grid mb-4">
            <button class="btn btn-success fw-bold py-2" id="btnBayar"
                data-payment-url="<?php echo e($order['payment_url']); ?>">
                💳 Bayar Sekarang
            </button>
        </div>
    <?php endif; ?>

    
    <div class="text-center">
        <a href="/" class="text-decoration-none text-muted">&larr; Kembali ke Beranda</a>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('styles'); ?>
<style>
    @media (min-width: 768px) {
        .card-body p {
            font-size: 0.95rem;
        }

        .alert {
            font-size: 0.95rem;
        }
    }
</style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        const bayarBtn = document.getElementById("btnBayar");

        if (bayarBtn) {
            const paymentUrl = bayarBtn.getAttribute("data-payment-url");

            if (paymentUrl) {
                console.log("🟢 Auto membuka halaman pembayaran...");
                // Delay kecil agar tidak diblock popup blocker
                setTimeout(() => {
                    window.open(paymentUrl, "_blank");
                }, 500);
            }
        }
    });

    document.getElementById("btnBayar")?.addEventListener("click", function () {
        const url = this.getAttribute("data-payment-url");
        if (url) {
            window.open(url, '_blank');
        } else {
            alert("URL pembayaran tidak ditemukan.");
        }
    });
</script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('layouts.mobile', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/plossayokesen/public_html/resources/views/payment-status-mobile.blade.php ENDPATH**/ ?>