diff --git a/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php b/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php index 22dcb3f4..88300adc 100644 --- a/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php +++ b/resources/views/Shop/Articles/partials/ArticleAddBasket.blade.php @@ -1,9 +1,6 @@ @php // Check if article is not visible OR has no offers at all - $hasNoOffers = empty($article['offers']['semences'] ?? false) - && empty($article['offers']['plants'] ?? false) - && empty($article['offers']['legumes'] ?? false) - && empty($article['offers']['marchandise'] ?? false); + $hasNoOffers = empty($article['offers'] ?? false) || !array_filter($article['offers']); $shouldShowComingSoon = !($article['visible'] ?? true) || $hasNoOffers; @endphp @@ -19,41 +16,16 @@ @else {{-- Display normal offers for visible articles with available offers --}} - @if ($article['offers']['semences'] ?? false) - @include('Shop.Articles.partials.addBasket', [ - 'data' => $article['offers']['semences'], - 'title' => 'Semences', - 'model' => 'semences', - 'bgClass' => 'bg-green-light', - ]) - @endif - - @if ($article['offers']['plants'] ?? false) - @include('Shop.Articles.partials.addBasket', [ - 'data' => $article['offers']['plants'], - 'title' => 'Plants', - 'model' => 'plants', - 'bgClass' => 'bg-green-light', - ]) - @endif - - @if ($article['offers']['legumes'] ?? false) - @include('Shop.Articles.partials.addBasket', [ - 'data' => $article['offers']['legumes'], - 'title' => 'Légumes', - 'model' => 'legumes', - 'bgClass' => 'bg-green-light', - ]) - @endif - - @if ($article['offers']['marchandise'] ?? false) - @include('Shop.Articles.partials.addBasket', [ - 'data' => $article['offers']['marchandise'], - 'title' => 'Marchandises', - 'model' => 'marchandise', - 'bgClass' => 'bg-green-light', - ]) - @endif + @foreach ($article['offers'] as $natureKey => $natureOffers) + @if (!empty($natureOffers)) + @include('Shop.Articles.partials.addBasket', [ + 'data' => $natureOffers, + 'title' => ucfirst($natureKey), + 'model' => $natureKey, + 'bgClass' => 'bg-green-light', + ]) + @endif + @endforeach @endif @include('load.basket')