ldc-groupe/resources/views/front/pages/our-commitment.blade.php

144 lines
8.3 KiB
PHP

@extends('front.layouts.layout')
@section('title', data_get($dynamicPageModel->content, 'list_identification.0.string_seo_title'))
@section('description', data_get($dynamicPageModel->content, 'list_identification.0.textarea_seo_description'))
@section('content')
<div class="our-commitment">
{{-- Section content blocs --}}
@if (array_key_exists('list_section_engagement', $dynamicPageModel->content))
@foreach($dynamicPageModel->content['list_section_engagement'] as $key => $sectionEngagement)
@php
$sections[$key] = [
'bg' => $sectionEngagement['boolean_background_dark'],
'title' => $sectionEngagement['string_title'],
'subtitle' => [
'text' => $sectionEngagement['string_subtitle'],
],
'list' => [],
];
$getConfig = fn($array, $value) => collect($array)->filter(fn($n) => $n['key'] === $value)->first();
foreach($sectionEngagement['list_block_content'] as $keyContent => $content) {
$positionMedium = isset($content['list_media']) ? intval($content['list_media'][0]['position_medium']) : 0;
array_push($sections[$key]['list'], [
'title' => $content['string_title'] ?? null,
'text' => $content['wysiwyg_content'],
'quote' => 0,
'swap_position' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value()
? true
: $positionMedium === \App\Enums\ElementPositionEnum::showright->value(),
'in_row' => $positionMedium === \App\Enums\ElementPositionEnum::showbottom->value(),
'floated' => isset($content['list_media']) ? intval($content['list_media'][0]['boolean_floated']) : 0,
'align_center' => 1,
'borders_desktop' => [
'left' => true,
'right' => true,
'top' => true,
'bottom' => true,
],
'borders_mobile' => [
'left' => true,
'right' => true,
'top' => true,
'bottom' => true,
],
'image' => [],
'video' => [],
'button_icon' => '',
'button' => [],
]);
if (isset($content['list_media']) && $content['list_media'][0]['boolean_medium']) {
foreach ($content['list_media'][0]['list_medium_type'] as $keyImg => $value) {
unset($value['order']);
$filtered = array_filter($value);
$field = array_key_first($filtered);
$aaa = $getConfig($dynamicPageModel->config->config, 'list_section_engagement');
$bbb = $getConfig($aaa['children'], 'list_block_content');
$ccc = $getConfig($bbb['children'], 'list_media');
$ddd = $getConfig($ccc['children'], 'list_medium_type');
$eee = $getConfig($ddd['children'], $field);
if ($eee['type'] === \App\Enums\DynamicFieldTypes::youtubeid->value()) {
$sections[$key]['list'][$keyContent]['video'] = [
'type_video' => 'youtube',
'video' => $filtered[$field],
];
} else {
array_push($sections[$key]['list'][$keyContent]['image'], [
'url' => $filtered[$field] ?? null,
]);
}
}
}
if (isset($content['list_button']) && $content['list_button'][0]['boolean_button']) {
if (isset($content['list_button'][0]['model_page'])) {
$url = \App\Models\DynamicPage::getAccessModel($content['list_button'][0]['model_page']);
}
if (isset($content['list_button'][0]['model_document'])) {
$url = \App\Models\Document::getAccessModel($content['list_button'][0]['model_document']);
}
if (isset($content['list_button'][0]['staticroute_url'])) {
$url = \App\Enums\StaticRoutesEnum::getRoute(
$content['list_button'][0]['staticroute_url']
);
}
$sections[$key]['list'][$keyContent]['button'] = [
'url' => $url ?? "#",
'title' => $content['list_button'][0]['string_label'],
'target' => '',
];
$sections[$key]['list'][$keyContent]['button_icon'] = $content['list_button'][0]['boolean_icon'] ? 'btn__icon_view' : 'btn__icon_arrow-right';
}
}
@endphp
@endforeach
@foreach ($sections as $section)
@if($section['title'] === 'bea_content')
@include('front.pages.partials.bea_content')
@continue
@endif
<x-front.text-block :textBlock="$section" />
@endforeach
@endif
{{-- Sections numbers --}}
@if (array_key_exists('list_section_numbers', $dynamicPageModel->content))
@php $section = $dynamicPageModel->content['list_section_numbers'][0]; @endphp
<div class="store-card fw fw-container">
<div class="store-card__wrapper wrapper wrapper_small">
@php
$brands = [];
if (
isset($pageNosMarques)
&& isset($pageNosMarques->content['list_our_big_brands'])
&& isset($pageNosMarques->content['list_our_big_brands'][0]['list_brands'])
) {
foreach ($pageNosMarques->content['list_our_big_brands'][0]['list_brands'] as $key => $logo) {
array_push($brands, [
'image' => [
'url' => asset($logo['list_logo'][0]['image_brand_logo']),
],
'link' => \App\Helpers\RouteHelper::routeNameChecker('front.dynamic-pages.nos-marques'),
]);
}
}
@endphp
@if(!empty($brands) && request()->route()->getName() === "front.dynamic-pages.bien-nourrir.fr")
<x-front.brands-icons.brands-icons :brands="$brands" :title="$section['string_title']" :subtitle="$section['string_subtitle']"
:isOnCommitmentPage="true" />
@else
<x-front.sections.title :title="$section['string_title']" :subtitle="$section['string_subtitle']" />
@endif
<x-front.commitments.score-card :cards="$section['list_card']" />
</div>
</div>
@endif
@if($pageNosEngagements->childPages->count())
<div class="engagements fw fw-container">
<div class="engagements__wrapper wrapper">
<x-front.commitments.list />
</div>
</div>
@endif
</div>
@endsection