add 'we produce' page

This commit is contained in:
Alexis Gousseau 2024-03-14 15:25:04 +01:00
parent 4ab0de37b5
commit 8611f696d1
12 changed files with 566 additions and 49 deletions

View file

@ -122,9 +122,20 @@ class StaticPageController extends Controller
public function produce(): \Illuminate\Contracts\View\View
{
$staticPageModel = StaticPage::query()->where('type', StaticPageType::we_produce)->first();
$sectionModels = Section::query()->where('page_id', $staticPageModel->id)->get();
$localSection = $sectionModels->where('section', PageSectionEnum::produce_local)->first();
$gmsSection = $sectionModels->where('section', PageSectionEnum::produce_gms)->first();
$rhdSection = $sectionModels->where('section', PageSectionEnum::produce_rhd)->first();
$exportSection = $sectionModels->where('section', PageSectionEnum::produce_export)->first();
$qualitySection = $sectionModels->where('section', PageSectionEnum::produce_quality)->first();
return view('fo.pages.produce', compact(
return view('fo.pages.produce.show', compact(
'staticPageModel',
'localSection',
'gmsSection',
'rhdSection',
'exportSection',
'qualitySection'
));
}

View file

@ -353,22 +353,206 @@ class Section extends Model
}
/**
* Get MiniCrud bloc for produce_linking section.
* Get MiniCrud bloc for produce_local section.
*
* @param array $data
* @param string $content
* @param string $secondContent
* @param array $data
* @param string $content
* @param string $img
* @param string $imgAlt
* @param string $imgTitle
* @param integer $width
* @param integer $height
* @return array
*/
public static function getProduceLinkingBloc(array $data, string $content, string $secondContent): array
{
$data = self::emptyWysiwygBloc($data, 'numéro 2', $content);
$data = self::emptyButtonBooleanBloc($data, 'On vous écoute');
$data = self::emptyWysiwygBloc($data, 'numéro 3', $secondContent);
$data = self::emptyButtonBooleanBloc($data, 'On se Dévoile');
public static function getProduceLocalBloc(
array $data,
string $content,
string $img,
string $imgAlt,
string $imgTitle,
int $width,
int $height
): array {
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height);
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image', $content);
$data = self::emptyWysiwygBloc($data, 'text', $content);
return $data;
}
/**
* Get MiniCrud bloc for produce_gms section.
*
* @param array $data
* @param string $content
* @param string $img
* @param string $imgAlt
* @param string $imgTitle
* @param integer $width
* @param integer $height
* @param string $banner
* @param integer $bannerWidth
* @param integer $bannerHeight
* @return array
*/
public static function getProduceGmsBloc(
array $data,
string $content,
string $img,
string $imgAlt,
string $imgTitle,
int $width,
int $height,
string $banner,
int $bannerWidth,
int $bannerHeight,
): array {
// @phpcs:disable Generic.Files.LineLength.TooLong
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 2 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 2 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 3 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 3 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'titre 2', $content);
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie 2");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie 2', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 2");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 2 de la partie 2', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 2 de la partie 2");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 3 de la partie 2', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 3 de la partie 2");
$data = self::emptyWysiwygBloc($data, 'titre 3', $content);
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie 3");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie 3', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 3");
// @phpcs:enable
return $data;
}
/**
* Get MiniCrud bloc for produce_rhd section.
*
* @param array $data
* @param string $content
* @param string $img
* @param string $imgAlt
* @param string $imgTitle
* @param integer $width
* @param integer $height
* @param string $banner
* @param integer $bannerWidth
* @param integer $bannerHeight
* @return array
*/
public static function getProduceRhdBloc(
array $data,
string $content,
string $img,
string $imgAlt,
string $imgTitle,
int $width,
int $height,
string $banner,
int $bannerWidth,
int $bannerHeight,
): array {
// @phpcs:disable Generic.Files.LineLength.TooLong
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 2 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 2 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 3 de la partie 1', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 3 de la partie 1");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie 2', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 2");
// @phpcs:enable
return $data;
}
/**
* Get MiniCrud bloc for produce_export section.
*
* @param array $data
* @param string $content
* @param string $img
* @param string $imgAlt
* @param string $imgTitle
* @param integer $width
* @param integer $height
* @param string $banner
* @param integer $bannerWidth
* @param integer $bannerHeight
* @return array
*/
public static function getProduceExportBloc(
array $data,
string $content,
string $img,
string $imgAlt,
string $imgTitle,
int $width,
int $height,
string $banner,
int $bannerWidth,
int $bannerHeight,
): array {
// @phpcs:disable Generic.Files.LineLength.TooLong
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 1 de la partie', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 2 de la partie', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 2 de la partie");
$data = self::emptyWysiwygBloc($data, 'accompagnant l\'image 3 de la partie', $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 3 de la partie");
// @phpcs:enable
return $data;
}
/**
* Get MiniCrud bloc for produce_quality section.
*
* @param array $data
* @param string $content
* @param string $img
* @param string $imgAlt
* @param string $imgTitle
* @param integer $width
* @param integer $height
* @param string $banner
* @param integer $bannerWidth
* @param integer $bannerHeight
* @return array
*/
public static function getProduceQualityBloc(
array $data,
string $content,
string $img,
string $imgAlt,
string $imgTitle,
int $width,
int $height,
string $banner,
int $bannerWidth,
int $bannerHeight,
): array {
// @phpcs:disable Generic.Files.LineLength.TooLong
$data = self::emptyButtonBooleanBloc($data, "'On vous explique comment lire cette étiquette'");
$data = self::emptyPictureBloc($data, $banner, $imgAlt, $imgTitle, $bannerWidth, $bannerHeight, true, "Bannière de la partie 1");
$data = self::emptyWysiwygBloc($data, "accompagnant l'image 1 de la partie 1", $content);
$data = self::emptyPictureBloc($data, $img, $imgAlt, $imgTitle, $width, $height, true, "Image 1 de la partie 1");
$data = self::emptyWysiwygBloc($data, "text de la partie 2", $content);
$data = self::emptyWysiwygBloc($data, "accompagnant le bouton 'On vous écoute'", $content);
$data = self::emptyButtonBooleanBloc($data, "'On vous écoute'");
$data = self::emptyWysiwygBloc($data, "accompagnant le bouton 'On se dévoile'", $content);
$data = self::emptyButtonBooleanBloc($data, "'On se dévoile'");
// @phpcs:enable
return $data;
}
// * EMPTY BLOCS
/**
* Empty bloc for picture.
*
@ -379,6 +563,7 @@ class Section extends Model
* @param integer $width
* @param integer $height
* @param boolean $required
* @param string $name
* @return array
*/
private static function emptyPictureBloc(
@ -389,9 +574,10 @@ class Section extends Model
int $width = 100,
int $height = 100,
bool $required = false,
string $name = 'image',
) {
$data["bloc_image"] = [
'label' => "Image",
$data[sprintf('bloc_%s', Str::of($name)->snake()->ascii()->remove(['\'', '-']))] = [
'label' => $name,
'dimensions' => ['width' => $width, 'height' => $height],
'inputType' => InputType::image->value,
'alt' => $imgAlt,

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -305,18 +305,157 @@ class SectionSeeder extends Seeder
return $section->getMoveCommitmentsBloc([]);
}
// * WE PRODUCE
/**
* Get MiniCrud datas for Produce - Linking section.
*
* @param \App\Models\Section $section
* @return array
*/
private function getProduceLinkingData(\App\Models\Section $section)
private function getProduceLocalData(\App\Models\Section $section)
{
return $section->getProduceLinkingBloc(
return $section->getProduceLocalBloc(
[],
\clean(\fake()->randomHtml()),
\clean(\fake()->randomHtml())
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/default-picture-100x100.png'
))
),
fake()->sentence(),
fake()->sentence(),
200,
200,
);
}
/**
* Get MiniCrud datas for Produce - Linking section.
*
* @param \App\Models\Section $section
* @return array
*/
private function getProduceGmsData(\App\Models\Section $section)
{
return $section->getProduceGmsBloc(
[],
\clean(\fake()->randomHtml()),
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/default-picture-100x100.png'
))
),
fake()->sentence(),
fake()->sentence(),
200,
200,
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/produce-banner-1200x450.png'
))
),
1200,
450,
);
}
/**
* Get MiniCrud datas for Produce - Linking section.
*
* @param \App\Models\Section $section
* @return array
*/
private function getProduceRhdData(\App\Models\Section $section)
{
return $section->getProduceRhdBloc(
[],
\clean(\fake()->randomHtml()),
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/default-picture-100x100.png'
))
),
fake()->sentence(),
fake()->sentence(),
100,
100,
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/produce-banner-1200x450.png'
))
),
1200,
450,
);
}
/**
* Get MiniCrud datas for Produce - Linking section.
*
* @param \App\Models\Section $section
* @return array
*/
private function getProduceExportData(\App\Models\Section $section)
{
return $section->getProduceExportBloc(
[],
\clean(\fake()->randomHtml()),
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/default-picture-100x100.png'
))
),
fake()->sentence(),
fake()->sentence(),
100,
100,
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/produce-banner-1200x450.png'
))
),
1200,
450,
);
}
/**
* Get MiniCrud datas for Produce - Linking section.
*
* @param \App\Models\Section $section
* @return array
*/
private function getProduceQualityData(\App\Models\Section $section)
{
return $section->getProduceQualityBloc(
[],
\clean(\fake()->randomHtml()),
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/default-picture-100x100.png'
))
),
fake()->sentence(),
fake()->sentence(),
100,
100,
FileStorageHelper::storeFile(
new Section(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/sections/produce-banner-1200x450.png'
))
),
1200,
450,
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View file

@ -10,6 +10,7 @@ $quint: $color-quint;
$sixt: $color-sixt;
$seven: $color-seven;
$eight: $color-eight;
$nine: $color-nine;
$success: $color-success;
$info: $color-info;
$warning: $color-warning;
@ -37,6 +38,7 @@ $custom-theme-colors: map.merge($theme-colors,
'sixt': $sixt,
'seven': $seven,
'eight': $eight,
'nine': $nine,
));
$theme-colors: map.merge($theme-colors, $custom-theme-colors);
$theme-colors-rgb: map-loop($theme-colors, to-rgb, '$value');

View file

@ -20,6 +20,7 @@ $color-quint: #4c764b;
$color-sixt: #b94c73;
$color-seven: #C3DFE9;
$color-eight: #EDF9FD;
$color-nine: #FFF2EA;
// * BACKGROUNDS COLORS
$bg-body: $color-white;

View file

@ -1,33 +0,0 @@
@extends('fo.layout')
@section('title', __($staticPageModel->seo_title))
@section('description', __($staticPageModel->seo_description))
@section('breadcrumb', request()->route()->getName())
@section('banner')
@include('fo.layouts.banner', [
'h1' => __($staticPageModel->title),
'asset' => Vite::asset('resources/assets/images/banners/home_reworked.jpg'),
'title' => __('Paysage d\'un champs de blé au soleil couchant avec une lisière en fond de tableau'),
'alt' => __('Image de fond'),
'displayArrow' => true,
'buttonLink' => '#listen',
])
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col">
<h1 class="f-intro-head-h-base text-center">{{ __($staticPageModel->title) }}</h1>
</div>
</div>
</div>
<div class="container">
<div class="row mb-5">
<div class="col ck-content">
{!! clean($staticPageModel->content) !!}
</div>
</div>
</div>
@endsection

View file

@ -0,0 +1,15 @@
<div class="col-12">
<img class="img-fluid" src="{{ asset($data["bloc_banniere_{$partName}"]['value']) }}"
title="{{ $data["bloc_banniere_{$partName}"]['title'] }}" alt="{{ $data["bloc_banniere_{$partName}"]['alt'] }}">
</div>
<div class="col-12">
@for ($i = 1; $i <= $itemMax; $i++)
@include('fo.pages.produce.flex-row', [
'image' => $data["bloc_image{$i}_{$partName}"]['value'],
'alt' => $data["bloc_image{$i}_{$partName}"]['alt'],
'title' => $data["bloc_image{$i}_{$partName}"]['title'],
'text' => $data["bloc_accompagnant_limage{$i}_{$partName}_content"]['value'],
'switch' => $i % 2 ? false : true,
])
@endfor
</div>

View file

@ -0,0 +1,11 @@
<div @class([
'd-flex flex-column flex-sm-row justify-content-center align-items-center my-3',
'flex-sm-row-reverse' => $switch,
])>
<img src="{{ asset($image) }}" title="{{ $title }}" alt="{{ $alt }}" role="img" aria-label="{{ $alt }}">
<div class="d-flex justify-content-start align-items-center mx-3">
<div class="text-start">
{!! $text !!}
</div>
</div>
</div>

View file

@ -0,0 +1,185 @@
@extends('fo.layout')
@section('title', __($staticPageModel->seo_title))
@section('description', __($staticPageModel->seo_description))
@section('breadcrumb', request()->route()->getName())
@section('banner')
@include('fo.layouts.banner', [
'h1' => __($staticPageModel->title),
'asset' => Vite::asset('resources/assets/images/banners/home_reworked.jpg'),
'title' => __('Paysage d\'un champs de blé au soleil couchant avec une lisière en fond de tableau'),
'alt' => __('Image de fond'),
'displayArrow' => true,
'buttonLink' => '#listen',
])
@endsection
@section('content')
{{-- LOCAL --}}
<section class="container my-4 text-center">
<div class="row">
<div class="col-12">
<h2 class="h2 fw-bold text-primary">{{ $localSection->h2_title }}</h2>
<div class="row justify-content-center align-items-center flex-md-column-reverse">
<div class="col-12 my-3">
@include('fo.pages.produce.flex-row', [
'image' => $localSection->data['bloc_image']['value'],
'alt' => $localSection->data['bloc_image']['alt'],
'title' => $localSection->data['bloc_image']['title'],
'text' => $localSection->data['bloc_text_content']['value'],
'switch' => false,
])
</div>
</div>
</div>
</div>
</section>
{{-- GMS --}}
<section class="border-top-curved-tertiary-light">
<div class="bg-tertiary-light overflow-hidden pb-5">
<div class="container text-center">
<h2 class="h2 fw-bold text-primary">{{ $gmsSection->h2_title }}</h2>
<div class="row">
<div class="col-12 mb-3">
<div class="ck-content">
{!! clean($gmsSection->text) !!}
</div>
</div>
{{-- PART 1 --}}
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie1',
'data' => $gmsSection->data,
'itemMax' => 3,
])
{{-- PART 2 --}}
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie2',
'data' => $gmsSection->data,
'itemMax' => 3,
])
{{-- PART 3 --}}
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie3',
'data' => $gmsSection->data,
'itemMax' => 1,
])
</div>
</div>
</div>
</section>
{{-- RHD --}}
<section class="border-top-curved-upper-tertiary-light">
<div class="overflow-hidden bg-white pb-5">
<div class="container text-center">
<h2 class="h2 fw-bold text-primary">{{ $rhdSection->h2_title }}</h2>
<div class="row">
{{-- PART 1 --}}
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie1',
'data' => $rhdSection->data,
'itemMax' => 3,
])
<div class="col-12 mb-3">
<div class="ck-content">
{!! clean($rhdSection->text) !!}
</div>
</div>
<div class="col-12 mb-3">
<button class="btn btn-primary rounded-pill">{{ __('LDC restauration') }}</button>
</div>
{{-- PART 2 --}}
<div class="col-12 mb-3">
<div class="row w-100 bg-nine rounded-4 mx-auto p-4">
<div class="col-4 d-none d-md-flex flex-column justify-content-center align-items-start">
<h3 class="h3 text-primary fw-bold text-uppercase m-0">{{ __('le saviez-vous ?') }}</h3>
<p class="text-sixt fw-bold text-uppercase m-0 mt-3 text-start">
{{ __('nos volailles sont aussi partenaires de l\'enseignes KFC') }}
</p>
</div>
<div class="col-12 col-md-8">
@include('fo.pages.produce.flex-row', [
'image' => $rhdSection->data['bloc_image1_de_la_partie2']['value'],
'alt' => $rhdSection->data['bloc_image1_de_la_partie2']['alt'],
'title' => $rhdSection->data['bloc_image1_de_la_partie2']['title'],
'text' => $rhdSection->data['bloc_accompagnant_limage1_de_la_partie2_content']['value'],
'switch' => false,
])
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{{-- EXPORT --}}
<section class="border-top-curved-primary">
<div class="bg-primary overflow-hidden pb-5 text-white">
<div class="container text-center">
<h2 class="h2 fw-bold">{{ $exportSection->h2_title }}</h2>
<div class="row">
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie',
'data' => $exportSection->data,
'itemMax' => 3,
])
</div>
</div>
</div>
</section>
{{-- QUALITY --}}
<section class="border-top-curved-upper-primary">
<div class="overflow-hidden bg-white pb-5">
<div class="container">
<div class="row gx-5">
<div class="col-12 mb-3 text-center">
<h2 class="h2 fw-bold">{{ $qualitySection->h2_title }}</h2>
<div class="ck-content">{!! clean($qualitySection->text) !!}</div>
@if ($qualitySection->data['bloc_button__on_vous_explique_comment_lire_cetteetiquette']['value'])
<a class="btn btn-primary rounded-pill mt-3" href="https://www.etiquettebienetreanimal.fr/"
target="_blank">{{ __('On vous explique comment lire cette étiquette') }}</a>
@endif
</div>
@include('fo.pages.produce.banner-elements', [
'partName' => 'de_la_partie1',
'data' => $qualitySection->data,
'itemMax' => 1,
])
<div class="col-12 mb-3 text-center">
<div class="bg-tertiary-light rounded-4 my-3 p-4">
<div class="ck-content">{!! clean($qualitySection->data['bloc_text_de_la_partie2_content']['value']) !!}</div>
<div class="d-flex justify-content-center align-items-center mt-3">
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/produce/schema.png') }}"
title="{{ __('Schéma') }}" alt="{{ __('Plein de formes différentes') }}">
</div>
</div>
</div>
<div class="col-12 col-md-6 my-3">
<div class="bg-sixt-light rounded-2 px-3 py-4 text-center">
<div class="ck-content">
{!! $qualitySection->data['bloc_accompagnant_le_bouton_on_vousecoute_content']['value'] !!}
</div>
@if ($qualitySection->data['bloc_button__on_vousecoute']['value'])
<a class="btn btn-primary rounded-pill rounded-2 mt-3" href="{{ route('fo.listen.show') }}">
{{ __('On vous écoute') }}
</a>
@endif
</div>
</div>
<div class="col-12 col-md-6 my-3">
<div class="bg-quint-light rounded-2 px-3 py-4 text-center">
<div class="ck-content">
{!! $qualitySection->data['bloc_accompagnant_le_bouton_on_se_devoile_content']['value'] !!}
</div>
@if ($qualitySection->data['bloc_button__on_se_devoile']['value'])
<a class="btn btn-primary rounded-pill rounded-2 mt-3" href="{{ route('fo.unveil.show') }}">
{{ __('On se dévoile') }}
</a>
@endif
</div>
</div>
</div>
</div>
</div>
</section>
@endsection