81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
@using CORE.Data.DbModels
|
|
@using CORE.Data.DTO
|
|
@using UI.Data
|
|
@inject GpwDataService GDataServ
|
|
@inject MessageService AppMServ
|
|
@inject IJSRuntime JSRuntime
|
|
|
|
<div class="py-0 mb-1 flex-fill @blockCss" style="width: @widthPerc; font-size: 0.7em;">
|
|
@if (CurrPeriodo.Tipo != CORE.Data.TipoPeriodo.ND)
|
|
{
|
|
|
|
<div class="d-flex justify-content-between" @onclick="Edit">
|
|
<div class="px-1 bg-dark">
|
|
<span>@CurrPeriodo.Inizio.ToString("HH:mm")</span>
|
|
</div>
|
|
@if (CurrPeriodo.IsClosed)
|
|
{
|
|
@if ((double)CurrPeriodo.OreTot >= 1.25)
|
|
{
|
|
<div class="px-2 bg-dark">
|
|
<i class="far fa-calendar-alt"></i>
|
|
</div>
|
|
}
|
|
@if ((double)CurrPeriodo.OreTot >= 1)
|
|
{
|
|
<div class="px-1 bg-dark">
|
|
<span>@CurrPeriodo.Fine.ToString("HH:mm")</span>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<div class="px-1 bg-dark">
|
|
<span><i class="far fa-clock"></i></span>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public PeriodoDTO CurrPeriodo { get; set; } = null!;
|
|
[Parameter]
|
|
public double Periodo { get; set; } = 1;
|
|
|
|
[Parameter]
|
|
public EventCallback<PeriodoDTO> ItemSelected { get; set; }
|
|
|
|
private string widthPerc
|
|
{
|
|
get
|
|
{
|
|
string answ = "1%";
|
|
if (CurrPeriodo != null)
|
|
{
|
|
double num = CurrPeriodo.OreTot != null ? (double)CurrPeriodo.OreTot : 0;
|
|
answ = $"{num / Periodo:P2}".Replace(",", ".");
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
|
|
private string blockCss
|
|
{
|
|
get
|
|
{
|
|
string answ = CurrPeriodo.Tipo == CORE.Data.TipoPeriodo.ND ? "" : " border border-success bg-dark text-light rounded ";
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
private async void Edit()
|
|
{
|
|
await ItemSelected.InvokeAsync(CurrPeriodo);
|
|
}
|
|
}
|