Added buttons to add transaction via account page.
Build and Deploy Web App / build-and-deploy (push) Successful in 19s Details

This commit is contained in:
andrewlalis 2025-12-02 16:36:34 -05:00
parent 43b1f153ad
commit 6fd388b656
2 changed files with 35 additions and 0 deletions

View File

@ -58,6 +58,17 @@ async function addValueRecord() {
history.value?.reload() history.value?.reload()
} }
} }
async function addCreditTransaction() {
await router.push(
`/profiles/${getSelectedProfile(route)}/add-transaction?credited-account=${account.value?.id}`,
)
}
async function addDebitTransaction() {
await router.push(
`/profiles/${getSelectedProfile(route)}/add-transaction?debited-account=${account.value?.id}`,
)
}
</script> </script>
<template> <template>
<AppPage <AppPage
@ -115,6 +126,22 @@ async function addValueRecord() {
>Delete</AppButton >Delete</AppButton
> >
</ButtonBar> </ButtonBar>
<ButtonBar>
<AppButton
@click="addCreditTransaction()"
:disabled="account.archived"
size="sm"
icon="arrow-up-right-from-square"
>Add Credit Transaction
</AppButton>
<AppButton
@click="addDebitTransaction()"
:disabled="account.archived"
size="sm"
icon="arrow-up-right-from-square"
>Add Debit Transaction</AppButton
>
</ButtonBar>
<AccountHistory <AccountHistory
:account="account" :account="account"

View File

@ -185,6 +185,14 @@ onMounted(async () => {
timestamp.value = getDatetimeLocalValueForNow() timestamp.value = getDatetimeLocalValueForNow()
amount.value = Math.pow(10, currency.value?.fractionalDigits ?? 0) amount.value = Math.pow(10, currency.value?.fractionalDigits ?? 0)
} }
// Load default values from the query parameters.
if ('credited-account' in route.query) {
creditedAccountId.value = parseInt(route.query['credited-account'] as string)
}
if ('debited-account' in route.query) {
debitedAccountId.value = parseInt(route.query['debited-account'] as string)
}
}) })
/** /**