@extends('layouts.app')

@section('title', 'Detail Penilaian Ujian')

@section('content')
<div class="row">
    <div class="col-md-4">
        <div class="card">
            <div class="card-header"><h3 class="card-title">Data Mahasiswa</h3></div>
            <div class="card-body">
                <strong>NIM</strong>
                <p class="text-muted">{{ $p4->nim_mahasiswa }}</p>
                <hr>
                <strong>Nama</strong>
                <p class="text-muted">{{ $p4->nama_mahasiswa }}</p>
                <hr>
                <strong>Judul Skripsi</strong>
                <p class="text-muted text-justify"><i>"{{ $p4->judul_skripsi }}"</i></p>
                
                <hr>
                <a href="{{ route('penilaian.cetak_rekap', $p4->nim_mahasiswa) }}" target="_blank" class="btn btn-primary btn-block">Cetak Rekap Nilai & Berita Acara</a>
                <a href="{{ route('penilaian.index') }}" class="btn btn-secondary btn-block">Kembali</a>
            </div>
        </div>
    </div>
    
    <div class="col-md-8">
        <div class="card">
            <div class="card-header"><h3 class="card-title">Daftar Tim Penguji & Input Nilai</h3></div>
            <div class="card-body">
                @if(session('success'))
                    <div class="alert alert-success">{{ session('success') }}</div>
                @endif
                
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th width="30">Ke</th>
                            <th>Nama Penguji</th>
                            <th>Status Penilaian</th>
                            <th>Nilai Akhir</th>
                            <th width="200">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($pengujis as $penguji)
                        <tr>
                            <td class="text-center">{{ $penguji->penguji_ke }}</td>
                            <td>{{ $penguji->nama }}</td>
                            <td>
                                @if($penguji->penilaian)
                                    <span class="badge badge-success">Sudah Dinilai</span>
                                @else
                                    <span class="badge badge-warning">Belum Dinilai</span>
                                @endif
                            </td>
                            <td>
                                <strong>{{ $penguji->penilaian ? number_format($penguji->penilaian->nilai_total, 2) : '-' }}</strong>
                            </td>
                            <td>
                                <a href="{{ route('penilaian.input', [$p4->nim_mahasiswa, $penguji->penguji_ke]) }}" class="btn btn-info btn-sm">Input Nilai</a>
                                @if($penguji->penilaian)
                                    <a href="{{ route('penilaian.cetak_form', [$p4->nim_mahasiswa, $penguji->penguji_ke]) }}" target="_blank" class="btn btn-secondary btn-sm">Cetak</a>
                                @endif
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection
