diff --git a/resources/assets/js/components/AkauntingSelect.vue b/resources/assets/js/components/AkauntingSelect.vue index c93713543..e7dfc1dcc 100644 --- a/resources/assets/js/components/AkauntingSelect.vue +++ b/resources/assets/js/components/AkauntingSelect.vue @@ -294,10 +294,12 @@ export default { }, created() { + let created_option = (this.dynamicOptions) ? this.dynamicOptions : this.options; + if (this.group) { // Option set sort_option data - if (!Array.isArray(this.options)) { - for (const [index, options] of Object.entries(this.options)) { + if (!Array.isArray(created_options)) { + for (const [index, options] of Object.entries(created_option)) { let values = []; for (const [key, value] of Object.entries(options)) { @@ -313,7 +315,7 @@ export default { }); } } else { - this.options.forEach(function (option, index) { + created_option.forEach(function (option, index) { if (typeof(option) == 'string') { this.sort_options.push({ index: index, @@ -331,15 +333,15 @@ export default { } } else { // Option set sort_option data - if (!Array.isArray(this.options)) { - for (const [key, value] of Object.entries(this.options)) { + if (!Array.isArray(created_option)) { + for (const [key, value] of Object.entries(created_option)) { this.sort_options.push({ key: key, value: value }); } } else { - this.options.forEach(function (option, index) { + created_option.forEach(function (option, index) { if (typeof(option) == 'string') { this.sort_options.push({ index: index, @@ -765,7 +767,7 @@ export default { dynamicOptions: function(options) { this.sort_options = []; this.selected = ''; - + if (this.group) { // Option set sort_option data if (!Array.isArray(options)) { diff --git a/resources/assets/js/components/AkauntingSelectRemote.vue b/resources/assets/js/components/AkauntingSelectRemote.vue index 79cb696a7..0ca43d8d8 100644 --- a/resources/assets/js/components/AkauntingSelectRemote.vue +++ b/resources/assets/js/components/AkauntingSelectRemote.vue @@ -466,11 +466,14 @@ export default { return 0; } }, + setSortOptions() { + let created_option = (this.dynamicOptions) ? this.dynamicOptions : this.options; + if (this.group) { // Option set sort_option data - if (!Array.isArray(this.options)) { - for (const [index, options] of Object.entries(this.options)) { + if (!Array.isArray(created_options)) { + for (const [index, options] of Object.entries(created_option)) { let values = []; for (const [key, value] of Object.entries(options)) { @@ -486,7 +489,7 @@ export default { }); } } else { - this.options.forEach(function (option, index) { + created_option.forEach(function (option, index) { this.sort_options.push({ index: index, key: option.id, @@ -496,15 +499,15 @@ export default { } } else { // Option set sort_option data - if (!Array.isArray(this.options)) { - for (const [key, value] of Object.entries(this.options)) { + if (!Array.isArray(created_option)) { + for (const [key, value] of Object.entries(created_option)) { this.sort_options.push({ key: key, value: value }); } } else { - this.options.forEach(function (option, index) { + created_option.forEach(function (option, index) { this.sort_options.push({ index: index, key: option.id, @@ -956,7 +959,7 @@ export default { dynamicOptions: function(options) { this.sort_options = []; this.selected = ''; - + if (this.group) { // Option set sort_option data if (!Array.isArray(options)) {