sort transaction tags by name (#487)
This commit is contained in:
@@ -83,6 +83,15 @@
|
||||
:title="tt('Change Group Display Order')"
|
||||
v-if="allTagGroupsWithDefault.length >= 2"
|
||||
@click="showChangeGroupDisplayOrderDialog"></v-list-item>
|
||||
<v-divider class="my-2" v-if="tags.length > 1"/>
|
||||
<v-list-item :prepend-icon="mdiSortAlphabeticalAscending"
|
||||
:title="tt('Sort by Name (A to Z)')"
|
||||
@click="sortByName(false)"
|
||||
v-if="tags.length > 1"></v-list-item>
|
||||
<v-list-item :prepend-icon="mdiSortAlphabeticalDescending"
|
||||
:title="tt('Sort by Name (Z to A)')"
|
||||
@click="sortByName(true)"
|
||||
v-if="tags.length > 1"></v-list-item>
|
||||
<v-divider class="my-2"/>
|
||||
<v-list-item :prepend-icon="mdiEyeOutline"
|
||||
:title="tt('Show Hidden Transaction Tags')"
|
||||
@@ -347,6 +356,8 @@ import {
|
||||
mdiPencilOutline,
|
||||
mdiCheck,
|
||||
mdiClose,
|
||||
mdiSortAlphabeticalAscending,
|
||||
mdiSortAlphabeticalDescending,
|
||||
mdiEyeOffOutline,
|
||||
mdiEyeOutline,
|
||||
mdiSort,
|
||||
@@ -589,6 +600,14 @@ function cancelSave(tag: TransactionTag): void {
|
||||
}
|
||||
}
|
||||
|
||||
function sortByName(desc: boolean): void {
|
||||
const changed = transactionTagsStore.sortTagDisplayOrderByTagName(activeTagGroupId.value, desc);
|
||||
|
||||
if (changed) {
|
||||
displayOrderModified.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function saveSortResult(): void {
|
||||
if (!displayOrderModified.value) {
|
||||
return;
|
||||
|
||||
@@ -194,8 +194,10 @@
|
||||
<f7-actions-group v-if="allTagGroupsWithDefault.length >= 2">
|
||||
<f7-actions-button @click="changeTagGroupDisplayOrder">{{ tt('Change Group Display Order') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-group v-if="tags.length > 1">
|
||||
<f7-actions-button @click="setSortable()">{{ tt('Sort') }}</f7-actions-button>
|
||||
<f7-actions-button @click="sortByName(false)">{{ tt('Sort by Name (A to Z)') }}</f7-actions-button>
|
||||
<f7-actions-button @click="sortByName(true)">{{ tt('Sort by Name (Z to A)') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Transaction Tags') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Transaction Tags') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
@@ -462,6 +464,17 @@ function remove(tag: TransactionTag | null, confirm: boolean): void {
|
||||
});
|
||||
}
|
||||
|
||||
function sortByName(desc: boolean): void {
|
||||
showHidden.value = true;
|
||||
sortable.value = true;
|
||||
|
||||
const changed = transactionTagsStore.sortTagDisplayOrderByTagName(activeTagGroupId.value, desc);
|
||||
|
||||
if (changed) {
|
||||
displayOrderModified.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function setSortable(): void {
|
||||
if (sortable.value || hasEditingTag.value) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user