Skip to content

Commit

Permalink
only edit one account info at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Dec 23, 2023
1 parent 5881a30 commit 0ebff6a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Pages/AccountView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,23 @@
<div style=clear:left>
@{var accountIndex = 0;}
@{selectedInvestment = null;}
@{Account? accountEditing = null;}
@foreach (var account in appData.FamilyData.Accounts) {
int accBuffer = accountIndex;
accountIndex++;
if(account.View) {
bool alternateRow2 = false;
if (account.Investments.Count == 0 && account.AccountType == null && account.Custodian == null && account.Note == null)
{
accountEditing = account;
account.Edit = true;
}

@if(accountEditing == account) {
@if(account.Edit) {
@((MarkupString)bold("Edit Account Info:"))
}

<br/>
<table class=mainTable>
<tr style=color:white;background:black; @onclick=editAccountInfo>
<tr style=color:white;background:black; @onclick='@(e=>editAccountInfo(e,account))'>
<td colspan=3>
@account.Title
</td>
Expand All @@ -122,7 +120,7 @@
<a style=margin:0px;padding:0px;width:20px class="m-0 btn" >✏️</a>
</td>
</tr>
@if (accountEditing == account) {
@if (account.Edit) {
<tr style=color:white;background:black;padding-left:8px>
<td colspan=4>
@if (appData.FamilyData.PersonCount == 2) {
Expand Down Expand Up @@ -191,7 +189,7 @@
<button @onclick='@(e=>deleteAccount2(e,accBuffer))' title='delete account'>account</button>
</td>
<td colspan=1 style=text-align:right>
<button @onclick=editAccountInfo>save info</button>
<button @onclick='@(e=>editAccountInfo(e,account))'>save info</button>
</td>
</tr>
}
Expand Down Expand Up @@ -337,8 +335,8 @@

@code {
bool editingAccountInfo = false;
void editAccountInfo() {
editingAccountInfo = !editingAccountInfo;
void editAccountInfo(MouseEventArgs e, Account account) {
account.Edit = !account.Edit;
}
void deleteSelectedInvestment(MouseEventArgs e, Investment selectedInvestment)
{
Expand Down

0 comments on commit 0ebff6a

Please sign in to comment.