Widget
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using StandManager.Domain.Entita.Base;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
@ -14,4 +15,10 @@ public class Evento : EntitaBase
|
||||
|
||||
public DateTime IscrizioneDa { get; set; }
|
||||
public DateTime IscrizioneA { get; set; }
|
||||
|
||||
[InverseProperty(nameof(InvitoEvento.Evento))]
|
||||
public List<InvitoEvento> InvitoEventoList { get; set; }
|
||||
|
||||
[InverseProperty(nameof(IscrizioneEvento.Evento))]
|
||||
public List<IscrizioneEvento> IscrizioneEventoList { get; set; }
|
||||
}
|
||||
|
||||
@ -19,9 +19,5 @@ public class UtenteService : TService<Utente>, IUtenteService
|
||||
public async Task<List<Utente>> ListaCapoarea()
|
||||
{
|
||||
return (await _unitOfWork.UtenteRepository.RicercaQueryable(x => x.IsCapoarea, skip:0, take:0)).ToList();
|
||||
/*return (await _unitOfWork.UtenteRepository.RicercaQueryable(x =>
|
||||
x.Ruolo.Permessi.Any(y => y.Feature.Type == FeatureType.Capoarea || y.Feature.Type == FeatureType.AdminGlobal),
|
||||
includi:x => x.Include(y => y.Ruolo).ThenInclude(z => z.Permessi).ThenInclude(u => u.Feature),
|
||||
skip: 0, take: 0)).ToList();*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
@ -1,2 +1,29 @@
|
||||
@attribute [Authorize]
|
||||
@page "/management"
|
||||
@page "/management"
|
||||
@using StandManager.Components.Widget
|
||||
|
||||
<div class="page-wrapper">
|
||||
<!-- BEGIN PAGE BODY -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="row row-cards">
|
||||
<div class="col">
|
||||
<h2 class="page-title">Management</h2>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="row row-cards">
|
||||
<div class="col-3">
|
||||
<Widget_Clienti senzaAgente="false"/>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<Widget_Clienti senzaAgente="true"/>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<Widget_Evento/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,64 +0,0 @@
|
||||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Simulate asynchronous loading to demonstrate streaming rendering
|
||||
await Task.Delay(500);
|
||||
|
||||
var startDate = DateOnly.FromDateTime(DateTime.Now);
|
||||
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
|
||||
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = startDate.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = summaries[Random.Shared.Next(summaries.Length)]
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
private class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
}
|
||||
23
StandManager/Components/Widget/Widget_Clienti.razor
Normal file
23
StandManager/Components/Widget/Widget_Clienti.razor
Normal file
@ -0,0 +1,23 @@
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body d-flex flex-column align-items-center text-center">
|
||||
<span class="text-muted">@(senzaAgente ? "Clienti senza agente" : "Clienti senza capoarea")</span>
|
||||
<span class="display-6 fw-bold">@totale</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool senzaAgente { get; set; } = false;
|
||||
|
||||
private int totale = 0;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
var clientiSenza = senzaAgente
|
||||
? await _managerService.ClienteService.RicercaQueryable(x => x.AgenteId == null)
|
||||
: await _managerService.ClienteService.RicercaQueryable(x => x.CapoareaId == null);
|
||||
totale = clientiSenza.Count();
|
||||
}
|
||||
|
||||
}
|
||||
20
StandManager/Components/Widget/Widget_Evento.razor
Normal file
20
StandManager/Components/Widget/Widget_Evento.razor
Normal file
@ -0,0 +1,20 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body d-flex flex-column align-items-center text-center">
|
||||
<span class="text-muted">Prenotati al prossimo evento</span>
|
||||
<span class="display-6 fw-bold">@totale</span>
|
||||
</div>
|
||||
</div>
|
||||
@code {
|
||||
private int totale = 0;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
var nextEvent = await _managerService.EventoService.RicercaPer(x => x.DataDa >= DateTime.Now && x.Eliminato == false,
|
||||
includi:x => x.Include(y => y.InvitoEventoList), ordinamento:x => x.OrderBy(y => y.DataDa));
|
||||
totale = nextEvent.InvitoEventoList.Count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user