@extends('user.template')

@section('title', 'Pengumuman')

@section('content')

    <div class="page-title">
        <div class="container d-lg-flex justify-content-between align-items-center">
            <h1 class="mb-2 mb-lg-0">Pengumuman</h1>
            <nav class="breadcrumbs">
                <ol>
                    <li><a href="{{ route('user.index') }}">Beranda</a></li>
                    <li class="current">Pengumuman</li>
                </ol>
            </nav>
        </div>
    </div><!-- End Page Title -->

    <!-- Blog Posts Section -->
    <section id="blog-posts" class="blog-posts section">
        <div class="container">
            <div class="row gy-4">

                @forelse ($pengumuman as $item)
                    <div class="col-lg-4">
                        <article>

                            <div class="post-img">
                                @if ($item->gambar_informasi)
                                    <img src="{{ asset('storage/' . $item->gambar_informasi) }}"
                                        alt="{{ $item->judul_informasi }}" class="img-fluid">
                                @else
                                    <img src="assets/img/blog/default.jpg" alt="default" class="img-fluid">
                                @endif
                            </div>

                            <p class="post-category">
                                <time datetime="{{ $item->tanggal_informasi }}">
                                    {{ $item->tanggal_informasi ? \Carbon\Carbon::parse($item->tanggal_informasi)->translatedFormat('d F Y') : '-' }}
                                </time>
                            </p>

                            <h2 class="title">
                                <a href="{{ route('user.detail-pengumuman', $item->id_informasi) }}">
                                    {{ Str::limit($item->judul_informasi, 30) }}
                                </a>
                            </h2>

                            <div class="d-flex align-items-start">
                                <div class="post-meta ms-2">
                                    <p class="post-excerpt">
                                        {{ Str::limit(strip_tags($item->isi_informasi), 120, '...') }}
                                    </p>
                                </div>
                            </div>

                        </article>
                    </div><!-- End post list item -->
                @empty
                    <p class="text-center">Belum ada pengumuman tersedia.</p>
                @endforelse

            </div>

        </div>
    </section><!-- /Blog Posts Section -->

@endsection
