Merge branch 'develop' into trunk

This commit is contained in:
K Muller 2026-06-01 11:19:59 +02:00
commit 3948787e3d
14 changed files with 261 additions and 101 deletions

View file

@ -0,0 +1,31 @@
<?php
namespace App\Enums;
use App\Traits\Enums\BaseEnum;
enum StickiesColorEnum: int
{
use BaseEnum;
case primary = 1;
case secondary = 2;
case tertiary = 3;
case quad = 4;
case quint = 5;
case sixt = 6;
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::primary->name => 'Primary',
self::secondary->name => 'Secondary',
self::tertiary->name => 'Tertiary',
self::quad->name => 'Quad',
self::quint->name => 'Quint',
self::sixt->name => 'Sixt',
];
}

View file

@ -6,6 +6,7 @@ use App\Enums\Listen\ObjectEnum;
use App\Enums\Sections\PageSectionEnum;
use App\Enums\Slides\SliderTypeEnum;
use App\Enums\StaticPageType;
use App\Enums\StickiesColorEnum;
use App\Enums\Testimonials\TypeEnum;
use App\Http\Controllers\Controller;
use App\Http\Requests\Fo\ListenFormRequest;
@ -150,6 +151,8 @@ class StaticPageController extends Controller
$feedSection = $sectionModels->where('section', PageSectionEnum::commit_feed)->first();
$testimonialsSection = $sectionModels->where('section', PageSectionEnum::commit_commitments)->first();
$navLinks = Sticky::query()->where('type', StaticPageType::we_commit)->get();
return view('fo.pages.commitments', compact(
'staticPageModel',
'sectionModels',
@ -162,6 +165,7 @@ class StaticPageController extends Controller
'earthSection',
'feedSection',
'testimonialsSection',
'navLinks',
));
}
@ -326,12 +330,22 @@ class StaticPageController extends Controller
];
$initialZoom = 10;
// Create datas similar to Sticky model.
$navLinks = collect([
(object) [
'title' => $site->sticky_title,
'anchor' => $site->sticky_link,
'color' => StickiesColorEnum::quad,
],
]);
return view('fo.pages.site', [
'siteModelList' => $siteModelList,
'siteModel' => $site,
'nextSiteModel' => $nextSiteModel,
'viewBox' => $viewBox,
'initialZoom' => $initialZoom,
'navLinks' => $navLinks,
]);
}
}

View file

@ -3,6 +3,7 @@
namespace App\Http\Requests\Bo\Stickies;
use App\Enums\StaticPageType;
use App\Enums\StickiesColorEnum;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Enum;
@ -37,6 +38,10 @@ class StoreStickyRequest extends FormRequest
'string',
'between:3,255'
],
'color' => [
Rule::requiredIf($this->user()->can('create', $this->sticky)),
new Enum(StickiesColorEnum::class)
],
];
}
@ -51,6 +56,7 @@ class StoreStickyRequest extends FormRequest
'type' => trans('validation.custom.type'),
'title' => trans('validation.attributes.title'),
'anchor' => trans('validation.custom.anchor'),
'color' => trans('validation.custom.color'),
];
}
}

View file

@ -3,6 +3,7 @@
namespace App\Models;
use App\Enums\StaticPageType;
use App\Enums\StickiesColorEnum;
use App\Enums\Users\RoleEnum;
use App\Traits\Models\ActivityLog;
use Illuminate\Auth\Access\AuthorizationException;
@ -13,6 +14,7 @@ use Illuminate\Database\Eloquent\Model;
* @property \App\Enums\StaticPageType $type Page type (StaticPageEnum).
* @property string $title Title for the sticky.
* @property string $anchor Anchor for the sticky.
* @property \App\Enums\StickiesColorEnum $color Color of the button (StickiesColorEnum).
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
*
@ -31,6 +33,7 @@ class Sticky extends Model
'type',
'title',
'anchor',
'color',
];
/**
@ -40,6 +43,7 @@ class Sticky extends Model
*/
protected $casts = [
'type' => StaticPageType::class,
'color' => StickiesColorEnum::class,
];
/**

View file

@ -0,0 +1,35 @@
<?php
use Database\Seeders\Mandatory\StickySeeder;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('stickies', function (Blueprint $table) {
$table->unsignedSmallInteger('color')->comment('Color of the button (StickyColorEnum) based on bootstrap colots')->after('anchor');
});
// Update existing stickies + Add commitments stickies (actually hard-written).
Artisan::call('db:seed', [
'class' => StickySeeder::class
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('stickies', function (Blueprint $table) {
$table->removeColumn('color');
});
}
};

View file

@ -3,6 +3,7 @@
namespace Database\Seeders\Mandatory;
use App\Enums\StaticPageType;
use App\Enums\StickiesColorEnum;
use App\Models\Sticky;
use Illuminate\Database\Seeder;
@ -14,73 +15,171 @@ class StickySeeder extends Seeder
public function run(): void
{
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_hire,
'anchor' => 'company-life',
],
[
'type' => StaticPageType::we_hire,
'title' => 'La vie d\'entreprise',
'anchor' => 'company-life'
'anchor' => 'company-life',
'color' => StickiesColorEnum::primary,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_hire,
'anchor' => 'formation',
],
[
'type' => StaticPageType::we_hire,
'title' => 'L\'alternance et la formation',
'anchor' => 'formation'
'anchor' => 'formation',
'color' => StickiesColorEnum::secondary,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_hire,
'anchor' => 'we-testimonials',
],
[
'type' => StaticPageType::we_hire,
'title' => 'Nos collaborateurs témoignent',
'anchor' => 'we-testimonials'
'anchor' => 'we-testimonials',
'color' => StickiesColorEnum::quad,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_hire,
'anchor' => 'parity',
],
[
'type' => StaticPageType::we_hire,
'title' => 'La parité',
'anchor' => 'parity'
'anchor' => 'parity',
'color' => StickiesColorEnum::quint,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_hire,
'anchor' => 'on-se-retrouve',
],
[
'type' => StaticPageType::we_hire,
'title' => 'En savoir plus',
'anchor' => 'on-se-retrouve'
'anchor' => 'on-se-retrouve',
'color' => StickiesColorEnum::sixt,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::unveil,
'anchor' => 'key-numbers',
],
[
'type' => StaticPageType::unveil,
'title' => 'VOLENA',
'anchor' => 'key-numbers'
'anchor' => 'key-numbers',
'color' => StickiesColorEnum::primary,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::unveil,
'anchor' => 'missions',
],
[
'type' => StaticPageType::unveil,
'title' => 'Notre mission',
'anchor' => 'missions'
'anchor' => 'missions',
'color' => StickiesColorEnum::secondary,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::unveil,
'anchor' => 'local',
],
[
'type' => StaticPageType::unveil,
'title' => 'Filière 100% française',
'anchor' => 'local'
'anchor' => 'local',
'color' => StickiesColorEnum::quad,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::unveil,
'anchor' => 'sites',
],
[
'type' => StaticPageType::unveil,
'title' => 'Nos sites',
'anchor' => 'sites'
'anchor' => 'sites',
'color' => StickiesColorEnum::quint,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::unveil,
'anchor' => 'history',
],
[
'type' => StaticPageType::unveil,
'title' => 'Notre histoire',
'anchor' => 'history'
'anchor' => 'history',
'color' => StickiesColorEnum::sixt,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_commit,
'anchor' => 'breeding',
],
[
'type' => StaticPageType::we_commit,
'title' => 'Élever durablement',
'anchor' => 'breeding',
'color' => StickiesColorEnum::tertiary,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_commit,
'anchor' => 'life',
],
[
'type' => StaticPageType::we_commit,
'title' => 'Mieux vivre',
'anchor' => 'life',
'color' => StickiesColorEnum::quad,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_commit,
'anchor' => 'earth',
],
[
'type' => StaticPageType::we_commit,
'title' => 'Respecter la terre',
'anchor' => 'earth',
'color' => StickiesColorEnum::quint,
],
);
Sticky::query()->updateOrCreate(
[
'type' => StaticPageType::we_commit,
'anchor' => 'feed',
],
[
'type' => StaticPageType::we_commit,
'title' => 'Bien nourrir',
'anchor' => 'feed',
'color' => StickiesColorEnum::sixt,
],
);
}

View file

@ -305,5 +305,6 @@ return [
'media' => 'média',
'anchor' => 'ancre',
'link' => 'lien',
'color' => 'couleur',
],
];

View file

@ -32,21 +32,21 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
// * Commit Buttons
// * Stickies on mobile.
document.addEventListener("DOMContentLoaded", function () {
const commitDiv = document.getElementById("commit-blocks") as HTMLDivElement;
if (commitDiv) {
commitDiv.style.display = "none";
const stickyDiv = document.getElementById("sticky-blocks") as HTMLDivElement;
if (stickyDiv) {
stickyDiv.style.display = "none";
document.onscroll = function () {
const introCommitDiv = document.getElementById("introduction") as HTMLDivElement;
const stickyDisplayerDiv = document.getElementById("sticky-displayer") as HTMLDivElement;
if (introCommitDiv) {
if (stickyDisplayerDiv) {
const scrollTop = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
if (scrollTop < introCommitDiv.offsetTop - 100) {
commitDiv.style.display = "none";
if (scrollTop < stickyDisplayerDiv.offsetTop - 100) {
stickyDiv.style.display = "none";
} else {
commitDiv.style.display = "block";
stickyDiv.style.display = "block";
}
}
};

View file

@ -86,6 +86,27 @@
</fieldset>
</div>
@endcan
{{-- TYPE --}}
@can('create', \App\Models\Sticky::class)
<div class="col-12 col-md-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ Str::ucfirst(__('validation.custom.color')) }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.tinyint-enum', [
'id' => 'stickyColor',
'label' => __('Associer une couleur'),
'name' => 'color',
'model' => $stickyModel ?? null,
'required' => true,
'associatedModels' => \App\Enums\StickiesColorEnum::toArray(),
'helper' => __('Sélectionnez une couleur dans la liste déroulante.'),
])
</div>
</div>
</fieldset>
</div>
@endcan
<div class="col-12 text-center">
<p><b>{{ __('validation.custom.required_fields') }}</b></p>
</div>

View file

@ -7,27 +7,21 @@
@include('fo.layouts.search')
</div> --}}
</div>
@if (request()->routeIs('fo.commit.show'))
<div class="col-12 d-md-none pointer-events pb-2" id="commit-blocks">
<div class="commit-navigation z-2">
<div class="commit-navigation-wrapper row m-0 p-0">
{{-- blade-formatter-disable --}}
@php
$commitNav = [
['label' => __('Élever durablement'), 'link' => '#breeding', 'color' => 'tertiary'],
['label' => __('Mieux vivre'), 'link' => '#life', 'color' => 'quad'],
['label' => __('Respecter la terre'), 'link' => '#earth', 'color' => 'quint'],
['label' => __('Bien nourrir'), 'link' => '#feed', 'color' => 'sixt']];
@endphp
{{-- blade-formatter-enable --}}
@foreach ($commitNav as $key => $value)
@if (isset($navLinks))
<div class="col-12 d-md-none pointer-events pb-2" id="sticky-blocks">
<div class="sticky-navigation z-2">
<div class="sticky-navigation-wrapper row m-0 p-0">
@foreach ($navLinks as $link)
<div class="col-6 col-md-12 px-md-0 py-md-1 p-2">
<div class="rounded-5 bg-{{ $value['color'] }}-light shadow-sm">
<a class="d-flex justify-content-center align-items-center text-primary text-decoration-none p-sm-3 p-2"
data-bs-toggle="tooltip" href="{{ $value['link'] }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $value['label']]) }}">
<span class="badge rounded-pill bg-{{ $value['color'] }} d-block me-2"></span>
<small>{{ $value['label'] }}</small>
<div class="rounded-5 shadow-sm h-100 bg-{{ $link->color->name }}-light">
@php
$hrefLink = !request()->routeIs('fo.site.show') ? str($link->anchor)->start('#') : $link->anchor
@endphp
<a class="d-flex justify-content-center align-items-center text-primary text-decoration-none p-sm-3 p-2 text-center h-100"
data-bs-toggle="tooltip" href="{{ $hrefLink }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $link->title]) }}">
<small>{{ $link->title }}</small>
</a>
</div>
</div>

View file

@ -19,23 +19,14 @@
<section class="commit">
<div class="sticky-navigation">
<div class="sticky-navigation-wrapper show row m-0 p-0">
{{-- blade-formatter-disable --}}
@php
$commitNav = [
['label' => __('Élever durablement'), 'link' => '#breeding', 'color' => 'tertiary'],
['label' => __('Mieux vivre'), 'link' => '#life', 'color' => 'quad'],
['label' => __('Respecter la terre'), 'link' => '#earth', 'color' => 'quint'],
['label' => __('Bien nourrir'), 'link' => '#feed', 'color' => 'sixt']];
@endphp
{{-- blade-formatter-enable --}}
@foreach ($commitNav as $key => $value)
@foreach ($navLinks as $link)
<div class="col-6 col-md-12 py-md-1 p-2">
<div class="rounded-5 bg-{{ $value['color'] }}-light shadow-sm">
<div class="rounded-5 bg-{{ $link->color->name }}-light shadow-sm">
<a class="d-flex justify-content-center align-items-center text-primary text-decoration-none p-sm-3 p-2"
data-bs-toggle="tooltip" href="{{ $value['link'] }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $value['label']]) }}">
<span class="badge rounded-pill bg-{{ $value['color'] }} d-block me-2"></span>
<small>{{ $value['label'] }}</small>
data-bs-toggle="tooltip" href="#{{ $link->anchor }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $link->title]) }}">
<span class="badge rounded-pill bg-{{ $link->color->name }} d-block me-2"></span>
<small>{{ $link->title }}</small>
</a>
</div>
</div>
@ -49,6 +40,7 @@
</div>
{{-- AMBITION --}}
<section class="ambition anchor-padding container my-4" id="introduction">
<span id="sticky-displayer"></span>
<div class="row mt-3">
<div class="col-12">
<h2 class="h2 fw-bold text-primary text-center">{{ $ambitionSection->h2_title }}</h2>

View file

@ -19,33 +19,13 @@
<section class="we-hire">
<div class="sticky-navigation">
<div class="sticky-navigation-wrapper show row m-0 p-0">
@foreach ($navLinks as $key => $link)
@foreach ($navLinks as $link)
<div class="col-6 col-md-12 py-md-1 p-2">
<div @class([
'rounded-5 shadow-sm h-100',
match($loop->index) {
0 => 'bg-primary-light',
1 => 'bg-secondary-light',
2 => 'bg-quad-light',
3 => 'bg-quint-light',
4 => 'bg-sixt-light',
default => 'bg-primary-light'
}
])>
<div class="rounded-5 shadow-sm h-100 bg-{{ $link->color->name }}-light">
<a class="d-flex justify-content-start align-items-center text-primary text-decoration-none p-sm-3 p-2 h-100"
data-bs-toggle="tooltip" href="#{{ $link->anchor }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $link->title]) }}">
<span @class([
'badge rounded-pill d-block me-2',
match($loop->index) {
0 => 'bg-primary',
1 => 'bg-secondary',
2 => 'bg-quad',
3 => 'bg-quint',
4 => 'bg-sixt',
default => 'bg-primary'
}
])></span>
<span class="badge rounded-pill d-block me-2 bg-{{ $link->color->name }}"></span>
<small>{{ $link->title }}</small>
</a>
</div>
@ -60,6 +40,7 @@
</div>
{{-- COMPAGNY LIFE --}}
<section class="company-life anchor-padding" id="company-life">
<span id="sticky-displayer"></span>
<div class="container">
<div class="row position-relative">
<div class="col-12 text-center">

View file

@ -8,7 +8,7 @@
<section class="site">
@if ($siteModel->sticky_title && $siteModel->sticky_link)
<div class="site-navigation z-2">
<div class="site-navigation-wrapper show row m-0 p-0">
<div class="site-navigation-wrapper show row m-0 p-0 justify-content-center">
<div class="col-6 col-md-12 px-md-0 py-md-1 p-2">
<div class="rounded-5 bg-quad-light shadow-sm">
<a class="d-flex justify-content-center align-items-center text-primary text-decoration-none p-sm-3 p-2"
@ -41,6 +41,7 @@
title="{{ __('Retour à la page d\'accueil') }}" alt="{{ __('Flèche vers la gauche') }}">
{{ __('Retour') }}
</a>
<span id="sticky-displayer"></span>
@if ($nextSiteModel)
<a href="{{ route('fo.sites.show', $nextSiteModel) }}"
title="{{ __('Voir le site suivant : :name', ['name' => $nextSiteModel->name]) }}">

View file

@ -19,33 +19,13 @@
<section class="unveil">
<div class="sticky-navigation">
<div class="sticky-navigation-wrapper show row m-0 p-0">
@foreach ($navLinks as $key => $link)
@foreach ($navLinks as $link)
<div class="col-6 col-md-12 py-md-1 p-2">
<div @class([
'rounded-5 shadow-sm h-100',
match($loop->index) {
0 => 'bg-primary-light',
1 => 'bg-secondary-light',
2 => 'bg-quad-light',
3 => 'bg-quint-light',
4 => 'bg-sixt-light',
default => 'bg-primary-light'
}
])>
<div class="rounded-5 shadow-sm h-100 bg-{{ $link->color->name }}-light">
<a class="d-flex justify-content-start align-items-center text-primary text-decoration-none p-sm-3 p-2 h-100"
data-bs-toggle="tooltip" href="#{{ $link->anchor }}"
title="{{ __('Accéder à la partie :name de la page', ['name' => $link->title]) }}">
<span @class([
'badge rounded-pill d-block me-2',
match($loop->index) {
0 => 'bg-primary',
1 => 'bg-secondary',
2 => 'bg-quad',
3 => 'bg-quint',
4 => 'bg-sixt',
default => 'bg-primary'
}
])></span>
<span class="badge rounded-pill d-block me-2 bg-{{ $link->color->name }}"></span>
<small>{{ $link->title }}</small>
</a>
</div>
@ -60,6 +40,7 @@
</div>
{{-- KEY NUMBERS --}}
<section class="key-numbers anchor-padding my-5" id="key-numbers">
<span id="sticky-displayer"></span>
<div class="container">
<div class="row">
<div class="col-12">