@extends('layouts.layout-user')
@section('content')
<table id="table-register" class="table table-bordered table-hover">
    <thead>
        <tr>
            <th colspan="6">
                <h2 style="display: inline-block; margin-right: 10px;">Data Pelaporan Apresiasi</h2>
                <span style="margin:1%; float: right;"></span>
                <form class="w-72" action="{{route('apresiasi.userIndex')}}" method="GET">
                    <div class="input-group input-group-merge" style="max-width: 300px">
                        <span class="input-group-text" id="basic-addon-search31"><i class="fa fa-search"></i></span>
                        <input name="search" class="form-control" placeholder="Search..." aria-label="Search..." aria-describedby="basic-addon-search31"></input>
                    </div>
                </form>
            </th>
        </tr>
        <tr style="background-color: #155dfa;">
            <th style="vertical-align: middle; color: white; text-align: center; padding: 10px;">No</th>
            <th style="vertical-align: middle; color: white; text-align: center; padding: 10px;">Judul</th>
            <th style="vertical-align: middle; color: white; text-align: center; padding: 10px; width: 30%;">Deskripsi</th>
            <th style="vertical-align: middle; color: white; text-align: center; padding: 10px;">Lokasi</th>
            <th style="vertical-align: middle; color: white; text-align: center; padding: 10px;">Foto</th>
            <th style="vertical-align: middle; text-align: center; color: white; padding: 10px; width: 20%;">Action</th>
        </tr>
    </thead>
    <!-- Isi tabel -->
    <tbody>
        @php
            $i=1;
        @endphp
        @if($apresiasi->count() > 0)
            @foreach ($apresiasi as $apresiasi)
            <tr>
                <td style="text-align: center; vertical-align: middle;">{{ $i++ }}</td>
                <td style="text-align: center; vertical-align: middle;">{{ $apresiasi->judul }}</td>
                <td style="text-align: center; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 10em;">{{ $apresiasi->deskripsi }}</td>
                <td style="text-align: center; vertical-align: middle;">{{ $apresiasi->lokasi }}</td>
                <td style="text-align: center; vertical-align: middle;">
                    <img src="{{ asset('foto/' . $apresiasi->foto) }}" alt="Foto" style="width: 100px; height: 100px; object-fit: cover;">
                </td>
                <td style="text-align: center; vertical-align: middle;">
                    <div style="display: flex; justify-content: center; gap: 10px;">
                        <a href="{{ route('apresiasi.adminDestroy', ['id' => $apresiasi->id]) }}" class="btn btn-delete" style="background-color: red; color: #fff; border: none; border-radius: 4px; cursor: pointer; width: 80px;">Delete</a>
                        <a href="{{ route('apresiasi.adminShow', ['id' => $apresiasi->id]) }}" class="btn btn-delete" style="background-color: rgb(82, 210, 67); color: #fff; border: none; border-radius: 4px; cursor: pointer; width: 80px;">Show</a>
                    </div>
                </td>
            </tr>


            @endforeach
        @else
            <tr>
                <td class="text-center" colspan="6">Pelaporan Apresiasi not found</td>
            </tr>
        @endif
    </tbody>
</table>

@endsection
