<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>Edit Data Pendaftaran</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Bootstrap CDN -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">

    <style>
        body{
            background:#f4f6fb;
        }
        .card{
            border-radius:16px;
            box-shadow:0 10px 25px rgba(0,0,0,.08);
        }
        .section-title{
            background:#0b2c4d;
            color:white;
            padding:10px 16px;
            border-radius:10px;
            margin-bottom:15px;
            font-weight:600;
        }
    </style>
</head>
<body>

<div class="container my-5">

    <div class="card p-4">

        <h4 class="fw-bold text-primary mb-4">
            Edit Data Pendaftaran
        </h4>

        <form action="{{ route('admin.pendaftaran.update', $data->id) }}" method="POST">
            @csrf
            @method('PUT')

            <!-- DATA SISWA -->
            <div class="section-title">Data Calon Peserta Didik</div>

            <div class="row g-3">
                <div class="col-md-6">
                    <label class="form-label">Nama Lengkap</label>
                    <input type="text" name="nama_lengkap" class="form-control"
                           value="{{ $data->nama_lengkap }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">No Telepon</label>
                    <input type="text" name="no_telepon" class="form-control"
                           value="{{ $data->no_telepon }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">NISN</label>
                    <input type="text" name="nisn" class="form-control"
                           value="{{ $data->nisn }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Sekolah Asal</label>
                    <input type="text" name="sekolah_asal" class="form-control"
                           value="{{ $data->sekolah_asal }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Tempat Lahir</label>
                    <input type="text" name="tempat_lahir" class="form-control"
                           value="{{ $data->tempat_lahir }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Tanggal Lahir</label>
                    <input type="date" name="tanggal_lahir" class="form-control"
                           value="{{ $data->tanggal_lahir }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Jenis Kelamin</label>
                    <select name="jenis_kelamin" class="form-select">
                        <option value="Laki-laki" {{ $data->jenis_kelamin=='Laki-laki'?'selected':'' }}>
                            Laki-laki
                        </option>
                        <option value="Perempuan" {{ $data->jenis_kelamin=='Perempuan'?'selected':'' }}>
                            Perempuan
                        </option>
                    </select>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Agama</label>
                    <select name="agama" class="form-select">
                        @php
                            $agama = ['Islam','Kristen','Katholik','Hindhu','Budha','Konghucu'];
                        @endphp
                        @foreach($agama as $a)
                            <option value="{{ $a }}" {{ $data->agama==$a?'selected':'' }}>
                                {{ $a }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Anak Ke .... Dari .... Bersaudara</label>
                    <input type="text" name="anak_ke" class="form-control"
                           value="{{ $data->anak_ke }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Status Anak</label>
                    <select name="status_anak" class="form-select">
                        <option value="Anak Kandung" {{ $data->status_anak=='Anak Kandung'?'selected':'' }}>
                            Anak Kandung
                        </option>
                        <option value="Anak Angkat" {{ $data->status_anak=='Anak Angkat'?'selected':'' }}>
                            Anak Angkat
                        </option>
                    </select>
                </div>

                <div class="col-md-12">
                    <label class="form-label">Alamat Murid</label>
                    <textarea name="alamat_murid" class="form-control" rows="2">{{ $data->alamat_murid }}</textarea>
                </div>

                <div class="col-md-12">
                    <label class="form-label">Riwayat Penyakit</label>
                    <textarea name="riwayat_penyakit" class="form-control" rows="2">{{ $data->riwayat_penyakit }}</textarea>
                </div>
            </div>

            <!-- DATA ORANG TUA -->
            <div class="section-title mt-4">Data Orang Tua / Wali</div>

            <div class="row g-3">
                <div class="col-md-6">
                    <label class="form-label">Nama Ayah</label>
                    <input type="text" name="nama_ayah" class="form-control"
                           value="{{ $data->nama_ayah }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Nama Ibu</label>
                    <input type="text" name="nama_ibu" class="form-control"
                           value="{{ $data->nama_ibu }}">
                </div>

                <div class="col-md-12">
                    <label class="form-label">Alamat Orang Tua</label>
                    <textarea name="alamat_orangtua" class="form-control" rows="2">{{ $data->alamat_orangtua }}</textarea>
                </div>

                <div class="col-md-6">
                    <label class="form-label">No Telepon Orang Tua</label>
                    <input type="text" name="telepon_orangtua" class="form-control"
                           value="{{ $data->telepon_orangtua }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Nomor KIP</label>
                    <input type="text" name="nomor_kip" class="form-control"
                           value="{{ $data->nomor_kip }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Pekerjaan Ayah</label>
                    <input type="text" name="pekerjaan_ayah" class="form-control"
                           value="{{ $data->pekerjaan_ayah }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Pekerjaan Ibu</label>
                    <input type="text" name="pekerjaan_ibu" class="form-control"
                           value="{{ $data->pekerjaan_ibu }}">
                </div>

                <div class="col-md-6">
                    <label class="form-label">Pendidikan Ayah</label>
                    <select name="pendidikan_ayah" class="form-select">
                        @php
                            $pendidikan = ['SD','SMP','SMA/SMK','D3','S1','S2','S3'];
                        @endphp
                        @foreach($pendidikan as $p)
                            <option value="{{ $p }}" {{ $data->pendidikan_ayah==$p?'selected':'' }}>
                                {{ $p }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Pendidikan Ibu</label>
                    <select name="pendidikan_ibu" class="form-select">
                        @foreach($pendidikan as $p)
                            <option value="{{ $p }}" {{ $data->pendidikan_ibu==$p?'selected':'' }}>
                                {{ $p }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Penghasilan Ayah</label>
                    <select name="penghasilan_ayah" class="form-select">
                        <option value="< 1.000.000" {{ $data->penghasilan_ayah=='< 1.000.000'?'selected':'' }}>&lt; 1.000.000</option>
                        <option value="1.000.000 - 2.000.000" {{ $data->penghasilan_ayah=='1.000.000 - 2.000.000'?'selected':'' }}>1.000.000 s.d 2.000.000</option>
                        <option value="2.000.000 - 3.000.000" {{ $data->penghasilan_ayah=='2.000.000 - 3.000.000'?'selected':'' }}>2.000.000 s.d 3.000.000</option>
                        <option value="> 3.000.000" {{ $data->penghasilan_ayah=='> 3.000.000'?'selected':'' }}>&gt; 3.000.000</option>
                    </select>
                </div>

                <div class="col-md-6">
                    <label class="form-label">Penghasilan Ibu</label>
                    <select name="penghasilan_ibu" class="form-select">
                        <option value="< 1.000.000" {{ $data->penghasilan_ibu=='< 1.000.000'?'selected':'' }}>&lt; 1.000.000</option>
                        <option value="1.000.000 - 2.000.000" {{ $data->penghasilan_ibu=='1.000.000 - 2.000.000'?'selected':'' }}>1.000.000 s.d 2.000.000</option>
                        <option value="2.000.000 - 3.000.000" {{ $data->penghasilan_ibu=='2.000.000 - 3.000.000'?'selected':'' }}>2.000.000 s.d 3.000.000</option>
                        <option value="> 3.000.000" {{ $data->penghasilan_ibu=='> 3.000.000'?'selected':'' }}>&gt; 3.000.000</option>
                    </select>
                </div>
            </div>

            <!-- JURUSAN -->
            <div class="section-title mt-4">Pilihan Jurusan</div>

            <div class="row">
                <div class="col-md-6">
                    <select name="jurusan" class="form-select">
                        <option value="PPLG" {{ $data->jurusan=='PPLG'?'selected':'' }}>PPLG</option>
                        <option value="TO" {{ $data->jurusan=='TO'?'selected':'' }}>TO</option>
                        <option value="MPLB" {{ $data->jurusan=='MPLB'?'selected':'' }}>MPLB</option>
                    </select>
                </div>
            </div>

            <!-- BUTTON -->
            <div class="mt-4">
                <button class="btn btn-primary">Simpan Perubahan</button>
                <a href="{{ route('admin.dashboard') }}" class="btn btn-secondary">
                    Kembali
                </a>
            </div>

        </form>
    </div>
</div>

</body>
</html>
