Synchro back-office, fix on tariffs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="col-lg-8">
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-3">
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-lg-4">
|
||||
<div id="product_images_inherited">
|
||||
@include('Admin.Shop.Articles.partials.product.images')
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@if ($inherited['tags'])
|
||||
<h6> Tags</h6>
|
||||
@foreach ($inherited['tags'] as $tag)
|
||||
<span class="btn btn-xs">{{ $tag['name'] }}</span>
|
||||
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['group']['name'] }}-{{ $tag['name'] }}</button>
|
||||
@endforeach
|
||||
@endif
|
||||
@endcomponent
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-3">
|
||||
<div class="col-6">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
{{ Form::label('article_id', 'Article') }}
|
||||
@@ -20,15 +20,7 @@
|
||||
@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-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-12 col-xl-6">
|
||||
@@ -58,6 +50,14 @@
|
||||
</div>
|
||||
@endcomponent
|
||||
</div>
|
||||
<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>
|
||||
|
||||
@include('components.save')
|
||||
|
||||
@@ -53,56 +53,57 @@
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
function handleAddPrice() {
|
||||
$('#add_price').click( function () {
|
||||
var index = $('#prices-table tbody tr').length;
|
||||
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
|
||||
$("#prices-table").append(data);
|
||||
})
|
||||
handlePrices();
|
||||
<script>
|
||||
function handleAddPrice() {
|
||||
$('#add_price').click( function () {
|
||||
var index = $('#prices-table tbody tr').length;
|
||||
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
|
||||
$("#prices-table").append(data);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices() {
|
||||
$('.price').change(function() {
|
||||
$col_tax = $(this).parent().parent().find('.tax')();
|
||||
tax_selected = $col_tax.find('select option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
price_taxed = price_taxed.toFixed(2);
|
||||
$(this).parent().parent().find('.price_taxed').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_taxes() {
|
||||
$('.tax').change(function() {
|
||||
tax_selected = $(this).text();
|
||||
price = $(this).parent().parent().find('.price').val();
|
||||
price_taxed = price * (1 + (tax_selected / 100));
|
||||
price_taxed = price_taxed.toFixed(2);
|
||||
$(this).parent().parent().find('.price_taxed').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price_taxed').change(function() {
|
||||
$col_tax = $(this).parent().parent().find('.tax')();
|
||||
tax_selected = $col_tax.find('select option:selected').text();
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
price = price.toFixed(2);
|
||||
$(this).parent().parent().find('.price').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
function handlePrices() {
|
||||
handle_prices();
|
||||
handle_taxes();
|
||||
handle_prices_taxed();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
handleAddPrice();
|
||||
handlePrices();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
function handle_prices() {
|
||||
$('.price').change(function() {
|
||||
$col_tax = $(this).parent().parent().find('.tax');
|
||||
tax_selected = $col_tax.find('option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
price_taxed = price_taxed.toFixed(2);
|
||||
console.log(price_taxed);
|
||||
$(this).parent().parent().find('.price_taxed').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_taxes() {
|
||||
$('.tax').change(function() {
|
||||
tax_selected = $(this).find('option:selected').text();
|
||||
price = $(this).parent().parent().find('.price').val();
|
||||
price_taxed = price * (1 + (tax_selected / 100));
|
||||
price_taxed = price_taxed.toFixed(2);
|
||||
$(this).parent().parent().find('.price_taxed').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price_taxed').change(function() {
|
||||
$col_tax = $(this).parent().parent().find('.tax');
|
||||
tax_selected = $col_tax.find('option:selected').text();
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
price = price.toFixed(2);
|
||||
$(this).parent().parent().find('.price').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
function handlePrices() {
|
||||
handle_prices();
|
||||
handle_taxes();
|
||||
handle_prices_taxed();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
handleAddPrice();
|
||||
handlePrices();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
|
||||
@if ($tariff['id'] ?? false)
|
||||
@@ -70,6 +70,7 @@
|
||||
@include('components.save')
|
||||
|
||||
@include('load.form.editor')
|
||||
@include('load.form.save')
|
||||
@include('load.form.select2')
|
||||
@include('load.layout.modal')
|
||||
|
||||
@@ -77,19 +78,21 @@
|
||||
<script>
|
||||
$(function() {
|
||||
initEditor();
|
||||
initSelect2();
|
||||
initSaveForm('#tariffs-form');
|
||||
});
|
||||
|
||||
function PriceListCreate() {
|
||||
var tariff_id = $('#id').val();
|
||||
var url_open = "{{ route('Admin.Shop.PriceLists.modalCreate') }}/" + tariff_id;
|
||||
var url_save = "{{ route('Admin.Shop.PriceLists.storeAjax') }}";
|
||||
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();");
|
||||
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();","extra-large");
|
||||
}
|
||||
|
||||
function PriceListEdit(id) {
|
||||
var url_open = "{{ route('Admin.Shop.PriceLists.modalEdit') }}/" + id;
|
||||
var url_save = "{{ route('Admin.Shop.PriceLists.storeAjax') }}";
|
||||
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();");
|
||||
openModal("{{ __('price_list') }}", '#price_list-form', url_open, url_save, "PriceListRefresh();","extra-large");
|
||||
}
|
||||
|
||||
function PriceListRefresh()
|
||||
|
||||
Reference in New Issue
Block a user