Add toggle by rows/by cards
This commit is contained in:
@@ -18,9 +18,10 @@ class CategoryController extends Controller
|
|||||||
return $dataTable->render('Shop.Categories.list');
|
return $dataTable->render('Shop.Categories.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($category_id)
|
public function show(Request $request, $category_id)
|
||||||
{
|
{
|
||||||
$data = self::init();
|
$data = self::init();
|
||||||
|
$data['display_by_rows'] = $request->input('by_rows') ?? false;
|
||||||
$data['category'] = Categories::getFull($category_id);
|
$data['category'] = Categories::getFull($category_id);
|
||||||
$data['articles'] = Articles::getArticlesToSell($category_id);
|
$data['articles'] = Articles::getArticlesToSell($category_id);
|
||||||
$data['tags'] = TagGroups::getWithTagsAndCountOffers();
|
$data['tags'] = TagGroups::getWithTagsAndCountOffers();
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
@include("Shop.layout.partials.header")
|
@include("Shop.layout.partials.header")
|
||||||
|
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@@ -35,13 +33,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include("Shop.layout.partials.footer")
|
@include("Shop.layout.partials.footer")
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="/js/site.min.js" ></script>
|
<script type="text/javascript" src="/js/site.min.js" ></script>
|
||||||
|
|
||||||
@stack('scripts')
|
@stack('scripts')
|
||||||
|
|||||||
@@ -15,9 +15,31 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
Il y a {{ count($articles) ?? 0 }} article(s) dans la liste
|
Il y a {{ count($articles) ?? 0 }} article(s) dans la liste
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
@include('components.form.button', ['id' => 'by_cards', 'icon' => 'fa-th', 'class' => 'btn-success'])
|
||||||
|
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-success'])
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
<form name="product_sorting">
|
<form name="product_sorting">
|
||||||
<label>Trier par</label>
|
<label>Trier par</label>
|
||||||
@include('components.form.select', ['name' => 'sorting', 'list' => ['Pertinence']])
|
@include('components.form.select', ['name' => 'sorting', 'list' => ['Pertinence']])
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
$('#by_rows').click(function() {
|
||||||
|
var url = "{{ url()->current() }}" + '?by_rows=1';
|
||||||
|
window.location = url;
|
||||||
|
})
|
||||||
|
$('#by_cards').click(function() {
|
||||||
|
var url = "{{ url()->current() }}";
|
||||||
|
window.location = url;
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="row bg-green">
|
<div class="row bg-green">
|
||||||
|
|
||||||
<div class="col-4 col-md-2 form-inline pl-4">
|
<div class="col-4 col-md-2 form-inline pl-4">
|
||||||
<img src="/img/logo.jpg" class="img-responvive pull-left">
|
<a href="/"><img src="/img/logo.jpg" class="img-responvive pull-left"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-8 col-md-6 form-inline">
|
<div class="col-8 col-md-6 form-inline">
|
||||||
|
|||||||
@@ -17,7 +17,11 @@
|
|||||||
@include('Shop.layout.partials.category_add')
|
@include('Shop.layout.partials.category_add')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@include('Shop.layout.partials.category_articles')
|
@if ($display_by_rows ?? false)
|
||||||
|
@include('Shop.layout.partials.category_articles_rows')
|
||||||
|
@else
|
||||||
|
@include('Shop.layout.partials.category_articles')
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
Reference in New Issue
Block a user