Merge branch 'le-gaulois-2024' into develop

This commit is contained in:
Noah Lancien 2024-09-27 11:10:30 +02:00
commit 984f0bcf94
51 changed files with 515 additions and 171 deletions

View file

@ -0,0 +1,23 @@
<?php
namespace App\Enums;
use App\Traits\Enums\BaseEnum;
enum HistoricalMilestonePosition: string
{
use BaseEnum;
case hg = "hg";
case hd = "hd";
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::hg->name => 'Haut gauche',
self::hd->name => "Haut droit",
];
}

View file

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\HistoricalMilestones\StoreHistoricalMilestoneRequest;
use App\Http\Requests\Bo\HistoricalMilestones\UpdateHistoricalMilestoneRequest;
use App\Models\HistoricalMilestone;
use App\Traits\Controllers\ChangesModelOrder;
use App\Traits\Controllers\UpdateModelPublished;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@ -13,6 +14,7 @@ use Illuminate\Support\Str;
class HistoricalMilestoneController extends Controller
{
use ChangesModelOrder;
use UpdateModelPublished;
/**

View file

@ -11,7 +11,6 @@ use App\Models\Recipe;
use App\Models\StaticPage;
use App\Models\Submeat;
use App\Models\Subrange;
use App\Models\Video;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;

View file

@ -48,7 +48,7 @@ class RecipeController extends Controller
$consumptionMomentModels = ConsumptionMoment::getOrderedBySlug();
$meatModels = Meat::getPublishedOrderedWithSubmeats();
$submeatModels = $submeatModelsFiltered ??
Submeat::publishedSubmeatsOrderedByOrder();
Submeat::getPublishedOrdered();
return view('fo.pages.recipes.index', [
'viewsPaginate' => $this->getViewsFromPaginateModels($recipeModels),

View file

@ -88,15 +88,15 @@ class StaticPageController extends Controller
*/
public function recruitment(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
$detect = new MobileDetect();
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recruitment);
$offerModels = Cache::rememberForever(
$detect = new MobileDetect();
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recruitment);
$offerModels = Cache::rememberForever(
config('services.digital_recruiter.url'),
fn() => Offer::query()->where('published', true)->orderBy('publish_at', 'DESC')->take(6)->get()
);
$professionModels = Profession::get5Published();
$brandAdvantageModels = BrandAdvantage::getPublishedOrdered();
$newsCorporateModels = NewsCorporate::get9PublishedOrderedByUpdatedAt();
$professionModels = Profession::get5Published();
$brandAdvantageModels = BrandAdvantage::getPublishedOrdered();
$newsCorporateModels = NewsCorporate::get9PublishedOrderedByUpdatedAt();
if ($detect->isMobile()) {
$newsCorporateModels = $newsCorporateModels->take(3);
}
@ -127,7 +127,7 @@ class StaticPageController extends Controller
{
$staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::story);
$keyNumberModels = KeyNumber::get5PublishedOrdered();
$historicalMilestoneModels = HistoricalMilestone::getPublishedOrderedByYear();
$historicalMilestoneModels = HistoricalMilestone::getPublishedOrdered();
return view('fo.pages.story', compact('staticPageModel', 'keyNumberModels', 'historicalMilestoneModels'));
}

View file

@ -2,11 +2,13 @@
namespace App\Http\Requests\Bo\HistoricalMilestones;
use App\Enums\HistoricalMilestonePosition;
use App\Models\HistoricalMilestone;
use App\Rules\WysiwygLength;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
class StoreHistoricalMilestoneRequest extends FormRequest
{
@ -52,7 +54,10 @@ class StoreHistoricalMilestoneRequest extends FormRequest
'picture_alt' => 'required_with:picture|nullable|between:3,255',
'picture_title' => 'required_with:picture|nullable|between:3,255',
'video_id' => [
'sometimes', 'nullable', 'string', 'between:3,255',
'sometimes',
'nullable',
'string',
'between:3,255',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, string $value, $fail) {
if (!empty($value) && !empty($this->picture)) {
@ -65,11 +70,12 @@ class StoreHistoricalMilestoneRequest extends FormRequest
'picto_alt' => 'required_with:picto|nullable|between:3,255',
'picto_title' => 'required_with:picto|nullable|between:3,255',
'published' => 'required|boolean',
'picto_placement' => ['required_with:picto', 'nullable', Rule::enum(HistoricalMilestonePosition::class)]
];
return \array_merge(
$rules,
$this->pictureRules('picture', 608, 342, 608, 342, true, null, null, 'video_id'),
$this->pictureRules('picto', 432, 243, 432, 243, true),
$this->pictureRules('picto', 340, 160, 340, 160, true),
);
}

View file

@ -64,7 +64,7 @@ class BrandAdvantage extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -133,6 +133,7 @@ class BrandAdvantage extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -143,6 +144,7 @@ class BrandAdvantage extends Model
/**
* Get all published BrandAdvantages ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -51,7 +51,7 @@ class ConsumptionMoment extends Model
$model->slug = str($model->title)->slug();
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -88,6 +88,7 @@ class ConsumptionMoment extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -98,6 +99,7 @@ class ConsumptionMoment extends Model
/**
* Get all consumption moments ordered by slug.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getOrderedBySlug(): \Illuminate\Database\Eloquent\Collection

View file

@ -86,7 +86,7 @@ class DemarcheSlide extends Model
self::setButtons($demarcheSlide);
$demarcheSlide->picture = FileStorageHelper::storeFile($demarcheSlide, $demarcheSlide->picture, true);
});
static::created(function (self $demarcheSlide) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $demarcheSlide) {
@ -186,6 +186,7 @@ class DemarcheSlide extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -196,6 +197,7 @@ class DemarcheSlide extends Model
/**
* Get all published demarche slides ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -193,6 +193,8 @@ class GeneralSetting extends Model
/**
* Reset all cache elements related to this model.
*
* @param \App\Enums\Settings\SettingsType $type
* @return void
*/
private static function resetCache(SettingsType $type)
@ -203,6 +205,7 @@ class GeneralSetting extends Model
/**
* Get cached general setting associated to a given type.
*
* @param \App\Enums\Settings\SettingsType $type
* @return \App\Models\StaticPage
*/

View file

@ -44,6 +44,8 @@ class HistoricalMilestone extends Model
'picto',
'picto_alt',
'picto_title',
'picto_placement',
'order',
'published',
];
@ -68,7 +70,7 @@ class HistoricalMilestone extends Model
self::setImage($historicalMilestone, 'picture');
self::setImage($historicalMilestone, 'picto');
});
static::created(function (self $historicalMilestone) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $historicalMilestone) {
@ -112,6 +114,7 @@ class HistoricalMilestone extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -122,6 +125,7 @@ class HistoricalMilestone extends Model
/**
* Get all published HistoricalMilestones ordered by year.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedByYear(): \Illuminate\Database\Eloquent\Collection

View file

@ -50,7 +50,7 @@ class KeyNumber extends Model
self::setOrder($keyNumber);
$keyNumber->picto = FileStorageHelper::storeFile($keyNumber, $keyNumber->picto, true);
});
static::created(function (self $keyNumber) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $keyNumber) {
@ -81,6 +81,7 @@ class KeyNumber extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -91,6 +92,7 @@ class KeyNumber extends Model
/**
* Get 5 published key numbers ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get5PublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -113,7 +113,7 @@ class MainSlide extends Model
self::setImage($mainSlide);
$mainSlide->background = FileStorageHelper::storeFile($mainSlide, $mainSlide->background, true);
});
static::created(function (self $mainSlide) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $mainSlide) {
@ -236,6 +236,7 @@ class MainSlide extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -246,6 +247,7 @@ class MainSlide extends Model
/**
* Get all published main slides ordered by order with approaches.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedWithApproaches(): \Illuminate\Database\Eloquent\Collection

View file

@ -81,7 +81,7 @@ class Meat extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -154,6 +154,7 @@ class Meat extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -166,6 +167,7 @@ class Meat extends Model
/**
* Get all published Meats ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
@ -177,6 +179,7 @@ class Meat extends Model
/**
* Get all published Meats ordered by order with submeats.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedWithSubmeats(): \Illuminate\Database\Eloquent\Collection

View file

@ -89,7 +89,7 @@ class News extends Model
self::assertTitleIsUnique($news->title);
self::manageFields($news);
});
static::created(function (self $news) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $news) {
@ -152,7 +152,7 @@ class News extends Model
->orderBy('publish_at', 'ASC')
->get();
if ($hotNewsModels->count() >= 2 && $news->highlight) {
$hotNewsModel = $hotNewsModels->first();
$hotNewsModel = $hotNewsModels->first();
$hotNewsModel->highlight = false;
$hotNewsModel->saveOrFail();
Session::flash('warning', trans(
@ -219,6 +219,7 @@ class News extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -229,6 +230,7 @@ class News extends Model
/**
* Get all published news with categories relations.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedWithNewsCategory(): \Illuminate\Database\Eloquent\Collection

View file

@ -185,6 +185,8 @@ class NewsBreeding extends Model
/**
* Reset all cache elements related to this model.
*
* @param \App\Enums\StaticPageType $type
* @return void
*/
private static function resetCache(StaticPageType $type)
@ -195,6 +197,8 @@ class NewsBreeding extends Model
/**
* Get all published news breeding ordered by order associated to a given static page type.
*
* @param \App\Enums\StaticPageType $type
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedForType(StaticPageType $type): \Illuminate\Database\Eloquent\Collection

View file

@ -57,17 +57,17 @@ class NewsCategory extends Model
self::setOrder($newsCategory);
self::manageFields($newsCategory);
});
static::created(function (self $newsCategory) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $newsCategory) {
self::assertTitleIsUnique($newsCategory->title, $newsCategory->getKey());
self::manageFields($newsCategory);
});
static::updated(function (self $newsCategory) {
static::updated(function () {
self::resetCache();
});
static::deleted(function (self $newsCategory) {
static::deleted(function () {
self::resetCache();
});
}
@ -113,6 +113,7 @@ class NewsCategory extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -123,6 +124,7 @@ class NewsCategory extends Model
/**
* Get all published NewsCategories ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -65,7 +65,7 @@ class NewsCorporate extends Model
self::makeStatusSense($newsCorporate);
$newsCorporate->picture = FileStorageHelper::storeFile($newsCorporate, $newsCorporate->picture, true);
});
static::created(function (self $newsCorporate) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $newsCorporate) {
@ -133,6 +133,7 @@ class NewsCorporate extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -143,6 +144,7 @@ class NewsCorporate extends Model
/**
* Get 9 published news corporate ordered by updated_at.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get9PublishedOrderedByUpdatedAt(): \Illuminate\Database\Eloquent\Collection

View file

@ -105,7 +105,7 @@ class Product extends Model implements SeoInterface
self::assertLabelIsUnique($product->label);
self::manageFields($product);
});
static::created(function (self $product) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $product) {
@ -197,6 +197,7 @@ class Product extends Model implements SeoInterface
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -207,6 +208,7 @@ class Product extends Model implements SeoInterface
/**
* Get all published products with discover === true.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedDiscovered(): \Illuminate\Database\Eloquent\Collection

View file

@ -59,7 +59,7 @@ class Profession extends Model
static::creating(function (self $profession) {
$profession->picture = FileStorageHelper::storeFile($profession, $profession->picture, true);
});
static::created(function (self $profession) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $profession) {
@ -79,6 +79,7 @@ class Profession extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -89,6 +90,7 @@ class Profession extends Model
/**
* Get 5 published professions.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get5Published(): \Illuminate\Database\Eloquent\Collection

View file

@ -85,7 +85,7 @@ class Range extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -159,6 +159,7 @@ class Range extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -173,6 +174,7 @@ class Range extends Model
/**
* Get all published Ranges ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
@ -184,6 +186,7 @@ class Range extends Model
/**
* Get all published Ranges ordered by slug.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedBySlug(): \Illuminate\Database\Eloquent\Collection
@ -195,6 +198,7 @@ class Range extends Model
/**
* Get all published Ranges ordered by order with subranges.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrderedWithSubranges(): \Illuminate\Database\Eloquent\Collection

View file

@ -94,7 +94,7 @@ class Recipe extends Model implements SeoInterface
self::setHighlightValue($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -195,6 +195,7 @@ class Recipe extends Model implements SeoInterface
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -207,9 +208,10 @@ class Recipe extends Model implements SeoInterface
/**
* Get first published and highlighted recipe.
* @return \Illuminate\Database\Eloquent\Collection
*
* @return \Illuminate\Database\Eloquent\Collection|null
*/
public static function getFirstHighlighted(): \Illuminate\Database\Eloquent\Collection
public static function getFirstHighlighted(): \Illuminate\Database\Eloquent\Collection|null
{
return Cache::rememberForever('publishedFirstHighlightedRecipe', function () {
return self::query()->where('published', true)->where('highlight', true)->first();
@ -218,6 +220,7 @@ class Recipe extends Model implements SeoInterface
/**
* Get 9 published recipes with products relations.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get9PublishedWithProducts(): \Illuminate\Database\Eloquent\Collection

View file

@ -135,6 +135,8 @@ class StaticPage extends Model
/**
* Reset all cache elements related to this model.
*
* @param \App\Enums\StaticPageType $type
* @return void
*/
private static function resetCache(StaticPageType $type)
@ -149,6 +151,7 @@ class StaticPage extends Model
/**
* Get cached static page associated to a given type.
*
* @param \App\Enums\StaticPageType $type
* @return \App\Models\StaticPage
*/
@ -162,7 +165,7 @@ class StaticPage extends Model
/**
* Get cached static pages associated to all breeding types.
* @param \App\Enums\StaticPageType $type
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getCachedBreedingStaticPages()

View file

@ -71,7 +71,7 @@ class Submeat extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -130,6 +130,7 @@ class Submeat extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -140,6 +141,7 @@ class Submeat extends Model
/**
* Get all published Subeats ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -70,7 +70,7 @@ class Subrange extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -129,6 +129,7 @@ class Subrange extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -139,6 +140,7 @@ class Subrange extends Model
/**
* Get all published Subranges ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* @property \App\Models\NewsClub $news_club_id Survey answer news club associated.
* @property boolean $order Survey answer order.
* @property integer $order Survey answer order.
* @property boolean $published Survey answer status.
* @property string $answer Survey answer.
* @property-read \Illuminate\Support\Carbon $created_at Created date.

View file

@ -67,7 +67,7 @@ class Testimonial extends Model
self::setOrder($model);
self::manageFields($model);
});
static::created(function (self $model) {
static::created(function () {
self::resetCache();
});
static::updating(function (self $model) {
@ -134,6 +134,7 @@ class Testimonial extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -144,6 +145,7 @@ class Testimonial extends Model
/**
* Get all published Testimonials ordered by order.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection

View file

@ -58,13 +58,13 @@ class Video extends Model
static::creating(function (self $video) {
self::setOrder($video);
});
static::created(function (self $video) {
static::created(function () {
self::resetCache();
});
static::updated(function (self $video) {
static::updated(function () {
self::resetCache();
});
static::deleted(function (self $video) {
static::deleted(function () {
self::resetCache();
});
}
@ -84,6 +84,7 @@ class Video extends Model
/**
* Reset all cache elements related to this model.
*
* @return void
*/
private static function resetCache()
@ -96,6 +97,7 @@ class Video extends Model
/**
* Get 9 published Videos to display in homepage ordered by order with products relations.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get9PublishedHomeVideosOrderedWithProducts(): \Illuminate\Database\Eloquent\Collection
@ -113,6 +115,7 @@ class Video extends Model
/**
* Get 9 published Videos to display in homepage ordered by order with products relations.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function get6PublishedVideosOrderedWithProducts(): \Illuminate\Database\Eloquent\Collection

View file

@ -83,4 +83,15 @@ class HistoricalMilestonePolicy
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
/**
* Determine whether the user can change the order of the model.
*
* @param \App\Models\User $authUser
* @return boolean
*/
public function changeOrder(User $authUser): bool
{
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
}
}

View file

@ -104,20 +104,56 @@ class ViewServiceProvider extends ServiceProvider
['name' => 'mainMenuMeatModels', 'value' => Meat::getPublishedOrdered()],
['name' => 'homeStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::home)],
['name' => 'storyStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::story)],
['name' => 'recruitmentStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recruitment)],
[
'name' => 'recruitmentStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::recruitment)
],
['name' => 'sagaStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::saga)],
['name' => 'recipesStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recipes)],
['name' => 'recipeStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recipe)],
['name' => 'productsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::products)],
[
'name' => 'recipesStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::recipes)
],
[
'name' => 'recipeStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::recipe)
],
[
'name' => 'productsStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::products)
],
['name' => 'legalsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::legals)],
['name' => 'confidentialityStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::confidentiality)],
['name' => 'sellingStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::selling)],
['name' => 'accessibilityStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::accessibility)],
['name' => 'productStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::product)],
['name' => 'breedingPoultryStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingPoultry)],
['name' => 'breedingJobStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingJob)],
['name' => 'breedingFoodStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingFood)],
['name' => 'breedingHealthStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingHealth)],
[
'name' => 'confidentialityStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::confidentiality)
],
[
'name' => 'sellingStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::selling)
],
[
'name' => 'accessibilityStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::accessibility)
],
[
'name' => 'productStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::product)
],
[
'name' => 'breedingPoultryStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingPoultry)
],
[
'name' => 'breedingJobStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingJob)
],
[
'name' => 'breedingFoodStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingFood)
],
[
'name' => 'breedingHealthStaticPageModel',
'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingHealth)
],
['name' => 'newsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::news)],
])->map(function ($array) {
View::share($array['name'], (function () use ($array) {

View file

@ -152,11 +152,12 @@ trait HasPicture
$changedPicture = ltrim($decodedPath, '/');
$this->merge([
$name => $changedPicture
]);// le else if sert a gerer le cas ou l'image de la bannière produit est nulle
} else if (is_null($picturePath)) {
]);
// le else if sert a gerer le cas ou l'image de la bannière produit est nulle
} elseif (is_null($picturePath)) {
$this->merge([$name => null]);
return;
}
}//end if
}
/**

View file

@ -11,8 +11,12 @@ use App\Models\HistoricalMilestone;
class HistoricalMilestoneComponent extends Component
{
public $staticPageModel;
/** @var \App\Models\StaticPage $staticPageModel */
public $staticPageModel;
/** @var \Illuminate\Database\Eloquent\Collection $historicalMilestoneModels */
public $historicalMilestoneModels;
/**
* Create a new component instance.
*/
@ -24,6 +28,8 @@ class HistoricalMilestoneComponent extends Component
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View
*/
public function render(): View|Closure|string
{

View file

@ -10,11 +10,16 @@ use App\Enums\StaticPageType;
class WhoWeAre extends Component
{
/** @var \App\Models\StaticPage $staticPageModel */
public $staticPageModel;
/** @var boolean $displayButton */
public bool $displayButton;
/**
* Create a new component instance.
*
* @param boolean $displayButton
*/
public function __construct(bool $displayButton = false)
{
@ -24,10 +29,11 @@ class WhoWeAre extends Component
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View
*/
public function render(): View|Closure|string
{
// Passe la donnée à la vue
return view('components.fo.story.who-we-are', [
'staticPageModel' => $this->staticPageModel,
]);

View file

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('historical_milestones', function (Blueprint $table) {
$table->string('picto_placement')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{
Schema::table('historical_milestones', function (Blueprint $table) {
$table->dropColumn('picto_placement');
});
}
};

View file

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('historical_milestones', function (Blueprint $table) {
$table->integer('order')->comment('Milestone order.');
});
$this->setOrderForExistingMilestones();
}
private function setOrderForExistingMilestones(): void
{
// Récupérer tous les milestones actuels
$milestones = DB::table('historical_milestones')->orderBy('id')->get();
// Mettre à jour chaque milestone avec un ordre basé sur l'index
foreach ($milestones as $index => $milestone) {
DB::table('historical_milestones')
->where('id', $milestone->id)
->update(['order' => $index + 1]); // L'index commence à 0, donc +1 pour commencer à 1
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('historical_milestones', function (Blueprint $table) {
$table->dropColumn('order');
});
}
};

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('key_numbers', function (Blueprint $table) {
$table->string('source')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('key_numbers', function (Blueprint $table) {
$table->string('source')->nullable(false)->change();
});
}
};

View file

@ -256,6 +256,7 @@ return [
'demarche' => 'demarche',
'details' => 'details',
'difficulty' => 'difficulty',
'emplacement' => 'emplacement',
'event' => 'event',
'function' => 'function',
'general_setting_type' => 'general setting type',

View file

@ -257,6 +257,7 @@ return [
'demarche' => 'démarche',
'details' => 'détails',
'difficulty' => 'difficulté',
'emplacement' => 'emplacement',
'event' => 'évènement',
'function_list' => 'liste de fonctions',
'function' => 'fonction',

View file

@ -1,4 +1,21 @@
#home {
.swiper-content-range-product-pagination {
.swiper-pagination-bullet {
width: 1rem;
height: 1rem;
border: 0;
border-radius: 100%;
margin: 0 0.5rem;
background-color: #fff;
transition: .3s;
&-active {
background-color: $color-success !important;
transform: scale(1.1);
}
}
}
.hot-news-content {
height: fit-content;
@ -10,7 +27,8 @@
border-bottom: 2px #0006 dashed;
@include media-breakpoint-up(sm) {
&:nth-child(1), &:nth-child(2) {
&:nth-child(1),
&:nth-child(2) {
border-right: 2px #0006 dashed;
border-bottom: 0;
}
@ -22,14 +40,16 @@
}
@include media-breakpoint-up(md) {
&:nth-child(1), &:nth-child(2) {
&:nth-child(1),
&:nth-child(2) {
border-right: 2px #0006 dashed;
border-bottom: 0;
}
}
@include media-breakpoint-up(xl) {
&:nth-child(1), &:nth-child(2) {
&:nth-child(1),
&:nth-child(2) {
border-right: 0 !important;
border-bottom: 2px #0006 dashed !important;
}
@ -115,7 +135,8 @@
background-color: transparent !important;
}
&-body, &-picture {
&-body,
&-picture {
transform: translateY(-1rem);
@include media-breakpoint-up(md) {
@ -163,7 +184,7 @@
}
}
#products > div {
#products>div {
background-image: url('@/images/common/wood-bg-white-big-reverse.jpg');
background-position: right;
background-repeat: no-repeat;
@ -171,7 +192,8 @@
}
#demarche {
&-bg, &-slides .bg-demarche-slides {
&-bg,
&-slides .bg-demarche-slides {
margin-top: 4rem;
@include media-breakpoint-up(lg) {
@ -318,6 +340,9 @@
}
}
.swiper-videos {
.swiper-slide {
transition: all .2s ease;

View file

@ -87,8 +87,9 @@
top: 8rem;
&.is-sticky {
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
@extend .bottom-left-shadow;
@include media-breakpoint-down(lg) {
filter: drop-shadow(-2px 2px 4px #4e32381f);
}
&::before {
position: absolute;
@ -100,6 +101,12 @@
content: "";
transform: translateY(-8rem);
}
@include media-breakpoint-up(lg) {
&::before {
display: none;
}
}
}
.swiper-slide-active .btn {
@ -178,10 +185,10 @@
.slider-picto {
top: -10%;
left: 0;
left: -20%;
&-reversed {
right: 0;
right: -20%;
left: auto;
}
}
@ -191,4 +198,4 @@
}
}
}
}
}

View file

@ -209,6 +209,11 @@
>
</button>
</div>
<div class="d-flex justify-content-center align-items-center mb-4 mt-2">
<div
class="swiper-pagination swiper-content-range-product-pagination d-flex justify-content-center align-items-center w-100"
/>
</div>
</div>
<!-- BUTTONS -->
<div
@ -244,7 +249,7 @@
<script lang="ts" setup>
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import Swiper from "swiper";
import { Navigation } from "swiper/modules";
import { Navigation, Pagination } from "swiper/modules";
import type { App } from "vue";
import { createApp, defineOptions, nextTick, onMounted, reactive, ref, useAttrs } from "vue";
import route from "../../modules/route";
@ -406,13 +411,23 @@ function initLegendsSwiper(): void {
/** Init content slider. */
function initContentsSwiper(): void {
const customOptions = {
modules: [Navigation, Pagination],
spaceBetween: 40,
slidesPerView: 1,
breakpoints: {
992: {
slidesPerView: 3,
centeredSlides: false,
slidesPerGroup: 3
}
}
},
pagination: {
el: ".swiper-content-range-product-pagination",
clickable: true,
renderBullet: function (index: number, className: string) {
return "<button class=\"" + className + "\" title=\"Aller à la slide " + (index + 1) + "\"></button>";
},
},
};
swiper.value = new Swiper(".swiper-content", Object.assign(swiperOptions(".swiper-content"), customOptions));
}
@ -437,7 +452,8 @@ function swiperOptions(classParent: string): object {
slidesPerView: 4,
centeredSlides: false,
}
}
},
};
}

View file

@ -18,27 +18,60 @@ document.addEventListener("DOMContentLoaded", function () {
const swiperYearsNode = document.querySelector("#swiper-historicalmilestone-years") as unknown as SwiperType;
const swiperYearsBtns = document.querySelectorAll("#swiper-historicalmilestone-years .btn") as NodeListOf<HTMLButtonElement>;
// MOBILE.
let isChangingSlide = false; // Flag to avoid conflict between onClick and onScroll actions on mobile.
// MOBILE on click navigation (arrows)
setTimeout(() => {
if (swiperNodeMobile && swiperYearsNode) {
swiperYearsNode.swiper.on("slideChange", function () {
if (!isChangingSlide) {
const activeIndex = swiperYearsNode.swiper.realIndex;
const slides = swiperYearsNode.swiper.slides;
const activeSlide = slides[activeIndex];
const linkElement = activeSlide.querySelector("a");
console.log(linkElement);
if (linkElement && linkElement.href) {
// Simule un clic sur le lien
linkElement.click();
}
}
});
}
}, 10);
// MOBILE on scroll
window.addEventListener("scroll", (e) => {
// Check if year slider is sticky or not.
const stickyTop = parseInt(window.getComputedStyle(stickyElm).top);
const currentTop = stickyElm.getBoundingClientRect().top;
stickyElm.classList.toggle("is-sticky", currentTop === stickyTop);
// Check what section is active.
const target = e.target as HTMLDocument;
swiperNodeMobile.forEach((yearSlide, indexSlide) => {
// 210px for the years slider.
if (
target.scrollingElement?.scrollTop !== undefined &&
(yearSlide.offsetTop - 210) <= target.scrollingElement?.scrollTop &&
(yearSlide.offsetTop + yearSlide.clientHeight - 210) >= target.scrollingElement?.scrollTop
) {
swiperYearsNode.swiper.slideTo(indexSlide);
}
});
if (!isChangingSlide) {
const target = e.target as HTMLDocument;
// Flag temporaire pour éviter le conflit
isChangingSlide = true;
swiperNodeMobile.forEach((yearSlide, indexSlide) => {
// 210px for the years slider.
if (
target.scrollingElement?.scrollTop !== undefined &&
(yearSlide.offsetTop - 210) <= target.scrollingElement?.scrollTop &&
(yearSlide.offsetTop + yearSlide.clientHeight - 210) >= target.scrollingElement?.scrollTop
) {
swiperYearsNode.swiper.slideTo(indexSlide);
}
});
// Wait a moment to reboot the flag
setTimeout(() => {
isChangingSlide = false;
}, 100); // Délai pour éviter un déclenchement trop rapide entre le scroll et le slide
}
});
// DESKTOP.
setTimeout(() => {
const swiperNodeDesktop = document.querySelector("#swiper-historicalmilestone-desktop") as unknown as SwiperType;

View file

@ -251,13 +251,40 @@
@include('bo.partials.inputs.varchar-picture', [
'id' => 'historicalMilestonePicto',
'name' => 'picto',
'width' => 432,
'height' => 243,
'width' => 340,
'height' => 160,
'model' => $historicalMilestoneModel ?? null,
'required' => false,
'preview' => true,
])
</div>
{{-- EMPLACEMENT --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ str(__('validation.custom.emplacement'))->ucfirst() }}</legend>
<div class="row">
<div class="col-12">
@include('bo.partials.inputs.tinyint-enum', [
'id' => 'pictoPlacement',
'label' => sprintf(
'%s %s %s',
str(__('validation.custom.emplacement'))->ucfirst(),
__('validation.custom.of_the.male'),
__('validation.custom.picto')),
'name' => 'picto_placement',
'model' => $historicalMilestoneModel ?? null,
'required' => false,
'value' => $historicalMilestoneModel->picto_placement,
'associatedModels' => \App\Enums\HistoricalMilestonePosition::toArray(),
'helper' => __('crud.minicrud.select_entity', [
'entity' => sprintf('un seul et unique %s', __('validation.custom.emplacement')),
]),
])
</div>
</div>
</fieldset>
</div>
</div>
</fieldset>
</div>

View file

@ -8,6 +8,7 @@
'picture' => str(__('validation.attributes.image'))->ucfirst(),
'published' => str(__('validation.custom.publication'))->ucfirst(),
'updated_at' => str(__('validation.attributes.updated_at'))->ucfirst(),
'order' => str(__('validation.custom.order'))->ucfirst(),
],
])
</thead>
@ -17,8 +18,8 @@
<td class="text-center align-middle">{{ $historicalMilestoneModel->year }}</td>
<td class="text-center align-middle">{{ $historicalMilestoneModel->title }}</td>
<td class="text-center align-middle">
<img class="image-preview" src="{{ asset($historicalMilestoneModel->picture) }}" title="{{ $historicalMilestoneModel->picture_title }}"
alt="{{ $historicalMilestoneModel->picture_alt }}">
<img class="image-preview" src="{{ asset($historicalMilestoneModel->picture) }}"
title="{{ $historicalMilestoneModel->picture_title }}" alt="{{ $historicalMilestoneModel->picture_alt }}">
</td>
@include('bo.modules.change-published-status', [
'routeName' => 'historical_milestones',
@ -27,10 +28,17 @@
<td class="text-center align-middle">
<span class="badge text-bg-secondary">{{ $historicalMilestoneModel->updated_at->isoFormat('LLLL') }}</span>
</td>
@if (empty(request()->search) && session()->get(request()->route()->getName() . '.sort_col') === 'order')
@include('bo.modules.change-model-order', [
'routeName' => 'historical_milestones',
'model' => $historicalMilestoneModel,
'models' => $historicalMilestoneModels,
])
@endif
<td class="text-end align-middle">
@canAny(['show', 'duplicate', 'update', 'delete'], $historicalMilestoneModel)
<form class="btn-group confirmDeleteTS" action="{{ route('bo.historical_milestones.destroy', $historicalMilestoneModel) }}"
method="POST" novalidate>
<form class="btn-group confirmDeleteTS"
action="{{ route('bo.historical_milestones.destroy', $historicalMilestoneModel) }}" method="POST" novalidate>
@can('view', $historicalMilestoneModel)
<a class="btn btn-sm btn-warning" data-bs-toggle="tooltip"
href="{{ route('bo.historical_milestones.show', ['historical_milestone' => $historicalMilestoneModel]) }}"

View file

@ -120,7 +120,7 @@
]),
'hasWordCounter' => true,
'name' => 'source',
'required' => true,
'required' => false,
'model' => $keyNumberModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [

View file

@ -125,7 +125,7 @@
// All
$collectionComplexItems = collect([$complexItem1, $complexItem2, $complexItem3, $complexItem4]);
@endphp
<section class="line-border-large container mb-5 p-0">
<section class="line-border-large mb-md-5 container p-0">
@include('fo.partials.commitments.complex-flex-items', [
'background_color' => 'tertiary',
'collection' => $collectionComplexItems,
@ -249,21 +249,7 @@
])
</section>
{{-- PARAGRAPH WITH PICTURE --}}
@php
$newsCategory = new stdClass();
$newsCategory->title = __('Actu');
$newsModel = new stdClass();
$newsModel->title = __('découvrez notre charte nutritionnelle pour alliers plaisir et santé');
$newsModel->slug = str($newsModel->title)->slug();
$newsModel->thumbnail = Vite::asset('resources/assets/images/commitments/pictograms/picto-medications.svg');
$newsModel->thumbnail_alt = __('Pictogramme de plusieurs médicaments.');
$newsModel->thumbnail_title = __('Pictogramme d’une diminution de l’utilisation des antibiotiques.');
$newsModel->date = now()->subDays(rand(0, 31));
$newsModel->link = 'FIXME: route to the news';
$newsModel->newsCategory = $newsCategory;
$newsModel->updated_at = now();
@endphp
@include('fo.partials.commitments.paragraph-with-visual', [
'title' => __('la santé de nos volailles : on en prend le plus grand soin'),
'text' => __(
@ -273,7 +259,6 @@
'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'),
'newsModel' => $newsModel,
])
{{-- COMPLEX FLEX ITEMS --}}
@php

View file

@ -138,8 +138,8 @@
'contentViews' => $productViews,
'contentSwiper' => true,
'texts' => [
'helperNoItems' => __('Aucun produits disponibles dans cette gammes'),
'btn1Label' => str(__('découvrir tous les produits'))->upper(),
'helperNoItems' => __('Aucun produit disponible dans cette gamme'),
'btn1Label' => str(__('découvrir tous nos produits'))->upper(),
'btn2Label' => str(__('découvrir tous nos produits'))->upper(),
],
];

View file

@ -18,8 +18,8 @@
<img class="position-absolute img-fluid rotate-left" src="{{ asset($nextProductModel->packaging) }}"
title="{{ $nextProductModel->packaging_title }}" alt="{{ $nextProductModel->packaging_alt }}">
<a class="btn btn-secondary rounded-0 position-relative d-flex justif-y-content-start align-items-center z-1 py-2 pe-5 ps-2"
href="{{ route('fo.products.show', $nextProductModel->slug) }}"
title="{{ __('Accéder au produit suivant') }}" role="button">
href="{{ route('fo.products.show', $nextProductModel->slug) }}" title="{{ __('Accéder au produit suivant') }}"
role="button">
<div class="fs-5">
{{ __('models.classes.product') }}<br>
{{ __('suivant') }}
@ -35,8 +35,7 @@
@if (!is_null($prevProductModel) && $productModel->getKey() !== $prevProductModel->getKey())
<a class="product-header-next-mobile d-sm-none position-absolute top-50 translate-middle-y btn btn-white rounded-circle z-1 start-0 ms-3"
href="{{ route('fo.products.show', $prevProductModel->slug) }}">
<img class="img-fluid"
src="{{ Vite::asset('resources/assets/images/common/arrow-brown.svg') }}"
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/common/arrow-brown.svg') }}"
title="{{ __('Accéder au produit précédent') }}" alt="{{ __('Flèche marron') }}" />
</a>
@endif
@ -44,20 +43,20 @@
@if ($productModel->new)
<img class="d-none d-lg-block position-absolute tag-new z-1"
src="{{ Vite::asset('resources/assets/images/common/tag-new.svg') }}"
title="{{ __('Tag pour un nouveau produit') }}"
alt="{{ __('Tag pour un nouveau produit') }}" />
title="{{ __('Tag pour un nouveau produit') }}" alt="{{ __('Tag pour un nouveau produit') }}" />
@endif
<img class="img-fluid rotate-right" src="{{ asset($productModel->packaging) }}"
title="{{ $productModel->packaging_title }}" alt="{{ $productModel->packaging_alt }}">
<img class="d-none d-sm-block img-fluid position-absolute bottom-0 start-0"
src="{{ asset($productModel->picture) }}" title="{{ $productModel->picture_title }}"
alt="{{ $productModel->picture_alt }}">
@if ($productModel->picture)
<img class="d-none d-sm-block img-fluid position-absolute bottom-0 start-0"
src="{{ asset($productModel->picture) }}" title="{{ $productModel->picture_title }}"
alt="{{ $productModel->picture_alt }}">
@endif
</div>
@if (!is_null($nextProductModel) && $productModel->getKey() !== $nextProductModel->getKey())
<a class="product-header-next-mobile d-sm-none position-absolute top-50 translate-middle-y btn btn-white rounded-circle z-1 end-0 me-3"
href="{{ route('fo.products.show', $nextProductModel->slug) }}">
<img class="img-fluid"
src="{{ Vite::asset('resources/assets/images/common/arrow-brown.svg') }}"
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/common/arrow-brown.svg') }}"
title="{{ __('Accéder au produit suivant') }}" alt="{{ __('Flèche marron') }}" />
</a>
@endif
@ -84,16 +83,17 @@
<div class="col-12 col-sm-4 col-lg-12 col-xxl-4 d-flex justify-content-start align-items-center mb-2 flex-wrap"
id="product-header-details-labels">
@foreach ($productModel->labels->where('published', true) as $label)
<img class="img-fluid pb-2 pe-3" src="{{ asset($label->picture) }}"
title="{{ $label->picture_title }}" alt="{{ $label->picture_alt }}">
@if ($label->picture)
<img class="img-fluid pb-2 pe-3" src="{{ asset($label->picture) }}"
title="{{ $label->picture_title }}" alt="{{ $label->picture_alt }}">
@endif
@endforeach
</div>
@endif
{{-- RANGE --}}
<div class="col-12">
@php $productRangeModel = $productModel->subrange ? $productModel->subrange->range : $productModel->range; @endphp
<a class="btn btn-primary border-0"
href="{{ route('fo.products.search.range', $productRangeModel->slug) }}"
<a class="btn btn-primary border-0" href="{{ route('fo.products.search.range', $productRangeModel->slug) }}"
title="{{ __('Accéder à la page nos produits de la gamme :range', ['range' => $productRangeModel->label]) }}"
style="background-color:{{ $productRangeModel->color }};">
{{ $productRangeModel->label }}
@ -110,8 +110,7 @@
<div class="col-12 d-flex flex-column flex-lg-row flex-lg-wrap align-items-start">
@foreach ($productModel->claims->where('published', true) as $claim)
<div class="d-flex justify-content-center align-items-center pb-2 pe-3">
<img class="img-fluid"
src="{{ Vite::asset('resources/assets/images/product/claim-icon.svg') }}"
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/product/claim-icon.svg') }}"
title="{{ __('Coche marron') }}" alt="{{ __('Allégation icône') }}">
<p class="f-bourton-base fs-5 m-0 ms-2">{{ $claim->label }}</p>
</div>
@ -120,8 +119,7 @@
@endif
{{-- BTN INGREDIENTS --}}
<div class="col-12">
<button class="btn btn-white my-3" data-bs-toggle="modal"
data-bs-target="#productIngredients">
<button class="btn btn-white my-3" data-bs-toggle="modal" data-bs-target="#productIngredients">
{{-- FIXME: add nutritionnal values when it's ready --}}
{{ __('ingrédients & valeurs nutritionnelles') }}
</button>
@ -153,8 +151,8 @@
<div class="col-12 d-xl-none">
<button
class="product-collapse-btn btn btn-white position-relative fs-4 w-100 collapsed border-0 bg-transparent px-0 text-start shadow-none"
data-bs-toggle="collapse" data-bs-target="#productPreparationMobile" type="button"
aria-expanded="false" aria-controls="productPreparationMobile">
data-bs-toggle="collapse" data-bs-target="#productPreparationMobile" type="button" aria-expanded="false"
aria-controls="productPreparationMobile">
{{ __('conseil de préparation') }}
</button>
<div class="collapse" id="productPreparationMobile">
@ -167,8 +165,8 @@
<div class="col-12 d-xl-none product-paper-demarche">
<button
class="product-collapse-btn btn btn-white position-relative fs-4 w-100 collapsed border-0 bg-transparent px-0 text-start shadow-none"
data-bs-toggle="collapse" data-bs-target="#productDemarcheMobile" type="button"
aria-expanded="false" aria-controls="productDemarcheMobile">
data-bs-toggle="collapse" data-bs-target="#productDemarcheMobile" type="button" aria-expanded="false"
aria-controls="productDemarcheMobile">
{{ $productModel->productTypes[0]->label }}
<img class="img-fluid" src="{{ asset($productModel->productTypes[0]->picture) }}"
title="{{ $productModel->productTypes[0]->picture_title }}"
@ -215,10 +213,8 @@
{{-- PRODUCTTYPE/DEMARCHE DESKTOP --}}
@if (count($productModel->productTypes))
{{-- CHANGEME: quand la relation product<->productType aura été changé, adapter cette partie --}}
<div
class="product-paper product-paper-demarche d-none d-xl-block position-absolute bottom-left-shadow">
<img class="img-fluid position-absolute z-1"
src="{{ asset($productModel->productTypes[0]->picture) }}"
<div class="product-paper product-paper-demarche d-none d-xl-block position-absolute bottom-left-shadow">
<img class="img-fluid position-absolute z-1" src="{{ asset($productModel->productTypes[0]->picture) }}"
title="{{ $productModel->productTypes[0]->picture_title }}"
alt="{{ $productModel->productTypes[0]->picture_alt }}">
<div class="line-border-small bg-tertiary p-3">
@ -238,12 +234,9 @@
</div>
</div>
@elseif ($productModel->approach)
<div
class="product-paper product-paper-demarche d-none d-xl-block position-absolute bottom-left-shadow">
<img class="img-fluid position-absolute z-1"
src="{{ asset($productModel->approach->picture) }}"
title="{{ $productModel->approach->picture_title }}"
alt="{{ $productModel->approach->picture_alt }}">
<div class="product-paper product-paper-demarche d-none d-xl-block position-absolute bottom-left-shadow">
<img class="img-fluid position-absolute z-1" src="{{ asset($productModel->approach->picture) }}"
title="{{ $productModel->approach->picture_title }}" alt="{{ $productModel->approach->picture_alt }}">
<div class="line-border-small bg-tertiary p-3">
<h4 class="text-center">
{{ __('la démarche') }}
@ -265,14 +258,12 @@
</div>
{{-- PRODUCT INGREDIENT MODAL --}}
{{-- FIXME: add nutritionnal values when it's ready --}}
<div class="modal fade" id="productIngredients" aria-labelledby="productIngredientsLabel" aria-hidden="true"
tabindex="-1">
<div class="modal fade" id="productIngredients" aria-labelledby="productIngredientsLabel" aria-hidden="true" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg px-4">
<div class="modal-content border-0 bg-transparent">
<button class="btn btn-secondary rounded-circle position-absolute z-1 p-1" data-bs-dismiss="modal"
type="button" aria-label="Close">
<img class="img-fluid"
src="{{ Vite::asset('resources/assets/images/product/modal-cross.svg') }}"
<button class="btn btn-secondary rounded-circle position-absolute z-1 p-1" data-bs-dismiss="modal" type="button"
aria-label="Close">
<img class="img-fluid" src="{{ Vite::asset('resources/assets/images/product/modal-cross.svg') }}"
title="{{ __('Bouton de fermeture de la modale') }}" alt="{{ __('Croix marron') }}">
</button>
<div class="modal-body line-border-small bg-white">
@ -302,9 +293,8 @@
<div class="container my-5">
<div class="row align-items-center justify-content-center">
@if ($videoModel)
<div class="col-4" data-aos="fade-rotate-right" data-aos-easing="ease-in-out"
data-aos-duration="750" data-aos-delay="1250" data-aos-once="true"
data-aos-anchor-placement="bottom-bottom">
<div class="col-4" data-aos="fade-rotate-right" data-aos-easing="ease-in-out" data-aos-duration="750"
data-aos-delay="1250" data-aos-once="true" data-aos-anchor-placement="bottom-bottom">
<div class="part-left rotate-left">
@include('fo.partials.video-card', ['details' => false])
<div class="rotate-custom ps-4 pt-5">
@ -314,10 +304,9 @@
</div>
</div>
</div>
@else
<div class="col-4" data-aos="fade-rotate-right" data-aos-easing="ease-in-out"
data-aos-duration="750" data-aos-delay="1250" data-aos-once="true"
data-aos-anchor-placement="bottom-bottom">
@elseif ($recipeModel)
<div class="col-4" data-aos="fade-rotate-right" data-aos-easing="ease-in-out" data-aos-duration="750"
data-aos-delay="1250" data-aos-once="true" data-aos-anchor-placement="bottom-bottom">
<div class="part-left rotate-left">
<img class="img-fluid rotate-right" src="{{ asset($recipeModel->picture) }}"
title="{{ $recipeModel->picture_title }}" alt="{{ $recipeModel->picture_alt }}">
@ -329,20 +318,20 @@
</div>
</div>
@endif
<div data-aos="fade-down" data-aos-easing="ease-in-out" data-aos-duration="1000"
data-aos-once="true" data-aos-anchor-placement="bottom-bottom" @class(['col-4', 'col-6 mx-auto' => !$videoModel && !$recipeModel])>
<div data-aos="fade-down" data-aos-easing="ease-in-out" data-aos-duration="1000" data-aos-once="true"
data-aos-anchor-placement="bottom-bottom" @class(['col-4', 'col-6 mx-auto' => !$videoModel && !$recipeModel])>
<div class="position-relative d-flex justify-content-center align-items-center h-fit px-5 pb-5">
<img class="img-fluid rotate-right" src="{{ asset($productModel->packaging) }}"
title="{{ $productModel->packaging_title }}" alt="{{ $productModel->packaging_alt }}">
<img class="img-fluid position-absolute w-50 bottom-0 start-0"
src="{{ asset($productModel->picture) }}" title="{{ $productModel->picture_title }}"
alt="{{ $productModel->picture_alt }}">
@if ($productModel->picture)
<img class="img-fluid position-absolute w-50 bottom-0 start-0" src="{{ asset($productModel->picture) }}"
title="{{ $productModel->picture_title }}" alt="{{ $productModel->picture_alt }}">
@endif
</div>
</div>
@if ($recipeModel)
<div class="col-4" data-aos="fade-rotate-left" data-aos-easing="ease-in-out"
data-aos-duration="750" data-aos-delay="750" data-aos-once="true"
data-aos-anchor-placement="bottom-bottom">
<div class="col-4" data-aos="fade-rotate-left" data-aos-easing="ease-in-out" data-aos-duration="750"
data-aos-delay="750" data-aos-once="true" data-aos-anchor-placement="bottom-bottom">
<div class="part-right rotate-right">
<div class="rotate-custom pb-5 pe-4">
<p class="h3 fs-5 text-center">
@ -355,7 +344,7 @@
</div>
</div>
@endif
</div>
</div>
</div>
</section>
{{-- RECIPES --}}

View file

@ -53,13 +53,11 @@
{{-- TITLE/DESCRIPTION --}}
<div class="container">
<div class="row">
<div class="col-12">
<div class="col-12 text-center">
<h2 class="text-uppercase text-center">
{{ $staticPageModel->data['story_title']['value'] }}
</h2>
<p class="fs-8 text-center">
{{ $staticPageModel->data['story_description']['value'] }}
</p>
{!! clean($staticPageModel->data['story_description']['value']) !!}
</div>
</div>
</div>
@ -170,6 +168,7 @@
</div>
</div>
</div>
{{-- DESKTOP HISTORICAL MILESTONES --}}
<div class="d-none d-xl-block container-fluid row" id="story-desktop">
<div class="col-12 position-relative">
@ -197,15 +196,17 @@
</div>
<div class="col-7">
<div @class([
'bottom-left-shadow',
'bottom-left-shadow w-fit',
$loop->iteration % 2 ? 'rotate-right' : 'rotate-left',
])>
@if (isset($historicalMilestoneModel->picto) && $historicalMilestoneModel->picto !== null)
<img src="{{ asset($historicalMilestoneModel->picto) }}"
title="{{ $historicalMilestoneModel->picto_title }}"
alt="{{ $historicalMilestoneModel->picto_alt }}" @class([
'slider-picto position-absolute w-50 img-fluid z-1',
$loop->iteration % 2 ? 'slider-picto' : 'slider-picto-reversed',
'slider-picto position-absolute img-fluid z-1',
$historicalMilestoneModel->picto_placement === 'hg'
? 'slider-picto'
: 'slider-picto-reversed',
])>
@endif
@if (

View file

@ -7,7 +7,7 @@
<div class="bg-tertiary line-border-small w-fit p-3 ps-5">
<h3 class="m-0 text-center">{{ $title }}</h3>
@if (isset($subtitle))
<p class="f-bourton-base m-0">{{ $subtitle }}</p>
<p class="f-bourton-base m-0 text-center">{{ $subtitle }}</p>
@endif
</div>
</div>

View file

@ -430,6 +430,11 @@ Route::middleware(['throttle:web', 'admin-secure'])->prefix('bo')->name('bo.')->
HistoricalMilestoneController::class,
'changePublished'
])->name('historical_milestones.change-published');
Route::patch('/historical_milestones/{historical_milestone}/change-order/{direction}', [
HistoricalMilestoneController::class,
'changeOrder'
])->where('direction', 'up|down')->name('historical_milestones.change-order');
// * NEWS CORPORATE.
Route::resource('news_corporates', NewsCorporateController::class);