Upgrade boilerplate
This commit is contained in:
@@ -27,7 +27,9 @@
|
||||
<tr>
|
||||
<th>Code</th>
|
||||
<th>Seuil</th>
|
||||
<th>Prix Unit.</th>
|
||||
<th>Unit. HT</th>
|
||||
<th>TVA</th>
|
||||
<th>Unit. TTC</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -58,11 +60,49 @@
|
||||
$.get("{{ route('Admin.Shop.PriceListValues.addPrice') }}/" + index, function(data) {
|
||||
$("#prices-table").append(data);
|
||||
})
|
||||
handlePrices();
|
||||
})
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
<tr>
|
||||
@foreach ($prices as $price)
|
||||
<td>
|
||||
{{ $price['quantity'] ?? null }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $price['price'] ?? null }}
|
||||
{{ $price['quantity'] ?? null }} : {{ $price['price'] ?? null }} €
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user