<?php $page_title = 'Pembayaran Selesai'; ?>
<?php $this->load->view('kasir/_nav', compact('page_title')); ?>

<div class="row justify-content-center">
  <div class="col-md-8">
    <div class="card card-success">
      <div class="card-header">
        <h3 class="card-title"><i class="fas fa-check-circle mr-2"></i>Pembayaran Lunas</h3>
      </div>
      <div class="card-body">
        <div class="text-center mb-4">
          <div style="font-size: 56px; color: #28a745;"><i class="fas fa-badge-check"></i></div>
          <h3 class="mt-3">Transaksi Selesai</h3>
          <p class="text-muted mb-0">Tampilan dummy kasir untuk simulasi alur pembayaran.</p>
        </div>

        <div class="row">
          <div class="col-md-6">
            <p><strong>No. Tagihan:</strong> <?= html_escape($tagihan['no_tagihan']); ?></p>
            <p><strong>Pasien:</strong> <?= html_escape($tagihan['nama_pasien']); ?></p>
            <p><strong>No. RM:</strong> <?= html_escape($tagihan['rme_no']); ?></p>
            <p><strong>Poli:</strong> <?= html_escape($tagihan['nama_poli']); ?></p>
          </div>
          <div class="col-md-6">
            <p><strong>Metode Bayar:</strong> <?= html_escape($tagihan['metode_bayar']); ?></p>
            <p><strong>Jumlah Bayar:</strong> Rp <?= number_format((float) $tagihan['jumlah_bayar'], 0, ',', '.'); ?></p>
            <p><strong>Kembalian:</strong> Rp <?= number_format((float) $tagihan['kembalian'], 0, ',', '.'); ?></p>
            <p><strong>Waktu:</strong> <?= date('d/m/Y H:i', strtotime($tagihan['waktu_bayar'])); ?></p>
          </div>
        </div>

        <div class="alert alert-light border mt-3">
          <div class="d-flex justify-content-between">
            <span>Total Billing</span>
            <strong>Rp <?= number_format((float) $tagihan['grand_total'], 0, ',', '.'); ?></strong>
          </div>
          <div class="d-flex justify-content-between">
            <span>Kasir</span>
            <strong><?= html_escape($tagihan['kasir_nama']); ?></strong>
          </div>
          <div class="d-flex justify-content-between">
            <span>No. Referensi</span>
            <strong><?= html_escape($tagihan['nomor_referensi'] ?: '-'); ?></strong>
          </div>
        </div>
      </div>
      <div class="card-footer text-right">
        <a href="<?= site_url('kasir/detail/' . $tagihan['tagihan_id']); ?>" class="btn btn-outline-secondary">Kembali ke Detail</a>
        <a href="<?= site_url('kasir'); ?>" class="btn btn-success">Selesai</a>
      </div>
    </div>
  </div>
</div>
