@page "/"
@using NimbusFlow.Frontend.Services
@using NimbusFlow.Frontend.Models
@inject IApiService ApiService
NimbusFlow Dashboard
NimbusFlow Dashboard
@activeMemberCount
Currently Active
@pendingScheduleCount
Awaiting Response
@upcomingServiceCount
This Week
@code {
private int activeMemberCount = 0;
private int pendingScheduleCount = 0;
private int upcomingServiceCount = 0;
protected override async Task OnInitializedAsync()
{
try
{
// Load dashboard data
var members = await ApiService.GetMembersAsync();
activeMemberCount = members.Count(m => m.IsActive == 1);
var schedules = await ApiService.GetSchedulesAsync();
pendingScheduleCount = schedules.Count(s => s.Status == "pending");
var services = await ApiService.GetServicesAsync();
upcomingServiceCount = services.Count(s => s.ServiceDate >= DateTime.Today);
}
catch (Exception ex)
{
// Handle API errors gracefully
Console.WriteLine($"Error loading dashboard data: {ex.Message}");
}
}
}