Fixes on attributes on prices
This commit is contained in:
@@ -58,6 +58,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
function init_attribute_values() {
|
||||
$('.attributes-family').each( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
load_attribute_values($selector, family_id);
|
||||
value_id = $selector.data('id');
|
||||
$selector.val(value_id).trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function load_attribute_values($selector, family_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Shop.Admin.ArticleAttributeValues.getOptionsByFamily') }}",
|
||||
@@ -69,5 +81,35 @@
|
||||
});
|
||||
}
|
||||
|
||||
function handle_delete_price() {
|
||||
$('.delete-price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-price');
|
||||
var id = $selector.find('.price_id').val();
|
||||
|
||||
confirm_delete(id, laroute.route('Shop.Admin.ArticlePrices.destroy', {id : id}), function() {
|
||||
$selector.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handle_prices() {
|
||||
$('.price-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-taxed-item').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price-taxed-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
console.log($(this).parent().prev());
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-item').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user