diff --git a/src/components/BalanceAssertionEditor.vue b/src/components/BalanceAssertionEditor.vue new file mode 100644 index 0000000..bf074d9 --- /dev/null +++ b/src/components/BalanceAssertionEditor.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/main.ts b/src/main.ts index 824f9fb..d0c32a1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,6 +31,8 @@ async function initApp() { const routes = [ { path: '/', name: 'index', component: () => import('./pages/HomeView.vue') }, { path: '/balance-assertions', name: 'balance-assertions', component: () => import('./pages/BalanceAssertionsView.vue') }, + { path: '/balance-assertions/edit/:id', name: 'balance-assertions-edit', component: () => import('./pages/EditBalanceAssertionView.vue') }, + { path: '/balance-assertions/new', name: 'balance-assertions-new', component: () => import('./pages/NewBalanceAssertionView.vue') }, { path: '/chart-of-accounts', name: 'chart-of-accounts', component: () => import('./pages/ChartOfAccountsView.vue') }, { path: '/general-ledger', name: 'general-ledger', component: () => import('./pages/GeneralLedgerView.vue') }, { path: '/journal', name: 'journal', component: () => import('./pages/JournalView.vue') }, diff --git a/src/pages/BalanceAssertionsView.vue b/src/pages/BalanceAssertionsView.vue index 5343bc3..eb2ae56 100644 --- a/src/pages/BalanceAssertionsView.vue +++ b/src/pages/BalanceAssertionsView.vue @@ -22,12 +22,10 @@
- +
@@ -54,10 +52,8 @@ @@ -72,7 +68,8 @@ import { db, totalBalancesAtDate } from '../db.ts'; import { pp } from '../display.ts'; - import { CheckIcon, XMarkIcon } from '@heroicons/vue/24/outline'; + import { CheckIcon, PencilIcon, XMarkIcon } from '@heroicons/vue/24/outline'; + import { PlusIcon } from '@heroicons/vue/16/solid'; const balanceAssertions = ref([] as ValidatedBalanceAssertion[]); diff --git a/src/pages/EditBalanceAssertionView.vue b/src/pages/EditBalanceAssertionView.vue new file mode 100644 index 0000000..e7df81e --- /dev/null +++ b/src/pages/EditBalanceAssertionView.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/src/pages/EditTransactionView.vue b/src/pages/EditTransactionView.vue index b70aa0e..c4f1272 100644 --- a/src/pages/EditTransactionView.vue +++ b/src/pages/EditTransactionView.vue @@ -30,7 +30,7 @@ import { ref } from 'vue'; import { useRoute } from 'vue-router'; - import { JoinedTransactionPosting, Posting, db, joinedToTransactions, serialiseAmount } from '../db.ts'; + import { JoinedTransactionPosting, db, joinedToTransactions, serialiseAmount } from '../db.ts'; import TransactionEditor, { EditingTransaction } from '../components/TransactionEditor.vue'; const route = useRoute(); @@ -56,16 +56,18 @@ const transactions = joinedToTransactions(joinedTransactionPostings); if (transactions.length !== 1) { throw new Error('Unexpected number of transactions returned from SQL'); } - transaction.value = transactions[0] as unknown as EditingTransaction; + const rawTransaction = transactions[0] as any; // Format dt - transaction.value.dt = dayjs(transaction.value.dt).format('YYYY-MM-DD') + rawTransaction.dt = dayjs(rawTransaction.dt).format('YYYY-MM-DD'); // Initialise sign and amount_abs - for (const posting of transaction.value.postings) { - posting.sign = (posting as unknown as Posting).quantity! >= 0 ? 'dr' : 'cr'; - posting.amount_abs = serialiseAmount(Math.abs((posting as unknown as Posting).quantity), (posting as unknown as Posting).commodity); + for (const posting of rawTransaction.postings) { + posting.sign = posting.quantity >= 0 ? 'dr' : 'cr'; + posting.amount_abs = serialiseAmount(Math.abs(posting.quantity), posting.commodity); } + + transaction.value = rawTransaction as EditingTransaction; } load(); diff --git a/src/pages/NewBalanceAssertionView.vue b/src/pages/NewBalanceAssertionView.vue new file mode 100644 index 0000000..f02930d --- /dev/null +++ b/src/pages/NewBalanceAssertionView.vue @@ -0,0 +1,41 @@ + + + + +
- - - - + +