Skip to content

Commit 3a8d761

Browse files
committed
support IBOND purchase date and hide quantity/price
1 parent e21d40f commit 3a8d761

File tree

5 files changed

+64
-15
lines changed

5 files changed

+64
-15
lines changed

Pages/AccountView.razor

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,18 @@
228228
} else {
229229
bgColor = alternateRow2 ? "white" : "lightgray";
230230
}
231+
bool isIBond = investment.Ticker == "IBOND";
231232
<tr style=background-color:@bgColor @onclick='@(e=>chooseInvestment(e,accBuffer,invBuffer))'>
232233
<td style=padding-left:8px;height:30px; title=@investment.Name>
233234
@(investment.Ticker != null ? investment.Ticker : investment.Name)
234235
</td>
235-
<td style=text-align:right;padding-left:8px>@FormatUtilities.formatDoubleTwoDecimal(investment.SharesPIN)</td>
236-
<td style=text-align:right;padding-left:8px>@FormatUtilities.formatMoney(investment.Price)</td>
236+
@if (isIBond)
237+
{
238+
<td style=text-align:center colspan="2">@FormatUtilities.formatMonth(investment.PurchaseDate)</td>
239+
} else {
240+
<td style=text-align:right;padding-left:8px>@FormatUtilities.formatDoubleTwoDecimal(investment.SharesPIN)</td>
241+
<td style=text-align:right;padding-left:8px>@FormatUtilities.formatMoney(investment.Price)</td>
242+
}
237243
<td style=text-align:right;padding-left:8px>
238244
@FormatUtilities.formatMoney(investment.ValuePIN, decimalPlaces:0)
239245
</td>
@@ -363,27 +369,58 @@
363369
<button @onclick='@(e=>plan(e,account,account.SelectedInvestment))'>Plan</button> <button @onclick='@(e=>commit(e,account,account.SelectedInvestment))'>Commit</button><br/>
364370
break;
365371
case "Edit":
366-
@((MarkupString)bold("Edit:"))<br/>
372+
bool isIBond = @account.SelectedInvestment.Ticker?.ToUpperInvariant() == "IBOND";
373+
<span>@((MarkupString)bold("Edit:"))</span><br/>
367374
<table>
368375
<tr>
369-
<td style=padding-left:16px>
370-
<input type=text style=width:70px @bind-Value=account.SelectedInvestment.Ticker @bind-Value:event=oninput placeholder='ticker'/></td>
371-
<label>Quantity: </label>
372-
<td style=text-align:right;padding-left:8px><input type=text style=width:100px;text-align:right @bind-Value=account.SelectedInvestment.SharesPIN @bind-Value:event=onchange placeholder='shares'/></td>
373-
<td></td>
376+
<td style=text-align:right>
377+
<label>Ticker: </label>
378+
</td>
379+
<td style=padding-left:8px>
380+
<input type=text style=width:70px @bind-Value=account.SelectedInvestment.Ticker @bind-Value:event=oninput placeholder='ticker'/>
381+
</td>
374382
</tr>
383+
@if (isIBond)
384+
{
385+
<tr>
386+
<td style=text-align:right>
387+
<label>Purchase Date: </label>
388+
</td>
389+
<td style=padding-left:8px>
390+
<input type=text style=width:100px @bind-Value=account.SelectedInvestment.PurchaseDate @bind-Value:event=oninput placeholder='m/yyyy'/>
391+
</td>
392+
</tr>
393+
} else {
394+
<tr>
395+
<td style=text-align:right>
396+
<label>Quantity: </label>
397+
</td>
398+
<td style=text-align:right;padding-left:8px>
399+
<input type=text style=width:100px;text-align:right @bind-Value=account.SelectedInvestment.SharesPIN @bind-Value:event=onchange placeholder='shares'/></td>
400+
<td></td>
401+
</tr>
402+
<tr>
403+
<td style=text-align:right>
404+
<label>Price: </label>
405+
</td>
406+
<td style=text-align:left;padding-left:8px colspan=2>
407+
$<input type=text style=width:80px;text-align:right @bind-Value=account.SelectedInvestment.Price @bind-Value:event=onchange placeholder='price'/>
408+
</td>
409+
</tr>
410+
}
375411
<tr>
376-
<td style=text-align:right;padding-left:8px colspan=2>
377-
<label>Price: </label>
378-
$<input type=text style=width:80px;text-align:right @bind-Value=account.SelectedInvestment.Price @bind-Value:event=onchange placeholder='price'/></td>
379-
<td style=text-align:right;padding-left:8px colspan=2>
412+
<td style=text-align:right>
380413
<label>Balance: </label>
414+
</td>
415+
<td style=padding-left:8px colspan=2>
381416
$<input type=text style=width:100px;text-align:right @bind-Value=account.SelectedInvestment.ValuePIN @bind-Value:event=onchange placeholder='value'/>
382417
</td>
383418
</tr>
384419
<tr>
385-
<td style=text-align:right;padding-left:8px colspan=3>
420+
<td style=text-align:right>
386421
<label>Cost Basis: </label>
422+
</td>
423+
<td style=padding-left:8px colspan=3>
387424
$<input type=text style=width:100px;text-align:right @bind-Value=account.SelectedInvestment.CostBasis @bind-Value:event=oninput placeholder='cost basis'/>
388425
</td>
389426
<td></td>

Shared/Models/FamilyData/Investment.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public string? Name {
3333

3434
public List<Transaction> Transactions { get; set; }
3535

36+
public DateOnly? PurchaseDate { get; set; }
3637
public bool AutoCompleted { get; set; }
3738
private string? _Ticker;
3839
public string? Ticker {

Shared/Models/FormatUtilities.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ public static string formatMoney(int? amount)
66
return String.Format("${0:#,0.##}", amount);
77
}
88

9+
public static string formatMonth(DateOnly? date)
10+
{
11+
if (date == null) {
12+
return "";
13+
}
14+
else
15+
{
16+
return date?.ToString("MM/yyyy");
17+
}
18+
}
19+
920
public static string formatMoney(double? amount, bool withColor = false, int decimalPlaces = 2)
1021
{
1122
if (decimalPlaces != 2 && decimalPlaces != 0) {

wwwroot/cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CACHE MANIFEST
22

3-
# Version 1.0106
3+
# Version 1.0107
44

55
NETWORK:
66
*

wwwroot/data/funds.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)