fix layout

This commit is contained in:
Ludovic CANDELLIER
2022-12-21 18:33:15 +01:00
parent 9895266798
commit ae39681cb0
16 changed files with 164 additions and 135 deletions

View File

@@ -20,19 +20,37 @@ class CategoryController extends Controller
public function show(Request $request, $category_id) public function show(Request $request, $category_id)
{ {
switch ($request->input('article_nature')) {
case 'semences':
$product_type = 'botanic';
$article_nature_id = 1;
break;
case 'plants':
$product_type = 'botanic';
$article_nature_id = 2;
break;
default:
$product_type = 'botanic';
$article_nature_id = 1;
break;
}
$data = [ $data = [
'category' => Categories::getFull($category_id), 'category' => Categories::getFull($category_id),
'breadcrumb' => Categories::getAncestorsByCategory($category_id), 'breadcrumb' => Categories::getAncestorsByCategory($category_id),
'display_by_rows' => $request->input('display_by_rows') ?? false, 'display_by_rows' => $request->input('display_by_rows') ?? false,
'product_type' => $request->input('product_type') ?? 'botanic', 'product_type' => $product_type,
'article_nature' => $request->input('article_nature'),
'tags_selected' => $request->input('tags') ?? [], 'tags_selected' => $request->input('tags') ?? [],
'articles' => Articles::getArticlesToSell([ 'articles' => Articles::getArticlesToSell([
'category_id' => $category_id, 'category_id' => $category_id,
'tags' => $request->input('tags') ?? [], 'tags' => $request->input('tags') ?? [],
'product_type' => $request->input('product_type') ?? 'botanic', 'product_type' => $product_type,
'article_nature_id' => $article_nature_id ?? false,
]), ]),
'tags' => TagGroups::getWithTagsAndCountOffers($category_id), 'tags' => TagGroups::getWithTagsAndCountOffers($category_id),
]; ];
// dump($data);
// exit;
return view('Shop.Shelves.shelve', $data); return view('Shop.Shelves.shelve', $data);
} }

View File

@@ -44,7 +44,8 @@
label: '{{ __('Commander') }}', label: '{{ __('Commander') }}',
className: 'btn-success', className: 'btn-success',
callback: function() { callback: function() {
window.location = "{{ route('Shop.Orders.order') }}"; console.log('ici');
window.location = "{{ route('Shop.Basket.basket') }}";
} }
}, },
}; };

View File

@@ -1,7 +1,7 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="{{ ($product_type == 'botanic') ? 'green-dark' : 'green-dark' }}"> <a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="{{ ($product_type == 'botanic') ? 'green-dark' : 'green-dark' }}">
<div class="card {{ ($product_type == 'botanic') ? 'bg-yellow' : 'bg-green-light' }}"> <div class="card {{ ($article_nature == 'semences') ? 'bg-yellow' : 'bg-green-light' }}">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}"> <img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
<div class="card-body"> <div class="card-body p-2 pb-1">
<div class="row card-title"> <div class="row card-title">
<div class="col-12"> <div class="col-12">
<!-- <!--

View File

@@ -1,22 +1,36 @@
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-7">
<span style="font-size: 1.4em"> @if ($article_nature == 'semences')
@if ($article['semences'] ?? false) <strong>Semences</strong><br/>
{{ $article['semences']['price'] ?? null }}</span> <small>
@else {{ $article['semences']['variation'] ?? null }}
- </small>
@endif @endif
</span><br/> @if ($article_nature == 'plants')
<strong>Semence</strong> <strong>Plants</strong><br/>
<small>
{{ $article['plants']['variation'] ?? null }}
</small>
@endif
</div> </div>
<div class="col-6"> <div class="col-5 text-right" style="font-weight: 700; font-size: 1.1em;">
<span style="font-size: 1.4em"> @if ($article_nature == 'semences')
@if ($article['plants'] ?? false) <span style="font-size: 1.4em">
{{ $article['plants']['price'] }}</span> @if ($article['semences'] ?? false)
@else {{ $article['semences']['price'] ?? null }}</span>
- @else
@endif -
</span><br/> @endif
<strong>Plant</strong> </span><br/>
@endif
@if ($article_nature == 'plants')
<span style="font-size: 1.4em">
@if ($article['plants'] ?? false)
{{ $article['plants']['price'] }}</span>
@else
-
@endif
</span><br/>
@endif
</div> </div>
</div> </div>

View File

@@ -16,8 +16,8 @@
</div> </div>
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark"> <a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div class="row"> <div class="row">
<div class="col-2"> <div class="col-2 pr-0">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="..."> <img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top shadow" alt="...">
</div> </div>
<div class="col-10 text-justify"> <div class="col-10 text-justify">
{!! $article['description'] !!} {!! $article['description'] !!}

View File

@@ -1,5 +1,5 @@
@if ($article['semences'] ?? false) @if ($article_nature == 'semences')
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border border-success text-center"> <div class="w-100 mt-3 p-1 bg-yellow yellow-dark rounded-lg border text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br> <span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }} {{ $article['semences']['variation'] }}
<div> <div>
@@ -13,8 +13,8 @@
</div> </div>
@endif @endif
@if ($article['plants'] ?? false) @if ($article_nature == 'plants')
<div class="w-100 mt-3 p-1 bg-yellow-light yellow-dark border border-warning text-center"> <div class="w-100 mt-3 p-1 bg-green green-dark rounded-lg border text-center text-white">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br> <span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }} {{ $article['plants']['variation'] }}
<div> <div>

View File

@@ -0,0 +1,9 @@
<h1 style="font-size: 1.5em;">
@foreach($breadcrumb ?? [] as $parent)
<a href="{{ route('Shop.Categories.show', ['id' => $parent['id']]) }}" style="text-decoration: none; color: inherit;">{{ $parent['name'] }}</a> /
@endforeach
<span style="font-size: 1.4em;">
{{ $category['name'] }}
</span>
</h1>
<h3 style="font-size: 1.2em;">{!! $category['description'] !!}</h3>

View File

@@ -1,31 +1,15 @@
<div class="row"> <div class="row">
<div class="col-12 text-right"> <div class="col-12 text-right">
@if ($display_by_rows ?? false)
@include('components.form.button', [
'id' => 'by_cards',
'icon' => 'fa-th',
'class' => 'btn-secondary',
'title' => 'Vue par vignettes',
])
@else
@include('components.form.button', [
'id' => 'by_rows',
'icon' => 'fa-list',
'class' => 'btn-secondary',
'title' => 'Vue par lignes',
])
@endif
@include('components.form.button', [ @include('components.form.button', [
'data_id' => 'botanic', 'data_id' => 'semences',
'icon' => 'fa-leaf', 'icon' => 'fa-leaf',
'class' => 'products bg-yellow yellow-dark', 'class' => 'products bg-yellow yellow-dark' . (($article_nature == 'semences') ? ' d-none' : ''),
'title' => 'Par semences', 'title' => 'Par semences',
]) ])
@include('components.form.button', [ @include('components.form.button', [
'data_id' => 'merchandise', 'data_id' => 'plants',
'icon' => 'fa-seedling', 'icon' => 'fa-seedling',
'class' => 'products bg-green text-white', 'class' => 'products bg-green text-white' . (($article_nature == 'plants') ? ' d-none' : ''),
'title' => 'Par plants', 'title' => 'Par plants',
]) ])
@@ -43,7 +27,7 @@
$('#category-form').submit(); $('#category-form').submit();
}); });
$('.products').click(function() { $('.products').click(function() {
$('#product_type').val($(this).data('id')); $('#article_nature').val($(this).data('id'));
$('#category-form').submit(); $('#category-form').submit();
}); });
</script> </script>

View File

@@ -2,9 +2,9 @@
@if ($articles ?? false) @if ($articles ?? false)
@foreach ($articles as $product_name => $article) @foreach ($articles as $product_name => $article)
@if ((($product_type == 'botanic') && (($article['semences'] ?? false) || ($article['plants'] ?? false))) || (($product_type == 'merchandise') &&($article['mercchandises'] ?? false))) @if ((($product_type == 'botanic') && (($article['semences'] ?? false) || ($article['plants'] ?? false))) || (($product_type == 'merchandise') &&($article['mercchandises'] ?? false)))
<div class="col-3 mb-3"> <div class="col-3 mb-3">
@include('Shop.Articles.partials.article') @include('Shop.Articles.partials.article')
</div> </div>
@endif @endif
@endforeach @endforeach
@endif @endif

View File

@@ -7,21 +7,14 @@
{{ Form::open(['id' => 'category-form', 'autocomplete' => 'off']) }} {{ Form::open(['id' => 'category-form', 'autocomplete' => 'off']) }}
<input type="hidden" id="display_by_rows" name="display_by_rows" value="{{ $display_by_rows ?? false }}"> <input type="hidden" id="display_by_rows" name="display_by_rows" value="{{ $display_by_rows ?? false }}">
<input type="hidden" id="product_type" name="product_type" value="{{ $product_type ?? false }}"> <input type="hidden" id="product_type" name="product_type" value="{{ $product_type ?? false }}">
<input type="hidden" id="article_nature" name="article_nature" value="{{ $article_nature ?? false }}">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-3"> <div class="col-3">
@include('Shop._partials.display_filters') @include('Shop._partials.display_filters')
</div> </div>
<div class="col-6"> <div class="col-6">
<h1 style="font-size: 1.5em;"> @include('Shop.Shelves.partials.breadcrumb')
@foreach($breadcrumb ?? [] as $parent)
<a href="{{ route('Shop.Categories.show', ['id' => $parent['id']]) }}" style="text-decoration: none; color: inherit;">{{ $parent['name'] }}</a> /
@endforeach
<span style="font-size: 1.4em;">
{{ $category['name'] }}
</span>
</h1>
<h3 style="font-size: 1.2em;">{!! $category['description'] !!}</h3>
</div> </div>
<div class="col-3"> <div class="col-3">
@include('Shop.Shelves.partials.category_add') @include('Shop.Shelves.partials.category_add')

View File

@@ -7,31 +7,29 @@
</div> </div>
</div> </div>
<form id="filter"> @if ($tags ?? false)
@if ($tags ?? false) @foreach ($tags as $tag_group_id => $group)
@foreach ($tags as $tag_group_id => $group) @if ($group['tags'] ?? false)
@if ($group['tags'] ?? false) @component('components.layout.box-collapse', [
@component('components.layout.box-collapse', [ 'title' => $group['name'],
'title' => $group['name'], 'id' => 'tag_group_' . $tag_group_id,
'id' => 'tag_group_' . $tag_group_id, ])
]) @foreach ($group['tags'] as $tag)
@foreach ($group['tags'] as $tag) <div class="form-inline">
<div class="form-inline"> @include('components.form.checkboxes.icheck', [
@include('components.form.checkboxes.icheck', [ 'name' => 'tags[]',
'name' => 'tags[]', 'val' => $tag['id'],
'val' => $tag['id'], 'value' => in_array($tag['id'], $tags_selected ?? []),
'value' => in_array($tag['id'], $tags_selected ?? []), 'id_name' => 'tag_' . $tag['id'],
'id_name' => 'tag_' . $tag['id'], 'class' => 'filter_tags',
'class' => 'filter_tags', ])
]) {{ $tag['name'] }} ({{ $tag['count'] }})
{{ $tag['name'] }} ({{ $tag['count'] }}) </div>
</div> @endforeach
@endforeach @endcomponent
@endcomponent @endif
@endif @endforeach
@endforeach @endif
@endif
</form>
</section> </section>
</aside> </aside>
@@ -49,5 +47,13 @@
$('#category-form').submit(); $('#category-form').submit();
}) })
initChevron(); initChevron();
$('#reset_filters').click(function() {
$("input[type=checkbox]").each(function() {
$(this).prop("checked", false);
});
$('#category-form').submit();
});
</script> </script>
@endpush @endpush

View File

@@ -1,12 +1,28 @@
@if (!($no_filter ?? false)) @if (!($no_filter ?? false))
Filtres <button type="button" class="btn btn-success" id="filters" title="Filtres" data-toggle="tooltip">
<a id="filters" href="#" class="btn btn-success p-0"> <span id="filter-on" class="fa fa-fw @if ($filter_on ?? false) d-none" @endif">
<span id="filter-on" class="fa-stack fa-sm @if ($filter_on ?? false) d-none" @endif"> <i class="fa fa-filter"></i>
<i class="fa fa-stack-1x fa-filter"></i>
</span> </span>
<span id="filter-off" class="fa-stack fa-sm @if (!($filter_on ?? false)) d-none" @endif"> <span id="filter-off" class="fa-stack fa fa-fw @if (!($filter_on ?? false)) d-none" @endif" style="font-size: 0.75em;">
<i class="fa fa-stack-1x fa-eye"></i> <i class="fa fa-stack-1x fa-filter"></i>
<i class="fa fa-stack-2x fa-ban" style="color:Tomato"></i> <i class="fa fa-stack-2x fa-ban" style="color:Tomato"></i>
</span> </span>
</a> </button>
@endif @endif
@if ($display_by_rows ?? false)
@include('components.form.button', [
'id' => 'by_cards',
'icon' => 'fa-th',
'class' => 'btn-secondary',
'title' => 'Vue par vignettes',
])
@else
@include('components.form.button', [
'id' => 'by_rows',
'icon' => 'fa-list',
'class' => 'btn-secondary',
'title' => 'Vue par lignes',
])
@endif

View File

@@ -29,7 +29,7 @@
lazyLoad: 'ondemand', lazyLoad: 'ondemand',
slidesToShow: 6, slidesToShow: 6,
slidesToScroll: 1, slidesToScroll: 1,
dots: true, dots: false,
autoplay: true, autoplay: true,
autoplaySpeed: 5000 autoplaySpeed: 5000
}); });

View File

@@ -1,45 +1,23 @@
<div class="container"> <div class="container">
<div class="row rounded m-0 drop-shadow bg-white p-2"> <div class="row rounded m-0 drop-shadow bg-white p-2">
<div class="col mb-4"> <div class="col mb-4">
@for ($i = 0; $i < round(count($category['children']) / 3); $i++) <strong>
<strong> <a class="green-dark @if (($category['id'] ?? false) == $menu['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}">
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $category['children'][$i]['id']]) }}"> Tous les articles
{{ $category['children'][$i]['name'] }} </a>
</a> </strong><br>
</strong><br> @for ($i = 0; $i < round(count($menu['children']) / 3); $i++)
@foreach ($category['children'][$i]['children'] ?? [] as $leaf) @include('Shop.layout.partials.megamenu_leafs')
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
{{ $leaf['name'] }}
</a><br>
@endforeach
@endfor @endfor
</div> </div>
<div class="col mb-4"> <div class="col mb-4">
@for ($i = round(count($category['children']) / 3); $i < round(2 * count($category['children']) / 3); $i++) @for ($i = round(count($menu['children']) / 3); $i < round(2 * count($menu['children']) / 3); $i++)
<strong> @include('Shop.layout.partials.megamenu_leafs')
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $category['children'][$i]['id']]) }}">
{{ $category['children'][$i]['name'] }}
</a>
</strong><br>
@foreach ($category['children'][$i]['children'] ?? [] as $leaf)
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
{{ $leaf['name'] }}
</a><br>
@endforeach
@endfor @endfor
</div> </div>
<div class="col mb-4"> <div class="col mb-4">
@for ($i = round(2 * count($category['children']) / 3); $i < count($category['children']); $i++) @for ($i = round(2 * count($menu['children']) / 3); $i < count($menu['children']); $i++)
<strong> @include('Shop.layout.partials.megamenu_leafs')
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $category['children'][$i]['id']]) }}">
{{ $category['children'][$i]['name'] }}
</a>
</strong><br>
@foreach ($category['children'][$i]['children'] ?? [] as $leaf)
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
{{ $leaf['name'] }}
</a><br>
@endforeach
@endfor @endfor
</div> </div>
</div> </div>

View File

@@ -0,0 +1,10 @@
<strong>
<a class="green-dark @if (($category['id'] ?? false) == $menu['children'][$i]['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['children'][$i]['id']]) }}">
{{ $menu['children'][$i]['name'] }}
</a>
</strong><br>
@foreach ($menu['children'][$i]['children'] ?? [] as $leaf)
<a class="green-dark @if (($category['id'] ?? false) == $leaf['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
{{ $leaf['name'] }}
</a><br>
@endforeach

View File

@@ -3,18 +3,18 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light "> <nav class="navbar navbar-expand-lg navbar-light bg-light ">
<div class="collapse navbar-collapse" id="navbarContent"> <div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav"> <ul class="navbar-nav">
@foreach ($categories as $category) @foreach ($categories as $menu)
<li class="nav-item dropdown megamenu"> <li class="nav-item dropdown megamenu">
@if (isset($category['children'])) @if ($menu['children'] ?? false)
<a id="megamenu_{{ $category['id'] }}" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle font-weight-bold text-uppercase"> <a id="megamenu_{{ $menu['id'] }}" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle font-weight-bold text-uppercase @if (($category['id'] ?? false) == $menu['id']) active @endif">
{{ $category['name'] }} {{ $menu['name'] }}
</a> </a>
<div aria-labelledby="megamenu_{{ $category['id'] }}" class="dropdown-menu border-0 p-0 m-0"> <div aria-labelledby="megamenu_{{ $menu['id'] }}" class="dropdown-menu border-0 p-0 m-0">
@include('Shop.layout.partials.megamenu') @include('Shop.layout.partials.megamenu')
</div> </div>
@else @else
<a href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}" class="nav-link font-weight-bold text-uppercase"> <a href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}" class="nav-link font-weight-bold text-uppercase @if (($category['id'] ?? false) == $menu['id']) active @endif">
{{ $category['name'] }} {{ $menu['name'] }}
</a> </a>
@endif @endif
</li> </li>