[WIP] begin of new display for article, shelves

This commit is contained in:
Ludovic CANDELLIER
2022-06-13 23:29:05 +02:00
parent e31978b1e3
commit b37321daf8
13 changed files with 163 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="green-dark">
<div class="card bg-green-light">
<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' }}">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
<div class="card-body">
<div class="row card-title">
@@ -11,29 +11,7 @@
<div class="text-truncate">{{ $article['product_name'] }}</div>
</div>
</div>
<div class="row">
<div class="col-6">
<span style="font-size: 1.4em">
@if ($article['semences'] ?? false)
{{ $article['semences']['price'] ?? null }}</span>
@else
-
@endif
</span><br/>
<strong>Semence</strong>
</div>
<div class="col-6">
<span style="font-size: 1.4em">
@if ($article['plants'] ?? false)
{{ $article['plants']['price'] }}</span>
@else
-
@endif
</span><br/>
<strong>Plant</strong>
</div>
</div>
@include('Shop.Articles.partials.article_' . $product_type)
</div>
</div>
</a>

View File

@@ -0,0 +1,22 @@
<div class="row">
<div class="col-6">
<span style="font-size: 1.4em">
@if ($article['semences'] ?? false)
{{ $article['semences']['price'] ?? null }}</span>
@else
-
@endif
</span><br/>
<strong>Semence</strong>
</div>
<div class="col-6">
<span style="font-size: 1.4em">
@if ($article['plants'] ?? false)
{{ $article['plants']['price'] }}</span>
@else
-
@endif
</span><br/>
<strong>Plant</strong>
</div>
</div>

View File

@@ -0,0 +1,12 @@
<div class="row">
<div class="col-12">
<span style="font-size: 1.4em">
@if ($article['merchandises'] ?? false)
{{ $article['merchandises']['price'] ?? null }}</span>
@else
-
@endif
</span><br/>
<strong>Marchandise</strong>
</div>
</div>

View File

@@ -1,5 +1,5 @@
<div class="row pb-3 bg-light">
<div class="col-8">
<div class="col-9">
<div class="row pt-2">
<div class="col-10">
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
@@ -25,37 +25,10 @@
</div>
</a>
</div>
<div class="col-4">
<div class="col-3">
<div class="row h-100">
<div class="col-6">
@if ($article['semences'] ?? false)
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border border-success text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-green-dark basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif
</div>
<div class="col-6">
@if ($article['plants'] ?? false)
<div class="w-100 mt-3 p-1 bg-yellow-light yellow-dark border border-warning text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-success basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif
<div class="col-12">
@include('Shop.Articles.partials.article_rows_' . $product_type)
</div>
</div>
</div>

View File

@@ -0,0 +1,26 @@
@if ($article['semences'] ?? false)
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border border-success text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
{{ $article['semences']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-green-dark basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif
@if ($article['plants'] ?? false)
<div class="w-100 mt-3 p-1 bg-yellow-light yellow-dark border border-warning text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-success basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif

View File

@@ -0,0 +1,13 @@
@if ($article['merchandises'] ?? false)
<div class="w-100 mt-3 p-1 bg-yellow-light yellow-dark border border-warning text-center">
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['merchandises']['price'] ?? null }}</span> <br>
{{ $article['merchandises']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-success basket merchandises mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif

View File

@@ -6,8 +6,8 @@
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-secondary'])
@endif
@include('components.form.button', ['id' => 'semences', 'icon' => 'fa-leaf', 'class' => 'bg-yellow yellow-dark'])
@include('components.form.button', ['id' => 'plants', 'icon' => 'fa-seedling', 'class' => 'bg-green text-white'])
@include('components.form.button', ['data_id' => 'botanic', 'icon' => 'fa-leaf', 'class' => 'products bg-yellow yellow-dark'])
@include('components.form.button', ['data_id' => 'merchandise', 'icon' => 'fa-seedling', 'class' => 'products bg-green text-white'])
</div>
</div>
@@ -15,12 +15,16 @@
@push('js')
<script>
$('#by_rows').click(function() {
var url = "{{ route('Shop.Categories.show', ['id' => $category['id'], 'by_rows' => true]) }}";
window.location = url;
})
$('#display_by_rows').val(1);
$('#category-form').submit();
});
$('#by_cards').click(function() {
var url = "{{ route('Shop.Categories.show', ['id' => $category['id']]) }}";
window.location = url;
})
$('#display_by_rows').val(0);
$('#category-form').submit();
});
$('.products').click(function() {
$('#product_type').val($(this).data('id'));
$('#category-form').submit();
});
</script>
@endpush

View File

@@ -3,31 +3,38 @@
])
@section('content')
<div class="row mb-3">
<div class="col-3">
@include('Shop._partials.display_filters')
</div>
<div class="col-6">
<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>
</div>
<div class="col-3">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
@include('Shop.Tags.partials.filter')
@if ($display_by_rows ?? false)
@include('Shop.Shelves.partials.category_articles_rows')
@else
@include('Shop.Shelves.partials.category_articles')
@endif
{{ 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="product_type" name="product_type" value="{{ $product_type ?? false }}">
<div class="row mb-3">
<div class="col-3">
@include('Shop._partials.display_filters')
</div>
<div class="col-6">
<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>
</div>
<div class="col-3">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
@include('Shop.Tags.partials.filter')
@if ($display_by_rows ?? false)
@include('Shop.Shelves.partials.category_articles_rows')
@else
@include('Shop.Shelves.partials.category_articles')
@endif
</form>
@endsection