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)
|
||||
{
|
||||
$productTypes = Articles::getProductTypesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
if ($articleNatureId) {
|
||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||
dump($productType);
|
||||
exit;
|
||||
} else {
|
||||
$articleNature = $request->input('article_nature');
|
||||
if (!$articleNature) {
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
if (! $articleNature) {
|
||||
if (count($articleNatures) === 1) {
|
||||
$articleNature = $articleNatures[0];
|
||||
} else {
|
||||
$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);
|
||||
}
|
||||
$data = [
|
||||
@@ -65,6 +62,8 @@ class CategoryController extends Controller
|
||||
]),
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||
];
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Shop.Shelves.shelve', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +1,14 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">
|
||||
<div class="row btn h-100 products @if($article_nature == 'semences') shadow2 @endif" data-id="semences">
|
||||
<div class="col-lg-6 col-xs-12">
|
||||
<img src="/img/article_natures/semences.png" class="img-fluid">
|
||||
@foreach ($article_natures as $nature)
|
||||
<div class="col-4">
|
||||
<div class="row btn h-100 products @if($article_nature == $nature) shadow2 @endif" data-id="{{ $nature }}">
|
||||
<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 class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Semences </div>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
|
||||
Reference in New Issue
Block a user