Akaunting select vue component enhancement

This commit is contained in:
Cüneyt Şentürk 2021-08-01 21:00:26 +03:00
parent 50f2e7d991
commit 31f2732ae4

View File

@ -384,13 +384,13 @@ export default {
for (const [key, value] of Object.entries(options)) { for (const [key, value] of Object.entries(options)) {
values.push({ values.push({
key: key, key: key.toString(),
value: value value: value
}); });
} }
this.sorted_options.push({ this.sorted_options.push({
key: index, key: index.toString(),
value: values value: values
}); });
} }
@ -405,7 +405,7 @@ export default {
} else { } else {
this.sorted_options.push({ this.sorted_options.push({
index: index, index: index,
key: option.id, key: option.id.toString(),
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
}); });
} }
@ -416,7 +416,7 @@ export default {
if (!Array.isArray(created_options)) { if (!Array.isArray(created_options)) {
for (const [key, value] of Object.entries(created_options)) { for (const [key, value] of Object.entries(created_options)) {
this.sorted_options.push({ this.sorted_options.push({
key: key, key: key.toString(),
value: value value: value
}); });
} }
@ -431,7 +431,7 @@ export default {
} else { } else {
this.sorted_options.push({ this.sorted_options.push({
index: index, index: index,
key: option.id, key: option.id.toString(),
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
}); });
} }
@ -654,6 +654,7 @@ export default {
} }
}) })
.then(response => { .then(response => {
this.loading = false;
this.form.loading = false; this.form.loading = false;
if (response.data.success) { if (response.data.success) {
@ -675,10 +676,14 @@ export default {
this.add_new.html = ''; this.add_new.html = '';
this.add_new_html = null; this.add_new_html = null;
response.data.data.mark_new = true;
this.$emit('new', response.data.data); this.$emit('new', response.data.data);
this.change(); this.change();
this.$emit('visible-change', event);
let documentClasses = document.body.classList; let documentClasses = document.body.classList;
documentClasses.remove("modal-open"); documentClasses.remove("modal-open");