migrate transaction category edit page to composition API and typescript

This commit is contained in:
MaysWind
2025-01-18 23:47:49 +08:00
parent f5f8b9a145
commit 965be837a3
4 changed files with 346 additions and 337 deletions
+10
View File
@@ -127,6 +127,16 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
return ret;
}
public static findNameById(categories: TransactionCategory[], id: string): string | null {
for (const category of categories) {
if (category.id === id) {
return category.name;
}
}
return null;
}
public static createNewCategory(type?: CategoryType, parentId?: string): TransactionCategory {
return new TransactionCategory('', '', parentId || '0', type || CategoryType.Income, DEFAULT_CATEGORY_ICON_ID, DEFAULT_CATEGORY_COLOR, '', 0, true);
}