diff --git a/app/Http/Controllers/Shop/ArticleController.php b/app/Http/Controllers/Shop/ArticleController.php index 9eb8dd49..fe461fc6 100644 --- a/app/Http/Controllers/Shop/ArticleController.php +++ b/app/Http/Controllers/Shop/ArticleController.php @@ -18,5 +18,4 @@ class ArticleController extends Controller // exit; return view('Shop.Articles.show', $data); } - } diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index fd1a5be0..8c5b7da3 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -8,6 +8,7 @@ use App\Http\Controllers\Controller; use App\Repositories\Shop\Categories; use App\Repositories\Shop\Offers; use App\Repositories\Shop\Tags; +use App\Repositories\Shop\TagGroups; class CategoryController extends Controller { @@ -22,6 +23,7 @@ class CategoryController extends Controller $data['category'] = Categories::getFull($id); $data['offers'] = Offers::getByCategoryWithTags($id); $data['tags'] = Tags::getWithCountOffers(); + $data['tags2'] = TagGroups::getWithTagsAndCountOffers(); dump($data); exit; return view('Shop.shelve', $data); diff --git a/app/Http/Controllers/Shop/HomeController.php b/app/Http/Controllers/Shop/HomeController.php index 92d208f1..097d8804 100644 --- a/app/Http/Controllers/Shop/HomeController.php +++ b/app/Http/Controllers/Shop/HomeController.php @@ -8,6 +8,7 @@ use App\Http\Controllers\Controller; use App\Repositories\Shop\Articles; use App\Repositories\Shop\Categories; use App\Repositories\Shop\Offers; +use App\Repositories\Shop\Tags; class HomeController extends Controller { @@ -23,6 +24,8 @@ class HomeController extends Controller $data['display_by_rows'] = $input['by_rows'] ?? false; // $data['offers'] = Offers::getLast()->toArray(); $data['articles'] = Articles::getArticlesToSell(); + $data['tags'] = Tags::getWithCountOffers(); + // $data['prices'] = $data['articles']['offers'][0]['tariff']['price_lists'][0]['price_list_values'][0]; // dump($data); // exit; diff --git a/app/Repositories/Shop/TagGroups.php b/app/Repositories/Shop/TagGroups.php index ba83b6e7..a0775eb8 100644 --- a/app/Repositories/Shop/TagGroups.php +++ b/app/Repositories/Shop/TagGroups.php @@ -19,6 +19,11 @@ class TagGroups return TagGroup::get()->SortBy('name')->pluck('name', 'id')->toArray(); } + public static function getWithTagsAndCountOffers() + { + return TagGroup::with('tags')->withCount(['tags.articles'])->get()->toArray(); + } + public static function getTreeTags() { $items = TagGroup::with('tags')->get(); diff --git a/resources/views/Shop/Articles/show.blade.php b/resources/views/Shop/Articles/show.blade.php index 16c7ef5b..66c908f7 100644 --- a/resources/views/Shop/Articles/show.blade.php +++ b/resources/views/Shop/Articles/show.blade.php @@ -18,16 +18,32 @@ 'title' => 'Semence', 'class' => 'mb-3', ]) - @include('components.form.button', [ - 'class' => 'btn-success basket semences', - 'txt' => 'Ajouter au panier', - ]) + @include('components.form.button', [ + 'class' => 'btn-success basket semences', + 'txt' => 'Ajouter au panier', + ]) @endcomponent @component('components.card', [ 'title' => 'Plant', + 'class' => 'mb-3', ]) + @include('components.form.button', [ + 'class' => 'btn-success basket plants', + 'txt' => 'Ajouter au panier', + ]) @endcomponent + + @component('components.card', [ + 'title' => 'Légume', + 'class' => 'mb-3', + ]) + @include('components.form.button', [ + 'class' => 'btn-success basket legumes', + 'txt' => 'Ajouter au panier', + ]) + @endcomponent + @endsection diff --git a/resources/views/Shop/Tags/partials/filter.blade.php b/resources/views/Shop/Tags/partials/filter.blade.php new file mode 100644 index 00000000..7e5f68ec --- /dev/null +++ b/resources/views/Shop/Tags/partials/filter.blade.php @@ -0,0 +1,2 @@ +@foreach ($tags as $tag) +@endforeach \ No newline at end of file diff --git a/resources/views/Shop/home.blade.php b/resources/views/Shop/home.blade.php index ce42c97b..1c23495c 100644 --- a/resources/views/Shop/home.blade.php +++ b/resources/views/Shop/home.blade.php @@ -3,9 +3,15 @@ ]) @section('content') - @if ($display_by_rows ?? false) - @include('Shop.layout.partials.category_articles_rows') - @else - @include('Shop.layout.partials.category_articles') - @endif +
+
+
+
+ @if ($display_by_rows ?? false) + @include('Shop.layout.partials.category_articles_rows') + @else + @include('Shop.layout.partials.category_articles') + @endif +
+
@endsection \ No newline at end of file