@php
    header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
    header("Content-Disposition: attachment; filename=daftar-proposal-seleksi-internal-ketua.xls");  //File name extension was wrong
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false);
@endphp
<table border="1">
    <thead>
        <tr>
            <td style="border: 1px solid #000000;"><strong>No</strong></td>
            <td style="border: 1px solid #000000;"><strong>Kode Kelompok</strong></td>
            <td style="border: 1px solid #000000;"><strong>Jenis PKM</strong></td>
            <td style="border: 1px solid #000000;"><strong>Fak.</strong></td>
            <td style="border: 1px solid #000000;"><strong>Nama</strong></td>
            <td style="border: 1px solid #000000;"><strong>NIM</strong></td>
            <td style="border: 1px solid #000000;"><strong>Ketua/Anggota</strong></td>
            <td style="border: 1px solid #000000;"><strong>Email Ketua</strong></td>
            <td style="border: 1px solid #000000;"><strong>Judul Proposal</strong></td>
            <td style="border: 1px solid #000000;"><strong>Dosen Pembimbing</strong></td>
            <td style="border: 1px solid #000000;"><strong>Email Dosen Pembimbing</strong></td>
            <td style="border: 1px solid #000000;"><strong>Link Proposal</strong></td>
            <td style="border: 1px solid #000000;"><strong>Status {{ $jenis_monev }}</strong></td>
            <td style="border: 1px solid #000000;"><strong>Nilai Akhir</strong></td>
        </tr>
    </thead>
    <tbody>
        @php
            $no = 1;
            $tempKode = '';
        @endphp
        @foreach ($list_proposal as $proposal)
            {{-- @if($tempKode != $proposal['kode']) --}}
                <tr>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $no++ }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['kode'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['jenis'] }}</th>
                    @foreach ($proposal['detil'] as $res => $val)
                        @if($res == 0)
                            <th style="border: 1px solid #000000;">{{ $val['fak'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['nama'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['nim'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['keanggotaan'] }}</th>
                        @endif
                    @endforeach
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['email_ketua'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['judul'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['dospem'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['email_dospem'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;"><a href="{{ $proposal['link'] }}" target="_blank">Link</a></th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['status'] }}</th>
                    <th style="vertical-align: top; border: 1px solid #000000;">{{ $proposal['rata'] }}</th>
                </tr>
            {{-- @else --}}
                {{-- @foreach ($proposal['detil'] as $res => $val)
                    @if($res != 0)
                        <tr valign="top">
                            <th style="border: 1px solid #000000;">{{ $val['fak'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['nama'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['nim'] }}</th>
                            <th style="border: 1px solid #000000;">{{ $val['keanggotaan'] }}</th>
                        </tr>
                    @endif
                @endforeach --}}
            {{-- @endif --}}
            @php
                // $tempKode = $proposal['kode'];
            @endphp
        @endforeach
    </tbody>
</table>
