From 749214bab7f556be9c5da6038c2f6ace942aae0a Mon Sep 17 00:00:00 2001 From: xds Date: Wed, 19 Nov 2025 10:09:06 +0300 Subject: [PATCH] fix tx isdone checkbox text size --- src/components/targets/TargetList.vue | 76 +++++++++++++++++++ .../transactions/TransactionCreateUpdate.vue | 4 +- src/models/enums.ts | 25 ++++++ src/models/targets.ts | 63 +++++++++++++++ src/router/index.ts | 68 ++++++++++++++--- src/services/targets-service.ts | 33 ++++++++ 6 files changed, 258 insertions(+), 11 deletions(-) create mode 100644 src/components/targets/TargetList.vue create mode 100644 src/models/targets.ts create mode 100644 src/services/targets-service.ts diff --git a/src/components/targets/TargetList.vue b/src/components/targets/TargetList.vue new file mode 100644 index 0000000..157599e --- /dev/null +++ b/src/components/targets/TargetList.vue @@ -0,0 +1,76 @@ + + + + + \ No newline at end of file diff --git a/src/components/transactions/TransactionCreateUpdate.vue b/src/components/transactions/TransactionCreateUpdate.vue index a296a9d..086b437 100644 --- a/src/components/transactions/TransactionCreateUpdate.vue +++ b/src/components/transactions/TransactionCreateUpdate.vue @@ -206,7 +206,9 @@ const deleteTransaction = async () => { if (spaceStore.selectedSpaceId && transactionId.value) { await transactionService.deleteTransaction(spaceStore.selectedSpaceId, Number(transactionId.value)) await transactionStore.fetchTransactions(spaceStore.selectedSpaceId) - await moveUser() + if (openMode && openMode === "from_bot") { + tgApp.close() + } else await moveUser() } } diff --git a/src/models/enums.ts b/src/models/enums.ts index 8b7d7c8..e5f9d0d 100644 --- a/src/models/enums.ts +++ b/src/models/enums.ts @@ -21,6 +21,7 @@ export enum TransactionType { INCOME = "INCOME", EXPENSE = "EXPENSE", } + export const TransactionTypeName: Record = { [TransactionType.EXPENSE]: 'Расходы', [TransactionType.INCOME]: 'Поступления', @@ -30,9 +31,33 @@ export enum TransactionKind { PLANNING = "PLANNING", INSTANT = "INSTANT", } + export const TransactionKindName: Record = { [TransactionKind.INSTANT]: 'Текущие', [TransactionKind.PLANNING]: 'Плановые', } +export enum TargetType { + AUTO = "AUTO", + LEISURE = "LEISURE", + VACATION = "VACATION", + GOODS = "GOODS", + OTHER = "OTHER", +} + +export const TargetTypeName: Record = { + [TargetType.AUTO]: 'Авто', + [TargetType.LEISURE]: 'Досуг', + [TargetType.VACATION]: 'Отпуск', + [TargetType.GOODS]: 'Покупка', + [TargetType.OTHER]: 'Другое' +} +export const TargetTypeIcon: Record = { + [TargetType.AUTO]: '🏎️', + [TargetType.LEISURE]: '💃', + [TargetType.VACATION]: '🏖', + [TargetType.GOODS]: '🛍️', + [TargetType.OTHER]: '💸' +} + diff --git a/src/models/targets.ts b/src/models/targets.ts new file mode 100644 index 0000000..2d2a77d --- /dev/null +++ b/src/models/targets.ts @@ -0,0 +1,63 @@ +import {Transaction} from "@/models/transaction"; +import {User} from "@/models/user"; +import {TargetType} from "@/models/enums"; + +export interface Target { + id: number, + type: TargetType, + name: string, + description: string | null, + amount: number, + currentAmount: number, + date: Date | string, + components: TargetComponent[], + transactions: Transaction[], + createdBy: User, + createdAt: Date, + updatedBy: User | null, + updatedAt: Date | null, +} + + +export interface CreateTargetDTO { + type: TargetType, + name: string, + description: string | null, + amount: number, + date: Date | string, +} + +export interface UpdateTargetDTO { + type: TargetType, + name: string, + description: string | null, + amount: number, + date: Date | string, +} + + +export interface TargetComponent { + id: number, + name: string, + amount: number, + isDone: boolean, + date: Date | string, +} + + +export interface CreateTargetComponent { + name: string, + amount: number, + date: Date | string, +} + +export interface UpdateTargetComponent { + name: string, + amount: number, + isDone: boolean, + date: Date | string, +} + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 0f5ec2f..174590a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -8,6 +8,7 @@ import RecurrentyCreateUpdate from "@/components/settings/RecurrentyCreateUpdate import TransactionList from "@/components/transactions/TransactionList.vue"; import LoginPage from "@/components/auth/LoginPage.vue"; import TransactionCreateUpdate from "@/components/transactions/TransactionCreateUpdate.vue"; +import TargetList from "@/components/targets/TargetList.vue"; // 📝 Расширяем тип меты роутов (типобезопасный toolbar, requiresAuth, guestOnly) declare module 'vue-router' { @@ -32,6 +33,9 @@ export const enum RouteName { TransactionList = 'transaction-list', TransactionCreate = 'transaction-create', TransactionUpdate = 'transaction-update', + TargetList = 'target-list', + TargetCreate = 'target-create', + TargetUpdate = 'target-update', SettingsList = 'settings-list', CategoriesList = 'categories-list', CategoryCreate = 'category-create', @@ -45,7 +49,12 @@ export const enum RouteName { const routes: RouteRecordRaw[] = [ {path: '/login', name: RouteName.Login, component: LoginPage, meta: {requiresAuth: false, navStack: 'auth'}}, - {path: '/', name: RouteName.Dashboard, component: DashboardView, meta: {requiresAuth: true, navStack: 'dashboard', title: "Home"}}, + { + path: '/', + name: RouteName.Dashboard, + component: DashboardView, + meta: {requiresAuth: true, navStack: 'dashboard', title: "Home"} + }, { path: '/transactions', name: RouteName.TransactionList, @@ -53,7 +62,7 @@ const routes: RouteRecordRaw[] = [ meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'openTransactionCreation', text: '', icon: 'pi pi-plus', onClickId: 'openTransactionCreation'}, ], navStack: 'transactions', @@ -75,7 +84,7 @@ const routes: RouteRecordRaw[] = [ path: '/transactions/:id/edit', name: RouteName.TransactionUpdate, component: TransactionCreateUpdate, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'deleteTransaction', text: '', icon: 'pi pi-trash', onClickId: 'deleteTransaction'}, {id: 'updateTransaction', text: '', icon: 'pi pi-save', onClickId: 'updateTransaction'}, ], @@ -83,17 +92,56 @@ const routes: RouteRecordRaw[] = [ title: "Edit transaction" } }, + + { + path: '/targets', + name: RouteName.TargetList, + component: TargetList, + meta: { + requiresAuth: true, + toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ + + {id: 'openTargetCreation', text: '', icon: 'pi pi-plus', onClickId: 'openTargetCreation'}, + ], + navStack: 'targets', + title: "Targets" + + } + }, + // { + // path: '/transactions/create', name: RouteName.TransactionCreate, component: TransactionCreateUpdate, meta: { + // requiresAuth: true, + // toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ + // {id: 'createTransaction', text: '', icon: 'pi pi-save', onClickId: 'createTransaction'}, + // ], + // navStack: 'transactions', + // title: "Create transaction" + // } + // }, + // { + // path: '/transactions/:id/edit', name: RouteName.TransactionUpdate, component: TransactionCreateUpdate, meta: { + // requiresAuth: true, + // toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ + // + // {id: 'deleteTransaction', text: '', icon: 'pi pi-trash', onClickId: 'deleteTransaction'}, + // {id: 'updateTransaction', text: '', icon: 'pi pi-save', onClickId: 'updateTransaction'}, + // ], + // navStack: 'settings', + // title: "Edit transaction" + // } + // }, + { path: '/settings', name: RouteName.SettingsList, component: SettingsList, - meta: {requiresAuth: true, navStack: 'settings', title: "Settings"} + meta: {requiresAuth: true, navStack: 'settings', title: "Settings"} }, { path: '/categories', name: RouteName.CategoriesList, component: CategoriesList, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'openCategoryCreation', text: '', icon: 'pi pi-plus', onClickId: 'openCategoryCreation'}, ], navStack: 'settings', @@ -104,7 +152,7 @@ const routes: RouteRecordRaw[] = [ path: '/categories/create', name: RouteName.CategoryCreate, component: CategoryCreateUpdate, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'createCategory', text: '', icon: 'pi pi-save', onClickId: 'createCategory'}, ], navStack: 'settings', @@ -115,7 +163,7 @@ const routes: RouteRecordRaw[] = [ path: '/categories/:id/edit', name: RouteName.CategoryUpdate, component: CategoryCreateUpdate, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'deleteCategory', text: '', icon: 'pi pi-trash', onClickId: 'deleteCategory'}, {id: 'updateCategory', text: '', icon: 'pi pi-save', onClickId: 'updateCategory'}, ], @@ -129,7 +177,7 @@ const routes: RouteRecordRaw[] = [ path: '/recurrents', name: RouteName.RecurrentsList, component: RecurrentsList, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'openRecurrentCreation', text: '', icon: 'pi pi-plus', onClickId: 'openRecurrentCreation'}, ], navStack: 'settings', @@ -140,7 +188,7 @@ const routes: RouteRecordRaw[] = [ path: '/recurrents/create', name: RouteName.RecurrentCreate, component: RecurrentyCreateUpdate, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'createRecurrent', text: '', icon: 'pi pi-save', onClickId: 'createRecurrent'}, ], navStack: 'settings', @@ -151,7 +199,7 @@ const routes: RouteRecordRaw[] = [ path: '/recurrents/:id/edit', name: RouteName.RecurrentUpdate, component: RecurrentyCreateUpdate, meta: { requiresAuth: true, toolbar: ({spaceStore}: { spaceStore: ReturnType }) => [ - + {id: 'deleteRecurrent', text: '', icon: 'pi pi-trash', onClickId: 'deleteRecurrent'}, {id: 'updateRecurrent', text: '', icon: 'pi pi-save', onClickId: 'updateRecurrent'}, ], diff --git a/src/services/targets-service.ts b/src/services/targets-service.ts new file mode 100644 index 0000000..c188580 --- /dev/null +++ b/src/services/targets-service.ts @@ -0,0 +1,33 @@ +import {Target} from "@/models/targets"; +import {TargetType} from "@/models/enums"; +import {User} from "@/models/user"; + +async function fetchTargets(spaceId: number): Promise { + const targets = []; + for (var i = 0; i < 10; i++) { + const rand = Math.floor(Math.random() * 5); + const now = new Date(); + const amount = Math.floor(Math.random() * 100000); + now.setDate(Math.floor(Math.random() * 30)) + targets.push({ + id: i, + type: rand == 1 ? TargetType.AUTO : rand == 2 ? TargetType.LEISURE : rand == 3 ? TargetType.VACATION : rand == 4 ? TargetType.GOODS : TargetType.OTHER, + name: `Target ${i}`, + description: `Target ${i} description`, + amount: amount, + currentAmount: Math.floor(Math.random() * amount), + date: now, + components: [], + transactions: [], + createdBy: {} as User, + createdAt: new Date(), + updatedBy: {} as User, + updatedAt: new Date(), + } as Target) + } + return targets; +} + +export const targetService = { + fetchTargets +}; \ No newline at end of file