Skip to content

Commit

Permalink
#476 - Show incomes even when no expenses are logged in selected period.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Jun 14, 2023
1 parent a3b20db commit faaa0c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Money.Blazor.Host/Pages/Summary.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
</div>
}

@if (ExpenseTotal != null && ExpenseTotal.Value == 0)
@if (ExpenseTotal != null && ExpenseTotal.Value == 0 && (IncomeTotal == null || IncomeTotal.Value == 0))
{
<Alert Title="No data." Message="Let's add some expenses." Mode="@AlertMode.Warning" />
}
else if (Categories != null)
{
<div class="graph">
@if (ExpenseTotal != null)
@if (ExpenseTotal != null || IncomeTotal != null)
{
<div class="card bar-graph bar-graph-summary" @onclick="@(() => OpenOverview(SelectedPeriod))">
<div class="card-body">
Expand All @@ -52,7 +52,7 @@
}

<span class="text-danger">
@FormatPrice(ExpenseTotal)
@FormatPrice(ExpenseTotal, CurrencyFormatter.FormatZero.Zero)
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/Money.Blazor.Host/Pages/Summary.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ protected string GetPercentualValue(CategoryWithAmountModel category)
return percentage.ToString("0.##", CultureInfo.InvariantCulture);
}

protected string FormatPrice(Price price)
=> formatter.Format(price, CurrencyFormatter.FormatZero.Empty);
protected string FormatPrice(Price price, CurrencyFormatter.FormatZero formatZero = CurrencyFormatter.FormatZero.Empty)
=> formatter.Format(price, formatZero);

public void Dispose()
=> UnBindEvents();
Expand Down

0 comments on commit faaa0c8

Please sign in to comment.