@extends('layouts.master')
@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <h4 class="card-title">Daftar Reviewer</h4>
            </div>
            <div class="card-body">
                <div class="card-text">
                    <div class="row">
                        <div class="col-md-8">
                            {{-- @livewire('admin.masters.registrasi.add-registrasi-component') --}}
                        </div>
                        <div class="col-md-4 text-right">
                            {{-- <div class="row">
                                <label class="col-sm-3 col-form-label"></label>
                                <label class="col-sm-3 col-form-label">Cari : </label>
                                <div class="col-sm-6">
                                    <input type="text" class="form-control align-right" placeholder="Search" wire:model="keyword">
                                </div>
                            </div> --}}
                        </div>
                    </div>
                </div>
            </div>

            <div class="table-responsive mb-4">
                <table id="zero-config" class="table table-hover" style="width:100%">
                    <thead>
                        <tr>
                            <th>No</th>
                            {{-- <th>ID Pengajuan</th> --}}
                            <th style="text-align: left">File SK</th>
                            <th style="text-align: left">Nama/NIP</th>
                            <th style="text-align: left">Judul</th>
                            <th style="text-align: left">Tahun</th>
                            <th style="text-align: left">Klasifikasi</th>
                            <th style="text-align: left">File EC</th>
                            <th style="text-align: left">Kategori</th>
                        </tr>
                    </thead>
                    <tbody>
                        @php
                            $no = 1;
                            $nomorsurat = $penelaah[0]->no_sk;
                            $no_surat = explode('/', $nomorsurat);
                            $noagenda = $no_surat[0];
                            $tahun = $no_surat[3];
                            $nama_file = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
                        @endphp
                        @foreach($penelaah as $key => $item)
                        @php
                            // $pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
                            if($item->no_sk == $nomorsurat){
                                $namafile = $nama_file;
                            }
                            else{
                                $nosurat = explode('/', $item->no_sk);
                                $noagenda = $nosurat[0];
                                $tahun = $nosurat[3];
                                $namafile = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
                            }
                        @endphp
                            <tr>
                                <td>{{ $no }}</td>
                                {{-- <td>{{ $item->id_pengajuan_epk }}</td> --}}
                                <td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$namafile}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td>
                                <td style="text-align: left">{{ $item->nama }}<br>
                                    <strong>{{ $item->nip }}</strong></td>
                                <td style="text-align: left">{{ $item->judul }}</td>
                                <td style="text-align: left">{{ $item->tahun }}</td>
                                <td style="text-align: left">{{ $item->klasifikasi }}</td>
                                <td style="text-align: left">
                                @if(!empty($item->file_ec))
                                    <strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$item->file_ec!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong>
                                @endif
                                </td>
                                {{-- @php
                                    $kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
                                @endphp --}}
                                <td style="text-align: left">{{ $item->nama_kategori }}</td>
                            </tr>
                            @php
                                $no++;
                            @endphp
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@push('js')
@endpush
@stop
