@extends('front.layout.pages-layout')
@section('pageTitle', isset($pageTitle) ? $pageTitle : 'Document Title')
@section('meta_tags')
{!! SEO::generate() !!}
@endsection
@section('content')
<section class="section department-single">
    <div class="container py-5">
        <div class="row">
            <div class="col-12">
                <div class="d-flex justify-content-between align-items-center mb-4 flex-wrap">
                    <!-- Title -->
                    <h3 class="mb-0">Author: {{ $pageTitle }} | Bulletin Room</h3>
                    <!-- Breadcrumb -->
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb bg-transparent mb-0 px-0">
                            <li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
                            <li class="breadcrumb-item"><a href="{{ route('bulletin') }}">Bulletin</a></li>
                            <li class="breadcrumb-item active" aria-current="page">{{ $pageTitle }}</li>
                        </ol>
                    </nav>
                </div>
                <hr>
            </div>
        </div>

        <div class="author-card text-center border-0 p-4 mt-5">
            <img src="{{$author->picture}}" class="rounded-circle mx-auto" style="width: 100px; height: 100px;" alt="Profile Image">
            <h4 class="mt-3 mb-1 card-title fw-bold">{{ $author->name }}</h4>
            <p class="mb-2 text-muted">{{ $author->username }}</p>
            <p class="text-muted px-3">
                {{ $author->bio }}
            </p>
            @if ($author->social_links)
            <div class="d-flex justify-content-center mt-3 gap-3">
                @if ($author->social_links->facebook_url)
                <a href="{{ $author->social_links->facebook_url }}" target="_blank" class=" fs-5"><i class="icofont-facebook"></i></a>
                @endif
                @if ($author->social_links->instagram_url)
                <a href="{{ $author->social_links->instagram_url }}" target="_blank" class=" fs-5"><i class="icofont-instagram"></i></a>
                @endif
            </div>
            @endif
            <!-- <div class="d-flex justify-content-center mt-3 gap-3">
            <a href="#" class="text-dark fs-5"><i class="bi bi-github"></i></a>
            <a href="#" class="text-dark fs-5"><i class="mdi mdi-facebook"></i></a>
            <a href="#" class="text-dark fs-5"><i class="bi bi-linkedin"></i></a>
            <a href="#" class="text-dark fs-5"><i class="bi bi-twitter"></i></a>
        </div> -->
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
           
                <div class="container">
                    <div class="row">
                        @if ($post->count())
                        <div class="row">
                            @foreach ($post as $posts )
                            <!-- Card 1 -->
                            <div class="col-12 col-sm-6 col-lg-3 mb-4">
                                <div class="card h-100 border-0">
                                    <img src="/images/posts/resized/resized_{{ $posts->featured_image }}"
                                        class="card-img img-fluid rounded-3"
                                        alt="Post Image"
                                        style="height: 180px; object-fit: cover;">
                                    <div class="card-body px-0 ">
                                        <h6 class="card-title fw-semibold mb-3">

                                            <a href="{{ route('read_post', $posts->slug) }}">
                                                <strong>{{ $posts->title }}</strong>
                                            </a>
                                        </h6>
                                        <p class="mb-0 text-muted ">Date : {{ date_formatter($posts->created_at) }}</p>
                                        <p class="mb-0 text-muted ">Category : <a href="{{ route('category_post',$posts->post_category->slug) }}" class="ml-1"> </a>{{ $posts->post_category->name }}</p>
                                    </div>
                                </div>
                            </div>
                            @endforeach
                        </div>
                        @else
                        <p><span class="text-danger">No post found in this author!</span></p>
                        @endif
                        <!-- /Blog Posts Section -->
                    </div>
                </div>
            
            <!-- Blog Pagination Section -->
            <section id="blog-pagination" class="blog-pagination section">

                {{ $post->appends(request()->input())->links('custom_pagination') }}

            </section><!-- /Blog Pagination Section -->
        </div>
    </div>
</section>
@endsection