Dashboard: make recent transactions clickable and add Open action; include Id and ReceiptCount in recent data

Co-authored-by:Codex-CLI-Agent
codex-cli@users.noreply.local
This commit is contained in:
AJ
2025-10-19 00:07:48 -04:00
parent bfe9ee5f08
commit 23421bcc99
2 changed files with 12 additions and 5 deletions

View File

@@ -111,16 +111,17 @@
<th style="width: 110px;" class="text-end">Amount</th>
<th style="width: 160px;">Category</th>
<th style="width: 110px;">Card</th>
<th style="width: 90px;">Action</th>
</tr>
</thead>
<tbody>
@foreach (var t in Model.Recent)
{
<tr>
<tr style="cursor: pointer;" title="View details" onclick="window.location.href='@Url.Page("/EditTransaction", new { id = t.Id })'">
<td>@t.Date.ToString("yyyy-MM-dd")</td>
<td>
<div class="d-flex align-items-center gap-2">
<span>@t.Name</span>
<a asp-page="/EditTransaction" asp-route-id="@t.Id" class="text-decoration-none text-dark">@t.Name</a>
@if (t.ReceiptCount > 0)
{
<span class="badge bg-success" title="@t.ReceiptCount receipt(s) attached">
@@ -142,9 +143,12 @@
}
</td>
<td>@t.CardLabel</td>
<td>
<a asp-page="/EditTransaction" asp-route-id="@t.Id" class="btn btn-sm btn-outline-secondary">Open</a>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -50,6 +50,7 @@ namespace MoneyMap.Pages
public class RecentTxnRow
{
public long Id { get; set; }
public DateTime Date { get; set; }
public string Name { get; set; } = "";
public string Memo { get; set; } = "";
@@ -230,12 +231,14 @@ namespace MoneyMap.Pages
.ThenByDescending(t => t.Id)
.Select(t => new IndexModel.RecentTxnRow
{
Id = t.Id,
Date = t.Date,
Name = t.Name,
Memo = t.Memo,
Amount = t.Amount,
Category = t.Category ?? "",
CardLabel = t.PaymentMethodLabel
CardLabel = t.PaymentMethodLabel,
ReceiptCount = t.Receipts.Count()
})
.Take(count)
.AsNoTracking()
@@ -262,4 +265,4 @@ namespace MoneyMap.Pages
public required List<IndexModel.TopCategoryRow> TopCategories { get; init; }
public required List<IndexModel.RecentTxnRow> RecentTransactions { get; init; }
}
}
}