@extends('user.template')

@section('title', $pengumuman->judul_informasi)

@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">Detail Pengumuman</h1>
            <nav class="breadcrumbs">
                <ol>
                    <li><a href="{{ route('user.index') }}">Beranda</a></li>
                    <li><a href="{{ route('user.pengumuman') }}">Pengumuman</a></li>
                    <li class="current">Detail Pengumuman</li>
                </ol>
            </nav>
        </div>
    </div><!-- End Page Title -->

    <div class="container">
        <div class="row">

            <div class="col-lg-8">

                <!-- Blog Details Section -->
                <section id="blog-details" class="blog-details section">
                    <div class="container">

                        <article class="article">

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

                            <h2 class="title">{{ $pengumuman->judul_informasi }}</h2>

                            <div class="meta-top">
                                <ul>
                                    <li class="d-flex align-items-center">
                                        <i class="bi bi-person"></i>
                                        {{ $pengumuman->author ?? 'Admin' }}
                                    </li>
                                    <li class="d-flex align-items-center">
                                        <i class="bi bi-clock"></i>
                                        <time datetime="{{ $pengumuman->tanggal_informasi }}">
                                            {{ \Carbon\Carbon::parse($pengumuman->tanggal_informasi)->translatedFormat('d F Y') }}
                                        </time>
                                    </li>

                                </ul>
                            </div><!-- End meta top -->

                            <div class="content">
                                {!! $pengumuman->isi_informasi !!}
                            </div><!-- End post content -->

                        </article>

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

            </div>

            <div class="col-lg-4 sidebar">

                <div class="widgets-container">

                    <!-- Recent Posts Widget -->
                    <!-- Recent Posts Widget -->
                    <div class="recent-posts-widget widget-item">
                        <h3 class="widget-title">Pengumuman Lainnya</h3>

                        @foreach ($recentPengumuman as $recent)
                            <div class="post-item">
                                @if ($recent->gambar_informasi)
                                    <img src="{{ asset('storage/' . $recent->gambar_informasi) }}"
                                        alt="{{ $recent->judul_informasi }}" class="flex-shrink-0">
                                @else
                                    <img src="assets/img/blog/default.jpg" alt="default" class="flex-shrink-0">
                                @endif
                                <div>
                                    <h4>
                                        <a href="{{ route('user.detail-pengumuman', $recent->id_informasi) }}">
                                            {{ Str::limit($recent->judul_informasi, 50) }}
                                        </a>
                                    </h4>
                                    <time datetime="{{ $recent->tanggal_informasi }}">
                                        {{ \Carbon\Carbon::parse($recent->tanggal_informasi)->translatedFormat('d F Y') }}
                                    </time>
                                </div>
                            </div>
                        @endforeach

                    </div><!--/Recent Posts Widget -->

                </div>

            </div>

        </div>
    </div>

@endsection
