@extends('front.layouts.app')

@section('content')
    <div class="container py-3">
        <div class="row justify-content-center text-center">
            <div class="col-12 col-lg-8 py-5">
                <h2 class="h3 fw-bold">ProductAlert is the place to be for top rated product reviews with recommendation such
                    as the right price, latest trend, from the best brands from
                    {{ $country_locale->country_iso == '*' ? 'the whole world' : get_country_name_by_iso($country_locale->country_iso) }}.
                </h2>
            </div>
        </div>
    </div>
    @if ($featured_posts->count() > 0)
        <div class="container-fluid py-4 bg-dark text-light">
            <div class="container">
                <h3 class="h4 fw-bold text-center mb-3">Featured Articles</h3>
                <div class="row g-3 justify-content-center">
                    @foreach ($featured_posts as $post)
                        <div class="col-10 col-md-8 col-xl-3">

                            @include('front.partials.featured_post_card', ['post' => $post])

                        </div>
                    @endforeach

                </div>
            </div>
        </div>
    @endif

    @if (count($latest_posts) > 0)
        <div class="container-fluid py-4">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col col-md-12 col-lg-12 col-xl-11 col-xxl-9">
                        <h3 class="h4 fw-bold text-center mb-3">What's New in
                            {{ get_country_name_by_iso($country_locale->country_iso) }}</h3>
                        <div class="row g-3">
                            @foreach ($latest_posts as $post)
                                <div class="col-12 col-lg-6">

                                    @include('front.partials.small_list_card', ['post' => $post])
                                </div>
                            @endforeach

                        </div>
                        <div class="text-center py-3">
                            @if ($country_locale->country_iso != '*')
                                <a href="{{ route('home.country.posts', ['country' => $country_locale->country_iso]) }}"
                                    class="btn btn-primary">All News & Updates</a>
                            @else
                                <a href="{{ route('home.country.posts', ['country' => 'world']) }}"
                                    class="btn btn-primary">All News & Updates</a>
                            @endif

                        </div>
                    </div>
                </div>
            </div>
        </div>
    @else
        <div class="container text-center pb-5">
            Oops! Nothing much here yet. Stay tuned!
        </div>
    @endif
@endsection
