From f332793a7e463a043dc67bb5b7fbc35df52144f7 Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Wed, 2 Oct 2024 09:57:11 +0200 Subject: [PATCH 01/11] Feat: Display nutritionnal values in FO --- app/Http/Controllers/Fo/ProductController.php | 19 ++--- resources/lang/fr/validation.php | 10 +++ resources/sass/fo/pages/product.scss | 26 ++++++- .../views/fo/pages/products/show.blade.php | 72 +++++++++++++++++-- 4 files changed, 114 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Fo/ProductController.php b/app/Http/Controllers/Fo/ProductController.php index f70c21d7..c579828e 100644 --- a/app/Http/Controllers/Fo/ProductController.php +++ b/app/Http/Controllers/Fo/ProductController.php @@ -98,15 +98,18 @@ class ProductController extends Controller /** @var \App\Models\Video $videoModel */ $videoModel = $productModel->videos->sortByDesc('created_at')->first(); + $nutritionnalValueModel = $productModel->getNutritionnalValue(); + return view('fo.pages.products.show', [ - 'productModel' => $productModel, - 'prevProductModel' => $productModelSibling[0], - 'nextProductModel' => $productModelSibling[1], - 'productModels' => $this->getProductsFiltered($productModel), - 'recipeModels' => $this->getRecipesFiltered($productModel), - 'recipeModel' => $recipeModel, - 'videoModel' => $videoModel, - 'staticPageModel' => $staticPageModel, + 'productModel' => $productModel, + 'nutritionnalValueModel' => $nutritionnalValueModel, + 'prevProductModel' => $productModelSibling[0], + 'nextProductModel' => $productModelSibling[1], + 'productModels' => $this->getProductsFiltered($productModel), + 'recipeModels' => $this->getRecipesFiltered($productModel), + 'recipeModel' => $recipeModel, + 'videoModel' => $videoModel, + 'staticPageModel' => $staticPageModel, ]); } diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 306f5656..566cd752 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -319,5 +319,15 @@ return [ ], 'code' => 'code', 'used' => 'utilisé', + 'nutritionnal_values' => [ + 'energy' => 'énergie', + 'proteins' => 'protéines', + 'carbohydrates' => 'glucides', + 'sugar' => 'dont sucres', + 'fat' => 'matières grasses', + 'saturated_fatty_acids' => 'dont Acides Gras Saturés', + 'dietary_fiber' => 'fibres alimentaires', + 'salt' => 'sel', + ] ], ]; diff --git a/resources/sass/fo/pages/product.scss b/resources/sass/fo/pages/product.scss index 0b74df5c..8bb97ae4 100644 --- a/resources/sass/fo/pages/product.scss +++ b/resources/sass/fo/pages/product.scss @@ -78,7 +78,7 @@ right: 30%; width: 20rem; transform: rotate(-2deg); - transition: top .5s,bottom .5s,transform .5s; + transition: top .5s, bottom .5s, transform .5s; @include media-breakpoint-up(xxl) { width: 24rem; @@ -159,6 +159,30 @@ left: 9rem; } } + + .nut-val-left-col { + border-right: 1rem solid #fff; + } + + .nut-val-row { + border-bottom: 0.4rem solid #fff; + + &-odd { + --bs-table-bg: var(--bs-light) !important; + + background-color: $color-light !important; + } + + &-even { + --bs-table-bg: var(--bs-tertiary) !important; + + background-color: $color-tertiary !important; + } + } + + .nut-val-header { + --bs-table-bg: #fff !important; + } } &-commitments { diff --git a/resources/views/fo/pages/products/show.blade.php b/resources/views/fo/pages/products/show.blade.php index a857b809..811d0978 100644 --- a/resources/views/fo/pages/products/show.blade.php +++ b/resources/views/fo/pages/products/show.blade.php @@ -255,7 +255,6 @@ {{-- PRODUCT INGREDIENT MODAL --}} - {{-- FIXME: add nutritionnal values when it's ready --}}