Fix comportamento editing condizionato x fastRec
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
{
|
||||
@foreach (var item in ListRegAtt())
|
||||
{
|
||||
<RegAtt CurrData="item" Periodo="periodo" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemCloned="ReportCloned" ItemSelected="ReportSelected" ItemUpdated="ReportUpdated"></RegAtt>
|
||||
<RegAtt CurrData="item" Periodo="periodo" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemCloned="ReportCloned" ItemSelected="ReportSelected" ItemUpdated="ReportUpdated" EnableActionMenu="@EnableActionMenu"></RegAtt>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,58 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using GPW.CORE.UI;
|
||||
using GPW.CORE.UI.Shared;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace GPW.CORE.UI.Components
|
||||
{
|
||||
public partial class DayHoriz
|
||||
{
|
||||
[Parameter]
|
||||
public DailyDataDTO? DayDTO { get; set; }
|
||||
#region Protected Fields
|
||||
|
||||
[Parameter]
|
||||
public int IdxDipSel { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// record prima timbratura x
|
||||
/// </summary>
|
||||
protected DateTime FirstTimb = DateTime.Now;
|
||||
|
||||
[Parameter]
|
||||
public int StartHour { get; set; }
|
||||
#endregion Protected Fields
|
||||
|
||||
[Parameter]
|
||||
public int EndHour { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool IsTitle { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public List<AnagFasiModel> ListFasi { get; set; } = null!;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<List<TimbratureModel>?> PeriodSelected { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> ItemUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> ReqTempList { get; set; }
|
||||
#region Private Properties
|
||||
|
||||
private bool noData { get => DayDTO == null || DayDTO.ListRA == null || DayDTO.ListRA.Count == 0; }
|
||||
|
||||
private bool OkTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (DayDTO != null && DayDTO.ListRilTemp != null)
|
||||
{
|
||||
answ = DayDTO.ListRilTemp.Count > 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OkVC19
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (DayDTO != null && DayDTO.ListCheckC19 != null)
|
||||
{
|
||||
answ = DayDTO.ListCheckC19.Count > 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private Double oreComm
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (DayDTO != null && DayDTO.ListRA != null)
|
||||
{
|
||||
answ = (double)DayDTO.ListRA.Sum(x => x.OreTot);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private Double oreLav
|
||||
{
|
||||
get
|
||||
@@ -65,7 +70,7 @@ namespace GPW.CORE.UI.Components
|
||||
{
|
||||
if (DayDTO.ListTimbr != null)
|
||||
{
|
||||
// aggiungo ultima timb fino ad adesso...
|
||||
// aggiungo ultima timb fino ad adesso...
|
||||
var lastIn = DayDTO.ListTimbr.Where(x => x.Entrata == true).OrderByDescending(x => x.DataOra).FirstOrDefault();
|
||||
var lastOut = DayDTO.ListTimbr.Where(x => x.Entrata == false).OrderByDescending(x => x.DataOra).FirstOrDefault();
|
||||
// se MANCA timb uscita finale...
|
||||
@@ -83,36 +88,6 @@ namespace GPW.CORE.UI.Components
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private Double oreComm
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
if (DayDTO != null && DayDTO.ListRA != null)
|
||||
{
|
||||
answ = (double)DayDTO.ListRA.Sum(x => x.OreTot);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private string TotLav
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan tSpan = TimeSpan.FromHours(oreLav);
|
||||
return $"{tSpan.Hours}h {tSpan.Minutes}'";
|
||||
}
|
||||
}
|
||||
|
||||
private string TotComm
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan tSpan = TimeSpan.FromHours(oreComm);
|
||||
return $"{tSpan.Hours}h {tSpan.Minutes}'";
|
||||
}
|
||||
}
|
||||
|
||||
private int periodo
|
||||
{
|
||||
@@ -128,30 +103,6 @@ namespace GPW.CORE.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
private bool OkTemp
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (DayDTO != null && DayDTO.ListRilTemp != null)
|
||||
{
|
||||
answ = DayDTO.ListRilTemp.Count > 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private bool OkVC19
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (DayDTO != null && DayDTO.ListCheckC19 != null)
|
||||
{
|
||||
answ = DayDTO.ListCheckC19.Count > 0;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private decimal tempRil
|
||||
{
|
||||
get
|
||||
@@ -165,6 +116,56 @@ namespace GPW.CORE.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
private string TotComm
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan tSpan = TimeSpan.FromHours(oreComm);
|
||||
return $"{tSpan.Hours}h {tSpan.Minutes}'";
|
||||
}
|
||||
}
|
||||
|
||||
private string TotLav
|
||||
{
|
||||
get
|
||||
{
|
||||
TimeSpan tSpan = TimeSpan.FromHours(oreLav);
|
||||
return $"{tSpan.Hours}h {tSpan.Minutes}'";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string cssBadgeLav
|
||||
{
|
||||
get
|
||||
{
|
||||
string bCtr = "btn";
|
||||
string answ = $"{bCtr}-light";
|
||||
var deltaComm = oreComm - oreLav;
|
||||
if (Math.Abs(deltaComm) < 0.5)
|
||||
{
|
||||
answ = $"{bCtr}-info";
|
||||
}
|
||||
else if (Math.Abs(deltaComm) < 1)
|
||||
{
|
||||
answ = $"{bCtr}-warning";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{bCtr}-danger";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public string cssCheck
|
||||
{
|
||||
get => OkVC19 ? "text-success" : "text-secondary";
|
||||
}
|
||||
|
||||
public string cssThermo
|
||||
{
|
||||
get
|
||||
@@ -198,38 +199,87 @@ namespace GPW.CORE.UI.Components
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public string cssCheck
|
||||
{
|
||||
get => OkVC19 ? "text-success" : "text-secondary";
|
||||
}
|
||||
|
||||
public string cssBadgeLav
|
||||
[Parameter]
|
||||
public DailyDataDTO? DayDTO { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool EnableActionMenu { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public int EndHour { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int IdxDipSel { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public bool IsTitle { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RegAttivitaModel> ItemUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<AnagFasiModel> ListFasi { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<List<TimbratureModel>?> PeriodSelected { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> ReqTempList { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int StartHour { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private List<CORE.Data.DbModels.RegAttivitaModel> ListRegAtt()
|
||||
{
|
||||
get
|
||||
// init
|
||||
DateTime currHour = DayDTO.DtRif.AddHours(StartHour);
|
||||
DateTime lastHour = DayDTO.DtRif.AddHours(EndHour);
|
||||
List<CORE.Data.DbModels.RegAttivitaModel> result = new List<CORE.Data.DbModels.RegAttivitaModel>();
|
||||
// ciclo partendo dal primo evento ed aggiungendo eventuali periodi in testa / coda / intermedi
|
||||
foreach (var item in DayDTO.ListRA)
|
||||
{
|
||||
string bCtr = "btn";
|
||||
string answ = $"{bCtr}-light";
|
||||
var deltaComm = oreComm - oreLav;
|
||||
if (Math.Abs(deltaComm) < 0.5)
|
||||
// se evento > ora corrente --> aggiungo vuoto...
|
||||
if (item.Inizio > currHour)
|
||||
{
|
||||
answ = $"{bCtr}-info";
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = item.Inizio,
|
||||
OreTot = (decimal)item.Inizio.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
else if (Math.Abs(deltaComm) < 1)
|
||||
{
|
||||
answ = $"{bCtr}-warning";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{bCtr}-danger";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// record prima timbratura x
|
||||
/// </summary>
|
||||
protected DateTime FirstTimb = DateTime.Now;
|
||||
// ...altrimenti parto con lui...
|
||||
result.Add(item);
|
||||
currHour = item.Fine;
|
||||
}
|
||||
// se non sono in fondo --> aggiungo!
|
||||
if (currHour < lastHour)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = lastHour,
|
||||
OreTot = (decimal)lastHour.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<PeriodoDTO> ListTimb()
|
||||
{
|
||||
@@ -319,74 +369,9 @@ namespace GPW.CORE.UI.Components
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
private List<CORE.Data.DbModels.RegAttivitaModel> ListRegAtt()
|
||||
{
|
||||
// init
|
||||
DateTime currHour = DayDTO.DtRif.AddHours(StartHour);
|
||||
DateTime lastHour = DayDTO.DtRif.AddHours(EndHour);
|
||||
List<CORE.Data.DbModels.RegAttivitaModel> result = new List<CORE.Data.DbModels.RegAttivitaModel>();
|
||||
// ciclo partendo dal primo evento ed aggiungendo eventuali periodi in testa / coda / intermedi
|
||||
foreach (var item in DayDTO.ListRA)
|
||||
{
|
||||
// se evento > ora corrente --> aggiungo vuoto...
|
||||
if (item.Inizio > currHour)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = item.Inizio,
|
||||
OreTot = (decimal)item.Inizio.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
// ...altrimenti parto con lui...
|
||||
result.Add(item);
|
||||
currHour = item.Fine;
|
||||
}
|
||||
// se non sono in fondo --> aggiungo!
|
||||
if (currHour < lastHour)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = lastHour,
|
||||
OreTot = (decimal)lastHour.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void ReportSelected(RegAttivitaModel selRecord)
|
||||
{
|
||||
await ItemSelected.InvokeAsync(selRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void ReportCloned()
|
||||
{
|
||||
await ItemSelected.InvokeAsync(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item aggiornato
|
||||
/// </summary>
|
||||
protected async void ReportUpdated()
|
||||
{
|
||||
await ItemUpdated.InvokeAsync(null);
|
||||
}
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
@@ -399,13 +384,30 @@ namespace GPW.CORE.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async void SelTimbrature()
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void ReportCloned()
|
||||
{
|
||||
if (DayDTO != null)
|
||||
{
|
||||
await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
|
||||
}
|
||||
await ItemSelected.InvokeAsync(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void ReportSelected(RegAttivitaModel selRecord)
|
||||
{
|
||||
await ItemSelected.InvokeAsync(selRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item aggiornato
|
||||
/// </summary>
|
||||
protected async void ReportUpdated()
|
||||
{
|
||||
await ItemUpdated.InvokeAsync(null);
|
||||
}
|
||||
|
||||
protected async void SelTemperature()
|
||||
{
|
||||
if (DayDTO != null)
|
||||
@@ -414,5 +416,14 @@ namespace GPW.CORE.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async void SelTimbrature()
|
||||
{
|
||||
if (DayDTO != null)
|
||||
{
|
||||
await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -98,9 +98,12 @@ else
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
@if (CalcOreProj != null && CalcOreProj.timeRem > 0)
|
||||
@if (AppMServ.PayloadOk)
|
||||
{
|
||||
<button class="btn btn-lg btn-block btn-success" @onclick="() => StartRecord()"><i class="fas fa-play"></i> Start</button>
|
||||
if (CalcOreProj != null && CalcOreProj.timeRem > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-block btn-success" @onclick="() => StartRecord()"><i class="fas fa-play"></i> Start</button>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
@@ -23,42 +23,45 @@
|
||||
<div class="badge badge-dark">@($"{CurrData.OreTot*60:N0}'")</div>
|
||||
}
|
||||
</button>
|
||||
@if (!IsClipboard)
|
||||
@if (!IsClipboard && EnableActionMenu)
|
||||
{
|
||||
<div class="dropdown-content border border-dark table-dark text-light rounded p-2">
|
||||
<div class="@cssDropContent border border-dark table-dark text-light rounded p-2">
|
||||
<div class="row">
|
||||
<div class="col-12 pr-0">
|
||||
<div class="text-light text-left"><b>@($"{CurrData.FasiNav?.ProgettoNav?.ClienteNav?.RagSociale}")</b> - <span>@($"{CurrData.FasiNav?.ProgettoNav?.NomeProj}")</span> | <span class="text-info text-left" title="@CurrData.FasiNav?.DescrizioneFase">@($"{CurrData.FasiNav?.DescrizioneFase}")</span></div>
|
||||
<div class="text-warning text-left textTrim max20Char" title="@CurrData.Descrizione">@($"{CurrData.Descrizione}")</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm w-100 py-2">
|
||||
<button @onclick="() => Edit()" class="btn btn-sm btn-info"><i class="fas fa-pencil-alt"></i> Edit</button>
|
||||
<button @onclick="() => Clone()" class="btn btn-sm btn-primary"><i class="far fa-copy"></i> Copy</button>
|
||||
<button @onclick="() => Delete()" class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i> Delete</button>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm w-100 small">
|
||||
<button @onclick="() => AddTime(false,-120)" class="btn btn-sm btn-warning">-2h</button>
|
||||
<button @onclick="() => AddTime(false,-60)" class="btn btn-sm btn-warning">-1h</button>
|
||||
<button @onclick="() => AddTime(false,-30)" class="btn btn-sm btn-warning">-30'</button>
|
||||
<button @onclick="() => AddTime(false,-15)" class="btn btn-sm btn-warning">-15'</button>
|
||||
<span class="bg-dark text-light py-2" style="font-size: 1.3em; width: 4em;">@CurrData.Inizio.ToString("HH:mm")</span>
|
||||
<button @onclick="() => AddTime(false,15)" class="btn btn-sm btn-success">+15'</button>
|
||||
<button @onclick="() => AddTime(false,30)" class="btn btn-sm btn-success">+30'</button>
|
||||
<button @onclick="() => AddTime(false,60)" class="btn btn-sm btn-success">+1h</button>
|
||||
<button @onclick="() => AddTime(false,120)" class="btn btn-sm btn-success ">+2h</button>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm w-100 small mt-2">
|
||||
<button @onclick="() => AddTime(true,-120)" class="btn btn-sm btn-outline-warning">-2h</button>
|
||||
<button @onclick="() => AddTime(true,-60)" class="btn btn-sm btn-outline-warning">-1h</button>
|
||||
<button @onclick="() => AddTime(true,-30)" class="btn btn-sm btn-outline-warning">-30'</button>
|
||||
<button @onclick="() => AddTime(true,-15)" class="btn btn-sm btn-outline-warning">-15'</button>
|
||||
<span class="bg-dark text-light py-2" style="font-size: 1.3em; width: 4em;">@CurrData.Fine.ToString("HH:mm")</span>
|
||||
<button @onclick="() => AddTime(true,15)" class="btn btn-sm btn-outline-success">+15'</button>
|
||||
<button @onclick="() => AddTime(true,30)" class="btn btn-sm btn-outline-success">+30'</button>
|
||||
<button @onclick="() => AddTime(true,60)" class="btn btn-sm btn-outline-success">+1h</button>
|
||||
<button @onclick="() => AddTime(true,120)" class="btn btn-sm btn-outline-success">+2h</button>
|
||||
</div>
|
||||
@if (AppMServ.PayloadOk)
|
||||
{
|
||||
<div class="btn-group btn-group-sm w-100 py-2">
|
||||
<button @onclick="() => Edit()" class="btn btn-sm btn-info"><i class="fas fa-pencil-alt"></i> Edit</button>
|
||||
<button @onclick="() => Clone()" class="btn btn-sm btn-primary"><i class="far fa-copy"></i> Copy</button>
|
||||
<button @onclick="() => Delete()" class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i> Delete</button>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm w-100 small">
|
||||
<button @onclick="() => AddTime(false,-120)" class="btn btn-sm btn-warning">-2h</button>
|
||||
<button @onclick="() => AddTime(false,-60)" class="btn btn-sm btn-warning">-1h</button>
|
||||
<button @onclick="() => AddTime(false,-30)" class="btn btn-sm btn-warning">-30'</button>
|
||||
<button @onclick="() => AddTime(false,-15)" class="btn btn-sm btn-warning">-15'</button>
|
||||
<span class="bg-dark text-light py-2" style="font-size: 1.3em; width: 4em;">@CurrData.Inizio.ToString("HH:mm")</span>
|
||||
<button @onclick="() => AddTime(false,15)" class="btn btn-sm btn-success">+15'</button>
|
||||
<button @onclick="() => AddTime(false,30)" class="btn btn-sm btn-success">+30'</button>
|
||||
<button @onclick="() => AddTime(false,60)" class="btn btn-sm btn-success">+1h</button>
|
||||
<button @onclick="() => AddTime(false,120)" class="btn btn-sm btn-success ">+2h</button>
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm w-100 small mt-2">
|
||||
<button @onclick="() => AddTime(true,-120)" class="btn btn-sm btn-outline-warning">-2h</button>
|
||||
<button @onclick="() => AddTime(true,-60)" class="btn btn-sm btn-outline-warning">-1h</button>
|
||||
<button @onclick="() => AddTime(true,-30)" class="btn btn-sm btn-outline-warning">-30'</button>
|
||||
<button @onclick="() => AddTime(true,-15)" class="btn btn-sm btn-outline-warning">-15'</button>
|
||||
<span class="bg-dark text-light py-2" style="font-size: 1.3em; width: 4em;">@CurrData.Fine.ToString("HH:mm")</span>
|
||||
<button @onclick="() => AddTime(true,15)" class="btn btn-sm btn-outline-success">+15'</button>
|
||||
<button @onclick="() => AddTime(true,30)" class="btn btn-sm btn-outline-success">+30'</button>
|
||||
<button @onclick="() => AddTime(true,60)" class="btn btn-sm btn-outline-success">+1h</button>
|
||||
<button @onclick="() => AddTime(true,120)" class="btn btn-sm btn-outline-success">+2h</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,27 @@ namespace GPW.CORE.UI.Components
|
||||
}
|
||||
}
|
||||
|
||||
private bool dropActionTop
|
||||
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
switch (CurrData.Inizio.DayOfWeek)
|
||||
{
|
||||
case DayOfWeek.Sunday:
|
||||
case DayOfWeek.Saturday:
|
||||
case DayOfWeek.Friday:
|
||||
answ = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private string widthPerc
|
||||
{
|
||||
get
|
||||
@@ -52,6 +73,11 @@ namespace GPW.CORE.UI.Components
|
||||
get => isSelected ? "table-info" : "";
|
||||
}
|
||||
|
||||
protected string cssDropContent
|
||||
{
|
||||
get => dropActionTop ? "dropdown-content-top" : "dropdown-content";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
@@ -59,6 +85,9 @@ namespace GPW.CORE.UI.Components
|
||||
[Parameter]
|
||||
public RegAttivitaModel CurrData { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public bool EnableActionMenu { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public int IdxDipSel { get; set; } = 0;
|
||||
|
||||
|
||||
@@ -107,20 +107,16 @@
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-block btn-success" @onclick="DoUpdate"><i class="fas fa-check-circle"></i> Save</button>
|
||||
@if (AppMServ.PayloadOk)
|
||||
{
|
||||
<button type="button" class="btn btn-block btn-success" @onclick="DoUpdate"><i class="fas fa-check-circle"></i> Save</button>
|
||||
}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-block btn-warning" @onclick="DoReset"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
|
||||
@*<div class="col-6">
|
||||
<button type="button" class="btn btn-block btn-primary" @onclick="DoClone"><i class="far fa-clone"></i> Clone</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-block btn-danger" @onclick="DoDelete"><i class="fas fa-trash-alt"></i> Delete</button>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,30 +123,6 @@ namespace GPW.CORE.UI.Data
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola HASH del codice impiego
|
||||
/// </summary>
|
||||
/// <param name="rigaDip"></param>
|
||||
/// <returns></returns>
|
||||
private string getHashCodImpiego(DipendentiModel rigaDip)
|
||||
{
|
||||
string hash = "";
|
||||
string answ = "";
|
||||
if (rigaDip != null)
|
||||
{
|
||||
answ = $"{rigaDip.IdxDipendente}|{rigaDip.Cognome}.{rigaDip.Nome}|{rigaDip.Cf}|{rigaDip.DataAssunzione:yyyyMMdd}|{rigaDip.Email}|{rigaDip.Matricola}";
|
||||
}
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(answ);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using GPW.CORE.Data;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace GPW.CORE.UI.Data
|
||||
{
|
||||
@@ -107,7 +109,7 @@ namespace GPW.CORE.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
public bool DipIsActive
|
||||
public bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -119,31 +121,34 @@ namespace GPW.CORE.UI.Data
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
private string _userPayload { get; set; } = "";
|
||||
public string DipPayload
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userPayload;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userPayload = value;
|
||||
}
|
||||
}
|
||||
private bool _userPayloadOk = false;
|
||||
public bool DipPayloadOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userPayloadOk;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userPayloadOk = value;
|
||||
}
|
||||
}
|
||||
public bool PayloadOk { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Calcola HASH del codice impiego = payload utente
|
||||
/// </summary>
|
||||
/// <param name="rigaDip"></param>
|
||||
/// <returns></returns>
|
||||
public string HashDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string hash = "";
|
||||
string answ = "";
|
||||
if (_rigaDip != null)
|
||||
{
|
||||
answ = $"{_rigaDip.IdxDipendente}|{_rigaDip.Cognome}.{_rigaDip.Nome}|{_rigaDip.Cf}|{_rigaDip.DataAssunzione:yyyyMMdd}|{_rigaDip.Email}|{_rigaDip.Matricola}";
|
||||
}
|
||||
// hashing!
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
byte[] InputBytes = Encoding.UTF8.GetBytes(answ);
|
||||
var byteHash = md5.ComputeHash(InputBytes);
|
||||
hash = BitConverter.ToString(byteHash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => showSearch;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>3.0.2201.1717</Version>
|
||||
<Version>3.0.2201.1718</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<DayHoriz IsTitle="true" StartHour="@startHour" EndHour="@endHour" ListFasi="@ListFasi" IdxDipSel="@idxDipendente"></DayHoriz>
|
||||
@foreach (var currItem in ListRecords)
|
||||
{
|
||||
<DayHoriz DayDTO="@currItem" StartHour="@startHour" EndHour="@endHour" ListFasi="@ListFasi" IdxDipSel="@idxDipendente"></DayHoriz>
|
||||
<DayHoriz DayDTO="@currItem" StartHour="@startHour" EndHour="@endHour" ListFasi="@ListFasi" IdxDipSel="@idxDipendente" EnableActionMenu="false"></DayHoriz>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
<div class="d-flex">
|
||||
<div class="px-1"><b>@userName</b></div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => ReloadUtente()">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => DoReloadUtente()">
|
||||
<i class="fas fa-user @cssActive" title="Attivazione Utente"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => VerifyActiv()">
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => DoVerifyActiv()">
|
||||
<i class="fas fa-address-card @cssLicOk" title="Licenza assegnata"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -31,12 +31,29 @@
|
||||
//effettuo eventuale recupero dati dipendente
|
||||
if (AppMServ.RigaDip == null)
|
||||
{
|
||||
await ReloadUtente();
|
||||
await LoadUtente();
|
||||
}
|
||||
// verifica attivazione
|
||||
await VerifyActiv();
|
||||
}
|
||||
protected async Task ReloadUtente()
|
||||
|
||||
protected async Task DoReloadUtente()
|
||||
{
|
||||
AppMServ.RigaDip = null;
|
||||
await Task.Delay(250);
|
||||
await LoadUtente();
|
||||
// verifico attivazione dipendente...
|
||||
await checkUserLicense();
|
||||
}
|
||||
|
||||
protected async Task DoVerifyActiv()
|
||||
{
|
||||
AppMServ.PayloadOk = false;
|
||||
await Task.Delay(250);
|
||||
await VerifyActiv();
|
||||
}
|
||||
|
||||
protected async Task LoadUtente()
|
||||
{
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
@@ -119,38 +136,32 @@
|
||||
/// Verifica info specifiche utente
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task checkUserLicense()
|
||||
protected async Task<bool> checkUserLicense()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
bool answ = false;
|
||||
// verifico utente attivo
|
||||
|
||||
// verifico payload utente
|
||||
|
||||
// confronto con elencoa ttivazioni dello shared service...
|
||||
|
||||
|
||||
#if false
|
||||
bool answ = false;
|
||||
var listaDip = await DipendentiGetAll();
|
||||
var currDipRow = listaDip.Where(x => x.IdxDipendente == idxDipendente).FirstOrDefault();
|
||||
if (currDipRow != null)
|
||||
{
|
||||
string hashImpiego = getHashCodImpiego(currDipRow);
|
||||
// cerco dip tra elenco json
|
||||
var userLocalList = await AttivazioniList();
|
||||
var foundRec = userLocalList.Where(x => x.CodImpiego == hashImpiego);
|
||||
answ = foundRec.Count() > 0;
|
||||
}
|
||||
return answ;
|
||||
#endif
|
||||
answ = AppMServ.IsActive;
|
||||
if (answ)
|
||||
{
|
||||
var rawActList = LicServ.ActivList;
|
||||
// recupero hash utente
|
||||
string hashImpiego = AppMServ.HashDip;
|
||||
// confronto con elenco attivazioni dello shared service...
|
||||
var foundRec = rawActList.Where(x => x.CodImpiego == hashImpiego);
|
||||
answ = foundRec.Count() > 0;
|
||||
// salvo status payloadOk
|
||||
AppMServ.PayloadOk = answ;
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected string cssActive
|
||||
{
|
||||
get => AppMServ.DipIsActive ? "text-success" : "text-danger";
|
||||
get => AppMServ.IsActive ? "text-success" : "text-danger";
|
||||
}
|
||||
protected string cssLicOk
|
||||
{
|
||||
get => AppMServ.DipPayloadOk ? "text-success" : "text-danger";
|
||||
get => AppMServ.PayloadOk ? "text-success" : "text-danger";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 3.0.2201.1717</h4>
|
||||
<h4>Versione: 3.0.2201.1718</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0.2201.1717
|
||||
3.0.2201.1718
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>3.0.2201.1717</version>
|
||||
<version>3.0.2201.1718</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user