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: 110px;" class="text-end">Amount</th>
<th style="width: 160px;">Category</th> <th style="width: 160px;">Category</th>
<th style="width: 110px;">Card</th> <th style="width: 110px;">Card</th>
<th style="width: 90px;">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var t in Model.Recent) @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>@t.Date.ToString("yyyy-MM-dd")</td>
<td> <td>
<div class="d-flex align-items-center gap-2"> <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) @if (t.ReceiptCount > 0)
{ {
<span class="badge bg-success" title="@t.ReceiptCount receipt(s) attached"> <span class="badge bg-success" title="@t.ReceiptCount receipt(s) attached">
@@ -142,6 +143,9 @@
} }
</td> </td>
<td>@t.CardLabel</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> </tr>
} }
</tbody> </tbody>

View File

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