Add refreshing for inherited data

This commit is contained in:
Ludovic CANDELLIER
2021-08-30 22:59:50 +02:00
parent 0cd0e1f126
commit 8842b7eea7
10 changed files with 73 additions and 15 deletions

View File

@@ -23,7 +23,7 @@
</div>
<div class="col-4">
{{ Form::label('article_nature_id', __('shop.article_natures.name')) }}<br>
@include('components.select', ['name' => 'article_nature_id', 'list' => $natures_options, 'value' => $article['article_nature_id'] ?? null, 'class' => 'select2', 'with_empty' => ''])
@include('components.select', ['name' => 'article_nature_id', 'list' => $natures_options, 'value' => $article['article_nature_id'] ?? null, 'class' => 'select2', 'with_empty' => '', 'required' => true])
</div>
</div>
@@ -42,7 +42,7 @@
</div>
<div class="row mb-3">
<div class="col-12">
<div class="col-12" id="product_description">
@include('Admin.Shop.Articles.partials.product.description')
</div>
</div>
@@ -69,6 +69,16 @@
var product = $('#product_id').select2('data');
var name = product[0]['text'];
$('input[name="name"]').val(name);
console.log(product);
var product_type = $('#product_type').select2('data');
var name = product_type[0]['id'];
console.log(product_type);
console.log(name);
var url = "{{ route('Admin.Shop.Articles.getProductDescription') }}/" + product[0]['id'] + '/' + btoa(name);
console.log(url);
$('#product_description').load(url);
});
$('#product_type').change( function() {

View File

@@ -1,5 +1,5 @@
@if (!empty($article['product']['description']))
@component('components.layout.box-collapse', ['id' => 'product_description', 'title' => 'Informations héritées'])
@if (count($article['inherited'] ?? []))
@component('components.layout.box-collapse', ['id' => 'product_description_box', 'title' => 'Informations héritées'])
@foreach ($article['inherited'] as $inherited)
@component('components.card', ['title' => $inherited['name'], 'class' => 'mb-3'])
{!! $inherited['description'] !!}