{{-- <!DOCTYPE html>
<html>
    <body> --}}
        <table>
            <thead>
                <tr>
                    <th colspan="3" style="font-size: 16;"><strong>DAFTAR PROPOSAL PMW MAHASISWA UNESA</strong></th>
                    <th></th>
                    <th></th>
                    <th><strong>Keterangan :</strong></th>
                    <th style="background-color: yellow; border: 1px solid black;"></th>
                    <th colspan="2"><strong>(Menunggu Persetujuan Dosen Pembimbing)</strong></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="3" style="font-size: 14;"><strong>Periode : {{ $list_proposal[0]['periode'] }}</strong></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td style="background-color: red; border: 1px solid black;"></td>
                    <td colspan="2"><strong>(Ditolak oleh Dosen Pembimbing)</strong></td>
                </tr>
            </tbody>
        </table><br>
        <table border="1">
            <thead>
                <tr>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>No.</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Kode Kelompok</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Kategori PMW</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Fakultas</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Nama</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>NIM</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Keanggotaan</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Judul Proposal</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Usulan Dana</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Dosen Pembimbing</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Link Proposal</strong></th>
                    <th valign="middle" style="background-color: orange; text-align: center; border: 1px solid black;"><strong>Link Video Produk</strong></th>
                </tr>
            </thead>
            <tbody>
                @php
                    $no = 1;
                @endphp
                @foreach ($list_proposal as $proposal)
                    {{-- @php
                        $bgColor = '';
                        if ($proposal['status'] == 2) {
                            $bgColor = "background-color: #FF0000";
                        } elseif ($proposal['status'] == 0) {
                            $bgColor = "background-color: #FFFF00";
                        }
                    @endphp --}}
                    @if ($proposal['status'] == 2)
                        <tr>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: right; border: 1px solid black;">{{ $no++ }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['kode'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['jenis'] }}</td>
                            <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['fak'] }}</td>
                            <td valign="middle" style="background-color: red; border: 1px solid black;">{{ ucwords($proposal['kelompok'][0]['nama']) }}</td>
                            <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['nim'] }}</td>
                            <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['keanggotaan'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; border: 1px solid black;">{{ ucwords($proposal['judul']) }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: right; border: 1px solid black;">
                                @if(substr(number_format($proposal['usulan'], 2, ',', '.'), -3) === ',00')
                                    Rp{{ substr(number_format($proposal['usulan'], 2, ',', '.'), 0, -3) }},-
                                @else
                                    Rp{{ number_format($proposal['usulan'], 2, ',', '.') }}
                                @endif
                            </td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; border: 1px solid black;">{!! nl2br(e($proposal['dospem'])) !!}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['link'] }}" target="_blank">Link</a></td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: red; vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['video'] }}" target="_blank">Link Video</a></td>
                        </tr>
                        @foreach ($proposal['kelompok'] as $key => $member)
                            @if ($key != 0)
                                <tr>
                                    <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $member['fak'] }}</td>
                                    <td valign="middle" style="background-color: red; border: 1px solid black;">{{ ucwords($member['nama']) }}</td>
                                    <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $member['nim'] }}</td>
                                    <td valign="middle" style="background-color: red; text-align: center; border: 1px solid black;">{{ $member['keanggotaan'] }}</td>
                                </tr>
                            @endif
                        @endforeach
                    @elseif ($proposal['status'] == 0)
                        <tr>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: right; border: 1px solid black;">{{ $no++ }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['kode'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['jenis'] }}</td>
                            <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['fak'] }}</td>
                            <td valign="middle" style="background-color: yellow; border: 1px solid black;">{{ ucwords($proposal['kelompok'][0]['nama']) }}</td>
                            <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['nim'] }}</td>
                            <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['keanggotaan'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; border: 1px solid black;">{{ ucwords($proposal['judul']) }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: right; border: 1px solid black;">
                                @if(substr(number_format($proposal['usulan'], 2, ',', '.'), -3) === ',00')
                                    Rp{{ substr(number_format($proposal['usulan'], 2, ',', '.'), 0, -3) }},-
                                @else
                                    Rp{{ number_format($proposal['usulan'], 2, ',', '.') }}
                                @endif
                            </td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; border: 1px solid black;">{!! nl2br(e($proposal['dospem'])) !!}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['link'] }}" target="_blank">Link</a></td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="background-color: yellow; vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['video'] }}" target="_blank">Link Video</a></td>
                        </tr>
                        @foreach ($proposal['kelompok'] as $key => $member)
                            @if ($key != 0)
                                <tr>
                                    <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $member['fak'] }}</td>
                                    <td valign="middle" style="background-color: yellow; border: 1px solid black;">{{ ucwords($member['nama']) }}</td>
                                    <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $member['nim'] }}</td>
                                    <td valign="middle" style="background-color: yellow; text-align: center; border: 1px solid black;">{{ $member['keanggotaan'] }}</td>
                                </tr>
                            @endif
                        @endforeach
                    @else
                        <tr>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: right; border: 1px solid black;">{{ $no++ }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['kode'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: center; border: 1px solid black;">{{ $proposal['jenis'] }}</td>
                            <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['fak'] }}</td>
                            <td valign="middle" style="border: 1px solid black;">{{ ucwords($proposal['kelompok'][0]['nama']) }}</td>
                            <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['nim'] }}</td>
                            <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $proposal['kelompok'][0]['keanggotaan'] }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; border: 1px solid black;">{{ ucwords($proposal['judul']) }}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: right; border: 1px solid black;">
                                @if(substr(number_format($proposal['usulan'], 2, ',', '.'), -3) === ',00')
                                    Rp{{ substr(number_format($proposal['usulan'], 2, ',', '.'), 0, -3) }},-
                                @else
                                    Rp{{ number_format($proposal['usulan'], 2, ',', '.') }}
                                @endif
                            </td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; border: 1px solid black;">{!! nl2br(e($proposal['dospem'])) !!}</td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['link'] }}" target="_blank">Link</a></td>
                            <td rowspan="{{ count($proposal['kelompok']) }}" style="vertical-align: top; text-align: center; border: 1px solid black;"><a href="{{ $proposal['video'] }}" target="_blank">Link Video</a></td>
                        </tr>
                        @foreach ($proposal['kelompok'] as $key => $member)
                            @if ($key != 0)
                                <tr>
                                    <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $member['fak'] }}</td>
                                    <td valign="middle" style="border: 1px solid black;">{{ ucwords($member['nama']) }}</td>
                                    <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $member['nim'] }}</td>
                                    <td valign="middle" style="text-align: center; border: 1px solid black;">{{ $member['keanggotaan'] }}</td>
                                </tr>
                            @endif
                        @endforeach
                    @endif
                @endforeach
            </tbody>                        
        </table>
    {{-- </body>
</html> --}}
