From 4cbe3fe0f9adfbdfeb19911bb3da3ad9b171aa8e Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sat, 23 Nov 2024 18:58:19 +0200 Subject: [PATCH] Add showing last digits for expense income payment and transfer pages --- src/routes/expense/+page.svelte | 3 +++ src/routes/income/+page.svelte | 3 +++ src/routes/payment/+page.svelte | 12 +++++------- src/routes/transfer/+page.svelte | 6 ++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/routes/expense/+page.svelte b/src/routes/expense/+page.svelte index 93079b7..cd46c56 100644 --- a/src/routes/expense/+page.svelte +++ b/src/routes/expense/+page.svelte @@ -259,6 +259,9 @@
Card: {getCardName(expense.card_id)} + {`•${cards.find((card) => card.id == expense.card_id)?.last_digits}`} Type: {getTypeName(expense.type_id)} Card: {getCardName(income.card_id)} + {`•${cards.find((card) => card.id == income.card_id)?.last_digits}`} Date: {income.date}
diff --git a/src/routes/payment/+page.svelte b/src/routes/payment/+page.svelte index 65a0323..8bdf7ca 100644 --- a/src/routes/payment/+page.svelte +++ b/src/routes/payment/+page.svelte @@ -132,11 +132,6 @@ const type = types.find((type) => type.id === typeId); return type ? type.color : "#000"; } - function getTypeName(typeId: number) { - if (typeId === 0) return "None"; - const type = types.find((card) => card.id === typeId); - return type ? type.name : "Unknown"; - } // let priceRefs: Map{payment.descr}

Card: - {payment.card_id} + {getCardName(payment.card_id || 0)} + {`•${cards.find((card) => card.id == payment.card_id)?.last_digits}`} Category: - {payment.category_id} + {categories.find(cat => cat.id == payment.category_id)?.name} Date: {payment.date}
diff --git a/src/routes/transfer/+page.svelte b/src/routes/transfer/+page.svelte index 83a2ef3..2ba343e 100644 --- a/src/routes/transfer/+page.svelte +++ b/src/routes/transfer/+page.svelte @@ -222,8 +222,14 @@
From: {getCardName(transfer.from_card_id)} + {`•${cards.find((card) => card.id == transfer.from_card_id)?.last_digits}`} To: {getCardName(transfer.to_card_id)} + {`•${cards.find((card) => card.id == transfer.to_card_id)?.last_digits}`} Date: {transfer.date}