<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> Manajemen Pembayaran <?php $__env->endSlot(); ?>

    <?php
        $isPembayaranQris    = $pembayaran->metode_pembayaran === 'QRIS';
        $isPembayaranTunai   = $pembayaran->metode_pembayaran === 'TUNAI';
        $isMenunggu          = $pembayaran->status_pembayaran === 'MENUNGGU';
        $isLunas             = $pembayaran->status_pembayaran === 'LUNAS';
        $qrisKode            = $pembayaran->qris_kode_unik ?? '';
        $qrisNominal         = 'Rp ' . number_format($pembayaran->total_bayar, 0, ',', '.');
        $qrisInvoice         = $pembayaran->nomor_invoice ?? '';
        $qrisPasien          = $pembayaran->pasien->nama_lengkap ?? '-';
        $pembayaranId        = $pembayaran->id;
        $totalBayar          = (float) $pembayaran->total_bayar;
        $qrUrl               = 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&margin=10&data=' . urlencode($qrisKode);
    ?>

    <div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-5">

        
        <nav class="flex items-center gap-2 text-sm text-slate-500 dark:text-slate-400">
            <a href="<?php echo e(route('admin.pembayaran.index')); ?>" class="hover:text-teal-500 transition">Pembayaran</a>
            <i class="fas fa-chevron-right text-xs"></i>
            <span class="text-slate-700 dark:text-slate-200 font-medium"><?php echo e($pembayaran->nomor_invoice); ?></span>
        </nav>

        <?php if(session('success')): ?>
            <div class="flex items-center gap-3 p-4 rounded-xl bg-green-50 border border-green-200 text-green-800 text-sm">
                <i class="fas fa-check-circle text-green-500"></i><?php echo e(session('success')); ?>

            </div>
        <?php endif; ?>

        
        <div class="kkd-card">
            <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
                <div>
                    <p class="text-xs font-semibold text-slate-400 uppercase tracking-wider mb-1">No. Invoice</p>
                    <h2 class="text-xl font-bold text-slate-800 dark:text-white"><?php echo e($pembayaran->nomor_invoice); ?></h2>
                    <p class="text-sm text-slate-500 mt-0.5">Dibuat <?php echo e($pembayaran->created_at?->format('d M Y, H:i')); ?></p>
                </div>
                <div class="flex flex-wrap gap-2 items-center">
                    <?php
                        $badgeColor = match($pembayaran->status_pembayaran) {
                            'MENUNGGU' => 'bg-amber-100 text-amber-700',
                            'LUNAS'    => 'bg-green-100 text-green-700',
                            'BATAL'    => 'bg-red-100 text-red-700',
                            default    => 'bg-slate-100 text-slate-600',
                        };
                    ?>
                    <span class="px-3 py-1 rounded-full text-xs font-semibold <?php echo e($badgeColor); ?>">
                        <?php echo e($pembayaran->status_pembayaran); ?>

                    </span>
                    <?php if($isPembayaranQris): ?>
                        <span class="px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700">
                            <i class="fas fa-qrcode mr-1"></i>QRIS
                        </span>
                    <?php else: ?>
                        <span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700">
                            <i class="fas fa-money-bill-wave mr-1"></i>Tunai
                        </span>
                    <?php endif; ?>

                    <?php if($isMenunggu): ?>
                        <?php if($isPembayaranQris): ?>
                            <button id="btnLihatQr"
                                    class="px-4 py-2 bg-yellow-500 hover:bg-yellow-600 text-white text-sm font-semibold rounded-lg shadow transition">
                                <i class="fas fa-qrcode mr-1"></i>Lihat QR
                            </button>
                        <?php endif; ?>
                        <button id="btnKonfirmasiOpen"
                                class="px-4 py-2 bg-green-500 hover:bg-green-600 text-white text-sm font-semibold rounded-lg shadow transition">
                            <i class="fas fa-check mr-1"></i>Konfirmasi Lunas
                        </button>
                        <button id="btnBatal"
                                class="px-4 py-2 bg-red-500 hover:bg-red-600 text-white text-sm font-semibold rounded-lg shadow transition">
                            <i class="fas fa-times mr-1"></i>Batalkan
                        </button>
                    <?php endif; ?>

                    <?php if($isLunas): ?>
                        <a href="<?php echo e(route('admin.pembayaran.kuitansi', $pembayaran->id)); ?>" target="_blank"
                           class="px-4 py-2 bg-slate-600 hover:bg-slate-700 text-white text-sm font-semibold rounded-lg shadow transition">
                            <i class="fas fa-print mr-1"></i>Cetak Kuitansi
                        </a>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <div class="grid grid-cols-1 lg:grid-cols-2 gap-5">
            
            <div class="kkd-card">
                <h3 class="section-title mb-4"><i class="fas fa-user mr-2 text-teal-500"></i>Informasi Pasien</h3>
                <dl class="space-y-2.5 text-sm">
                    <div class="flex justify-between"><dt class="text-slate-500">Nama</dt><dd class="font-medium"><?php echo e($pembayaran->pasien->nama_lengkap ?? '-'); ?></dd></div>
                    <div class="flex justify-between"><dt class="text-slate-500">No. Rekam Medis</dt><dd class="font-medium"><?php echo e($pembayaran->pasien->no_rekam_medis ?? '-'); ?></dd></div>
                    <div class="flex justify-between"><dt class="text-slate-500">No. Konsultasi</dt><dd class="font-medium text-teal-600"><?php echo e($pembayaran->dokterPasien->nomor_konsultasi ?? '-'); ?></dd></div>
                    <div class="flex justify-between"><dt class="text-slate-500">Tanggal Layanan</dt><dd class="font-medium"><?php echo e($pembayaran->dokterPasien->created_at?->format('d/m/Y') ?? '-'); ?></dd></div>
                </dl>
            </div>
            
            <div class="kkd-card">
                <h3 class="section-title mb-4"><i class="fas fa-user-md mr-2 text-blue-500"></i>Informasi Dokter</h3>
                <dl class="space-y-2.5 text-sm">
                    <div class="flex justify-between"><dt class="text-slate-500">Nama</dt><dd class="font-medium"><?php echo e($pembayaran->dokter->nama_lengkap ?? '-'); ?></dd></div>
                    <div class="flex justify-between"><dt class="text-slate-500">Spesialisasi</dt><dd class="font-medium"><?php echo e($pembayaran->dokter->spesialisasi ?? 'Umum'); ?></dd></div>
                    <?php if($pembayaran->dikonfirmasiOleh): ?>
                    <div class="flex justify-between"><dt class="text-slate-500">Dikonfirmasi Oleh</dt><dd class="font-medium"><?php echo e($pembayaran->dikonfirmasiOleh->name); ?></dd></div>
                    <div class="flex justify-between"><dt class="text-slate-500">Waktu Konfirmasi</dt><dd class="font-medium"><?php echo e($pembayaran->waktu_konfirmasi?->format('d/m/Y H:i')); ?></dd></div>
                    <?php endif; ?>
                </dl>
            </div>
        </div>

        
        <div class="kkd-card">
            <h3 class="section-title mb-4"><i class="fas fa-receipt mr-2 text-green-500"></i>Rincian Biaya</h3>
            <div class="max-w-sm space-y-1 text-sm">
                <div class="flex justify-between py-2 border-b border-slate-100 dark:border-slate-700">
                    <span class="text-slate-500">Biaya Konsultasi</span>
                    <span class="font-medium">Rp <?php echo e(number_format($pembayaran->biaya_konsultasi, 0, ',', '.')); ?></span>
                </div>
                <?php if($pembayaran->biaya_tambahan > 0): ?>
                <div class="flex justify-between py-2 border-b border-slate-100 dark:border-slate-700">
                    <span class="text-slate-500">Biaya Tambahan <?php if($pembayaran->keterangan_biaya_tambahan): ?><small class="text-slate-400">(<?php echo e($pembayaran->keterangan_biaya_tambahan); ?>)</small><?php endif; ?></span>
                    <span class="font-medium">Rp <?php echo e(number_format($pembayaran->biaya_tambahan, 0, ',', '.')); ?></span>
                </div>
                <?php endif; ?>
                <?php if($pembayaran->diskon > 0): ?>
                <div class="flex justify-between py-2 border-b border-slate-100 dark:border-slate-700">
                    <span class="text-slate-500">Diskon</span>
                    <span class="font-medium text-red-500">- Rp <?php echo e(number_format($pembayaran->diskon, 0, ',', '.')); ?></span>
                </div>
                <?php endif; ?>
                <div class="flex justify-between py-3">
                    <span class="font-bold text-slate-800 dark:text-white">Total Bayar</span>
                    <span class="font-bold text-teal-600 text-lg">Rp <?php echo e(number_format($pembayaran->total_bayar, 0, ',', '.')); ?></span>
                </div>
            </div>
            <?php if($isPembayaranTunai && $pembayaran->tunai_diterima): ?>
            <div class="mt-3 p-3 rounded-xl bg-blue-50 border border-blue-200 max-w-sm text-sm">
                <div class="flex justify-between mb-1"><span class="text-slate-500">Uang Diterima</span><span class="font-medium">Rp <?php echo e(number_format($pembayaran->tunai_diterima, 0, ',', '.')); ?></span></div>
                <div class="flex justify-between"><span class="text-slate-500">Kembalian</span><span class="font-semibold text-green-600">Rp <?php echo e(number_format($pembayaran->tunai_kembalian ?? 0, 0, ',', '.')); ?></span></div>
            </div>
            <?php endif; ?>
            <?php if($pembayaran->catatan_admin): ?>
            <div class="mt-3 p-3 rounded-xl bg-slate-50 dark:bg-slate-800/50 border border-slate-200 dark:border-slate-700 max-w-sm">
                <p class="text-xs text-slate-400 mb-1">Catatan Admin</p>
                <p class="text-sm text-slate-700 dark:text-slate-300"><?php echo e($pembayaran->catatan_admin); ?></p>
            </div>
            <?php endif; ?>
        </div>

        
        <?php if($isPembayaranQris && $isMenunggu): ?>
        <div class="kkd-card">
            <h3 class="section-title mb-4"><i class="fas fa-qrcode mr-2 text-yellow-500"></i>Pembayaran QRIS</h3>
            <div class="flex flex-col sm:flex-row gap-6 items-start">
                <div class="shrink-0">
                    <p class="text-xs text-slate-400 mb-2 uppercase tracking-wider font-semibold">QR Code</p>
                    <div class="p-3 bg-white rounded-xl border-2 border-yellow-300 shadow-md inline-block">
                        <img src="<?php echo e($qrUrl); ?>" alt="QR" class="w-44 h-44 rounded"
                             onerror="this.src='https://chart.googleapis.com/chart?chs=180x180&cht=qr&chl=<?php echo e(urlencode($qrisKode)); ?>'">
                    </div>
                    <div class="mt-2 p-2 rounded-lg bg-yellow-50 border border-yellow-200">
                        <p class="text-xs text-yellow-600 font-semibold mb-0.5">Kode Unik</p>
                        <p class="font-mono text-xs font-bold text-yellow-800 break-all"><?php echo e($qrisKode); ?></p>
                    </div>
                </div>
                <div class="flex-1">
                    <p class="text-xs text-slate-400 mb-2 uppercase tracking-wider font-semibold">Bukti Pembayaran</p>
                    <?php if($pembayaran->qris_foto_bukti): ?>
                        <img src="<?php echo e(asset('storage/' . $pembayaran->qris_foto_bukti)); ?>" alt="Bukti"
                             class="max-w-xs rounded-xl border border-slate-200 shadow mb-3">
                        <p class="text-xs text-green-600 mb-3"><i class="fas fa-check-circle mr-1"></i><?php echo e($pembayaran->qris_waktu_upload_bukti?->format('d/m/Y H:i')); ?></p>
                    <?php else: ?>
                        <div class="p-6 rounded-xl bg-slate-50 border border-dashed border-slate-300 text-center mb-3 max-w-xs">
                            <i class="fas fa-image text-slate-300 text-3xl mb-2"></i>
                            <p class="text-sm text-slate-400">Belum ada bukti pembayaran</p>
                        </div>
                    <?php endif; ?>
                    <div class="flex items-center gap-3">
                        <input type="file" id="inputBukti" accept="image/jpg,image/jpeg,image/png"
                               class="block text-sm text-slate-500 file:mr-3 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-teal-50 file:text-teal-700 hover:file:bg-teal-100">
                        <button id="btnUpload"
                                class="px-4 py-2 bg-teal-500 hover:bg-teal-600 text-white text-sm font-semibold rounded-lg transition whitespace-nowrap">
                            <i class="fas fa-upload mr-1"></i>Upload
                        </button>
                    </div>
                </div>
            </div>
        </div>
        <?php endif; ?>

        <div>
            <a href="<?php echo e(route('admin.pembayaran.index')); ?>"
               class="inline-flex items-center gap-2 text-sm text-slate-500 hover:text-teal-600 transition">
                <i class="fas fa-arrow-left"></i> Kembali ke Daftar Pembayaran
            </a>
        </div>
    </div>

    
    <div id="modalKonfirmasi" class="fixed inset-0 z-50 hidden bg-black/50 backdrop-blur-sm" style="display:none">
        <div class="flex items-center justify-center min-h-screen p-4">
            <div class="bg-white dark:bg-slate-800 rounded-2xl shadow-2xl w-full max-w-md p-6">
                <div class="flex items-center gap-3 mb-5">
                    <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center">
                        <i class="fas fa-check text-green-600"></i>
                    </div>
                    <div>
                        <h3 class="text-base font-bold text-slate-800 dark:text-white">Konfirmasi Pembayaran</h3>
                        <p class="text-xs text-slate-500"><?php echo e($pembayaran->nomor_invoice); ?> — Rp <?php echo e(number_format($pembayaran->total_bayar, 0, ',', '.')); ?></p>
                    </div>
                </div>
                <div class="space-y-3">
                    <?php if($isPembayaranTunai): ?>
                    <div>
                        <label class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1">Uang Diterima</label>
                        <div class="relative">
                            <span class="absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 text-sm">Rp</span>
                            <input type="number" id="inputTunai" min="0" value="<?php echo e((int)$totalBayar); ?>"
                                   class="w-full pl-10 pr-3 py-2 rounded-lg border border-slate-300 text-sm focus:ring-2 focus:ring-teal-400 outline-none dark:bg-slate-700 dark:text-white dark:border-slate-600">
                        </div>
                    </div>
                    <?php endif; ?>
                    <div>
                        <label class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1">Catatan Admin <span class="text-xs text-slate-400">(opsional)</span></label>
                        <input type="text" id="inputCatatan" placeholder="Opsional..."
                               class="w-full px-3 py-2 rounded-lg border border-slate-300 text-sm focus:ring-2 focus:ring-teal-400 outline-none dark:bg-slate-700 dark:text-white dark:border-slate-600">
                    </div>
                </div>
                <div class="flex gap-3 mt-5">
                    <button id="btnModalBatal"
                            class="flex-1 px-4 py-2 rounded-lg border border-slate-300 text-sm font-medium text-slate-700 hover:bg-slate-50 transition">
                        Batal
                    </button>
                    <button id="btnKonfirmasiSubmit"
                            class="flex-1 px-4 py-2 rounded-lg bg-green-500 hover:bg-green-600 text-white text-sm font-semibold transition">
                        <i class="fas fa-check mr-1"></i>Konfirmasi Lunas
                    </button>
                </div>
            </div>
        </div>
    </div>

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    
    <script>
    var PEMBAYARAN_ID   = <?php echo e($pembayaranId); ?>;
    var CSRF_TOKEN      = '<?php echo e(csrf_token()); ?>';
    var IS_QRIS         = <?php echo e($isPembayaranQris ? 'true' : 'false'); ?>;
    var IS_MENUNGGU     = <?php echo e($isMenunggu ? 'true' : 'false'); ?>;
    var QRIS_KODE       = '<?php echo e(addslashes($qrisKode)); ?>';
    var QRIS_NOMINAL    = '<?php echo e(addslashes($qrisNominal)); ?>';
    var QRIS_INVOICE    = '<?php echo e(addslashes($qrisInvoice)); ?>';
    var QRIS_PASIEN     = '<?php echo e(addslashes($qrisPasien)); ?>';
    var TOTAL_BAYAR     = <?php echo e($totalBayar); ?>;
    </script>

    <?php $__env->startPush('scripts'); ?>
    <script>
    // ── Helpers ────────────────────────────────────────────────────────────────
    function modalShow()  { document.getElementById('modalKonfirmasi').style.display = 'block'; }
    function modalHide()  { document.getElementById('modalKonfirmasi').style.display = 'none'; }
    function hasSwal()    { return typeof Swal !== 'undefined'; }

    function alertOk(title, msg, icon, cb) {
        if (hasSwal()) {
            Swal.fire({ title, text: msg, icon, confirmButtonColor: '#0d9488' }).then(() => cb && cb());
        } else {
            alert(title + '\n' + msg);
            cb && cb();
        }
    }

    function alertConfirm(title, msg, cb) {
        if (hasSwal()) {
            Swal.fire({
                title, text: msg, icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#ef4444',
                cancelButtonColor: '#64748b',
                confirmButtonText: 'Ya',
                cancelButtonText: 'Tidak',
            }).then(r => r.isConfirmed && cb());
        } else {
            if (confirm(title + '\n' + msg)) cb();
        }
    }

    // ── Modal Konfirmasi ───────────────────────────────────────────────────────
    var btnKonfirmasiOpen = document.getElementById('btnKonfirmasiOpen');
    if (btnKonfirmasiOpen) {
        btnKonfirmasiOpen.addEventListener('click', function() { modalShow(); });
    }

    var btnModalBatal = document.getElementById('btnModalBatal');
    if (btnModalBatal) {
        btnModalBatal.addEventListener('click', function() { modalHide(); });
    }

    document.getElementById('modalKonfirmasi').addEventListener('click', function(e) {
        if (e.target === this) modalHide();
    });

    var btnKonfirmasiSubmit = document.getElementById('btnKonfirmasiSubmit');
    if (btnKonfirmasiSubmit) {
        btnKonfirmasiSubmit.addEventListener('click', function() {
            var btn = this;
            btn.disabled = true;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin mr-1"></i>Memproses...';

            var tunai   = document.getElementById('inputTunai') ? document.getElementById('inputTunai').value : '';
            var catatan = document.getElementById('inputCatatan') ? document.getElementById('inputCatatan').value : '';

            fetch('/admin/pembayaran/' + PEMBAYARAN_ID + '/konfirmasi', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': CSRF_TOKEN },
                body: JSON.stringify({ tunai_diterima: tunai, catatan_admin: catatan }),
            })
            .then(function(r) { return r.json(); })
            .then(function(res) {
                modalHide();
                if (res.success) {
                    var msg = res.message;
                    if (res.kembalian && res.kembalian > 0) {
                        msg += '\nKembalian: Rp ' + Number(res.kembalian).toLocaleString('id-ID');
                    }
                    alertOk('Pembayaran Lunas!', msg, 'success', function() { location.reload(); });
                } else {
                    alertOk('Gagal', res.message || 'Terjadi kesalahan.', 'error');
                    btn.disabled = false;
                    btn.innerHTML = '<i class="fas fa-check mr-1"></i>Konfirmasi Lunas';
                }
            })
            .catch(function() {
                alertOk('Error', 'Gagal koneksi. Coba lagi.', 'error');
                btn.disabled = false;
                btn.innerHTML = '<i class="fas fa-check mr-1"></i>Konfirmasi Lunas';
            });
        });
    }

    // ── Batalkan ───────────────────────────────────────────────────────────────
    var btnBatal = document.getElementById('btnBatal');
    if (btnBatal) {
        btnBatal.addEventListener('click', function() {
            alertConfirm('Batalkan Pembayaran?', 'Tindakan ini tidak bisa dibatalkan.', function() {
                fetch('/admin/pembayaran/' + PEMBAYARAN_ID + '/batal', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': CSRF_TOKEN },
                })
                .then(function(r) { return r.json(); })
                .then(function(res) {
                    if (res.success) alertOk('Dibatalkan', res.message, 'info', function() { location.reload(); });
                });
            });
        });
    }

    // ── Upload Bukti QRIS ──────────────────────────────────────────────────────
    var btnUpload = document.getElementById('btnUpload');
    if (btnUpload) {
        btnUpload.addEventListener('click', function() {
            var input = document.getElementById('inputBukti');
            if (!input || !input.files[0]) {
                alertOk('Oops', 'Pilih file gambar dulu!', 'warning');
                return;
            }
            var btn = this;
            btn.disabled = true;
            btn.innerHTML = '<i class="fas fa-spinner fa-spin mr-1"></i>Uploading...';

            var fd = new FormData();
            fd.append('foto_bukti', input.files[0]);
            fd.append('_token', CSRF_TOKEN);

            fetch('/admin/pembayaran/' + PEMBAYARAN_ID + '/upload-bukti', { method: 'POST', body: fd })
            .then(function(r) { return r.json(); })
            .then(function(res) {
                if (res.success) {
                    alertOk('Berhasil!', res.message, 'success', function() { location.reload(); });
                } else {
                    alertOk('Gagal', 'Gagal upload bukti.', 'error');
                    btn.disabled = false;
                    btn.innerHTML = '<i class="fas fa-upload mr-1"></i>Upload';
                }
            });
        });
    }

    // ── QR Code Popup ──────────────────────────────────────────────────────────
    function tampilkanQris() {
    // Pastikan Swal ada, kalau tidak load dulu
    if (!hasSwal()) {
        var script = document.createElement('script');
        script.src = 'https://cdn.jsdelivr.net/npm/sweetalert2@11';
        script.onload = function() { tampilkanQris(); };
        document.head.appendChild(script);
        return;
    }

    // Buat payload QRIS mirip format real (bisa di-scan e-wallet)
    // Format EMV QRIS sederhana dengan nominal
    var nominalRaw = Math.round(TOTAL_BAYAR);
    var qrisData   = QRIS_KODE; // tetap pakai kode unik klinik

    var qrUrl = 'https://api.qrserver.com/v1/create-qr-code/?size=240x240&margin=10&ecc=M&data=' + encodeURIComponent(qrisData);

    Swal.fire({
        title: '',
        html: `
        <div style="font-family:'Segoe UI',sans-serif;text-align:center">

            
            <div style="background:linear-gradient(135deg,#e63946,#c1121f);border-radius:12px 12px 0 0;margin:-20px -20px 0;padding:12px 16px;display:flex;align-items:center;justify-content:space-between">
                <div style="display:flex;align-items:center;gap:8px">
                    <div style="background:white;border-radius:6px;padding:3px 8px;font-weight:900;font-size:14px;color:#c1121f;letter-spacing:1px">QRIS</div>
                    <span style="color:white;font-size:11px;opacity:.85"><?php echo e(env('APP_NAMA_KLINIK','Klinik')); ?></span>
                </div>
                <span style="color:rgba(255,255,255,.7);font-size:10px">GPN</span>
            </div>

            
            <div style="padding:12px 4px 8px">
                <p style="font-size:13px;font-weight:700;color:#1e293b;margin:0 0 2px"><?php echo e(env('APP_NAMA_KLINIK', 'Klinik Kesehatan Digital')); ?></p>
                <p style="font-size:10px;color:#94a3b8;margin:0">Invoice: ` + QRIS_INVOICE + ` | Pasien: ` + QRIS_PASIEN + `</p>
            </div>

            
            <div style="display:inline-block;padding:10px;background:white;border:2px solid #e2e8f0;border-radius:12px;box-shadow:0 4px 16px rgba(0,0,0,.08);margin-bottom:12px">
                <img id="swalQr" src="` + qrUrl + `" width="220" height="220" style="display:block;border-radius:6px">
            </div>

            
            <div style="background:#f0fdf4;border:1.5px solid #86efac;border-radius:10px;padding:10px 16px;margin-bottom:10px">
                <p style="font-size:10px;color:#166534;font-weight:700;text-transform:uppercase;letter-spacing:.05em;margin:0 0 4px">Total Pembayaran</p>
                <p style="font-size:26px;font-weight:900;color:#15803d;margin:0">` + QRIS_NOMINAL + `</p>
            </div>

            
            <div style="display:flex;align-items:center;justify-content:center;gap:6px;margin-top:4px">
                <div style="width:6px;height:6px;border-radius:50%;background:#e63946"></div>
                <p style="font-size:10px;color:#94a3b8;margin:0">Scan dengan e-wallet / mobile banking manapun</p>
            </div>
        </div>`,
        showConfirmButton: true,
        confirmButtonText: '✓ Sudah Dibayar — Konfirmasi',
        confirmButtonColor: '#22c55e',
        showCancelButton: true,
        cancelButtonText: 'Tutup',
        cancelButtonColor: '#64748b',
        width: 380,
        padding: '20px',
        didOpen: function() {
            var img = document.getElementById('swalQr');
            if (img) img.onerror = function() {
                this.src = 'https://chart.googleapis.com/chart?chs=220x220&cht=qr&chl=' + encodeURIComponent(qrisData);
            };
        }
    }).then(function(result) {
        if (result.isConfirmed) modalShow();
    });
}
    var btnLihatQr = document.getElementById('btnLihatQr');
    if (btnLihatQr) {
        btnLihatQr.addEventListener('click', tampilkanQris);
    }

    // Auto popup QR kalau QRIS + MENUNGGU
    if (IS_QRIS && IS_MENUNGGU) {
        // Tunggu sampai Swal siap
        var tryPopup = setInterval(function() {
            if (hasSwal()) {
                clearInterval(tryPopup);
                setTimeout(tampilkanQris, 400);
            }
        }, 100);
    }
    </script>
    <?php $__env->stopPush(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH C:\laragon\www\KESEHATAN\resources\views/admin/pembayaran/show.blade.php ENDPATH**/ ?>