Skip to content

Commit

Permalink
Merge pull request #335 from GregFinzer/feature/adminContent
Browse files Browse the repository at this point in the history
Change admin dashboard content
  • Loading branch information
GregFinzer authored Aug 28, 2024
2 parents 2f00cc4 + ddc51cb commit e72a30a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 208 deletions.
58 changes: 6 additions & 52 deletions BedBrigade.Client/Components/Pages/Administration/Dashboard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,11 @@
@page "/administration/dashboard"

@attribute [Authorize(Roles = RoleNames.CanViewAdminDashboard)]
<h3 class="w-100 text-center">Administrative Dashboard</h3>
<h3 class="w-100 text-center mt-3">Administration Dashboard</h3>

<div class="text-center">
<h2>Bed Brigade</h2>
</div>


@if (DonationSource == null || VolunteerSource == null)
{
<Spinner />
}
else
{
<div class="control-section" id="target">
<div class="text-center">
<h2>Bed Brigade</h2>
</div>
@*<div style="padding:5px;text-align: right;">
<SfButton CssClass="e-btn e-info" Content="New Panel" @onclick="AddClick"></SfButton>
</div>*@
<SfDashboardLayout CellSpacing="@(new double[] { 10, 10 })" Columns="3">
<DashboardLayoutPanels>
<DashboardLayoutPanel ZIndex="500" SizeX="1" SizeY="1" Column="0" Row="0">
<HeaderTemplate><div class="">@TotalVolunteers.ToString() Volunteers</div></HeaderTemplate>
<ContentTemplate>
<div>
Volunteers
</div>
</ContentTemplate>
</DashboardLayoutPanel>
<DashboardLayoutPanel ZIndex="500" SizeX="1" SizeY="1" Column="1" Row="0">
<HeaderTemplate><div class="">@TotalBedRequests.ToString() Bed Requests </div></HeaderTemplate>
<ContentTemplate>
<div>
Bed Requests
</div>
</ContentTemplate>
</DashboardLayoutPanel>
<DashboardLayoutPanel ZIndex="500" SizeX=1 SizeY="1" Column="2" Row="0">
<HeaderTemplate><div class="">@TotalScheduledDeliveries.ToString() Deliveries</div></HeaderTemplate>
<ContentTemplate>
<div>
Deliveries
</div>
</ContentTemplate>
</DashboardLayoutPanel>
@*<DashboardLayoutPanel ZIndex="500" SizeX=3 SizeY=2 Column="0" Row="1">
<HeaderTemplate><div>Upcoming Care Team Schedule</div></HeaderTemplate>
<ContentTemplate>
<div><SfSchedule TValue="AppointmentData" @bind-CurrentView=@CurrentView ></SfSchedule></div>
</ContentTemplate>
</DashboardLayoutPanel>*@
</DashboardLayoutPanels>
</SfDashboardLayout>
</div>

}
<p class="text-center">Please use the Administration menu to perform Admin functions.</p>
<p class="text-center">A future version of this dashboard will have summary information.</p>
156 changes: 0 additions & 156 deletions BedBrigade.Client/Components/Pages/Administration/Dashboard.razor.cs
Original file line number Diff line number Diff line change
@@ -1,166 +1,10 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;

namespace BedBrigade.Client.Components.Pages.Administration
{
public partial class Dashboard : ComponentBase
{
[Inject] private IJSRuntime _js { get; set; }

public int TotalVolunteers { get; private set; }
public int TotalBedRequests { get; private set; }
public int TotalScheduledDeliveries { get; private set; }
public int TotalLocations { get; private set; }
public int TotalUsers { get; private set; }
public double TotalDonationsToday { get; private set; }
public double TotalDonationsThisWeek { get; private set; }
public double TotalDonationsThisMonth { get; private set; }
public double TotalDonationsThisYear { get; private set; }

public int? DonationSource = 10;
public int? VolunteerSource = 15;

private class DataModel
{
public string Id { get; set; }
public string text { get; set; }
};


protected override async Task OnInitializedAsync()
{
TotalVolunteers = 132;
TotalBedRequests = 23;
TotalScheduledDeliveries = 10;
TotalLocations = 12;
TotalUsers = 6;
TotalDonationsToday = 1232.00;
TotalDonationsThisWeek = 2434.00;
TotalDonationsThisMonth = 4232.00;
TotalDonationsThisYear = 4232.00;

}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
//Collapse the mobile menu
await _js.InvokeVoidAsync("AddRemoveClass.RemoveClass", "navbarResponsive", "show");
}

// private async Task<List<GraphData>> GetUserRolesAsync()
// {
// List<GraphData> RoleSource = new();
// var users = await _svcUser.GetRegisteredUsersAsync();
// var roles = await _svcUser.GetRolesAsync();
// TotalUsers = (await _svcUser.UsersInRolesAsync(new List<string> { "Admin", "CareAdmin", "Clergy", "OfficeStaff", "Reports", "Caregiver" })).Count();
// foreach (var role in roles)
// {
// double count = (await _svcUser.UsersInRoleAsync(role.Name)).Count();
// if (count > 0)
// {
// RoleSource.Add(new GraphData { xValue = role.Name, yValue = count, text = Math.Round(count / TotalUsers * 100).ToString() + "%" });
// }
// }
// return RoleSource;
// }

// private async Task<List<GraphData>> GetMyVisitStatsAsync()
// {
// List<GraphData> VisitSource = new();
// var recipients = await _svcRecipient.GetRecipientsAsync(Hide);
// var myRecipients = recipients.Where(r => r.PrimaryCaregiver == Identity.UserName);
// var statusCodes = await _svcStatus.GetAllAsync();
// var caregivers = await _svcCaregiver.GetAllNotesForCaregiver(Identity.UserName);

// var TotalCareVisits = caregivers.Count();
// double TotalRecipients = myRecipients.Count();
// foreach (var status in statusCodes)
// {
// var count = myRecipients.Where(r => r.StatusId == status.StatusId).Count();
// if (count > 0)
// {
// VisitSource.Add(new GraphData { xValue = status.Name, yValue = count, text = Math.Round(count / TotalRecipients * 100).ToString() + "%" });
// }
// }

// var LastVisit = DateTime.Now;
// var NextVisit = DateTime.Now;
// return VisitSource;
// }

// private async Task<List<GraphData>> GetFacilitiesByTypeAsync()
// {
// List<GraphData> FacilitySource = new List<GraphData>();
// var facilities = await _svcFacility.GetAllAsync();
// var facilityTypeValues = Enum.GetNames(typeof(FacilityType));
// if (facilities == null) return FacilitySource;

// TotalFacilities = facilities.ToList().Count;
// TotalFacilityTypes = facilityTypeValues.Length;

// foreach (var facilityTypeValue in facilityTypeValues)
// {
// var type = facilityTypeValue.Replace('_', ' ');
// double count = facilities.Where(f => f.FacilityType == (int)Enum.Parse(typeof(FacilityType), facilityTypeValue)).Count();
// if (count > 0)
// {
// FacilitySource.Add(new GraphData { xValue = type, yValue = count, text = Math.Round(count / TotalFacilities * 100).ToString() + "%" });
// }
// }
// return FacilitySource;
// }

// private async Task<List<GraphData>> GetRecipientsByStatusAsync()
// {
// List<GraphData> RecipientSource = new();
// var recipients = await _svcRecipient.GetRecipientsAsync(Hide);
// var statuses = await _svcStatus.GetAllAsync();
// if (recipients == null) return RecipientSource;
// TotalRecipients = recipients.Count();
// TotalStatuses = statuses.Count();

// foreach (var status in statuses)
// {
// double count = recipients.Where(r => r.StatusId == status.StatusId).Count();
// if (count > 0)
// {
// RecipientSource.Add(new GraphData { xValue = status.Name, yValue = count, text = Math.Round(count / TotalRecipients * 100).ToString() + "%" });
// }
// }
// return RecipientSource;
// }

// public class GraphData
// {
// public string xValue { get; set; }
// public double yValue { get; set; }
// public string text { get; set; }
// }

// public class VisitDataModel
// {
// public string Text { get; set; }
// public string Icon { get; set; }
// public List<VisitDataModel> Child { get; set; }
// }


// public class AppointmentData
// {
// public int Id { get; set; }
// public string Subject { get; set; }
// public string Location { get; set; }
// public DateTime StartTime { get; set; }
// public DateTime EndTime { get; set; }
// public string Description { get; set; }
// public bool IsAllDay { get; set; }
// public string RecurrenceRule { get; set; }
// public string RecurrenceException { get; set; }
// public Nullable<int> RecurrenceID { get; set; }
// }
}


}


Expand Down

0 comments on commit e72a30a

Please sign in to comment.