- Added account linking functionality to cards with dropdown selector - Added optional nickname field for easier card identification - Updated Cards list page to show linked accounts with badges - Reorganized card display to show issuer and last4 together - Include account relationship when loading cards This allows cards to be properly associated with their bank accounts, which is essential for the transaction import and categorization flow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
111 lines
4.7 KiB
Plaintext
111 lines
4.7 KiB
Plaintext
@page
|
|
@model MoneyMap.Pages.CardsModel
|
|
@{
|
|
ViewData["Title"] = "Manage Cards";
|
|
}
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h2>Manage Cards</h2>
|
|
<div>
|
|
<a asp-page="/EditCard" class="btn btn-primary">Add New Card</a>
|
|
<a asp-page="/Index" class="btn btn-outline-secondary">Back to Dashboard</a>
|
|
</div>
|
|
</div>
|
|
|
|
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
|
|
{
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
@Model.SuccessMessage
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
}
|
|
|
|
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
|
|
{
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
@Model.ErrorMessage
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
}
|
|
|
|
@if (Model.Cards.Any())
|
|
{
|
|
<div class="card shadow-sm">
|
|
<div class="card-header">
|
|
<strong>Your Cards (@Model.Cards.Count)</strong>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Card</th>
|
|
<th>Owner</th>
|
|
<th>Linked Account</th>
|
|
<th class="text-end">Transactions</th>
|
|
<th style="width: 150px;">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model.Cards)
|
|
{
|
|
<tr>
|
|
<td>
|
|
<div>
|
|
<strong>@item.Card.Issuer •••• @item.Card.Last4</strong>
|
|
@if (!string.IsNullOrEmpty(item.Card.Nickname))
|
|
{
|
|
<br />
|
|
<small class="text-muted">@item.Card.Nickname</small>
|
|
}
|
|
</div>
|
|
</td>
|
|
<td>@item.Card.Owner</td>
|
|
<td>
|
|
@if (item.Card.Account != null)
|
|
{
|
|
<span class="badge bg-success">@item.Card.Account.DisplayLabel</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-muted">None</span>
|
|
}
|
|
</td>
|
|
<td class="text-end">@item.TransactionCount</td>
|
|
<td>
|
|
<div class="d-flex gap-1">
|
|
<a asp-page="/EditCard" asp-route-id="@item.Card.Id" class="btn btn-sm btn-outline-primary">
|
|
Edit
|
|
</a>
|
|
@if (item.TransactionCount == 0)
|
|
{
|
|
<form method="post" asp-page-handler="Delete" asp-route-id="@item.Card.Id"
|
|
onsubmit="return confirm('Delete this card?')" class="d-inline">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
|
|
</form>
|
|
}
|
|
else
|
|
{
|
|
<button type="button" class="btn btn-sm btn-outline-secondary" disabled
|
|
title="Cannot delete - card has transactions">
|
|
Delete
|
|
</button>
|
|
}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="alert alert-info">
|
|
<h5>No cards found</h5>
|
|
<p>Add your first card to start tracking transactions.</p>
|
|
<a asp-page="/EditCard" class="btn btn-primary">Add New Card</a>
|
|
</div>
|
|
} |