[WIP] Fix cosmetics, prices
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
<script>
|
||||
|
||||
function append_price() {
|
||||
handle_append_attribute();
|
||||
// handle_append_attribute();
|
||||
$('.select2').select2();
|
||||
handle_change_attribute();
|
||||
}
|
||||
|
||||
$("#append_price").appender({
|
||||
@@ -31,7 +33,7 @@
|
||||
|
||||
function handle_append_attribute(selector) {
|
||||
console.log('handle_append_attribute');
|
||||
$("#append_attribute").appender({
|
||||
$(".append_attribute").appender({
|
||||
rowSection: '.row-new-attribute',
|
||||
type: '.row-attribute',
|
||||
addBtn: '.add-new-attribute',
|
||||
@@ -45,6 +47,28 @@
|
||||
});
|
||||
}
|
||||
|
||||
function handle_change_attribute() {
|
||||
$('.attributes-family').change( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
// console.log($parent);
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
// console.log($selector);
|
||||
load_attribute_values($selector, family_id);
|
||||
});
|
||||
}
|
||||
|
||||
function load_attribute_values($selector, family_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Shop.Admin.ArticleAttributeValues.getOptionsByFamily') }}",
|
||||
method : 'POST',
|
||||
data: { family_id: family_id },
|
||||
success : function(data) {
|
||||
$selector.empty().select2({data: data});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user