@extends('layouts.app')
@section('title', 'SPK Penerima Karyawan')
@section('topbar', 'Dashboard')
@section('css')
<!-- Custom styles for this page -->
<link href="{{ asset('vendor/datatables/dataTables.bootstrap4.min.css') }}" rel="stylesheet">
@stop
@section('content')

<div class="container-fluid">
    
        <!-- Page Heading -->
        <div class="d-sm-flex align-items-center justify-content-between mb-4">
            <h1 class="h3 mb-0 text-dark">Selamat Datang! </h1>
        </div>

        <!-- Content Row -->
        <div class="row">

            <!-- List Warga Card Example -->
            <div class="col-xl-3 col-md-6 mb-4">
                <a href="{{ route('alternatif.index') }}">
                    <div class="card border-left-primary shadow h-100 py-2">
                        <div class="card-body">
                            <div class="row no-gutters align-items-center">
                                <div class="col mr-2">
                                    <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
                                        Jumlah Data Pelamar</div>
                                    <div class="h5 mb-0 font-weight-bold text-gray-800">{{ $alternatifs }}</div>
                                </div>
                                <div class="col-auto">
                                    <i class="fas fa-users fa-2x text-gray-300"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </a>
            </div>

            <!-- Earnings (Monthly) Card Example -->
            <div class="col-xl-3 col-md-6 mb-4">
                <a href="{{ route('kriteria.index') }}">
                    <div class="card border-left-success shadow h-100 py-2">
                        <div class="card-body">
                        <div class="row no-gutters align-items-center">
                                <div class="col mr-2">
                                    <div class="text-xs font-weight-bold text-success text-uppercase mb-1">
                                        Jumlah Kriteria</div>
                                    <div class="h5 mb-0 font-weight-bold text-gray-800">{{ $kriteria }}</div>
                                </div>
                                <div class="col-auto">
                                    <i class="fas fa-list-ol fa-2x text-gray-300"></i>
                                </div>
                            </div>
                        </div>
                        </div>
                        </a>
                    </div>
                </div>
            </div>

<!-- tabel lamaran pengguna -->
<div class="row mt-4">
    <div class="col-md-12">
        <div class="card shadow">
            <div class="card-header bg-info text-white font-weight-bold">
                <i class="fas fa-clipboard-list"></i> Daftar Lamaran Masuk
            </div>
            <div class="card-body">
                @if($lamarans->count() > 0)
                    <table class="table table-bordered table-hover">
                        <thead class="thead-light">
                            <tr>
                                <th>Nama</th>
                                <th>Usia</th>
                                <th>Pendidikan</th>
                                <th>IPK</th>
                                <th>Jurusan</th>
                                <th>Lama Studi</th>
                                <th>Pengalaman</th>
                                <th>Serkom</th>
                                <th>CV</th>
                                <th>Dokumen</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($lamarans as $lamaran)
                            <tr>
                                <td>{{ $lamaran->name }}</td>
                                <td>{{ $lamaran->usia }} tahun</td>
                                <td>{{ $lamaran->pendidikan }}</td>
                                <td>{{ $lamaran->ipk }}</td>
                                <td>{{ $lamaran->jurusan }}</td>
                                <td>{{ $lamaran->lama_studi }} tahun</td>
                                <td>{{ $lamaran->pengalaman }} tahun</td>
                                <td>
                                    @if($lamaran->serkom == 1)
                                        <span class="badge badge-success">Ada</span>
                                    @else
                                        <span class="badge badge-danger">Tidak</span>
                                    @endif
                                </td>
                                <td>
                                    <a href="{{ asset('storage/' . $lamaran->cv) }}" target="_blank" class="btn btn-sm btn-info">Lihat CV</a>
                                </td>
                                <td>
                                    @if($lamaran->dokumen_pendukung)
                                        @foreach(json_decode($lamaran->dokumen_pendukung, true) as $file)
                                            <a href="{{ asset('storage/' . $file) }}" target="_blank" class="btn btn-sm btn-secondary mb-1">Dokumen</a><br>
                                        @endforeach
                                    @else
                                        <span class="text-muted">Tidak Ada</span>
                                    @endif
                                </td>
                                <td class="d-flex">
                                    <form action="{{ route('admin.lamaran.terima', $lamaran->id) }}" method="POST" class="mr-2">
                                        @csrf
                                        <button type="submit" class="btn btn-sm btn-success">
                                            <i class="fas fa-check"></i> Terima
                                        </button>
                                    </form>
                                    <form action="{{ route('admin.lamaran.tolak', $lamaran->id) }}" method="POST">
                                        @csrf
                                        <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Yakin ingin menolak lamaran ini?')">
                                            <i class="fas fa-times"></i> Tolak
                                        </button>
                                    </form>
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                @else
                    <div class="alert alert-info mb-0">
                        <i class="fas fa-info-circle"></i> Belum ada lamaran yang masuk.
                    </div>
                @endif
            </div>
        </div>
    </div>
</div>


    <!--
           //**  Earnings (Monthly) Card Example */
           <div class="col-xl-3 col-md-6 mb-4">
            <a href="{{ route('penilaian.index') }}">
                <div class="card border-left-success shadow h-100 py-2">
                    <div class="card-body">
                        <div class="row no-gutters align-items-center">
                            <div class="col mr-2">
                                
                                <div class="h5 mb-0 font-weight-bold text-gray-800">Penilaian</div>
                            </div>
                            <div class="col-auto">
                                <i class="fas fa-bell fa-2x text-gray-300"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </a>
        </div>

            //** Pending Requests Card Example */
            <div class="col-xl-3 col-md-6 mb-4">
                <a href="{{ route('perhitungan.index') }}">
                    <div class="card border-left-warning shadow h-100 py-2">
                        <div class="card-body">
                            <div class="row no-gutters align-items-center">
                                <div class="col mr-2">
                                    
                                    <div class="h5 mb-0 font-weight-bold text-gray-800">Perhitungan SAW</div>
                                </div>
                                <div class="col-auto">
                                    <i class="fas fa-book fa-2x text-gray-300"></i>
                                </div>
                            </div>
                        </div>
                    </div>
                </a>
            </div> -->
@endsection