Fix on preview mode

This commit is contained in:
Ludovic CANDELLIER
2021-08-23 23:56:46 +02:00
parent 81fbec892c
commit 24fffce7a1
15 changed files with 289 additions and 102 deletions

View File

@@ -1,27 +1,34 @@
<div class="row mb-3">
<div class="col-8">
<div class="col-3">
<div class="row mb-3">
<div class="col-8">
<div class="col-12">
{{ Form::label('article_id', 'Article') }}
@include('components.form.autocomplete', ['name' => 'article', 'data' => $offer ?? null, 'url' => route('Admin.Shop.Articles.autocomplete')])
@include('components.select', ['name' => 'article_id', 'id_name' => 'article_id', 'list' => $articles ?? null, 'value' => $offer['article_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_article'])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
<div class="col-12">
{{ Form::label('variation_id', 'Déclinaison') }}
@include('components.form.autocomplete', ['name' => 'variation', 'data' => $offer ?? null, 'url' => route('Admin.Shop.Variations.autocomplete')])
@include('components.select', ['name' => 'variation_id', 'id_name' => 'variation_id', 'list' => $variations ?? null, 'value' => $offer['variation_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_variation'])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
<div class="col-12">
{{ Form::label('tariff_id', 'Tarif') }}
@include('components.form.autocomplete', ['name' => 'tariff', 'data' => $offer ?? null, 'url' => route('Admin.Shop.Tariffs.autocomplete')])
@include('components.select', ['name' => 'tariff_id', 'id_name' => 'tariff_id', 'list' => $tariffs ?? null, 'value' => $offer['tariff_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_tariffs'])
</div>
</div>
</div>
<div class="col-4">
<div class="col-6">
@component('components.card', ['title' => 'Previsualisation'])
<div id="preview-article"></div>
<div id="preview-variation"></div>
<div id="preview-tariff"></div>
@endcomponent
</div>
<div class="col-3">
@component('components.card', ['title' => 'Disponibilité'])
<div class="row mb-3">
<div class="col-6">
@@ -55,11 +62,44 @@
@include('components.save')
@include('load.form.autocomplete')
@include('load.layout.chevron')
@include('load.form.save')
@include('load.form.select2')
@push('js')
<script>
initAutocomplete();
function handleArticle() {
$('.select_article').change(function() {
var url = '{{ route('Admin.Shop.Offers.previewArticle') }}/' + $(this).val();
$('#preview-article').load(url, function() {
initChevron();
});
})
}
function handleVariation() {
$('.select_variation').change(function() {
var url = '{{ route('Admin.Shop.Offers.previewVariation') }}/' + $(this).val();
$('#preview-variation').load(url, function() {
initChevron();
});
})
}
function handleTariff() {
$('.select_tariffs').change(function() {
var url = '{{ route('Admin.Shop.Offers.previewTariff') }}/' + $(this).val();
$('#preview-tariff').load(url, function() {
initChevron();
});
})
}
handleArticle();
handleVariation();
handleTariff();
initChevron();
initSaveForm();
initSelect2();
</script>
@endpush

View File

@@ -0,0 +1,54 @@
<div class="row">
<div class="col-12">
<div class="row mb-3">
<div class="col-4">
{{ Form::label('ref', 'Référence') }}<br>
{{ $article['ref'] ?? null }}
</div>
<div class="col-8">
{{ Form::label('name', 'Nom') }}<br>
{{ $article['name'] ?? null }}
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('categories', __('Shop.shelves.title')) }}<br>
@foreach (($article['categories'] ?? null) as $category)
{{ $category }}
@endforeach
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('tags', 'Tags') }}<br>
@foreach (($article['tags'] ?? null) as $tag)
{{ $tag }}
@endforeach
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('Admin.Shop.Articles.partials.product.description')
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('description', 'Description') }}
{{ $article['description'] ?? null }}
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('Admin.Core.Comments.partials.comments', ['model' => 'Shop.Article', 'model_id' => $article['id'] ?? false, 'comments' => $article['comments'], 'with_add' => false])
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<div class="row">
<div class="col-4">
{{ $tariff['ref'] ?? null }}
</div>
<div class="col-8">
{{ $tariff['name'] ?? null }}
</div>
</div>
<div class="row">
<div class="col-12">
@foreach (($tariff['price_lists'] ?? []) as $price_list)
{{ $price_list['sale_channel']['name'] }}
{{ $price_list['name'] }}
@if ($price_list['price_list_values'] ?? false)
<table class="table table-bordered table-hover table-striped w-100">
<thead>
<tr>
<th>Seuil</th>
<th>Prix</th>
</tr>
</thead>
@foreach (($price_list['price_list_values'] ?? []) as $price_value)
<tr>
<td>{{ $price_value['quantity'] }}</td>
<td class="text-right">{{ $price_value['price'] }}</td>
</tr>
@endforeach
</table>
@endif
@endforeach
</div>
</div>

View File

@@ -0,0 +1,8 @@
<div class="row">
<div class="col-12">
{{ $variation['name'] }}
</div>
</div>