@m_remarks
diff --git a/Client/Pages/Dashboard/Elements/WelcomeCard.razor.cs b/Client/Pages/Dashboard/Elements/WelcomeCard.razor.cs index ee38ea2..4982050 100644 --- a/Client/Pages/Dashboard/Elements/WelcomeCard.razor.cs +++ b/Client/Pages/Dashboard/Elements/WelcomeCard.razor.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Components; +using Biskilog_Accounting.Shared.CustomModels; +using Microsoft.AspNetCore.Components; namespace Biskilog_Accounting.Client.Pages.Dashboard.Elements { @@ -8,11 +9,11 @@ namespace Biskilog_Accounting.Client.Pages.Dashboard.Elements public string Username { get; set; } = string.Empty; [Parameter] - public double CurrentTradeSales { get; set; } = 0; - [Parameter] - public double PreviousTradeSales { get; set; } = 0; + public TradeSummary TradeSummary { get; set; } = new TradeSummary(); private string m_remarks { get; set; } = ""; + private string m_currentTrade { get; set; } = string.Empty; + private string m_previousTrade { get; set; } = string.Empty; protected override void OnParametersSet() { @@ -20,20 +21,38 @@ namespace Biskilog_Accounting.Client.Pages.Dashboard.Elements } private void CalculateStatistic() { - double change = ((CurrentTradeSales - PreviousTradeSales) / PreviousTradeSales) * 100; - if (CurrentTradeSales > PreviousTradeSales) + if(TradeSummary.CurrentTradeDate != DateTime.Today) + { + m_currentTrade = $"most recent trade date ({TradeSummary.CurrentTradeDate.ToString("dd MMM,yyy")})"; + } + else + { + m_currentTrade = "current trade"; + } + + if (TradeSummary.LastTradeDate != DateTime.Today.AddDays(-1)) + { + m_previousTrade = $"previous trade date ({TradeSummary.LastTradeDate.ToString("dd MMM,yyy")})"; + } + else + { + m_previousTrade = "previous trade"; + } + + double change = ((TradeSummary.CurrentTradeSales - TradeSummary.LastTradeSales) / TradeSummary.LastTradeSales) * 100; + if (TradeSummary.CurrentTradeSales > TradeSummary.LastTradeSales) { string changePercent = change.ToString("0.00") + "%"; - m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, {changePercent} more than the previous trade sales"; + m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(TradeSummary.CurrentTradeSales)} in the {m_currentTrade}, {changePercent} more than the sales in the {m_previousTrade}"; } - else if (PreviousTradeSales > CurrentTradeSales) + else if (TradeSummary.LastTradeSales > TradeSummary.CurrentTradeSales) { string changePercent = (change * -1).ToString("0.00") + "%"; - m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, {changePercent} less than the previous trade sales"; + m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(TradeSummary.CurrentTradeSales)} in the {m_currentTrade}, {changePercent} less than the sales in the {m_previousTrade}"; } else { - m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(CurrentTradeSales)} in the current trade, same as the previous trade sales"; + m_remarks = $"You made a total of {m_calculator.FormatMoneyWithCurrency(TradeSummary.CurrentTradeSales)} in the {m_currentTrade}, same as the sales in the {m_previousTrade}"; } StateHasChanged(); } diff --git a/Client/_Imports.razor b/Client/_Imports.razor index bb5b0c1..80ed857 100644 --- a/Client/_Imports.razor +++ b/Client/_Imports.razor @@ -5,4 +5,6 @@ @using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.JSInterop @using Biskilog_Accounting.Client -@using ApexCharts; \ No newline at end of file +@using ApexCharts; +@using Radzen +@using Radzen.Blazor diff --git a/Client/wwwroot/index.html b/Client/wwwroot/index.html index 5cc4985..b7d2405 100644 --- a/Client/wwwroot/index.html +++ b/Client/wwwroot/index.html @@ -7,6 +7,7 @@