New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.8 KiB

using ApexCharts;
using Biskilog_Accounting.Shared.CustomModels;
using Microsoft.AspNetCore.Components;
namespace Biskilog_Accounting.Client.Pages.Dashboard.Elements
{
public partial class ChartElement
{
[Parameter]
public bool IsLoading { get; set; }
[Parameter]
public string Title { get; set; } = string.Empty;
[Parameter]
public string SubTitle { get; set; } = string.Empty;
[Parameter]
public List<WeeklySaleItem> Series { get; set; } = new List<WeeklySaleItem>();
private ApexChartOptions<WeeklySaleItem> m_options;
private string m_bestDay { get; set; } = string.Empty;
private string m_worstDay { get; set; } = string.Empty;
private string m_bestSales { get; set; } = string.Empty;
private string m_worstSales { get; set; } = string.Empty;
protected override void OnParametersSet()
{
m_options = new ApexChartOptions<WeeklySaleItem>
{
PlotOptions = new PlotOptions
{
Bar = new PlotOptionsBar
{
ColumnWidth = "7",
}
}
};
if (Series.Count > 1)
{
m_bestDay = Series.OrderByDescending(t => t.Total).First().Date.ToShortDateString();
m_bestSales = m_calculator.FormatMoneyWithCurrency((double)Series.OrderByDescending(t => t.Total).First().Total);
m_worstDay = Series.OrderByDescending(t => t.Total).Last().Date.ToShortDateString();
m_worstSales = m_calculator.FormatMoneyWithCurrency((double)Series.OrderByDescending(t => t.Total).Last().Total);
}
base.OnParametersSet();
}
}
}