Refactored editor page locations, started on generic editor logic.

This commit is contained in:
Andrew Lalis 2026-06-28 13:43:29 -04:00
parent d0e8b9ab4b
commit 9ce0ffd3a4
4 changed files with 36 additions and 4 deletions

View File

@ -0,0 +1,32 @@
import type { Currency } from '@/api/data'
import type { TransactionLineItemResponse, TransactionVendor } from '@/api/transaction'
/**
* The set of all form fields on the transaction editor page. Note that some
* fields may only be used in certain contexts.
*/
export interface TransactionEditorFormFields {
timestamp: string | null
amount: number | null
templateName: string | null // Only for drafts, not transactions.
currency: Currency | null
description: string | null
internalTransfer: boolean | null
vendor: TransactionVendor | null
categoryId: number | null
creditedAccountId: number | null
debitedAccountId: number | null
lineItems: TransactionLineItemResponse[]
tags: string[]
attachmentsToUpload: File[]
removedAttachmentIds: number[]
}
/**
* Base class for transaction editor contexts.
*/
export abstract class TransactionEditorContextBase {}
export class TransactionEditorContext extends TransactionEditorContextBase {}
export class DraftEditorContext extends TransactionEditorContextBase {}

View File

@ -44,7 +44,7 @@ const router = createRouter({
}, },
{ {
path: 'accounts/:id/edit', path: 'accounts/:id/edit',
component: () => import('@/pages/forms/EditAccountPage.vue'), component: () => import('@/pages/EditAccountPage.vue'),
meta: { title: 'Edit Account' }, meta: { title: 'Edit Account' },
}, },
{ {
@ -54,7 +54,7 @@ const router = createRouter({
}, },
{ {
path: 'add-account', path: 'add-account',
component: () => import('@/pages/forms/EditAccountPage.vue'), component: () => import('@/pages/EditAccountPage.vue'),
meta: { title: 'Add Account' }, meta: { title: 'Add Account' },
}, },
{ {
@ -64,7 +64,7 @@ const router = createRouter({
}, },
{ {
path: 'transactions/:id/edit', path: 'transactions/:id/edit',
component: () => import('@/pages/forms/EditTransactionPage.vue'), component: () => import('@/pages/transaction-editor/EditTransactionPage.vue'),
meta: { title: 'Edit Transaction' }, meta: { title: 'Edit Transaction' },
}, },
{ {
@ -74,7 +74,7 @@ const router = createRouter({
}, },
{ {
path: 'add-transaction', path: 'add-transaction',
component: () => import('@/pages/forms/EditTransactionPage.vue'), component: () => import('@/pages/transaction-editor/EditTransactionPage.vue'),
meta: { title: 'Add Transaction' }, meta: { title: 'Add Transaction' },
}, },
{ {