247 lines
11 KiB
PHP
247 lines
11 KiB
PHP
@php
|
||
$commitmentId = 3;
|
||
$badge = new stdClass();
|
||
|
||
$badge->label = str("engagement n°{$commitmentId}")->upper();
|
||
$badge->color = '#006633';
|
||
|
||
$section_2_model = $staticPageModel->sections[0];
|
||
$section_2 = $section_2_model->data;
|
||
$reduction_2 = data_get($section_2_model, 'blocks.0.data');
|
||
|
||
$section_3_model = $staticPageModel->sections[1];
|
||
$section_3 = $section_3_model->data;
|
||
|
||
$reduction_3 = data_get($section_3_model, 'blocks.0.data');
|
||
|
||
$section_4_model = $staticPageModel->sections[2];
|
||
$section_4 = $section_4_model->data;
|
||
$section_4_pictos = $section_4_model->pictos;
|
||
$reduction_4 = data_get($section_4_model, 'blocks.0.data');
|
||
|
||
$section_5_model = $staticPageModel->sections[3];
|
||
$section_5 = $section_5_model->data;
|
||
$section_5_pictos = $section_5_model->pictos;
|
||
$reduction_5 = data_get($section_5_model, 'blocks.0.data');
|
||
|
||
$section_6_model = $staticPageModel->sections[4];
|
||
$section_6 = $section_6_model->data;
|
||
$section_6_blocks = $section_6_model->blocks
|
||
->filter(fn($block) => $block->type->value === \App\Enums\BlockTypeEnum::bienfait->value)
|
||
->map(
|
||
fn($block) => collect($block->data)->map(
|
||
fn($field, $key) => $key === 'picture'
|
||
? ['value' => $field->value, 'alt' => $field->alt, 'title' => $field->title]
|
||
: $field->value,
|
||
),
|
||
);
|
||
$reduction_6 = data_get($section_6_model, 'blocks.0.data');
|
||
|
||
$section_7_model = $staticPageModel->sections[5];
|
||
$section_7 = $section_7_model->data;
|
||
$section_7_pictos = $section_7_model->pictos;
|
||
|
||
$section_8_model = $staticPageModel->sections[6];
|
||
$section_8 = $section_8_model->data;
|
||
$reduction_8 = data_get($section_8_model, 'blocks.0.data');
|
||
|
||
$section_9_model = $staticPageModel->sections[7];
|
||
$section_9 = $section_9_model->data;
|
||
$reduction_9 = data_get($section_9_model, 'blocks.0.data');
|
||
@endphp
|
||
|
||
@extends('fo.layout', ['brParam' => $staticPageModel])
|
||
|
||
@section('title', str($staticPageModel->title)->ucFirst())
|
||
@section('description', str($staticPageModel->title)->ucFirst())
|
||
@section('breadcrumb', request()->route()->getName())
|
||
@section('bg-offset', true)
|
||
|
||
@section('content')
|
||
{{-- NAVIGATION --}}
|
||
@include('fo.partials.commitments.navigation')
|
||
{{-- HEADER --}}
|
||
@include('fo.layouts.header-banner', [
|
||
'picto' => asset($staticPageModel->picture),
|
||
'picto_alt' => __($staticPageModel->picture_alt),
|
||
'picto_title' => __($staticPageModel->picture_title),
|
||
'picto_baner' => $staticPageModel->data['picto_banner'],
|
||
'content' => $staticPageModel->content
|
||
])
|
||
{{-- TAB-TEXTS --}}
|
||
@php
|
||
$tabItems = [
|
||
(object) ['color' => 'secondary', 'text_color' => 'white'],
|
||
(object) ['color' => 'light', 'text_color' => 'secondary'],
|
||
(object) ['color' => 'quint', 'text_color' => 'secondary'],
|
||
];
|
||
$section_2_blocks = $section_2_model->blocks
|
||
->filter(fn($block) => $block->type->value === \App\Enums\BlockTypeEnum::bienfait->value)
|
||
->values()
|
||
->map(
|
||
fn($block, $i) => (object) array_merge(
|
||
collect($block->data)
|
||
->map(
|
||
fn($field, $key) => $key === 'picture'
|
||
? (object) ['value' => $field->value, 'alt' => $field->alt, 'title' => $field->title]
|
||
: $field->value,
|
||
)
|
||
->toArray(),
|
||
[
|
||
'color' => $tabItems[$i]->color ?? null,
|
||
'text_color' => $tabItems[$i]->text_color ?? null,
|
||
],
|
||
),
|
||
);
|
||
@endphp
|
||
@if ($section_2_model->visibility)
|
||
@include('fo.partials.commitments.tabs-texts', [
|
||
'title' => str(__('quels sont les bienfaits de la volaille ?'))->upper(),
|
||
'text' => __(
|
||
'Les nutritionnistes sont d’accord, les viandes de volaille possèdent d’innombrables atouts pour la santé de l’Homme :'),
|
||
'collection' => $section_2_blocks,
|
||
'reduction' => $reduction_2,
|
||
])
|
||
@endif
|
||
{{-- DUO TITLE/TEXT --}}
|
||
@if ($section_3_model->visibility)
|
||
@include('fo.partials.commitments.duo-title-text', [
|
||
'title' => $section_3->title->value,
|
||
'text' => $section_3->description->value,
|
||
'background_color' => 'white',
|
||
'reduction' => $reduction_3,
|
||
])
|
||
@endif
|
||
{{-- PARAGRAPH WITH PICTURE --}}
|
||
@if ($section_4_model->visibility)
|
||
@include('fo.partials.commitments.paragraph-with-visual', [
|
||
'title' => $section_4->title->value,
|
||
'text' => nl2br(__($section_4->description->value)),
|
||
'background_color' => 'light',
|
||
'btn_color' => 'quint',
|
||
'picture' =>
|
||
$section_4->media->value->picture->path ?? null
|
||
? asset($section_4->media->value->picture->path)
|
||
: null,
|
||
'video_id' => $section_4->media->value->video->id ?? null,
|
||
'picture_alt' => $section_4->media->value->picture->alt ?? null,
|
||
'picture_title' => $section_4->media->value->picture->title ?? null,
|
||
'picto' => asset($section_4->media_picto->value),
|
||
'picto_alt' => __($section_4->media_picto->alt),
|
||
'picto_title' => __($section_4->media_picto->title),
|
||
'reduction' => $reduction_4,
|
||
'reversedMobile' => true,
|
||
])
|
||
{{-- BANNER TEXT --}}
|
||
@include('fo.partials.commitments.cards', [
|
||
'collection' => $section_4_pictos,
|
||
])
|
||
@endif
|
||
{{-- PARAGRAPH WITH PICTURE --}}
|
||
@if ($section_5_model->visibility)
|
||
@include('fo.partials.commitments.paragraph-with-visual', [
|
||
'title' => $section_5->title->value,
|
||
'text' => nl2br(__($section_5->description->value)),
|
||
'background_color' => 'light',
|
||
'btn_color' => 'quint',
|
||
'picture' =>
|
||
$section_5->media->value->picture->path ?? null
|
||
? asset($section_5->media->value->picture->path)
|
||
: null,
|
||
'video_id' => $section_5->media->value->video->id ?? null,
|
||
'picture_alt' => $section_5->media->value->picture->alt ?? null,
|
||
'picture_title' => $section_5->media->value->picture->title ?? null,
|
||
'picto' => asset($section_5->media_picto->value),
|
||
'picto_alt' => __($section_5->media_picto->alt),
|
||
'picto_title' => __($section_5->media_picto->title),
|
||
'reduction' => $reduction_5,
|
||
'reversed' => true,
|
||
])
|
||
@include('fo.partials.commitments.complex-flex-items', [
|
||
'background_color' => 'quint',
|
||
'collection' => $section_5_pictos,
|
||
])
|
||
@endif
|
||
{{-- BANNER TEXT --}}
|
||
@if ($section_6_model->visibility)
|
||
@include('fo.partials.commitments.visual-with-cards', [
|
||
'title' => $section_6->title->value,
|
||
'text' => nl2br(__($section_6->description->value)),
|
||
'subtext' => nl2br(__($section_6->description_2->value)),
|
||
'collection' => $section_6_blocks,
|
||
'picture' =>
|
||
$section_6->media->value->picture->path ?? null ? $section_6->media->value->picture->path : null,
|
||
'video_id' => $section_6->media->value->video->id ?? null,
|
||
'picture_alt' => $section_6->media->value->picture->alt ?? null,
|
||
'picture_title' => $section_6->media->value->picture->title ?? null,
|
||
'picto' => asset($section_6->media_picto->value),
|
||
'picto_alt' => __($section_6->media_picto->alt),
|
||
'picto_title' => __($section_6->media_picto->title),
|
||
'reduction' => $reduction_6,
|
||
])
|
||
@endif
|
||
{{-- BANNER TEXT --}}
|
||
@if ($section_7_model->visibility)
|
||
@include('fo.partials.commitments.banner-text', [
|
||
'number' => $commitmentId,
|
||
'title' => $section_7->title->value,
|
||
'text' => nl2br($section_7->description->value),
|
||
'picture' => $section_7->media->value ?? null,
|
||
'picture_alt' => $section_7->media->alt ?? null,
|
||
'picture_title' => $section_7->media->title ?? null,
|
||
])
|
||
@endif
|
||
{{-- PARAGRAPH WITH PICTURE --}}
|
||
@if ($section_8_model->visibility)
|
||
@include('fo.partials.commitments.paragraph-with-visual', [
|
||
'title' => $section_8->title->value,
|
||
'text' => nl2br($section_8->description->value),
|
||
'background_color' => 'light',
|
||
'picture' =>
|
||
$section_8->media->value->picture->path ?? null
|
||
? asset($section_8->media->value->picture->path)
|
||
: null,
|
||
'video_id' => $section_8->media->value->video->id ?? null,
|
||
'picture_alt' => $section_8->media->value->picture->alt ?? null,
|
||
'picture_title' => $section_8->media->value->picture->title ?? null,
|
||
'picto' => asset($section_8->media_picto->value),
|
||
'picto_alt' => __($section_8->media_picto->alt),
|
||
'picto_title' => __($section_8->media_picto->title),
|
||
'reversedMobile' => true,
|
||
])
|
||
{{-- HGROUP LIST --}}
|
||
@include('fo.partials.commitments.hgroup-list', [
|
||
'number' => $commitmentId,
|
||
'text' => nl2br(__($section_8->description_beige->value)),
|
||
'reduction' => $reduction_8,
|
||
])
|
||
@endif
|
||
{{-- PARAGRAPH WITH PICTURE --}}
|
||
@if ($section_9_model->visibility)
|
||
@include('fo.partials.commitments.paragraph-with-visual', [
|
||
'title' => $section_9->title->value,
|
||
'text' => nl2br(__($section_9->description->value)),
|
||
'background_color' => 'light',
|
||
'btn_color' => 'quint',
|
||
'picture' =>
|
||
$section_9->media->value->picture->path ?? null
|
||
? asset($section_9->media->value->picture->path)
|
||
: null,
|
||
'video_id' => $section_9->media->value->video->id ?? null,
|
||
'picture_alt' => $section_9->media->value->picture->alt ?? null,
|
||
'picture_title' => $section_9->media->value->picture->title ?? null,
|
||
'picto' => asset($section_9->media_picto->value),
|
||
'picto_alt' => __($section_9->media_picto->alt),
|
||
'picto_title' => __($section_9->media_picto->title),
|
||
'encart_beige' => $section_9->description_beige->value,
|
||
'reduction' => $reduction_9,
|
||
'reversed' => true,
|
||
])
|
||
@endif
|
||
{{-- OTHER COMMITMENTS --}}
|
||
@include('fo.partials.commitments.other-commitments', [
|
||
'number' => $commitmentId,
|
||
'title' => $staticPageModel->data['common_section']['title'],
|
||
'text' => $staticPageModel->data['common_section']['content'],
|
||
])
|
||
@endsection
|