Simplify payment column display in transactions table
Condensed the verbose payment method labels to show only the essential information: - Card transactions: Show just the card name (e.g., "AJ's Debit Card") - Direct account transactions: Show just the account name - Transfers: Show "Transfer → [Destination]" Removed duplicate display of account information since cards are already linked to accounts. This makes the Payment/Account column much less crowded and easier to read. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Transactions;
|
|||||||
|
|
||||||
namespace MoneyMap.Models;
|
namespace MoneyMap.Models;
|
||||||
|
|
||||||
[Index(nameof(Date), nameof(Amount), nameof(Name), nameof(Memo), nameof(CardId), nameof(AccountId), IsUnique = true)]
|
[Index(nameof(Date), nameof(Amount), nameof(Name), nameof(Memo), nameof(AccountId), nameof(CardId), IsUnique = true)]
|
||||||
public class Transaction
|
public class Transaction
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
@@ -31,37 +31,51 @@ public class Transaction
|
|||||||
|
|
||||||
public string Notes { get; set; } = string.Empty;
|
public string Notes { get; set; } = string.Empty;
|
||||||
|
|
||||||
// Payment method - EITHER Card OR Account (not both)
|
// Primary container: Every transaction belongs to an Account (the source of CSV)
|
||||||
// For credit/debit card transactions
|
[Required]
|
||||||
|
[ForeignKey(nameof(Account))]
|
||||||
|
public int AccountId { get; set; }
|
||||||
|
public Account Account { get; set; } = null!;
|
||||||
|
|
||||||
|
// Optional: Card used for this transaction (if it was a card payment)
|
||||||
[ForeignKey(nameof(Card))]
|
[ForeignKey(nameof(Card))]
|
||||||
public int? CardId { get; set; }
|
public int? CardId { get; set; }
|
||||||
public Card? Card { get; set; }
|
public Card? Card { get; set; }
|
||||||
|
|
||||||
// For bank account transactions (checking, savings)
|
// Optional: For transfers between accounts, this links to the destination account
|
||||||
[ForeignKey(nameof(Account))]
|
// This transaction is the "source" side of the transfer (debit)
|
||||||
public int? AccountId { get; set; }
|
// The matching transaction in the destination account has this AccountId as its TransferToAccountId
|
||||||
public Account? Account { get; set; }
|
[ForeignKey(nameof(TransferToAccount))]
|
||||||
|
public int? TransferToAccountId { get; set; }
|
||||||
|
public Account? TransferToAccount { get; set; }
|
||||||
|
|
||||||
[MaxLength(4)]
|
[MaxLength(4)]
|
||||||
public string? Last4 { get; set; } // parsed from Memo if present (replaces CardLast4)
|
public string? Last4 { get; set; } // parsed from Memo if present
|
||||||
|
|
||||||
public ICollection<Receipt> Receipts { get; set; } = new List<Receipt>();
|
public ICollection<Receipt> Receipts { get; set; } = new List<Receipt>();
|
||||||
|
|
||||||
[NotMapped] public bool IsCredit => Amount > 0;
|
[NotMapped] public bool IsCredit => Amount > 0;
|
||||||
[NotMapped] public bool IsDebit => Amount < 0;
|
[NotMapped] public bool IsDebit => Amount < 0;
|
||||||
|
[NotMapped] public bool IsTransfer => TransferToAccountId.HasValue;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string PaymentMethodLabel
|
public string PaymentMethodLabel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
// Handle transfers
|
||||||
|
if (IsTransfer)
|
||||||
|
{
|
||||||
|
var toLabel = TransferToAccount?.DisplayLabel ?? "Unknown";
|
||||||
|
return $"Transfer → {toLabel}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// If card was used, show just the card (since account is implied)
|
||||||
if (Card != null)
|
if (Card != null)
|
||||||
return $"{Card.Issuer} {Card.Last4}";
|
return Card.DisplayLabel;
|
||||||
if (Account != null)
|
|
||||||
return $"{Account.Institution} {Account.Last4}";
|
// Direct account transaction (no card)
|
||||||
if (!string.IsNullOrEmpty(Last4))
|
return Account?.DisplayLabel ?? $"···· {Last4}";
|
||||||
return $"···· {Last4}";
|
|
||||||
return "Unknown";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
<th>Memo</th>
|
<th>Memo</th>
|
||||||
<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: 140px;">Payment/Account</th>
|
||||||
<th style="width: 120px;">Actions</th>
|
<th style="width: 120px;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -164,7 +164,9 @@
|
|||||||
@t.Category
|
@t.Category
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@t.CardLabel</td>
|
<td class="small">
|
||||||
|
@t.CardLabel
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-page="/EditTransaction" asp-route-id="@t.Id" class="btn btn-sm btn-outline-primary" title="Edit">
|
<a asp-page="/EditTransaction" asp-route-id="@t.Id" class="btn btn-sm btn-outline-primary" title="Edit">
|
||||||
Edit
|
Edit
|
||||||
|
|||||||
Reference in New Issue
Block a user