@extends('layouts.app')

@section('title', 'Detail Murid Naik Jenjang')

@section('content')
<div class="container-fluid">
    <!-- Breadcrumb -->
    <nav aria-label="breadcrumb" class="mb-3">
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a href="{{ route('admin-sekolah.naik-jenjang.index') }}">Murid Naik Jenjang</a>
            </li>
            <li class="breadcrumb-item active">Detail Siswa</li>
        </ol>
    </nav>

    <!-- Page Header -->
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h2 class="mb-1">
                <i class="bi bi-person-fill text-success"></i>
                Detail Murid Naik Jenjang
            </h2>
            <p class="text-muted mb-0">Informasi lengkap siswa naik jenjang</p>
        </div>
        <a href="{{ route('admin-sekolah.naik-jenjang.index') }}" class="btn btn-outline-secondary">
            <i class="bi bi-arrow-left me-1"></i> Kembali
        </a>
    </div>

    <div class="row">
        <!-- Main Content -->
        <div class="col-lg-8">
            <!-- Data Identitas -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-success text-white py-3">
                    <h5 class="mb-0">
                        <i class="bi bi-person-vcard me-2"></i>
                        Data Identitas
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">NIK</div>
                        <div class="col-md-8 fw-bold">{{ $student->nik }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">NISN</div>
                        <div class="col-md-8 fw-bold">{{ $student->nisn }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">NIS</div>
                        <div class="col-md-8">{{ $student->nis }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Nama Lengkap</div>
                        <div class="col-md-8 fw-bold">{{ $student->nama }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Tempat, Tanggal Lahir</div>
                        <div class="col-md-8">
                            {{ $student->tempat_lahir }}, {{ $student->tanggal_lahir->format('d F Y') }}
                            <span class="badge bg-info ms-2">{{ $student->age }} tahun</span>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Jenis Kelamin</div>
                        <div class="col-md-8">{{ $student->jenis_kelamin == 'L' ? 'Laki-laki' : 'Perempuan' }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Agama</div>
                        <div class="col-md-8">{{ $student->agama }}</div>
                    </div>
                </div>
            </div>

            <!-- Data Orang Tua -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-primary text-white py-3">
                    <h5 class="mb-0">
                        <i class="bi bi-people me-2"></i>
                        Data Orang Tua
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Nama Ayah</div>
                        <div class="col-md-8 fw-bold">{{ $student->nama_ayah }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Tahun Lahir Ayah</div>
                        <div class="col-md-8">
                            @if($student->tahun_lahir_ayah)
                                {{ $student->tahun_lahir_ayah }}
                                <span class="badge bg-secondary ms-2">{{ date('Y') - $student->tahun_lahir_ayah }} tahun</span>
                            @else
                                <span class="text-muted">-</span>
                            @endif
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Nama Ibu</div>
                        <div class="col-md-8 fw-bold">{{ $student->nama_ibu }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Tahun Lahir Ibu</div>
                        <div class="col-md-8">
                            @if($student->tahun_lahir_ibu)
                                {{ $student->tahun_lahir_ibu }}
                                <span class="badge bg-secondary ms-2">{{ date('Y') - $student->tahun_lahir_ibu }} tahun</span>
                            @else
                                <span class="text-muted">-</span>
                            @endif
                        </div>
                    </div>
                </div>
            </div>

            <!-- Data Kontak -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-info text-white py-3">
                    <h5 class="mb-0">
                        <i class="bi bi-telephone me-2"></i>
                        Data Kontak
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Alamat</div>
                        <div class="col-md-8">{{ $student->alamat }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">No. HP/WA</div>
                        <div class="col-md-8">
                            <a href="https://wa.me/{{ preg_replace('/[^0-9]/', '', $student->phone) }}" target="_blank" class="text-decoration-none">
                                <i class="bi bi-whatsapp text-success me-1"></i>{{ $student->phone }}
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Data Pendidikan -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-warning text-dark py-3">
                    <h5 class="mb-0">
                        <i class="bi bi-mortarboard me-2"></i>
                        Data Pendidikan
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Sekolah Asal</div>
                        <div class="col-md-8">{{ $student->sekolah_asal ?? '-' }}</div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Jenis Ketunaan</div>
                        <div class="col-md-8">
                            @if($student->disabilityType)
                                <span class="badge bg-secondary">{{ $student->disabilityType->name }}</span>
                            @else
                                <span class="text-muted">-</span>
                            @endif
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Jenjang</div>
                        <div class="col-md-8">
                            <span class="badge bg-success fs-6">{{ $student->jenjang }}</span>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Kelas</div>
                        <div class="col-md-8">
                            <span class="badge bg-info fs-6">Kelas {{ $student->kelas }}</span>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-4 text-muted">Ijazah</div>
                        <div class="col-md-8">
                            @if($student->ijazah_path)
                                <a href="{{ Storage::url($student->ijazah_path) }}" target="_blank" class="btn btn-sm btn-outline-primary">
                                    <i class="bi bi-file-earmark-pdf me-1"></i> Lihat Ijazah
                                </a>
                            @else
                                <span class="text-muted">-</span>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Sidebar -->
        <div class="col-lg-4">
            <!-- School Info -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-body text-center">
                    <i class="bi bi-building display-4 text-primary mb-3"></i>
                    <h5 class="mb-2">{{ $student->school->name }}</h5>
                    <p class="text-muted mb-0">{{ $student->school->npsn }}</p>
                </div>
            </div>

            <!-- Status Badge -->
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-body">
                    <h6 class="mb-3">Status</h6>
                    <div class="d-flex justify-content-between align-items-center mb-2">
                        <span class="text-muted">Status Aktif</span>
                        <span class="badge {{ $student->is_active ? 'bg-success' : 'bg-danger' }}">
                            {{ $student->is_active ? 'Aktif' : 'Tidak Aktif' }}
                        </span>
                    </div>
                    <div class="d-flex justify-content-between align-items-center">
                        <span class="text-muted">Tanggal Input</span>
                        <small>{{ $student->created_at->format('d/m/Y') }}</small>
                    </div>
                </div>
            </div>

            <!-- Photo Placeholder -->
            <div class="card border-0 shadow-sm">
                <div class="card-body text-center">
                    <h6 class="mb-3">Foto Siswa</h6>
                    @if($student->photo)
                        <img src="{{ Storage::url($student->photo) }}" alt="Foto {{ $student->nama }}" class="img-fluid rounded">
                    @else
                        <div class="bg-light rounded p-5">
                            <i class="bi bi-person-circle display-1 text-muted"></i>
                            <p class="text-muted mt-2 mb-0 small">Belum ada foto</p>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
