<?php 
// 1. Hubungkan ke database dengan path baru
include $_SERVER['DOCUMENT_ROOT'] . '/assets/db/db.php'; 
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin - Input Sertifikat Vaksin ICV</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <style>
        .section-title { border-bottom: 2px solid #007bff; padding-bottom: 5px; margin-bottom: 15px; color: #007bff; font-weight: bold; }
        .card-header { font-weight: bold; font-size: 1.2rem; }
    </style>
</head>
<body class="bg-light">

<div class="container mt-5 mb-5">
    <div class="card shadow">
        <div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
            <span>Entry Data Sertifikat Baru (ICV)</span>
            <a href="../CRUD/list_sertifikat.php" class="btn btn-light btn-sm">Lihat Daftar Data</a>
        </div>
        <div class="card-body">
            <form action="../CRUD/proses_simpan.php" method="POST">
                
                <div class="section-title">Informasi Pasien</div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>Nama Lengkap (Sesuai Paspor)</label>
                            <input type="text" name="nama_lengkap" class="form-control" placeholder="Contoh: UMAYAH OTONG" required>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>Nomor Paspor</label>
                            <input type="text" name="no_paspor" class="form-control" placeholder="Contoh: X7708993" required>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="form-group">
                            <label>Tanggal Lahir</label>
                            <input type="date" name="tgl_lahir" class="form-control" required>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label>Nomor Kode ICV (eICV / Barcode)</label>
                            <input type="text" name="no_icv" class="form-control" placeholder="Contoh: E25-000013213" required>
                            <small class="text-muted">Nomor ini yang akan muncul di bawah QR Code.</small>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">
                        <div class="section-title">Detail Vaksinasi 1 (Utama)</div>
                        <div class="form-group">
                            <label>Jenis Vaksin 1</label>
                            <input type="text" name="vaksin_1_nama" class="form-control" value="MENINGITIS MENINGOCOCCUS">
                        </div>
                        <div class="form-group">
                            <label>Batch Number 1</label>
                            <input type="text" name="vaksin_1_batch" class="form-control" placeholder="BIOFARMA B20241126-1">
                        </div>
                        <div class="row">
                            <div class="col-6">
                                <label>Tgl Vaksinasi 1</label>
                                <input type="date" name="vaksin_1_tgl_admin" class="form-control">
                            </div>
                            <div class="col-6">
                                <label>Berlaku Sampai 1</label>
                                <input type="date" name="vaksin_1_valid_sampai" class="form-control">
                            </div>
                        </div>
                        <div class="form-group mt-2">
                            <label>Faskes / Dokter Pelaksana 1</label>
                            <textarea name="vaksin_1_faskes" class="form-control" rows="2">Klinik Pratama Abdul Karim Medika Center - dr. MEGA ROBBIATY UTOMO</textarea>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <div class="section-title">Detail Vaksinasi 2 (Tambahan)</div>
                        <div class="form-group">
                            <label>Jenis Vaksin 2</label>
                            <input type="text" name="vaksin_2_nama" class="form-control" placeholder="Contoh: POLIO">
                        </div>
                        <div class="form-group">
                            <label>Batch Number 2</label>
                            <input type="text" name="vaksin_2_batch" class="form-control" placeholder="BIOFARMA 21000125">
                        </div>
                        <div class="row">
                            <div class="col-6">
                                <label>Tgl Vaksinasi 2</label>
                                <input type="date" name="vaksin_2_tgl_admin" class="form-control">
                            </div>
                            <div class="col-6">
                                <label>Berlaku Sampai 2</label>
                                <input type="date" name="vaksin_2_valid_sampai" class="form-control">
                            </div>
                        </div>
                        <div class="form-group mt-2">
                            <label>Faskes / Dokter Pelaksana 2</label>
                            <textarea name="vaksin_2_faskes" class="form-control" rows="2">Klinik Pratama Abdul Karim Medika Center</textarea>
                        </div>
                    </div>
                </div>

                <hr>
                <div class="alert alert-info small">
                    Pastikan nomor ICV unik dan belum pernah digunakan sebelumnya. QR Code akan digenerate otomatis menuju halaman verifikasi sistem.
                </div>
                <button type="submit" class="btn btn-success btn-lg btn-block">Simpan Data & Generate Sertifikat</button>
            </form>
        </div>
    </div>
</div>

</body>
</html>