diff --git a/scripts/system/inventory/src/components/ItemIterator.vue b/scripts/system/inventory/src/components/ItemIterator.vue index c64767a7ef..ce324d397d 100644 --- a/scripts/system/inventory/src/components/ItemIterator.vue +++ b/scripts/system/inventory/src/components/ItemIterator.vue @@ -149,11 +149,38 @@ > mdi-minus - - mdi-ab-testing - + + + + + + + A-Z + + mdi-sort-alphabetical-ascending + + + + Z-A + + mdi-sort-alphabetical-descending + + + + @@ -304,23 +331,40 @@ export default { return returnedItemIconColor; }, - sortFolder: function(uuid) { + sortFolder: function(uuid, sort) { var findFolder = this.searchForItem(uuid); if (findFolder) { - findFolder.returnedItem.items.sort(function(a, b) { - var nameA = a.name.toUpperCase(); // ignore upper and lowercase - var nameB = b.name.toUpperCase(); // ignore upper and lowercase - if (nameA < nameB) { - return -1; - } - if (nameA > nameB) { - return 1; - } - - // names must be equal - return 0; - }); + if (sort === "az") { + findFolder.returnedItem.items.sort(function(a, b) { + var nameA = a.name.toUpperCase(); // ignore upper and lowercase + var nameB = b.name.toUpperCase(); // ignore upper and lowercase + if (nameA < nameB) { + return -1; + } + if (nameA > nameB) { + return 1; + } + + // names must be equal + return 0; + }); + } + if (sort === "za") { + findFolder.returnedItem.items.sort(function(a, b) { + var nameA = a.name.toUpperCase(); // ignore upper and lowercase + var nameB = b.name.toUpperCase(); // ignore upper and lowercase + if (nameA > nameB) { + return -1; + } + if (nameA < nameB) { + return 1; + } + + // names must be equal + return 0; + }); + } } }, searchForItem: function(uuid) {