109 lines
2.8 KiB
C#
109 lines
2.8 KiB
C#
using EgwCoreLib.Utils;
|
|
using GPW.CORE.Data.DTO;
|
|
using GPW.CORE.Data.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
using static EgwCoreLib.Razor.Toggler;
|
|
|
|
namespace GPW.CORE.WRKLOG.Components.Pages
|
|
{
|
|
public partial class MyReport
|
|
{
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MessageService AppMServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected GpwDataService DataService { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Dipendente corrente
|
|
/// </summary>
|
|
protected int IdxDipendente
|
|
{
|
|
get
|
|
{
|
|
return AppMServ.IdxDipendente;
|
|
}
|
|
}
|
|
|
|
protected bool isLoading { get; set; } = false;
|
|
|
|
protected DtUtils.Periodo periodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisMonth);
|
|
protected ReportDataDTO? userReportData { get; set; } = null;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
initToggler();
|
|
await ReloadData();
|
|
}
|
|
|
|
protected async Task setPeriodo(DtUtils.Periodo newPeriodo)
|
|
{
|
|
if (!periodo.Equals(newPeriodo))
|
|
{
|
|
periodo = newPeriodo;
|
|
}
|
|
await ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private bool showVert { get; set; } = false;
|
|
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task evToggled(SelectGlobalToggle newTogData)
|
|
{
|
|
ToggleData = newTogData;
|
|
showVert = !ToggleData.isActive;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
private async Task ForceReload(bool doReload)
|
|
{
|
|
await Task.Delay(1);
|
|
if (doReload)
|
|
{
|
|
await ReloadData();
|
|
}
|
|
}
|
|
|
|
private void initToggler()
|
|
{
|
|
ToggleData = new SelectGlobalToggle()
|
|
{
|
|
leftString = "Verticale",
|
|
rightString = "Orizzontale",
|
|
placardCss = "bg-light border-light text-dark",
|
|
};
|
|
}
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
//userReportData = null;
|
|
await Task.Delay(1);
|
|
if (IdxDipendente > 0)
|
|
{
|
|
var rawData = await DataService.ReportDetails(IdxDipendente, periodo);
|
|
if (rawData != null)
|
|
{
|
|
userReportData = rawData;
|
|
}
|
|
}
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |