adapt display of article natures by disponibility of offers in shelve
This commit is contained in:
@@ -21,31 +21,28 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
public function show(Request $request, $categoryId, $articleNatureId = false)
|
public function show(Request $request, $categoryId, $articleNatureId = false)
|
||||||
{
|
{
|
||||||
|
$productTypes = Articles::getProductTypesWithOffers([
|
||||||
|
'category_id' => $categoryId,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||||
|
'category_id' => $categoryId,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($articleNatureId) {
|
if ($articleNatureId) {
|
||||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||||
dump($productType);
|
dump($productType);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
$articleNature = $request->input('article_nature');
|
$articleNature = $request->input('article_nature');
|
||||||
if (!$articleNature) {
|
if (! $articleNature) {
|
||||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
|
||||||
'category_id' => $categoryId,
|
|
||||||
]);
|
|
||||||
if (count($articleNatures) === 1) {
|
if (count($articleNatures) === 1) {
|
||||||
$articleNature = $articleNatures[0];
|
$articleNature = $articleNatures[0];
|
||||||
} else {
|
} else {
|
||||||
$articleNature = 'semences';
|
$articleNature = 'semences';
|
||||||
}
|
}
|
||||||
$productTypes = Articles::getProductTypesWithOffers([
|
|
||||||
'category_id' => $categoryId,
|
|
||||||
]);
|
|
||||||
if (count($productTypes) === 1) {
|
|
||||||
$productType = $productTypes[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
|
||||||
}
|
}
|
||||||
|
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
||||||
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
|
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
@@ -65,6 +62,8 @@ class CategoryController extends Controller
|
|||||||
]),
|
]),
|
||||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||||
];
|
];
|
||||||
|
// dump($data);
|
||||||
|
// exit;
|
||||||
return view('Shop.Shelves.shelve', $data);
|
return view('Shop.Shelves.shelve', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,14 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-4">
|
@foreach ($article_natures as $nature)
|
||||||
<div class="row btn h-100 products @if($article_nature == 'semences') shadow2 @endif" data-id="semences">
|
<div class="col-4">
|
||||||
<div class="col-lg-6 col-xs-12">
|
<div class="row btn h-100 products @if($article_nature == $nature) shadow2 @endif" data-id="{{ $nature }}">
|
||||||
<img src="/img/article_natures/semences.png" class="img-fluid">
|
<div class="col-lg-6 col-xs-12">
|
||||||
|
<img src="{{ App\Repositories\Shop\ArticleNatures::getIconBySlug($nature) }}" class="img-fluid">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Semences </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Semences </div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endforeach
|
||||||
<div class="col-4">
|
|
||||||
<div class="row btn h-100 products @if($article_nature == 'plants') shadow2 @endif" data-id="plants">
|
|
||||||
<div class="col-lg-6 col-xs-12">
|
|
||||||
<img src="/img/article_natures/plants.png" class="img-fluid" class="img-fluid">
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Plants </div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-4">
|
|
||||||
<div class="row btn h-100 products @if($article_nature == 'legumes') shadow2 @endif" data-id="legumes">
|
|
||||||
<div class="col-lg-6 col-xs-12">
|
|
||||||
<img src="/img/article_natures/legumes.png" class="img-fluid" class="img-fluid">
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Légumes </div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row d-none">
|
|
||||||
<div class="col-12 text-right">
|
|
||||||
@include('components.form.button', [
|
|
||||||
'data_id' => 'semences',
|
|
||||||
'icon' => 'fa-leaf',
|
|
||||||
'class' => 'products bg-yellow yellow-dark' . (($article_nature == 'semences') ? ' d-none' : ''),
|
|
||||||
'title' => 'Par semences',
|
|
||||||
])
|
|
||||||
@include('components.form.button', [
|
|
||||||
'data_id' => 'plants',
|
|
||||||
'icon' => 'fa-seedling',
|
|
||||||
'class' => 'products bg-green text-white' . (($article_nature == 'plants') ? ' d-none' : ''),
|
|
||||||
'title' => 'Par plants',
|
|
||||||
])
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
|||||||
Reference in New Issue
Block a user