Skip to content

Commit

Permalink
Merge branch 'master' of github.com:akaunting/akaunting
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jan 8, 2021
2 parents c6d6fff + 3c9b578 commit 1fe38ff
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 90 deletions.
65 changes: 20 additions & 45 deletions resources/assets/js/components/AkauntingSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -345,55 +345,13 @@ export default {
computed: {
sortOptions() {
if (this.group) {
this.sort_options.sort(function (a, b) {
var nameA = a.key.toUpperCase(); // ignore upper and lowercase
var nameB = b.key.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
this.sort_options.sort(this.sortBy("key"));
for (const [index, options] of Object.entries(this.sort_options)) {
options.value.sort(function (aa, bb) {
var nameAA = aa.value.toUpperCase(); // ignore upper and lowercase
var nameBB = bb.value.toUpperCase(); // ignore upper and lowercase
if (nameAA < nameBB) {
return -1;
}
if (nameAA > nameBB) {
return 1;
}
// names must be equal
return 0;
});
options.value.sort(this.sortBy(this.option_sortable));
}
} else {
this.sort_options.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
this.sort_options.sort(this.sortBy(this.option_sortable));
}
return this.sort_options;
Expand Down Expand Up @@ -424,6 +382,23 @@ export default {
},
methods: {
sortBy(option) {
return (a, b) => {
var nameA = a.[option].toUpperCase(); // ignore upper and lowercase
var nameB = b.[option].toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
}
},
change() {
// This controll added add new changed..
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
Expand Down
65 changes: 20 additions & 45 deletions resources/assets/js/components/AkauntingSelectRemote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,55 +412,13 @@ export default {
computed: {
sortOptions() {
if (this.group) {
this.sort_options.sort(function (a, b) {
var nameA = a.key.toUpperCase(); // ignore upper and lowercase
var nameB = b.key.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
this.sort_options.sort(this.sortBy("key"));
for (const [index, options] of Object.entries(this.sort_options)) {
options.value.sort(function (aa, bb) {
var nameAA = aa.value.toUpperCase(); // ignore upper and lowercase
var nameBB = bb.value.toUpperCase(); // ignore upper and lowercase
if (nameAA < nameBB) {
return -1;
}
if (nameAA > nameBB) {
return 1;
}
// names must be equal
return 0;
});
options.value.sort(this.sortBy(this.option_sortable));
}
} else {
this.sort_options.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
this.sort_options.sort(this.sortBy(this.option_sortable));
}
return this.sort_options;
Expand Down Expand Up @@ -491,6 +449,23 @@ export default {
},
methods: {
sortBy(option) {
return (a, b) => {
var nameA = a.[option].toUpperCase(); // ignore upper and lowercase
var nameB = b.[option].toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
}
},
setSortOptions() {
if (this.group) {
// Option set sort_option data
Expand Down

0 comments on commit 1fe38ff

Please sign in to comment.