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 Series { get; set; } = new List(); private ApexChartOptions 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 { 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(); } } }