diff --git a/app/View/Components/Front/News/IndexNewsComponent.php b/app/View/Components/Front/News/IndexNewsComponent.php index 804ec04a..df767bd8 100644 --- a/app/View/Components/Front/News/IndexNewsComponent.php +++ b/app/View/Components/Front/News/IndexNewsComponent.php @@ -9,6 +9,7 @@ use App\Enums\News\NewsCategoryEnum; use App\Enums\News\NewsYearsEnum; use App\Helpers\BladeComponentHelper; use App\Models\News; +use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; class IndexNewsComponent extends Component @@ -16,6 +17,8 @@ class IndexNewsComponent extends Component public $categories; public $years; public $newsModels; + public $postContainer; + /** * Create a new component instance. */ @@ -51,6 +54,47 @@ class IndexNewsComponent extends Component $bladeHelper->runSortQuery($query); /** Custom pagination */ $this->newsModels = $bladeHelper->runPaginate($query); + + + + + + + /** + * Cette section est à revoir mais c'est pour coller et être iso au site actuellement en prod + */ + $currentRoute = Route::currentRouteName(); + // Common values + $this->postContainer = [ + 'secondaryClass' => 'fw-container no-bottom-padding', + 'tertiaryClass' => 'tagged-posts', + 'list_type' => 'news', + 'id' => 'news', + 'post_id' => '9', // FIXME: probablement plus utile + 'slug' => 'news', + 'url' => route('front.news.index'), + 'localized' => 'ajax_load_more_news_vars', // FIXME: probablement pas utile + 'object' => 'ajax_load_more_news', // FIXME: probablement pas utile + ]; + + + switch ($currentRoute) { + case 'front.news.index': + $this->postContainer['load_more'] = ucfirst(__('front.buttons.see_more_news')); + break; + + case 'front.espace-presse': + $this->postContainer = array_merge($this->postContainer, [ + 'class' => 'fw-container no-top-padding', + 'load_more' => ucfirst(__('front.buttons.see_more_docs')), + 'type_button' => true + ]); + break; + + default: + $this->postContainer['load_more'] = __('front.buttons.load_more'); + break; + } } /** @@ -63,7 +107,8 @@ class IndexNewsComponent extends Component return view('components.front.news.index-news-component', [ 'categories' => $this->categories, 'years' => $this->years, - 'newsModels' => $this->newsModels + 'newsModels' => $this->newsModels, + 'postContainer' => $this->postContainer ]); } } diff --git a/app/View/Components/Front/News/NewsNextEventComponent.php b/app/View/Components/Front/News/NewsNextEventComponent.php new file mode 100644 index 00000000..805c799a --- /dev/null +++ b/app/View/Components/Front/News/NewsNextEventComponent.php @@ -0,0 +1,38 @@ +nextEvents = News::with('categories') + ->whereHas('categories', function ($query) { + $query->where('category', NewsCategoryEnum::event->value); + }) + ->latest() + ->take(3) + ->get(); + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.front.news.news-next-event-component', [ + 'nextEvents' => $this->nextEvents + ]); + } +} diff --git a/lang/en/front.php b/lang/en/front.php index 03702aca..2edfd43f 100644 --- a/lang/en/front.php +++ b/lang/en/front.php @@ -23,7 +23,8 @@ return [ 'buttons' => [ 'send' => 'send', 'back_to_contact' => 'return to choice of contact', - 'see_more_news' => 'load more news' + 'see_more_news' => 'load more news', + 'see_more_docs' => 'load more documentary resources' ], 'contact' => [ "index" => "Contact us", diff --git a/lang/fr/front.php b/lang/fr/front.php index 41ebe48b..8d70590f 100644 --- a/lang/fr/front.php +++ b/lang/fr/front.php @@ -23,7 +23,8 @@ return [ 'buttons' => [ 'send' => 'envoyer', 'back_to_contact' => 'retour au choix de contact', - 'see_more_news' => 'voir plus d\'actualités' + 'see_more_news' => 'voir plus d\'actualités', + 'see_more_docs' => 'voir plus de ressources documentaires' ], 'contact' => [ "index" => "Nous contacter", diff --git a/resources/views/components/front/filter-posts.blade.php b/resources/views/components/front/filter-posts.blade.php index c0269f00..00f91054 100644 --- a/resources/views/components/front/filter-posts.blade.php +++ b/resources/views/components/front/filter-posts.blade.php @@ -1,33 +1,40 @@ {{-- # FIXME : Il manque les scripts JS pour filtrer et voir plus --}} +@php + $news = $newsModels->items(); + $maxPosts = $newsModels->perPage(); +@endphp + @if (isset($postContainer))
Il existe de multiples occasions de nous rencontrer :