Add showing last digits for expense income payment and transfer pages

This commit is contained in:
qowevisa 2024-11-23 18:58:19 +02:00
parent d328311ed6
commit 4cbe3fe0f9
4 changed files with 17 additions and 7 deletions

View File

@ -259,6 +259,9 @@
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<span class="font-bold">Card:</span> <span class="font-bold">Card:</span>
{getCardName(expense.card_id)} {getCardName(expense.card_id)}
<span class="text-sm"
>{`•${cards.find((card) => card.id == expense.card_id)?.last_digits}`}</span
>
<span class="font-bold">Type:</span> <span class="font-bold">Type:</span>
<span style="color: {getTypeColor(expense.type_id)};" <span style="color: {getTypeColor(expense.type_id)};"
>{getTypeName(expense.type_id)}</span >{getTypeName(expense.type_id)}</span

View File

@ -221,6 +221,9 @@
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<span class="font-bold">Card:</span> <span class="font-bold">Card:</span>
{getCardName(income.card_id)} {getCardName(income.card_id)}
<span class="text-sm"
>{`•${cards.find((card) => card.id == income.card_id)?.last_digits}`}</span
>
<span class="font-bold">Date:</span> <span class="font-bold">Date:</span>
{income.date} {income.date}
</div> </div>

View File

@ -132,11 +132,6 @@
const type = types.find((type) => type.id === typeId); const type = types.find((type) => type.id === typeId);
return type ? type.color : "#000"; 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<number, = new Map(); // let priceRefs: Map<number, = new Map();
function createHandler(item: ItemBought) { function createHandler(item: ItemBought) {
@ -470,9 +465,12 @@
<p>{payment.descr}</p> <p>{payment.descr}</p>
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<span class="font-bold">Card:</span> <span class="font-bold">Card:</span>
{payment.card_id} {getCardName(payment.card_id || 0)}
<span class="text-sm"
>{`•${cards.find((card) => card.id == payment.card_id)?.last_digits}`}</span
>
<span class="font-bold">Category:</span> <span class="font-bold">Category:</span>
{payment.category_id} {categories.find(cat => cat.id == payment.category_id)?.name}
<span class="font-bold">Date:</span> <span class="font-bold">Date:</span>
{payment.date} {payment.date}
</div> </div>

View File

@ -222,8 +222,14 @@
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<span class="font-bold">From:</span> <span class="font-bold">From:</span>
{getCardName(transfer.from_card_id)} {getCardName(transfer.from_card_id)}
<span class="text-sm"
>{`•${cards.find((card) => card.id == transfer.from_card_id)?.last_digits}`}</span
>
<span class="font-bold">To:</span> <span class="font-bold">To:</span>
{getCardName(transfer.to_card_id)} {getCardName(transfer.to_card_id)}
<span class="text-sm"
>{`•${cards.find((card) => card.id == transfer.to_card_id)?.last_digits}`}</span
>
<span class="font-bold">Date:</span> <span class="font-bold">Date:</span>
{transfer.date} {transfer.date}
</div> </div>