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,32 +1,22 @@
@component('components.layout.box-collapse', ['id' => 'comments', 'title' => __('comments')])
@if (!empty($comments))
@foreach ($comments as $comment)
<div class="row">
<div class="col-6">
<strong>{{ App\Repositories\Core\Auth\Users::getName($comment->user_id) }}</strong>
</div>
<div class="col-6 text-right"><i>{{ App\Repositories\Core\DateTime::DateToLocale($comment->updated_at) }}</i></div>
<div class="col-12">
{!! $comment->comment !!}
</div>
</div>
@endforeach
@endif
<button type="button" class="btn btn-xs btn-primary" id="add-comment">
{{ __('comment_add') }}
<i class="fa fa-plus"></i>
</button>
@include('Admin.Core.Comments.partials.list-comments')
@endcomponent
@push('js')
<script>
function handleAddComment() {
$('#add-comment').click(function() {
openModal('{{ __('comment_add') }}', '#comment-form', '{{ route('Admin.Core.Comments.create', ['model' => $model, 'model_id' => $model_id]) }}', '{{ route('Admin.Core.Comments.store') }}' );
openModal('{{ __('comment_add') }}', '#comment-form', '{{ route('Admin.Core.Comments.create', ['model' => $model, 'model_id' => $model_id]) }}', '{{ route('Admin.Core.Comments.store') }}', 'refreshComments()' );
});
}
function refreshComments() {
var url = '{{ route('Admin.Core.Comments.index') }}/{{ $model }}/{{ $model_id }}';
console.log('refresh');
console.log(url);
$("#comments").load(url);
}
$(document).ready(function () {
handleAddComment();
});

View File

@@ -0,0 +1,20 @@
@if (!empty($comments))
@foreach ($comments as $comment)
<div class="row">
<div class="col-6">
<strong>{{ App\Repositories\Core\Auth\Users::getName($comment['user_id']) }}</strong>
</div>
<div class="col-6 text-right"><i>{{ App\Repositories\Core\DateTime::DateToLocale($comment['updated_at']) }}</i></div>
<div class="col-12">
{!! $comment['comment'] !!}
</div>
</div>
@endforeach
@endif
@if ($with_add ?? true)
<button type="button" class="btn btn-xs btn-primary" id="add-comment">
{{ __('comment_add') }}
<i class="fa fa-plus"></i>
</button>
@endif

View File

@@ -1,36 +0,0 @@
@extends('layout.index', [
'title' => __('products.title'),
'subtitle' => __('products.title'),
'breadcrumb' => [__('products.title')]
])
@section('content')
<form action="{{ route('Shop.Products') }}" method="GET">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="box box-info">
<div class="box-body">
<div class="col-md-6">
<h3>{{ name }}</h3>
<h4>
{{ $product.section.name }}<br>
</h4>
</div>
<div class="col-md-6 text-right">
<h2>{{ $prix_total }} </h2>
<h4>{{ $residence['type_produit']['name'] }}</h4>
</div>
<div class="col-md-12">
@include('Hestimmo.modules.Lot.partials.carousel')
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

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>