@@ -134,7 +152,11 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
import categoryConstants from '@/consts/category.js';
import iconConstants from '@/consts/icon.js';
import colorConstants from '@/consts/color.js';
-import { setCategoryModelByAnotherCategory } from '@/lib/category.js';
+import {
+ setCategoryModelByAnotherCategory,
+ allVisiblePrimaryTransactionCategoriesByType
+} from '@/lib/category.js';
+import {getNameByKeyValue} from "@/lib/common";
export default {
props: [
@@ -153,11 +175,15 @@ export default {
loading: false,
loadingError: null,
category: newTransactionCategory,
+ showPrimaryCategorySheet: false,
submitting: false
};
},
computed: {
...mapStores(useTransactionCategoriesStore),
+ allAvailableCategories() {
+ return allVisiblePrimaryTransactionCategoriesByType(this.transactionCategoriesStore.allTransactionCategories, this.category.type);
+ },
title() {
if (!this.editCategoryId) {
if (this.category.parentId === '0') {
@@ -274,6 +300,9 @@ export default {
self.$toast(error.message || error);
}
});
+ },
+ getPrimaryCategoryName(parentId) {
+ return getNameByKeyValue(this.allAvailableCategories, parentId, 'id', 'name');
}
}
}