diff --git a/app/Enums/HistoricalMilestonePosition.php b/app/Enums/HistoricalMilestonePosition.php new file mode 100644 index 00000000..5dd5bb8f --- /dev/null +++ b/app/Enums/HistoricalMilestonePosition.php @@ -0,0 +1,23 @@ +name => 'Haut gauche', + self::hd->name => "Haut droit", + ]; +} diff --git a/app/Http/Controllers/Bo/HistoricalMilestoneController.php b/app/Http/Controllers/Bo/HistoricalMilestoneController.php index 47a0adbf..7ea40564 100644 --- a/app/Http/Controllers/Bo/HistoricalMilestoneController.php +++ b/app/Http/Controllers/Bo/HistoricalMilestoneController.php @@ -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; /** diff --git a/app/Http/Controllers/Fo/ProductController.php b/app/Http/Controllers/Fo/ProductController.php index 5e9c3810..f70c21d7 100644 --- a/app/Http/Controllers/Fo/ProductController.php +++ b/app/Http/Controllers/Fo/ProductController.php @@ -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; diff --git a/app/Http/Controllers/Fo/RecipeController.php b/app/Http/Controllers/Fo/RecipeController.php index b14fe22b..72bb33ba 100644 --- a/app/Http/Controllers/Fo/RecipeController.php +++ b/app/Http/Controllers/Fo/RecipeController.php @@ -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), diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index 67f936c7..83689531 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -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')); } diff --git a/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php b/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php index efeb2eb5..481ccc8f 100644 --- a/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php +++ b/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php @@ -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), ); } diff --git a/app/Models/BrandAdvantage.php b/app/Models/BrandAdvantage.php index 11ddeed9..dcda11ef 100644 --- a/app/Models/BrandAdvantage.php +++ b/app/Models/BrandAdvantage.php @@ -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 diff --git a/app/Models/ConsumptionMoment.php b/app/Models/ConsumptionMoment.php index 7347ddcd..72e77091 100644 --- a/app/Models/ConsumptionMoment.php +++ b/app/Models/ConsumptionMoment.php @@ -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 diff --git a/app/Models/DemarcheSlide.php b/app/Models/DemarcheSlide.php index 6b4be201..32f4f451 100644 --- a/app/Models/DemarcheSlide.php +++ b/app/Models/DemarcheSlide.php @@ -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 diff --git a/app/Models/GeneralSetting.php b/app/Models/GeneralSetting.php index 3cfb81f4..3820ea6b 100644 --- a/app/Models/GeneralSetting.php +++ b/app/Models/GeneralSetting.php @@ -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 */ diff --git a/app/Models/HistoricalMilestone.php b/app/Models/HistoricalMilestone.php index 00ed21e6..b48312fb 100644 --- a/app/Models/HistoricalMilestone.php +++ b/app/Models/HistoricalMilestone.php @@ -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 diff --git a/app/Models/KeyNumber.php b/app/Models/KeyNumber.php index c0949560..fa619bd5 100644 --- a/app/Models/KeyNumber.php +++ b/app/Models/KeyNumber.php @@ -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 diff --git a/app/Models/MainSlide.php b/app/Models/MainSlide.php index 40613da2..6bb9325e 100644 --- a/app/Models/MainSlide.php +++ b/app/Models/MainSlide.php @@ -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 diff --git a/app/Models/Meat.php b/app/Models/Meat.php index 46d44f55..b70cd7bf 100644 --- a/app/Models/Meat.php +++ b/app/Models/Meat.php @@ -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 diff --git a/app/Models/News.php b/app/Models/News.php index c74d2b4f..4e6d3f81 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -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 diff --git a/app/Models/NewsBreeding.php b/app/Models/NewsBreeding.php index ec9e49d8..0666082a 100644 --- a/app/Models/NewsBreeding.php +++ b/app/Models/NewsBreeding.php @@ -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 diff --git a/app/Models/NewsCategory.php b/app/Models/NewsCategory.php index b06ba54e..827d7991 100644 --- a/app/Models/NewsCategory.php +++ b/app/Models/NewsCategory.php @@ -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 diff --git a/app/Models/NewsCorporate.php b/app/Models/NewsCorporate.php index 19740c8d..ac4e8510 100644 --- a/app/Models/NewsCorporate.php +++ b/app/Models/NewsCorporate.php @@ -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 diff --git a/app/Models/Product.php b/app/Models/Product.php index e1f62ece..28a1e3ed 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -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 diff --git a/app/Models/Profession.php b/app/Models/Profession.php index 93b07334..f3aa81d8 100644 --- a/app/Models/Profession.php +++ b/app/Models/Profession.php @@ -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 diff --git a/app/Models/Range.php b/app/Models/Range.php index 925fd97c..bc4dc913 100644 --- a/app/Models/Range.php +++ b/app/Models/Range.php @@ -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 diff --git a/app/Models/Recipe.php b/app/Models/Recipe.php index d4a1b820..8fdf7082 100644 --- a/app/Models/Recipe.php +++ b/app/Models/Recipe.php @@ -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 diff --git a/app/Models/StaticPage.php b/app/Models/StaticPage.php index be936313..5a7c17b0 100644 --- a/app/Models/StaticPage.php +++ b/app/Models/StaticPage.php @@ -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() diff --git a/app/Models/Submeat.php b/app/Models/Submeat.php index 77739d95..9662b818 100644 --- a/app/Models/Submeat.php +++ b/app/Models/Submeat.php @@ -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 diff --git a/app/Models/Subrange.php b/app/Models/Subrange.php index 6fcc6c10..a9558e05 100644 --- a/app/Models/Subrange.php +++ b/app/Models/Subrange.php @@ -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 diff --git a/app/Models/SurveysAnswer.php b/app/Models/SurveysAnswer.php index b7acd8bb..315c8038 100644 --- a/app/Models/SurveysAnswer.php +++ b/app/Models/SurveysAnswer.php @@ -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. diff --git a/app/Models/Testimonial.php b/app/Models/Testimonial.php index dac6c3a0..79b787ec 100644 --- a/app/Models/Testimonial.php +++ b/app/Models/Testimonial.php @@ -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 diff --git a/app/Models/Video.php b/app/Models/Video.php index 5c188840..eb637122 100644 --- a/app/Models/Video.php +++ b/app/Models/Video.php @@ -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 diff --git a/app/Policies/HistoricalMilestonePolicy.php b/app/Policies/HistoricalMilestonePolicy.php index ccb32235..609942fd 100644 --- a/app/Policies/HistoricalMilestonePolicy.php +++ b/app/Policies/HistoricalMilestonePolicy.php @@ -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); + } } diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index b6e1497e..6de03d6c 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -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) { diff --git a/app/Traits/Requests/HasPicture.php b/app/Traits/Requests/HasPicture.php index d8c57086..aa72cad8 100644 --- a/app/Traits/Requests/HasPicture.php +++ b/app/Traits/Requests/HasPicture.php @@ -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 } /** diff --git a/app/View/Components/Fo/Story/HistoricalMilestoneComponent.php b/app/View/Components/Fo/Story/HistoricalMilestoneComponent.php index aa4ae12e..cb27e729 100644 --- a/app/View/Components/Fo/Story/HistoricalMilestoneComponent.php +++ b/app/View/Components/Fo/Story/HistoricalMilestoneComponent.php @@ -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 { diff --git a/app/View/Components/Fo/Story/WhoWeAre.php b/app/View/Components/Fo/Story/WhoWeAre.php index d4a149ab..7dd717a8 100644 --- a/app/View/Components/Fo/Story/WhoWeAre.php +++ b/app/View/Components/Fo/Story/WhoWeAre.php @@ -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, ]); diff --git a/database/migrations/2024_09_19_114210_add_picto_placement_historical_milestone_table.php b/database/migrations/2024_09_19_114210_add_picto_placement_historical_milestone_table.php new file mode 100644 index 00000000..683c2221 --- /dev/null +++ b/database/migrations/2024_09_19_114210_add_picto_placement_historical_milestone_table.php @@ -0,0 +1,30 @@ +string('picto_placement')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::table('historical_milestones', function (Blueprint $table) { + $table->dropColumn('picto_placement'); + }); + } +}; diff --git a/database/migrations/2024_09_19_125103_add_order_to_historical_milestones_table.php b/database/migrations/2024_09_19_125103_add_order_to_historical_milestones_table.php new file mode 100644 index 00000000..53cdb7e5 --- /dev/null +++ b/database/migrations/2024_09_19_125103_add_order_to_historical_milestones_table.php @@ -0,0 +1,45 @@ +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'); + }); + } +}; diff --git a/database/migrations/2024_09_19_142211_alter_source_key_numbers_table.php b/database/migrations/2024_09_19_142211_alter_source_key_numbers_table.php new file mode 100644 index 00000000..d340bea3 --- /dev/null +++ b/database/migrations/2024_09_19_142211_alter_source_key_numbers_table.php @@ -0,0 +1,28 @@ +string('source')->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('key_numbers', function (Blueprint $table) { + $table->string('source')->nullable(false)->change(); + }); + } +}; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 1765dc41..a8a5d10d 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -256,6 +256,7 @@ return [ 'demarche' => 'demarche', 'details' => 'details', 'difficulty' => 'difficulty', + 'emplacement' => 'emplacement', 'event' => 'event', 'function' => 'function', 'general_setting_type' => 'general setting type', diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 26aacf09..306f5656 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -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', diff --git a/resources/sass/fo/pages/home.scss b/resources/sass/fo/pages/home.scss index c7291147..524060d7 100644 --- a/resources/sass/fo/pages/home.scss +++ b/resources/sass/fo/pages/home.scss @@ -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; diff --git a/resources/sass/fo/pages/story.scss b/resources/sass/fo/pages/story.scss index d1ef1be2..01b1fe11 100644 --- a/resources/sass/fo/pages/story.scss +++ b/resources/sass/fo/pages/story.scss @@ -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 @@ } } } -} +} \ No newline at end of file diff --git a/resources/ts/fo/components/FilterCardsComponent.vue b/resources/ts/fo/components/FilterCardsComponent.vue index 10f5a250..665f424a 100644 --- a/resources/ts/fo/components/FilterCardsComponent.vue +++ b/resources/ts/fo/components/FilterCardsComponent.vue @@ -209,6 +209,11 @@ > +
+
+
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 ""; + }, + }, }; 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, } - } + }, + }; } diff --git a/resources/ts/fo/partials/historical-milestones.ts b/resources/ts/fo/partials/historical-milestones.ts index 5074ae38..deec7eef 100644 --- a/resources/ts/fo/partials/historical-milestones.ts +++ b/resources/ts/fo/partials/historical-milestones.ts @@ -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; - // 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; diff --git a/resources/views/bo/pages/historical_milestones/form.blade.php b/resources/views/bo/pages/historical_milestones/form.blade.php index 887a270f..1ea747d5 100644 --- a/resources/views/bo/pages/historical_milestones/form.blade.php +++ b/resources/views/bo/pages/historical_milestones/form.blade.php @@ -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, ])
+ + {{-- EMPLACEMENT --}} +
+
+ {{ str(__('validation.custom.emplacement'))->ucfirst() }} +
+
+ @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')), + ]), + ]) +
+
+
+
diff --git a/resources/views/bo/pages/historical_milestones/index-list.blade.php b/resources/views/bo/pages/historical_milestones/index-list.blade.php index fb2383a3..ae4f7f42 100644 --- a/resources/views/bo/pages/historical_milestones/index-list.blade.php +++ b/resources/views/bo/pages/historical_milestones/index-list.blade.php @@ -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(), ], ]) @@ -17,8 +18,8 @@ {{ $historicalMilestoneModel->year }} {{ $historicalMilestoneModel->title }} - {{ $historicalMilestoneModel->picture_alt }} + {{ $historicalMilestoneModel->picture_alt }} @include('bo.modules.change-published-status', [ 'routeName' => 'historical_milestones', @@ -27,10 +28,17 @@ {{ $historicalMilestoneModel->updated_at->isoFormat('LLLL') }} + @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 @canAny(['show', 'duplicate', 'update', 'delete'], $historicalMilestoneModel) -
+ @can('view', $historicalMilestoneModel) true, 'name' => 'source', - 'required' => true, + 'required' => false, 'model' => $keyNumberModel ?? null, 'helper' => __('validation.between.string', [ 'attribute' => __(':field :inter:model', [ diff --git a/resources/views/fo/pages/commitments/raise.blade.php b/resources/views/fo/pages/commitments/raise.blade.php index 7497b313..ad413e14 100644 --- a/resources/views/fo/pages/commitments/raise.blade.php +++ b/resources/views/fo/pages/commitments/raise.blade.php @@ -125,7 +125,7 @@ // All $collectionComplexItems = collect([$complexItem1, $complexItem2, $complexItem3, $complexItem4]); @endphp -
+
@include('fo.partials.commitments.complex-flex-items', [ 'background_color' => 'tertiary', 'collection' => $collectionComplexItems, @@ -249,21 +249,7 @@ ])
{{-- 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 diff --git a/resources/views/fo/pages/home.blade.php b/resources/views/fo/pages/home.blade.php index bbe4261d..22dba5ba 100644 --- a/resources/views/fo/pages/home.blade.php +++ b/resources/views/fo/pages/home.blade.php @@ -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(), ], ]; diff --git a/resources/views/fo/pages/products/show.blade.php b/resources/views/fo/pages/products/show.blade.php index ed42d1fa..4ec7d078 100644 --- a/resources/views/fo/pages/products/show.blade.php +++ b/resources/views/fo/pages/products/show.blade.php @@ -18,8 +18,8 @@ {{ $nextProductModel->packaging_alt }}
+ href="{{ route('fo.products.show', $nextProductModel->slug) }}" title="{{ __('Accéder au produit suivant') }}" + role="button">
{{ __('models.classes.product') }}
{{ __('suivant') }} @@ -35,8 +35,7 @@ @if (!is_null($prevProductModel) && $productModel->getKey() !== $prevProductModel->getKey())
- {{ __('Flèche marron') }} @endif @@ -44,20 +43,20 @@ @if ($productModel->new) {{ __('Tag pour un nouveau produit') }} + title="{{ __('Tag pour un nouveau produit') }}" alt="{{ __('Tag pour un nouveau produit') }}" /> @endif {{ $productModel->packaging_alt }} - {{ $productModel->picture_alt }} + @if ($productModel->picture) + {{ $productModel->picture_alt }} + @endif
@if (!is_null($nextProductModel) && $productModel->getKey() !== $nextProductModel->getKey()) - {{ __('Flèche marron') }} @endif @@ -84,16 +83,17 @@
@foreach ($productModel->labels->where('published', true) as $label) - {{ $label->picture_alt }} + @if ($label->picture) + {{ $label->picture_alt }} + @endif @endforeach
@endif {{-- RANGE --}}
@php $productRangeModel = $productModel->subrange ? $productModel->subrange->range : $productModel->range; @endphp - {{ $productRangeModel->label }} @@ -110,8 +110,7 @@
@foreach ($productModel->claims->where('published', true) as $claim)
- {{ __('Allégation icône') }}

{{ $claim->label }}

@@ -120,8 +119,7 @@ @endif {{-- BTN INGREDIENTS --}}
- @@ -153,8 +151,8 @@
@@ -167,8 +165,8 @@
{{-- RECIPES --}} diff --git a/resources/views/fo/pages/story.blade.php b/resources/views/fo/pages/story.blade.php index ec46cf34..f9fc65dc 100644 --- a/resources/views/fo/pages/story.blade.php +++ b/resources/views/fo/pages/story.blade.php @@ -53,13 +53,11 @@ {{-- TITLE/DESCRIPTION --}}
-
+

{{ $staticPageModel->data['story_title']['value'] }}

-

- {{ $staticPageModel->data['story_description']['value'] }} -

+ {!! clean($staticPageModel->data['story_description']['value']) !!}
@@ -170,6 +168,7 @@
+ {{-- DESKTOP HISTORICAL MILESTONES --}}
@@ -197,15 +196,17 @@
iteration % 2 ? 'rotate-right' : 'rotate-left', ])> @if (isset($historicalMilestoneModel->picto) && $historicalMilestoneModel->picto !== null) {{ $historicalMilestoneModel->picto_alt }}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 ( diff --git a/resources/views/fo/partials/commitments/complex-flex-items.blade.php b/resources/views/fo/partials/commitments/complex-flex-items.blade.php index 82720be3..8b3ce339 100644 --- a/resources/views/fo/partials/commitments/complex-flex-items.blade.php +++ b/resources/views/fo/partials/commitments/complex-flex-items.blade.php @@ -7,7 +7,7 @@

{{ $title }}

@if (isset($subtitle)) -

{{ $subtitle }}

+

{{ $subtitle }}

@endif
diff --git a/routes/web-bo.php b/routes/web-bo.php index 1c9400a1..bac77558 100644 --- a/routes/web-bo.php +++ b/routes/web-bo.php @@ -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);