@using GPW.CORE.Data
@code {
public class WeekArg
{
public int Year { get; set; }
public int Week { get; set; }
}
[Parameter]
public CORE.Data.DTO.WeekStatDTO? currData { get; set; }
[Parameter]
public int WeekSel { get; set; } = 0;
[Parameter]
public EventCallback weekSelected { get; set; }
protected int currWeekNum
{
get
{
int answ = 0;
if (currData != null)
{
answ = currData.WeekNumber;
}
return answ;
}
}
protected int currYearNum
{
get
{
int answ = 0;
if (currData != null)
{
answ = currData.Anno;
}
return answ;
}
}
protected void reportSelect()
{
weekSelected.InvokeAsync(new WeekData(currYearNum, currWeekNum));
}
protected string selStyle
{
get
{
string currCss = "bg-secondary";
if (currData != null)
{
currCss = currData.WeekNumber == WeekSel ? "btn-primary" : "btn-secondary";
}
return currCss;
}
}
protected double denom
{
get
{
double answ = 40;
// cerco massimo tra ore lav e commesse...
if (currData.SumOreLav > answ)
{
answ = currData.SumOreLav;
}
if (currData.SumOreComm > answ)
{
answ = currData.SumOreComm;
}
return answ;
}
}
protected string styleLav
{
get
{
double valPerc = 0;
if (currData != null)
{
try
{
valPerc = currData.SumOreLav / denom;
}
catch
{ }
}
return $"width: {valPerc:P0};";
}
}
protected string styleCom
{
get
{
double valPerc = 0;
if (currData != null)
{
try
{
valPerc = currData.SumOreComm / denom;
}
catch
{ }
}
return $"width: {valPerc:P0};";
}
}
}