Transactions: show ID on Edit page and add Copy ID button
Co-authored-by:Codex-CLI-Agent codex-cli@users.noreply.local
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
@page "{id:long}"
|
||||
@page "{id:long}"
|
||||
@model MoneyMap.Pages.EditTransactionModel
|
||||
@{
|
||||
ViewData["Title"] = "Edit Transaction";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h2>Edit Transaction</h2>
|
||||
<h2 class="mb-0">Edit Transaction <small class="text-muted">#@Model.Transaction.Id</small> <button type="button" class="btn btn-sm btn-outline-secondary ms-2" onclick="copyTransactionId()">Copy ID</button></h2>
|
||||
<a asp-page="/Transactions" class="btn btn-outline-secondary">Back to Transactions</a>
|
||||
</div>
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
@((item.Receipt.FileSizeBytes / 1024.0).ToString("F1")) KB
|
||||
· @item.Receipt.UploadedAtUtc.ToLocalTime().ToString("MMM d, yyyy")
|
||||
· @item.Receipt.UploadedAtUtc.ToLocalTime().ToString("MMM d, yyyy")
|
||||
</small>
|
||||
@if (!string.IsNullOrWhiteSpace(item.Receipt.Merchant))
|
||||
{
|
||||
@@ -309,3 +309,22 @@
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
|
||||
<script>
|
||||
function copyTransactionId() {
|
||||
var id = '@Model.Transaction.Id';
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
navigator.clipboard.writeText(id.toString());
|
||||
} else {
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = id;
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
var btns = document.querySelectorAll('button[onclick="copyTransactionId()"]');
|
||||
btns.forEach(function(btn){ var old=btn.textContent; btn.textContent='Copied!'; setTimeout(function(){ btn.textContent=old; }, 1500); });
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user