diff --git a/backend/db/migrations/0059_bankstatement_notes.sql b/backend/db/migrations/0059_bankstatement_notes.sql new file mode 100644 index 0000000..6984c51 --- /dev/null +++ b/backend/db/migrations/0059_bankstatement_notes.sql @@ -0,0 +1 @@ +ALTER TABLE "bankstatements" ADD COLUMN "notes" text; diff --git a/backend/db/migrations/meta/_journal.json b/backend/db/migrations/meta/_journal.json index 16f3b5b..f0c6f9d 100644 --- a/backend/db/migrations/meta/_journal.json +++ b/backend/db/migrations/meta/_journal.json @@ -393,6 +393,13 @@ "when": 1786023052994, "tag": "0058_global_reference_data", "breakpoints": true + }, + { + "idx": 56, + "version": "7", + "when": 1786082400000, + "tag": "0059_bankstatement_notes", + "breakpoints": true } ] } diff --git a/backend/db/schema/bankstatements.ts b/backend/db/schema/bankstatements.ts index c69ee2e..b28082f 100644 --- a/backend/db/schema/bankstatements.ts +++ b/backend/db/schema/bankstatements.ts @@ -34,6 +34,7 @@ export const bankstatements = pgTable("bankstatements", { credName: text("credName"), text: text("text"), + notes: text("notes"), amount: doublePrecision("amount").notNull(), tenant: bigint("tenant", { mode: "number" }) diff --git a/frontend/pages/banking/statements/[mode]/[[id]].vue b/frontend/pages/banking/statements/[mode]/[[id]].vue index b129af5..de61cd1 100644 --- a/frontend/pages/banking/statements/[mode]/[[id]].vue +++ b/frontend/pages/banking/statements/[mode]/[[id]].vue @@ -39,6 +39,7 @@ const ownaccounts = ref([]) const loading = ref(true) const loadingDocuments = ref(true) +const savingNotes = ref(false) const rebuildDocumentLists = () => { const documents = createddocuments.value.filter(i => i.type === "invoices" || i.type === "advanceInvoices") @@ -260,6 +261,22 @@ const removeAllocation = async (allocationId) => { manualAllocationSum.value = calculateOpenSum.value } +const saveNotes = async () => { + savingNotes.value = true + try { + const notes = String(itemInfo.value.notes || "").trim() || null + const updated = await useEntities("bankstatements").update(itemInfo.value.id, {notes}, true) + itemInfo.value.notes = updated.notes + oldItemInfo.value.notes = updated.notes + } finally { + savingNotes.value = false + } +} + +const notesChanged = computed(() => + String(itemInfo.value?.notes || "").trim() !== String(oldItemInfo.value?.notes || "").trim() +) + const searchString = ref(tempStore.searchStrings["bankstatementsedit"] || '') const clearSearchString = () => { @@ -595,6 +612,28 @@ setup() +