diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index 8535c69..9493b92 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -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' )); } diff --git a/app/Models/Section.php b/app/Models/Section.php index 60bb357..32b422a 100644 --- a/app/Models/Section.php +++ b/app/Models/Section.php @@ -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, diff --git a/database/factories/assets/sections/produce-banner-1200x450.png b/database/factories/assets/sections/produce-banner-1200x450.png new file mode 100644 index 0000000..ce2a733 Binary files /dev/null and b/database/factories/assets/sections/produce-banner-1200x450.png differ diff --git a/database/factories/assets/sections/produce-image-200x200.png b/database/factories/assets/sections/produce-image-200x200.png new file mode 100644 index 0000000..e0ddeca Binary files /dev/null and b/database/factories/assets/sections/produce-image-200x200.png differ diff --git a/database/seeders/Development/SectionSeeder.php b/database/seeders/Development/SectionSeeder.php index 1acfb0f..1f7c652 100644 --- a/database/seeders/Development/SectionSeeder.php +++ b/database/seeders/Development/SectionSeeder.php @@ -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, ); } } diff --git a/resources/assets/images/produce/schema.png b/resources/assets/images/produce/schema.png new file mode 100644 index 0000000..9d52a7b Binary files /dev/null and b/resources/assets/images/produce/schema.png differ diff --git a/resources/sass/fo/utilities/_bootstrap-variables.scss b/resources/sass/fo/utilities/_bootstrap-variables.scss index 3db062c..d3e251f 100644 --- a/resources/sass/fo/utilities/_bootstrap-variables.scss +++ b/resources/sass/fo/utilities/_bootstrap-variables.scss @@ -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'); diff --git a/resources/sass/fo/utilities/_variables.scss b/resources/sass/fo/utilities/_variables.scss index 0c5fdad..a2870a0 100644 --- a/resources/sass/fo/utilities/_variables.scss +++ b/resources/sass/fo/utilities/_variables.scss @@ -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; diff --git a/resources/views/fo/pages/produce.blade.php b/resources/views/fo/pages/produce.blade.php deleted file mode 100644 index adb4814..0000000 --- a/resources/views/fo/pages/produce.blade.php +++ /dev/null @@ -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') -
-
-
-

{{ __($staticPageModel->title) }}

-
-
-
-
-
-
- {!! clean($staticPageModel->content) !!} -
-
-
-@endsection diff --git a/resources/views/fo/pages/produce/banner-elements.blade.php b/resources/views/fo/pages/produce/banner-elements.blade.php new file mode 100644 index 0000000..4c38786 --- /dev/null +++ b/resources/views/fo/pages/produce/banner-elements.blade.php @@ -0,0 +1,15 @@ +
+ {{ $data[ +
+
+ @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 +
diff --git a/resources/views/fo/pages/produce/flex-row.blade.php b/resources/views/fo/pages/produce/flex-row.blade.php new file mode 100644 index 0000000..0f5e79a --- /dev/null +++ b/resources/views/fo/pages/produce/flex-row.blade.php @@ -0,0 +1,11 @@ +
$switch, +])> + {{ $alt }} +
+
+ {!! $text !!} +
+
+
diff --git a/resources/views/fo/pages/produce/show.blade.php b/resources/views/fo/pages/produce/show.blade.php new file mode 100644 index 0000000..e1c09e6 --- /dev/null +++ b/resources/views/fo/pages/produce/show.blade.php @@ -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 --}} +
+
+
+

{{ $localSection->h2_title }}

+
+
+ @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, + ]) +
+
+
+
+
+ {{-- GMS --}} +
+
+
+

{{ $gmsSection->h2_title }}

+
+
+
+ {!! clean($gmsSection->text) !!} +
+
+ {{-- 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, + ]) +
+
+
+
+ {{-- RHD --}} +
+
+
+

{{ $rhdSection->h2_title }}

+
+ {{-- PART 1 --}} + @include('fo.pages.produce.banner-elements', [ + 'partName' => 'de_la_partie1', + 'data' => $rhdSection->data, + 'itemMax' => 3, + ]) +
+
+ {!! clean($rhdSection->text) !!} +
+
+
+ +
+ {{-- PART 2 --}} +
+
+
+

{{ __('le saviez-vous ?') }}

+

+ {{ __('nos volailles sont aussi partenaires de l\'enseignes KFC') }} +

+
+
+ @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, + ]) +
+
+
+
+
+
+
+ {{-- EXPORT --}} +
+
+
+

{{ $exportSection->h2_title }}

+
+ @include('fo.pages.produce.banner-elements', [ + 'partName' => 'de_la_partie', + 'data' => $exportSection->data, + 'itemMax' => 3, + ]) +
+
+
+
+ {{-- QUALITY --}} +
+
+
+
+
+

{{ $qualitySection->h2_title }}

+
{!! clean($qualitySection->text) !!}
+ @if ($qualitySection->data['bloc_button__on_vous_explique_comment_lire_cetteetiquette']['value']) + {{ __('On vous explique comment lire cette étiquette') }} + @endif +
+ @include('fo.pages.produce.banner-elements', [ + 'partName' => 'de_la_partie1', + 'data' => $qualitySection->data, + 'itemMax' => 1, + ]) +
+
+
{!! clean($qualitySection->data['bloc_text_de_la_partie2_content']['value']) !!}
+
+ {{ __('Plein de formes différentes') }} +
+
+
+
+
+
+ {!! $qualitySection->data['bloc_accompagnant_le_bouton_on_vousecoute_content']['value'] !!} +
+ @if ($qualitySection->data['bloc_button__on_vousecoute']['value']) + + {{ __('On vous écoute') }} + + @endif +
+
+
+
+
+ {!! $qualitySection->data['bloc_accompagnant_le_bouton_on_se_devoile_content']['value'] !!} +
+ @if ($qualitySection->data['bloc_button__on_se_devoile']['value']) + + {{ __('On se dévoile') }} + + @endif +
+
+
+
+
+
+@endsection