76 lines
2.2 KiB
C#
76 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BankSampahApp.Models;
|
|
|
|
/// <summary>
|
|
/// View model yang menampung data grafik dashboard beserta opsi filter tahunan.
|
|
/// </summary>
|
|
public class DashboardChartViewModel
|
|
{
|
|
/// <summary>
|
|
/// Data grafik per tahun (key berupa tahun).
|
|
/// </summary>
|
|
public Dictionary<int, DashboardChartPayload> YearlyData { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Tahun yang dipilih saat halaman pertama kali dimuat.
|
|
/// </summary>
|
|
public int SelectedYear { get; set; }
|
|
|
|
/// <summary>
|
|
/// Daftar tahun yang tersedia untuk filter, disortir menurun.
|
|
/// </summary>
|
|
public IEnumerable<int> AvailableYears => YearlyData.Keys.OrderByDescending(x => x);
|
|
|
|
/// <summary>
|
|
/// Data grafik verifikasi vs aktif transaksi per tahun dan entitas.
|
|
/// </summary>
|
|
public Dictionary<int, Dictionary<string, VerifiedActiveChartPayload>> VerifiedActiveYearlyData { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Daftar entitas yang dapat difilter.
|
|
/// </summary>
|
|
public List<string> Entities { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Entitas yang dipilih secara default.
|
|
/// </summary>
|
|
public string SelectedEntity { get; set; } = string.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Struktur data payload untuk chart per tahun.
|
|
/// </summary>
|
|
public class DashboardChartPayload
|
|
{
|
|
/// <summary>
|
|
/// Label (umumnya nama bulan) yang ditampilkan pada sumbu X.
|
|
/// </summary>
|
|
public List<string> Labels { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Dataset yang ditampilkan pada grafik.
|
|
/// </summary>
|
|
public List<DashboardChartDataset> Datasets { get; set; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dataset individual untuk Chart.js.
|
|
/// </summary>
|
|
public class DashboardChartDataset
|
|
{
|
|
public string Label { get; set; } = string.Empty;
|
|
public List<int> Data { get; set; } = new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Payload untuk grafik data terverifikasi & aktif transaksi.
|
|
/// </summary>
|
|
public class VerifiedActiveChartPayload
|
|
{
|
|
public List<string> Labels { get; set; } = new();
|
|
public List<int> VerifiedData { get; set; } = new();
|
|
public List<int> ActiveData { get; set; } = new();
|
|
}
|