fixed AkauntingSelect.vue and AkauntingSelectRemote.vue files.

This commit is contained in:
Cüneyt Şentürk
2021-05-07 17:00:37 +03:00
parent dc6d53b649
commit aaafacf601
2 changed files with 135 additions and 91 deletions

View File

@ -269,7 +269,7 @@ export default {
type: String,
default: 'No Matchign Data',
description: "Selectbox search option not found item message"
}
},
},
data() {
@ -294,70 +294,7 @@ export default {
},
created() {
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.options;
if (this.group) {
// Option set sort_option data
if (!Array.isArray(created_options)) {
for (const [index, options] of Object.entries(created_options)) {
let values = [];
for (const [key, value] of Object.entries(options)) {
values.push({
key: key,
value: value
});
}
this.sort_options.push({
key: index,
value: values
});
}
} else {
created_options.forEach(function (option, index) {
if (typeof(option) == 'string') {
this.sort_options.push({
index: index,
key: index.toString(),
value: option
});
} else {
this.sort_options.push({
index: index,
key: option.id,
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
});
}
}, this);
}
} else {
// Option set sort_option data
if (!Array.isArray(created_options)) {
for (const [key, value] of Object.entries(created_options)) {
this.sort_options.push({
key: key,
value: value
});
}
} else {
created_options.forEach(function (option, index) {
if (typeof(option) == 'string') {
this.sort_options.push({
index: index,
key: index.toString(),
value: option
});
} else {
this.sort_options.push({
index: index,
key: option.id,
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
});
}
}, this);
}
}
this.setSortOptions();
},
computed: {
@ -418,6 +355,76 @@ export default {
}
},
setSortOptions() {
// Reset sort_options
this.sort_options = [];
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.options;
if (this.group) {
// Option set sort_option data
if (!Array.isArray(created_options)) {
for (const [index, options] of Object.entries(created_options)) {
let values = [];
for (const [key, value] of Object.entries(options)) {
values.push({
key: key,
value: value
});
}
this.sort_options.push({
key: index,
value: values
});
}
} else {
created_options.forEach(function (option, index) {
if (typeof(option) == 'string') {
this.sort_options.push({
index: index,
key: index.toString(),
value: option
});
} else {
this.sort_options.push({
index: index,
key: option.id,
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
});
}
}, this);
}
} else {
// Option set sort_option data
if (!Array.isArray(created_options)) {
for (const [key, value] of Object.entries(created_options)) {
this.sort_options.push({
key: key,
value: value
});
}
} else {
created_options.forEach(function (option, index) {
if (typeof(option) == 'string') {
this.sort_options.push({
index: index,
key: index.toString(),
value: option
});
} else {
this.sort_options.push({
index: index,
key: option.id,
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name
});
}
}, this);
}
}
},
change() {
// This controll added add new changed..
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
@ -541,6 +548,8 @@ export default {
},
onModal(value) {
//this.setSortOptions();
let add_new = this.add_new;
window.axios.get(this.add_new.path)