@extends('layouts.public.main')

@section('content')
    <div class="page-header header-filter clear-filter purple-filter" data-parallax="true" style="background-image: url({{'"'.\App\Config::getData('public_index_img_url').'"'}});">
        <div class="container">
            <div class="row">
                <div class="col-md-8 ml-auto mr-auto">
                    <div class="brand">
                        <h2>{{ App\Config::getData('text_public_news_title')}}</h2>
                        <p>{{ App\Config::getData('text_public_news_desc')}}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="main main-raised">
        <div class="container">
            <div class="section">
                @if ($news->isEmpty())
                    <h4 class="text-center">Aucune nouvelles</h4>
                @endif
                <div class="row">
                    @foreach ($news as $new)
                        <div class="col-md-4">
                            <h3>{{ $new->title }}</h3>
                            <p class="news-body-small">
                                {{ $new->body }}
                            </p>
                            <span class="news-small">{{ \App\User::find($new->user_id)->fullname()}}, {{ $new->created_at }}</span>
                            <a name="news" id="news" class="btn btn-block btn-secondary mt-2" href="/news/{{ $new->id }}" role="button">Voir plus!</a>
                        </div>
                    @endforeach
                </div>
                <div class="m-3" role="group">
                    {{ $news->links() }}
                </div>
                <a href="/" class="btn button primary">Retour</a>
        </div>
    </div>
@endsection