Added clickable category label.
This commit is contained in:
parent
683d11a9a4
commit
50884c37c0
|
|
@ -148,8 +148,8 @@ CREATE TABLE account_value_record (
|
|||
);
|
||||
|
||||
CREATE TABLE account_value_record_attachment (
|
||||
value_record_id BIGINT NOT NULL,
|
||||
attachment_id BIGINT NOT NULL,
|
||||
value_record_id INTEGER NOT NULL,
|
||||
attachment_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (value_record_id, attachment_id),
|
||||
CONSTRAINT fk_account_value_record_attachment_value_record
|
||||
FOREIGN KEY (value_record_id) REFERENCES account_value_record(id)
|
||||
|
|
@ -161,20 +161,24 @@ CREATE TABLE account_value_record_attachment (
|
|||
|
||||
-- History Entities
|
||||
|
||||
CREATE TABLE history (
|
||||
id INTEGER PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE history_item (
|
||||
id INTEGER PRIMARY KEY,
|
||||
history_id INTEGER NOT NULL,
|
||||
timestamp TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
CONSTRAINT fk_history_item_history
|
||||
FOREIGN KEY (history_id) REFERENCES history(id)
|
||||
timestamp TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE account_history_item (
|
||||
account_id INTEGER NOT NULL,
|
||||
history_item_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (account_id, history_item_id),
|
||||
CONSTRAINT fk_account_history_item_account
|
||||
FOREIGN KEY (account_id) REFERENCES account(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT fk_account_history_item_history_item
|
||||
FOREIGN KEY (history_item_id) REFERENCES history_item(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Zero or more plain text messages may be logged for any history item.
|
||||
CREATE TABLE history_item_text (
|
||||
item_id INTEGER PRIMARY KEY,
|
||||
content TEXT NOT NULL,
|
||||
|
|
@ -183,26 +187,40 @@ CREATE TABLE history_item_text (
|
|||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE account_history (
|
||||
account_id INTEGER NOT NULL UNIQUE,
|
||||
history_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (account_id, history_id),
|
||||
CONSTRAINT fk_account_history_account
|
||||
FOREIGN KEY (account_id) REFERENCES account(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT fk_account_history_history
|
||||
FOREIGN KEY (history_id) REFERENCES history(id)
|
||||
-- Zero or more property changes may be logged for any history item.
|
||||
CREATE TABLE history_item_property_change (
|
||||
item_id INTEGER NOT NULL,
|
||||
property_name TEXT NOT NULL,
|
||||
old_value TEXT,
|
||||
new_value TEXT,
|
||||
PRIMARY KEY (item_id, property_name),
|
||||
CONSTRAINT fk_history_item_property_change_item
|
||||
FOREIGN KEY (item_id) REFERENCES history_item(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE transaction_history (
|
||||
transaction_id INTEGER NOT NULL UNIQUE,
|
||||
history_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (transaction_id, history_id),
|
||||
CONSTRAINT fk_history_transaction_transaction
|
||||
FOREIGN KEY (transaction_id) REFERENCES "transaction"(id)
|
||||
-- Links a value record to a history item, used to include value records in an account's history.
|
||||
CREATE TABLE history_item_linked_value_record (
|
||||
item_id INTEGER NOT NULL,
|
||||
value_record_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (item_id, value_record_id),
|
||||
CONSTRAINT fk_history_item_linked_value_record_item
|
||||
FOREIGN KEY (item_id) REFERENCES history_item(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT fk_history_transaction_history
|
||||
FOREIGN KEY (history_id) REFERENCES history(id)
|
||||
CONSTRAINT fk_history_item_linked_value_record_value_record
|
||||
FOREIGN KEY (value_record_id) REFERENCES account_value_record(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Links a journal entry to a history item, used to include journal entries in an account's history.
|
||||
CREATE TABLE history_item_linked_journal_entry (
|
||||
item_id INTEGER NOT NULL,
|
||||
journal_entry_id INTEGER NOT NULL,
|
||||
PRIMARY KEY (item_id, journal_entry_id),
|
||||
CONSTRAINT fk_history_item_linked_journal_entry_item
|
||||
FOREIGN KEY (item_id) REFERENCES history_item(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT fk_history_item_linked_journal_entry_journal_entry
|
||||
FOREIGN KEY (journal_entry_id) REFERENCES account_journal_entry(id)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,20 @@
|
|||
<script setup lang="ts">
|
||||
import type { TransactionCategory } from '@/api/transaction';
|
||||
import { useProfileStore } from '@/stores/profile-store';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
defineProps<{ category: TransactionCategory }>()
|
||||
const router = useRouter()
|
||||
const props = defineProps<{ category: TransactionCategory, clickable?: boolean }>()
|
||||
|
||||
function onClicked() {
|
||||
if (props.clickable) {
|
||||
const profileStore = useProfileStore()
|
||||
router.push(`/profiles/${profileStore.state?.name}/categories`)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<span class="category-label">
|
||||
<span class="category-label" @click="onClicked()" :style="{ 'cursor': clickable ? 'pointer' : 'default' }">
|
||||
<div class="category-label-color" :style="{ 'background-color': '#' + category.color }"></div>
|
||||
{{ category.name }}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ async function deleteTransaction() {
|
|||
<tr v-if="transaction.category">
|
||||
<th>Category</th>
|
||||
<td>
|
||||
<CategoryLabel :category="transaction.category" />
|
||||
<CategoryLabel :category="transaction.category" :clickable="true" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="transaction.creditedAccount">
|
||||
|
|
|
|||
Loading…
Reference in New Issue