fix conflicts

This commit is contained in:
System User 2026-05-06 17:13:57 +02:00
commit 487ff748ee
51 changed files with 621 additions and 117 deletions

View file

@ -45,7 +45,6 @@ CRM_ENDPOINT=
CRM_TOKEN=
CRM_PASSWORD=
CRM_QUESTION_ID=
CRM_BRAND_ID=
# - JSON ONLY (like this: {"subject1":44,"subject2":55,"subject3":66})
CRM_SUBJECTS=

View file

@ -32,6 +32,7 @@ enum StaticPageType: int
case rules = 22;
case exitOutside = 23;
case ouiCBon = 24;
case ourFarms = 25;
/**
* Optionnal labels definition.
@ -62,7 +63,8 @@ enum StaticPageType: int
self::sitemap->name => 'Plan du site',
self::rules->name => 'Règlement du jeu',
self::exitOutside->name => 'Sortir à l\'extérieur',
self::ouiCBon->name => 'Oui c\'est bon'
self::ouiCBon->name => 'Oui c\'est bon',
self::ourFarms->name => 'Nos élevages'
];
/**
@ -77,6 +79,19 @@ enum StaticPageType: int
self::breedingJob,
self::breedingFood,
self::breedingHealth,
self::ourFarms
];
}
/**
* Get all breeding pages type values.
*
* @return array<string>
*/
public static function getBreedingValues(): array
{
return collect(self::getBreedingPages())
->map(fn($page) => $page->value)
->toArray();
}
}

View file

@ -2,14 +2,17 @@
namespace App\Http\Controllers\Bo;
use App\Enums\StaticPageType;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\NewsBreedings\StoreNewsBreedingRequest;
use App\Http\Requests\Bo\NewsBreedings\UpdateNewsBreedingRequest;
use App\Models\NewsBreeding;
use App\Models\StaticPage;
use App\Traits\Controllers\ChangesModelOrder;
use App\Traits\Controllers\UpdateModelPublished;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
@ -77,7 +80,11 @@ class NewsBreedingController extends Controller
*/
public function create(NewsBreeding $newsBreeding): \Illuminate\Contracts\View\View
{
return view('bo.pages.news_breedings.create', ['newsBreedingModel' => $newsBreeding]);
$breedingPages = StaticPage::query()
->whereIn('type', Arr::pluck(StaticPageType::getBreedingPages(), 'value'))
->get();
return view('bo.pages.news_breedings.create', ['newsBreedingModel' => $newsBreeding, 'breedingPages' => $breedingPages]);
}
/**

View file

@ -2,11 +2,15 @@
namespace App\Http\Controllers\Bo;
use App\Enums\StaticPageType;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\StaticPages\UpdateCommonSectionRequest;
use App\Http\Requests\Bo\StaticPages\UpdateStaticPageRequest;
use App\Models\StaticPage;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Throwable;
class StaticPageController extends Controller
{
@ -56,4 +60,60 @@ class StaticPageController extends Controller
]));
});
}
/**
* Display the common section edit form for all breeding static pages.
*
* @return \Illuminate\Contracts\View\View
*/
public function getCommonSection(): \Illuminate\Contracts\View\View
{
$commonSection = StaticPage::whereIn('type', StaticPageType::getBreedingValues())
->get()
->map(fn($page) => $page->data['common_section'] ?? null)
->filter()
->first();
return view('bo.pages.static_pages.common_section.edit', [
'commonSection' => $commonSection,
]);
}
/**
* Update the common section for all breeding static pages.
*
* @param \App\Http\Requests\Bo\StaticPage\UpdateCommonSectionRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function updateCommonSection(UpdateCommonSectionRequest $request): RedirectResponse
{
$pages = StaticPage::whereIn('type', StaticPageType::getBreedingValues())->get();
try {
DB::transaction(function () use ($pages, $request) {
foreach ($pages as $page) {
$data = $page->data ?? [];
$data['common_section'] = [
'title' => $request->validated('title'),
'content' => $request->validated('content'),
];
$page->data = $data;
$page->saveOrFail();
}
});
} catch (Throwable $e) {
return redirect()
->back()
->withInput()
->with('error', __('crud.messages.cannot_be_updated', [
'model' => Str::ucfirst(__('validation.custom.common_section_part'))]));
}
return redirect()
->route('bo.static_page.sections.edit')
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('validation.custom.common_section_part'))]));
}
}

View file

@ -95,4 +95,15 @@ class BreedingController extends Controller
'sectionApproachModels' => $sectionApproachModels
]);
}
/**
* Display our farms page.
*
* @return \Illuminate\Contracts\View\View
*/
public function ourFarmsPage(): \Illuminate\Contracts\View\View
{
$staticPage = StaticPage::query()->where('type', StaticPageType::ourFarms)->first();
return view('fo.pages.breeding.index', ['staticPageModel' => $staticPage]);
}
}

View file

@ -73,7 +73,6 @@ class ContactController extends Controller
$validatedData['firstname'],
$validatedData['email'],
$validatedData['message'],
config('crm.brand'),
ContactFormType::make($validatedData['type'])->crmId(),
$validatedData['address'],
$validatedData['town'],

View file

@ -52,7 +52,10 @@ class StoreNewsBreedingRequest extends FormRequest
'content' => ['required', 'string', new WysiwygLength(15, 15000)],
'static_page_id' => [
'required',
Rule::enum(StaticPageType::class)->only(StaticPageType::getBreedingPages())
Rule::exists('static_pages', 'id')->whereIn(
'type',
array_column(StaticPageType::getBreedingPages(), 'value')
)
],
'picture_alt' => 'required_with:picture|between:3,255',
'picture_title' => 'required_with:picture|between:3,255',

View file

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Bo\StaticPages;
use App\Rules\WysiwygLength;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCommonSectionRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'title' => ['required', 'string', 'min:3', 'max:50'],
'content' => ['required', 'string', new WysiwygLength()],
];
}
}

View file

@ -129,7 +129,8 @@ class UpdateStaticPageRequest extends UpdateMiniCrudRequest
}
if (
!$staticPageModel->type->equals(StaticPageType::recipe) &&
!$staticPageModel->type->equals(StaticPageType::product)
!$staticPageModel->type->equals(StaticPageType::product) &&
!$staticPageModel->type->equals(StaticPageType::ourFarms)
) {
$rules = \array_merge(
$rules,
@ -147,6 +148,7 @@ class UpdateStaticPageRequest extends UpdateMiniCrudRequest
!$staticPageModel->type->equals(StaticPageType::confidentiality) &&
!$staticPageModel->type->equals(StaticPageType::selling) &&
!$staticPageModel->type->equals(StaticPageType::accessibility) &&
!$staticPageModel->type->equals(StaticPageType::ourFarms) &&
!$staticPageModel->type->equals(StaticPageType::exitOutside) &&
!$staticPageModel->type->equals(StaticPageType::ouiCBon)
) {

View file

@ -40,9 +40,13 @@ abstract class UpdateMiniCrudRequest extends FormRequest
}
foreach ($this->{$this->modelName}->data as $iptName => $input) {
$input = \json_decode(\json_encode($input), true);
// input without inputType we skip
if (!isset($input['inputType'])) {
continue;
}
switch ($input['inputType']) {
case InputType::text->value:
if (is_null($this->data[$iptName]['value']) && !$input['required']) {
if (is_null($this->data[$iptName]['value'] ?? null) && !$input['required']) {
$this->merge([
$this->data[$iptName]['value'] => ''
]);
@ -65,6 +69,10 @@ abstract class UpdateMiniCrudRequest extends FormRequest
$rules = [];
foreach ($this->{$this->modelName}->data as $iptName => $input) {
$input = \json_decode(\json_encode($input), true);
// input without inputType we skip
if (!isset($input['inputType'])) {
continue;
}
switch ($input['inputType']) {
case InputType::number->value:
$rules = array_merge($rules, [
@ -171,7 +179,8 @@ abstract class UpdateMiniCrudRequest extends FormRequest
case InputType::url->value:
$rules = array_merge($rules, [
"data.$iptName.value" => [
'required', 'url',
'required',
'url',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
function ($attribute, $value, $fail) {
try {
@ -237,12 +246,22 @@ abstract class UpdateMiniCrudRequest extends FormRequest
{
$rule = \collect(\explode(':', $rule, 1))->filter()->first(null, '');
return \collect([
'nullable', 'present', 'required', 'required_if',
'required_unless', 'required_with', 'required_with_all',
'required_without', 'required_without_all', 'required_with_all',
'missing', 'missing_if', 'missing_unless',
'missing_with', 'missing_with_all',
])->first(fn (string $firstRule) => \strpos($rule, $firstRule) === 0) ? true : false;
'nullable',
'present',
'required',
'required_if',
'required_unless',
'required_with',
'required_with_all',
'required_without',
'required_without_all',
'required_with_all',
'missing',
'missing_if',
'missing_unless',
'missing_with',
'missing_with_all',
])->first(fn(string $firstRule) => \strpos($rule, $firstRule) === 0) ? true : false;
}
/**

View file

@ -135,6 +135,7 @@ class ViewServiceProvider extends ServiceProvider
['name' => 'searchStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::search)],
['name' => 'exitOutsideStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::exitOutside)],
['name' => 'ouiCestBonStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::ouiCBon)],
['name' => 'ourFarmsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::ourFarms)],
])->map(function ($array) {
View::share($array['name'], (function () use ($array) {
return $array['value'] ?: null;

View file

@ -147,6 +147,9 @@ trait MiniCrudModel
private function serializeData(array $data): array
{
foreach ($data as $o => $input) {
if (!isset($input['inputType'])){
continue;
}
switch ($input['inputType']) {
case InputType::image->value:
$data[$o]['value'] = \preg_replace(

14
composer.lock generated
View file

@ -2659,16 +2659,16 @@
},
{
"name": "ldc/ldccrmv4client",
"version": "4.1.5",
"version": "4.1.8",
"source": {
"type": "git",
"url": "git@lab.s-web.fr:ldc-web/projets/crm-client.git",
"reference": "9725ed12914d75c39f0ee66990a1bff6c77f457c"
"reference": "96183314eab486370bdef1a687672f47aeb413ae"
},
"dist": {
"type": "zip",
"url": "https://lab.s-web.fr/api/v4/projects/26/packages/composer/archives/ldc/ldccrmv4client.zip?sha=9725ed12914d75c39f0ee66990a1bff6c77f457c",
"reference": "9725ed12914d75c39f0ee66990a1bff6c77f457c",
"url": "https://lab.s-web.fr/api/v4/projects/26/packages/composer/archives/ldc/ldccrmv4client.zip?sha=96183314eab486370bdef1a687672f47aeb413ae",
"reference": "96183314eab486370bdef1a687672f47aeb413ae",
"shasum": ""
},
"require": {
@ -13938,13 +13938,13 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3",
"ext-bcmath": "*"
},
"platform-dev": {},
"plugin-api-version": "2.9.0"
"platform-dev": [],
"plugin-api-version": "2.3.0"
}

View file

@ -5,6 +5,5 @@ return [
'token' => env('CRM_TOKEN'),
'password' => env('CRM_PASSWORD'),
'question' => env('CRM_QUESTION_ID'),
'brand' => env('CRM_BRAND_ID'),
'subjects' => env('CRM_SUBJECTS'),
];

View file

@ -0,0 +1,142 @@
<?php
use App\Enums\StaticPageType;
use App\Models\StaticPage;
use Illuminate\Database\Migrations\Migration;
use App\Lib\Helpers\FileStorageHelper;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$data = [
'title' => [
'label' => 'Titre de la section',
'inputType' => 11,
'value' => '',
'validate' => 'required|string|between:3,255',
'required' => true
],
'card_title_1' => [
'label' => 'Démarche "Oui c\'est bon" : Titre',
'inputType' => 11,
'value' => '',
'validate' => 'required|string|between:3,255',
'required' => true
],
'card_description_1' => [
'label' => 'Démarche "Oui c\'est bon" : Description',
'inputType' => 12,
'value' => '',
'validate' => 'required|string|min:15',
'required' => true
],
'card_logo_1' => [
'label' => 'Démarche "Oui c\'est bon" : Picto',
'inputType' => 4,
'dimensions' => [
'width' => 90,
'height' => 90
],
'alt' => '',
'title' => '',
'value' => '',
'validate' => 'required',
'required' => true
],
'card_image_1' => [
'label' => 'Démarche "Oui c\'est bon" : Image',
'inputType' => 4,
'dimensions' => [
'width' => 528,
'height' => 351
],
'alt' => '',
'title' => '',
'value' => '',
'validate' => 'required',
'required' => true
],
'card_title_2' => [
'label' => 'Démarche "Sortant à l\'extérieur" : Titre',
'inputType' => 11,
'value' => '',
'validate' => 'required|string|between:3,255',
'required' => true
],
'card_description_2' => [
'label' => 'Démarche "Sortant à l\'extérieur" : Description',
'inputType' => 12,
'value' => '',
'validate' => 'required|string|min:15',
'required' => true
],
'card_logo_2' => [
'label' => 'Démarche "Sortant à l\'extérieur" : Picto',
'inputType' => 4,
'dimensions' => [
'width' => 90,
'height' => 90
],
'alt' => '',
'title' => '',
'value' => '',
'validate' => 'required',
'required' => true
],
'card_image_2' => [
'label' => 'Démarche "Sortant à l\'extérieur" : Image',
'inputType' => 4,
'dimensions' => [
'width' => 528,
'height' => 214
],
'alt' => '',
'title' => '',
'value' => '',
'validate' => 'required',
'required' => true
]
];
$staticPage = StaticPage::where('type', StaticPageType::ourFarms)->first();
if ($staticPage) {
$staticPage->data = $data;
$staticPage->saveQuietly();
} else {
StaticPage::query()->forceCreateQuietly([
'type' => StaticPageType::ourFarms->value(),
'slug' => 'les-elevages',
'seo_title' => sprintf('Seo title pour la page %s', StaticPageType::ourFarms->label()),
'seo_description' => sprintf('Seo description pour la page %s', StaticPageType::ourFarms->label()),
'title' => StaticPageType::ourFarms->label(),
'subtitle' => 'sous-titre' . StaticPageType::ourFarms->label(),
'picture_alt' => 'picture alt',
'picture_title' => 'picture title',
'picture' => FileStorageHelper::storeFile(
(new StaticPage()),
new \SplFileInfo(\resource_path(
'../database/factories/assets/static_pages/default-picture-720x405.jpg'
))
),
'content' => \clean(\fake()->randomHtml()),
'data' => $data,
]);
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$staticPage = StaticPage::where('type', StaticPageType::ourFarms)->first();
if ($staticPage) {
$staticPage->data = [];
$staticPage->saveQuietly();
}
}
};

View file

@ -0,0 +1,72 @@
<?php
use App\Enums\StaticPageType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$breedingValues = collect(StaticPageType::getBreedingPages())
->map(fn($page) => $page->value)->toArray();
$pages = DB::table('static_pages')
->whereIn('type', $breedingValues)
->get(['id', 'data']);
// check page that already have values
$existingCommonSection = null;
foreach ($pages as $page) {
$data = json_decode($page->data ?? '{}', true);
if (!empty($data['common_section']['title']) || !empty($data['common_section']['content'])) {
$existingCommonSection = $data['common_section'];
break;
}
}
// fallback solution if no pages have a value
$commonSection = $existingCommonSection ?? [
'title' => 'L’élevage des volailles',
'content' => '<p>Face aux préoccupations des consommateurs sur le bien-être animal, Le Gaulois vous dit tout sur ses éleveurs partenaires et ses conditions d’élevages de volailles.
Chaque jour, nous collaborons avec les éleveurs partenaires engagés dans la démarche éthique et responsable pour améliorer le confort de nos volailles. Chez les éleveurs partenaires Le Gaulois, la protection animale ne cesse d’être l’enjeu majeur.</p>',
];
// apply to all breeding pages
foreach ($pages as $page) {
$data = json_decode($page->data ?? '{}', true);
if (!isset($data['common_section'])) {
$data['common_section'] = $commonSection;
DB::table('static_pages')
->where('id',$page->id)
->update(['data' => json_encode($data)]);
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$breedingValues = collect(StaticPageType::getBreedingPages())
->map(fn($page) => $page->value)->toArray();
$pages = DB::table('static_pages')
->whereIn('type', $breedingValues)
->get(['id', 'data']);
foreach ($pages as $page) {
$data = json_decode($page->data ?? '{}', true);
unset($data['common_section']);
DB::table('static_pages')
->where('id',$page->id)
->update(['data' => json_encode($data)]);
}
}
};

View file

@ -109,6 +109,7 @@ class StaticPageSeeder extends Seeder
$this->seedStaticPage(StaticPageType::search);
$this->seedStaticPage(StaticPageType::sitemap);
$this->seedStaticPage(StaticPageType::rules);
$this->seedStaticPage(StaticPageType::ourFarms);
}
/**

View file

@ -29,7 +29,6 @@ data:
CRM_TOKEN: "${APP_CRM_TOKEN}"
CRM_PASSWORD: "${APP_CRM_PASSWORD}"
CRM_QUESTION_ID: "${APP_CRM_QUESTION_ID}"
CRM_BRAND_ID: "${APP_CRM_BRAND_ID}"
CRM_SUBJECTS: '${APP_CRM_SUBJECTS}'
MESBR_REF_SITE: "${APP_MESBR_REF_SITE}"
MESBR_REF_CAMP: "${APP_MESBR_REF_CAMP}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View file

@ -326,6 +326,8 @@ return [
'saturated_fatty_acids' => 'saturated fatty acids',
'dietary_fiber' => 'dietary fiber',
'salt' => 'salt',
]
],
'breeding_section_card' => 'Common breeding section',
'common_section_part' => 'common section'
],
];

View file

@ -345,6 +345,8 @@ return [
'dietary_fiber' => 'fibres alimentaires',
'salt' => 'sel',
],
'breeding_section_card' => 'section commune des élevages',
'common_section_part' => 'section commune',
'rules_accepted' => 'réglement du jeux'
],
];

View file

@ -399,7 +399,7 @@
&-reversed {
top: -3rem;
right: -2rem;
right: 2rem;
left: auto;
width: 6rem;
}
@ -410,7 +410,8 @@
height: 90px;
}
.rotate-right {
.rotate-right,
.rotate-left {
max-width: 30rem;
}

View file

@ -75,7 +75,7 @@ function updateToolbar(els: NotificationsElements): void {
// Mode select all
// Enable mode
// Enable mode
function enterSelectionMode(els: NotificationsElements): void {
els.list.classList.add("selection-mode");
els.toolbar.classList.remove("d-none");
@ -83,7 +83,7 @@ function enterSelectionMode(els: NotificationsElements): void {
els.btnToggle.classList.add("d-none");
}
// Disable mode
// Disable mode
function exitSelectionMode(els: NotificationsElements): void {
els.list.classList.remove("selection-mode");
els.toolbar.classList.add("d-none");
@ -100,7 +100,7 @@ function exitSelectionMode(els: NotificationsElements): void {
updateToolbar(els);
}
// call Ajax
// call Ajax
function fetchDelete(url: string, body: object | null = null): Promise<Response> {
return fetch(url, {
method: "DELETE",
@ -113,7 +113,7 @@ function fetchDelete(url: string, body: object | null = null): Promise<Response>
});
}
//delete one by one
//delete one by one
function deleteSingle(btn: HTMLButtonElement, els: NotificationsElements): void {
sweetalert.methods.confirm(
"Supprimer cette notification ?",
@ -164,8 +164,8 @@ function reloadAfterDelete(deletedCount: number = 1): void {
window.location.href = url.toString();
}
// init
document.addEventListener("DOMContentLoaded", function () {
// init
document.addEventListener("DOMContentLoaded", function () {
const els = resolveElements();
if (!els) return;
@ -215,4 +215,4 @@ document.addEventListener("DOMContentLoaded", function () {
box.setAttribute("aria-checked", String(checked));
updateToolbar(els);
});
});
});

View file

@ -821,7 +821,10 @@
</ul>
</div>
{{-- BREEDING --}}
@if(isset($breedingPoultryStaticPageModel))
@if(isset($breedingPoultryStaticPageModel) || isset($breedingJobStaticPageModel) ||
isset($breedingFoodStaticPageModel) || isset($breedingHealthStaticPageModel) ||
isset($ourFarmsStaticPageModel)
)
<div class="dropdown">
<button data-bs-toggle="dropdown" type="button" aria-expanded="false" @class([
'btn btn-primary text-start w-100 dropdown-toggle mt-1',
@ -842,9 +845,14 @@
route(
'bo.static_pages.edit',
$breedingHealthStaticPageModel->type->value()) ||
url()->current() ===
route(
'bo.static_pages.edit',
$ourFarmsStaticPageModel->type->value()) ||
// FIXME: uncomment when breeder map feature is ready
// || url()->current() === route('bo.general_settings.edit', \App\Enums\Settings\SettingsType::breederMap->value())
request()->routeIs('bo.news_breedings.*'),
request()->routeIs('bo.news_breedings.*') ||
request()->routeIs('bo.static_page.sections.*'),
])>
<i @class([
'fa-solid fa-tractor fa-fw',
@ -865,9 +873,14 @@
route(
'bo.static_pages.edit',
$breedingHealthStaticPageModel->type->value()) ||
url()->current() ===
route(
'bo.static_pages.edit',
$ourFarmsStaticPageModel->type->value()) ||
// FIXME: uncomment when breeder map feature is ready
// || url()->current() === route('bo.general_settings.edit', \App\Enums\Settings\SettingsType::breederMap->value())
request()->routeIs('bo.news_breedings.*'),
request()->routeIs('bo.news_breedings.*') ||
request()->routeIs('bo.static_page.sections.*'),
])></i>
{{ __('Elevages') }}
</button>
@ -927,6 +940,23 @@
{{ $breederMapSettingModel->type->label() }}
</a>
</li> --}}
<li>
<hr class="dropdown-divider">
</li>
<li>
<a data-bs-toggle="tooltip" href="{{ route('bo.static_page.sections.edit') }}"
title="{{ __('crud.helpers.update_model', ['model' => trans_choice('validation.custom.breeding_section_card', \INF)]) }}"
@class([
'dropdown-item px-3 py-2',
'fw-bold text-bg-secondary' => request()->routeIs('bo.static_page.sections*'),
])>
<i @class([
'fa-solid fa-tag fa-fw',
'fa-lg' => request()->routeIs('bo.breedings.*'),
])></i>
{{ str(trans_choice('validation.custom.breeding_section_card', \INF))->ucFirst() }}
</a>
</li>
</ul>
</div>
@endif

View file

@ -1,5 +1,8 @@
{{-- MINI CRUD EDIT WHEN JSON IS TRANSLATABLE --}}
@foreach ($data as $k => $input)
@if (!isset($input['inputType']))
@continue
@endif
@switch(intval($input['inputType']))
@case(intval(\App\Enums\InputType::string->value))
<div class="minicrud-input col-12 col-md-6 mb-3">

View file

@ -224,20 +224,17 @@
<legend>{{ str(trans_choice('validation.custom.static_page_id', 1))->ucfirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.tinyint-enum', [
@include('bo.partials.inputs.bigint-foreign-id', [
'id' => 'newsBreedingAssociatedPage',
'name' => 'static_page_id',
'model' => $newsBreedingModel ?? null,
'associatedModels' => $breedingPages,
'foreignLabel' => 'title',
'label' => sprintf(
'%s %s %s',
str(trans_choice('validation.custom.static_page_id', 1))->ucfirst(),
__('to'),
trans_choice('models.classes.news_breeding', 1)),
'name' => 'static_page_id',
'model' => $newsBreedingModel ?? null,
'required' => true,
'value' => $newsBreedingModel->static_page_id,
'associatedModels' => Arr::where(\App\Enums\StaticPageType::toArray(), function ($value, $key) {
return \in_array($key, Arr::pluck(\App\Enums\StaticPageType::getBreedingPages(), 'name'));
}),
'helper' => __('crud.minicrud.select_entity', [
'entity' => sprintf('une seule et unique %s', trans_choice('validation.custom.static_page_id', 1)),
]),

View file

@ -0,0 +1,35 @@
@extends('bo.layout', ['brParam' => (object) $commonSection])
@section('title', __('Édition section commune d\'une :model', ['model' => trans_choice('models.classes.static_page', 1)]))
@section('description', __('Édition de la séction commune dans les :model déjà existant', ['model' => trans_choice('models.classes.static_page', 2)]))
@section('breadcrumb', request()->route()->getName())
@section('content')
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
<div class="d-flex align-items-start flex-row">
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => (object) $commonSection])
</div>
<div class="mb-md-0 mb-2">
<div class="btn-group">
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.static_page', 1)]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
</div>
</div>
</div>
<form action="{{ route('bo.static_page.sections.update') }}" method="POST">
@csrf
@method('PATCH')
@include('bo.pages.static_pages.common_section.form')
@include('bo.partials.script-button-clone')
<div class="row">
<div class="col text-center">
<button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit"
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.news_breeding', 1)]) }}">
{{ str(__('crud.actions.save'))->ucfirst() }}
</button>
</div>
</div>
</form>
@endsection

View file

@ -0,0 +1,70 @@
<div class="row">
{{-- TITLE --}}
<div class="col-12 col-lg-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.attributes.title'))->ucFirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.varchar', [
'id' => 'newsBreedingTitle',
'label' => __(':field :inter:model', [
'field' => str(__('validation.custom.common_section_part'))->ucFirst(),
'inter' => __('validation.custom.of_the.plural'),
'model' => trans_choice('models.classes.static_page', 2),
]),
'hasWordCounter' => true,
'name' => 'title',
'required' => true,
'model' => null,
'value' => $commonSection['title'] ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.common_section_part'),
'inter' => __('validation.custom.of_the.plural'),
'model' => trans_choice('models.classes.static_page', 2),
]),
'min' => 3,
'max' => 255,
]),
'placeholder' => __(':field ', [
'field' => str(__('validation.attributes.title'))->ucFirst(),
]),
])
</div>
</div>
</fieldset>
</div>
{{-- CONTENT --}}
<div class="col-12 mb-3">
<fieldset class="border p-3">
<legend>{{ str(__('validation.attributes.content'))->ucfirst() }}</legend>
<div class="row mb-3">
<div class="col-12">
@include('bo.partials.inputs.text-html', [
'id' => 'newsBreedingContent',
'label' => str(
__(':field :inter:model', [
'field' => __('validation.custom.common_section_part'),
'inter' => __('validation.custom.of_the.plural'),
'model' => trans_choice('models.classes.static_page', 2),
]))->ucfirst(),
'name' => 'content',
'model' => $StaticPageBreeding ?? null,
'required' => true,
'value' => $commonSection['content'] ?? null,
'helper' => sprintf(
'%s %s',
__('crud.minicrud.text_warning'),
__('validation.min.string', [
'attribute' => __(':field', [
'field' => __('validation.attributes.content')
]),
'min' => 15,
])),
])
</div>
</div>
</fieldset>
</div>
</div>

View file

@ -119,6 +119,7 @@
!$staticPageModel->type->equals(StaticPageType::confidentiality) &&
!$staticPageModel->type->equals(StaticPageType::accessibility) &&
!$staticPageModel->type->equals(StaticPageType::selling) &&
!$staticPageModel->type->equals(StaticPageType::ourFarms) &&
!$staticPageModel->type->equals(StaticPageType::exitOutside) &&
!$staticPageModel->type->equals(StaticPageType::ouiCBon))
{{-- SUBTITLE --}}

View file

@ -1,4 +1,4 @@
@props(['title' => '', 'subtitle' => '', 'image' => ''])
@props(['title' => '', 'subtitle' => '', 'image' => '', 'title_img' => '', 'alt_img' => ''])
@php
$translatedTitle = __($title);
@ -31,9 +31,14 @@
<div class="d-none d-xl-block col-6 col-xxl-4">
<div class="header-image-wrapper breeding-header-translate-right">
<img class="img-fluid" src="{{ asset($image) }}"
title="{{ __('titre de l\'image') }}" alt="{{ __('alt de l\'image') }}">
title="{{ $title_img }}" alt="{{ $alt_img }}">
</div>
</div>
<div class="col-12 col-md-8 position-relative z-1 mx-auto mt-4">
<div class="d-xl-none header-image-wrapper">
<img class="img-fluid" src="{{ asset($image) }}"
title="{{ $title_img }}" alt="{{ $alt_img }}">
</div>
</div>
</div>
</section>

View file

@ -1,41 +1,41 @@
@php
$cards = [
[
'logo' => [
'path' => Vite::asset('resources/assets/images/breeding/oui-c-est-bon/logo-oui-c-est-bon.png'),
'title' => __('Oui c’est bon'),
'alt' => __('Oui c’est bon'),
],
'picture' => [
'path' => Vite::asset('resources/assets/images/breeding/oui-c-est-bon/poulet.jpg'),
'title' => __('Bien au chaud avec de la paille fraiche'),
'alt' => __('Une poule'),
],
'title' => __('La démarche oui c’est bon !'),
'content' => nl2br(__('Notre démarche Le Gaulois "Oui c’est Bon" respecte un cahier des charges d’élevage spécifique pour garantir des produits de qualité à un prix accessible tout en visant à améliorer le bien-être animal, à préserver la santé des volailles et à respecter l’environnement.')),
'href' => route('fo.breeding.oui-c-est-bon'),
],
[
'logo' => [
'path' => Vite::asset('resources/assets/images/breeding/sortant-a-l-exterieur/logo-sortant-a-l-exterieur.png'),
'title' => __('Sortant a l’exterieur'),
'alt' => __('Logo de la demarche sortant a l’exterieur, une poule sur de l’herbe'),
],
'picture' => [
'path' => Vite::asset('resources/assets/images/breeding/sortant-a-l-exterieur/sortant_exterieur.jpg'),
'title' => __('Les poules adorent sortir dehors !'),
'alt' => __('Une eleveur tennant une poule'),
],
'title' => __('La démarche sortant à l’extérieur !'),
'content' => nl2br(__('Notre démarche inédite Le Gaulois "Sortant à l’extérieur" s’engage à ce que les volailles sortent à l’extérieur, tous les jours, dans les prés de France, pour favoriser le bien-être des volailles.')),
'href' => route('fo.breeding.sortant-a-l-exterieur'),
],
];
@endphp
$cards = [];
$href = '';
$i = 1;
while (isset($staticPageModel->data["card_title_{$i}"])) {
$label = strtolower($staticPageModel->data["card_title_{$i}"]['label']);
$typeLabelOuiCbon = strtolower(\App\Enums\StaticPageType::ouiCBon->label());
$typeLabelExitOutside = strtolower(\App\Enums\StaticPageType::exitOutside->label());
if (str_contains($label, $typeLabelOuiCbon)) {
$href = route('fo.breeding.oui-c-est-bon');
} if (str_contains($label, $typeLabelExitOutside)) {
$href = route('fo.breeding.sortant-a-l-exterieur');
}
$cards[] = [
'logo' => [
'path' => $staticPageModel->data["card_logo_{$i}"]['value'],
'title' => $staticPageModel->data["card_logo_{$i}"]['title'],
'alt' => $staticPageModel->data["card_logo_{$i}"]['alt'],
],
'picture' => [
'path' => $staticPageModel->data["card_image_{$i}"]['value'],
'title' => $staticPageModel->data["card_image_{$i}"]['title'],
'alt' => $staticPageModel->data["card_image_{$i}"]['alt'],
],
'title' => $staticPageModel->data["card_title_{$i}"]['value'],
'content' => $staticPageModel->data["card_description_{$i}"]['value'],
'href' => $href
];
$i++;
}
@endphp
@props(['staticPageModel'])
<div class="container-fluid position-relative z-1 container mb-5 pt-5">
<div class="bg-light position-relative line-border-small w-100 w-lg-50 mx-auto p-3">
<h2 class="w-75 fs-1 mx-auto text-center">{{ __('LES DEMARCHES D’ELEVAGE LE GAULOIS') }}</h2>
<h2 class="w-75 fs-1 mx-auto text-center">{{ $staticPageModel->data['title']['value'] }}</h2>
<p class="text-center"></p>
</div>
<div class="row gx-5">

View file

@ -1,29 +1,23 @@
@extends('fo.layout')
@section('title', str('Les élevages')->upper())
@section('description', str('Les élevages')->ucFirst())
@section('title', Str::upper($staticPageModel->seo_title))
@section('description', Str::ucfirst($staticPageModel->seo_description))
@section('bg-offset', true)
@section('content')
<x-fo.breeding.section.header-section title="{{ __('NOS ELEVAGES') }}"
subtitle="{{ __('L’amélioration du bien-être animal est au coeur de nos élevages et des éleveurs partenaires Le Gaulois. C’est pourquoi, nous avons mis en place des cahiers des charges spécifiques sur les aménagements des poulaillers, l’alimentation et la santé des volailles.') }}" />
<x-fo.breeding.section.header-section title="{{ $staticPageModel->title }}"
subtitle="{{ strip_tags($staticPageModel->content) }}" :image="$staticPageModel->picture"
alt_img="{{ $staticPageModel->picture_alt }}" title_img="{{ $staticPageModel->picture_title }}"
/>
<section class="position-relative line-border-large py-4" id="les-elevages">
<div class="position-absolute h-100 w-100 top-0 z-0">
<div class="bg-green-wood h-100 w-100"></div>
</div>
<x-fo.breeding.section.les-elevages.les-demarches-chez-le-gaulois />
<x-fo.breeding.section.les-elevages.les-demarches-chez-le-gaulois :staticPageModel="$staticPageModel" />
@include('fo.partials.breeding.farming-poultry-other', [
'commitmentId' => 4,
'title' => 'L’élevage des volailles',
'text' => nl2br(
__('Face aux préoccupations des consommateurs sur le bien-être animal, Le Gaulois vous dit tout sur ses :strongStartéleveurs partenaires:strongEnd et ses :strongStartconditions d’élevages de volailles.:strongEnd :br Chaque jour, nous collaborons avec les éleveurs partenaires engagés dans la :strongStartdémarche éthique et responsable:strongEnd pour améliorer le confort de nos volailles. Chez les éleveurs partenaires Le Gaulois, la :strongStartprotection animale:strongEnd ne cesse d’être l’enjeu majeur.',
[
'strongStart' => '<strong>',
'strongEnd' => '</strong>',
'br' => '<br>',
]
)
),
'title' => $staticPageModel->data['common_section']['title'],
'text' => $staticPageModel->data['common_section']['content'] ,
])
</section>
@endsection

View file

@ -5,12 +5,14 @@
@section('bg-offset', true)
@section('content')
<x-fo.breeding.section.header-section title="{{ __($staticPageModel->title) }}" :image="$staticPageModel->picture" />
<x-fo.breeding.section.header-section title="{{ __($staticPageModel->title) }}" :image="$staticPageModel->picture"
alt_img="{{ $staticPageModel->picture_alt }}" title_img="{{ $staticPageModel->picture_title }}" />
<section class="position-relative line-border-large" id="oui-c-est-bon">
<div class="position-absolute h-100 w-100 top-0 z-0">
<div class="bg-green-wood h-100 w-100" id="demarche-bg"></div>
</div>
<x-fo.breeding.section.oui-c-est-bon.cahier-des-charges-section :staticPageModel="$staticPageModel" :onglets="$categoryApproachModels" :sections="$sectionApproachModels"/>
<x-fo.breeding.section.oui-c-est-bon.cahier-des-charges-section :staticPageModel="$staticPageModel" :onglets="$categoryApproachModels"
:sections="$sectionApproachModels" />
<x-fo.breeding.section.oui-c-est-bon.search-breeders-section :ocbBreederModels="$ocbBreederModels" />
<x-fo.breeding.section.oui-c-est-bon.our-breeder-section />
</section>

View file

@ -27,16 +27,8 @@
@endforeach
@include('fo.partials.breeding.farming-poultry-other', [
'commitmentId' => 4,
'title' => 'L\'élevage des volailles',
'text' => nl2br(
__('Face aux préoccupations des consommateurs sur le bien-être animal, Le Gaulois vous dit tout sur ses :strongStartéleveurs partenaires:strongEnd et ses :strongStartconditions d\'élevages de volailles.:strongEnd :br Chaque jour, nous collaborons avec les éleveurs partenaires engagés dans la :strongStartdémarche éthique et responsable:strongEnd pour améliorer le confort de nos volailles. Chez les éleveurs partenaires Le Gaulois, la :strongStartprotection animale:strongEnd ne cesse d\'être l\'enjeu majeur.',
[
'strongStart' => '<strong>',
'strongEnd' => '</strong>',
'br' => '<br>',
]
)
),
'title' => $staticPageModel->data['common_section']['title'],
'text' => $staticPageModel->data['common_section']['content'],
])
</section>
@endsection

View file

@ -4,9 +4,11 @@
@section('bg-offset', true)
@section('content')
<x-fo.breeding.section.header-section title="{{ __($staticPageModel->title) }}" :image="$staticPageModel->picture"/>
<x-fo.breeding.section.header-section title="{{ __($staticPageModel->title) }}" :image="$staticPageModel->picture"
alt_img="{{ $staticPageModel->picture_alt }}" title_img="{{ $staticPageModel->picture_title }}" />
<section id="sortant-a-l-exterieur">
<x-fo.breeding.section.sortant-a-l-exterieur.cahier-des-charges-section :staticPageModel="$staticPageModel" :onglets="$categoryApproachModels" :sections="$sectionApproachModels" />
<x-fo.breeding.section.sortant-a-l-exterieur.cahier-des-charges-section :staticPageModel="$staticPageModel" :onglets="$categoryApproachModels"
:sections="$sectionApproachModels" />
<x-fo.breeding.section.sortant-a-l-exterieur.galery-section :sliderImages="$sliderImages" />
</section>
{{-- <section class="pb-3 pt-5" id="breeder-map-section">
@ -15,4 +17,3 @@
</div>
</section> --}}
@endsection

View file

@ -256,7 +256,7 @@
'btn_color' => 'secondary',
'picture' => Vite::asset('resources/assets/images/commitments/common/poultries-1.jpg'),
'picture_alt' => __('Volailles dans le poulailler en train de marcher'),
'picture_title' => __(' Volailles en bonne santé marchant le poulailler librement'),
'picture_title' => __('Volailles en bonne santé marchant le poulailler librement'),
])
{{-- COMPLEX FLEX ITEMS --}}
@php

View file

@ -2,7 +2,7 @@
<div class="container">
<div class="row">
<div @class([
'col-12 col-md-5',
'col-12 col-md-6',
isset($picto) && !empty($picto) ? 'px-5 pt-5' : 'p-5',
])>
<div class="position-relative pt-md-0 mx-auto my-5">
@ -10,7 +10,7 @@
<img class="img-fluid position-absolute pictogram-reversed z-1" src="{{ $picto }}" title="{{ $picto_title }}"
alt="{{ $picto_alt }}">
@endif
<div class="d-flex justify-content-end align-items-start bottom-left-shadow">
<div class="d-flex justify-content-start align-items-start bottom-left-shadow">
<div class="line-border-small rotate-right w-100 m-lg-0 mx-auto h-fit bg-white p-2">
<img class="img-fluid line-border-small w-100" src="{{ $picture }}" title="{{ $picture_title }}"
alt="{{ $picture_alt }}">
@ -33,7 +33,7 @@
<h2>{{ $title }}</h2>
<p class="m-0">{!! $text !!}</p>
</div>
<div class="col-12 col-md-7 d-flex justify-content-center align-items-center">
<div class="col-12 col-md-6 d-flex justify-content-center align-items-center">
<div class="row d-flex justify-content-center align-items-start">
@foreach ($collection as $item)
<div class="col-6 col-md-4 d-flex justify-content-center align-items-center flex-column p-3 text-center">

View file

@ -7,7 +7,7 @@
</div>
<div class="col-12 col-md-5">
<div class="bottom-left-shadow mb-3">
<div class="line-border-small bg-white p-2">
<div class="line-border-small bg-white w-fit p-2">
<img class="line-border-small img-fluid" src="{{ Vite::asset($picture) }}" title="{{ $picture_title }}"
alt="{{ $picture_alt }}">
</div>

View file

@ -155,6 +155,9 @@ Breadcrumbs::for('bo.activity_logs.show', function (Generator $trail, ActivityLo
Breadcrumbs::for('bo.static_pages.edit', function (Generator $trail, StaticPage $static_page) {
$trail->push(sprintf('Page %s', Str::ucfirst($static_page->title)));
});
Breadcrumbs::for('bo.static_page.sections.edit', function (Generator $trail) {
$trail->push(sprintf('Section commune des élevages'));
});
// * BRAND_ADVANTAGES
Breadcrumbs::for('bo.brand_advantages.index', function (Generator $trail) {

View file

@ -92,6 +92,10 @@ Route::middleware(['throttle:web', 'admin-secure'])->prefix('bo')->name('bo.')->
->only(['edit', 'update'])
->withoutMiddleware('htmlsanitize')
->middleware('htmlsanitize:content,data');
Route::get('/pages/common_section', [StaticPageController::class, 'getCommonSection'])->name('static_page.sections.edit');
Route::patch('/pages/common_section/update', [StaticPageController::class, 'updateCommonSection'])
->name('static_page.sections.update')
->withoutMiddleware('htmlsanitize');
// * MENU NODE DATA
Route::resource('menu_node_data', MenuNodeDataController::class)

View file

@ -136,7 +136,7 @@ Route::middleware(['throttle:web'])->name('fo.')->group(function () {
Route::prefix('les-elevages')
->name('breeding.')
->group(function () {
Route::view('/', 'fo.pages.breeding.index')->name('index');
Route::get('/', [BreedingController::class, 'ourFarmsPage'])->name('index');
Route::get('/oui-c-est-bon', [BreedingController::class, 'ocbBreederPage'])->name('oui-c-est-bon');
Route::get('/sortant-a-l-exterieur', [BreedingController::class, 'exitOutsidePage'])
->name('sortant-a-l-exterieur');