@extends('layout.layout')
@php
    $title='Daftar Pengumuman Kegiatan';
    $subTitle = 'Daftar Pengumuman Kegiatan';
    $script = '<script>
                    let table = new DataTable("#dataTable");
               </script>';
@endphp

@section('content')

            <div class="card basic-data-table">
                <div class="card-body">
                    <div class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-3 gap-3">
                        <div>
                            <h5 class="mb-0">Data Pengumuman Kegiatan</h5>
                        </div>
                        <div>
                            <a href="{{ route('pengumuman.create') }}" class="btn btn-primary-600 radius-8 px-20 py-11">
                                <i class="ri-add-line"></i>
                                Tambah Pengumuman
                            </a>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table bordered-table mb-0" id="dataTable" data-page-length='10'>
                            <thead>
                                <tr>
                                    <th scope="col">
                                        <div class="form-check style-check d-flex align-items-center">
                                            <label class="form-check-label">
                                                No
                                            </label>
                                        </div>
                                    </th>
                                    <th scope="col">Nomor Registrasi</th>
                                    <th scope="col">Nama Perusahaan</th>
                                    <th scope="col">Nama Kegiatan</th>
                                    <th scope="col">Jenis Dokumen</th>
                                    <th scope="col">Tanggal</th>
                                    <th scope="col">Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                @forelse($pengumuman as $item)
                                <tr>
                                    <td>
                                        <div class="form-check style-check d-flex align-items-center">
                                            <label class="form-check-label">
                                                {{ str_pad($item['no'], 2, '0', STR_PAD_LEFT) }}
                                            </label>
                                        </div>
                                    </td>
                                    <td>
                                        <a href="{{ $item['detail_url'] }}" class="text-primary-600">{{ $item['no_registrasi'] }}</a>
                                    </td>
                                    <td>
                                        <div class="d-flex align-items-center">
                                            <h6 class="text-md mb-0 fw-medium flex-grow-1">{{ $item['nama_perusahaan'] }}</h6>
                                        </div>
                                    </td>
                                    <td>{{ Str::limit($item['nama_kegiatan'], 50) }}</td>
                                    <td>{{ $item['jenis_dokumen'] }}</td>
                                    <td>{{ $item['periode'] }}</td>
                                    <td>
                                        <span class="bg-success-focus text-success-main px-24 py-4 rounded-pill fw-medium text-sm">
                                            {{ $item['status'] }}
                                        </span>
                                    </td>
                                </tr>
                                @empty
                                <tr>
                                    <td colspan="7" class="text-center py-4">
                                        <div class="text-muted">
                                            <i class="ri-inbox-line fs-2"></i>
                                            <p class="mt-2">Tidak ada data pengumuman kegiatan</p>
                                        </div>
                                    </td>
                                </tr>
                                @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

@endsection
