+ }
}
else
{
if (DayDTO != null)
{
-
@DayDTO.DtRif.ToString("ddd")
-
@DayDTO.DtRif.ToString("dd.MM")
+ @if (MultiUser)
+ {
+
@Cognome
+
@Nome
+ }
+ else
+ {
+
@DayDTO.DtRif.ToString("ddd")
+
@DayDTO.DtRif.ToString("dd.MM")
+ }
@if (hasFest && DayDTO.ListFermateAzienda != null && DayDTO.ListFermateAzienda.Count > 0)
{
@foreach (var fermata in DayDTO.ListFermateAzienda)
diff --git a/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs b/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs
index 9efee7d..76c801f 100644
--- a/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs
+++ b/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs
@@ -8,68 +8,12 @@ namespace GPW.CORE.WRKLOG.Components
{
#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}-primary bg-opacity-75";
- }
- 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
- {
- string answ = "";
- // verifico in base a ok temp o meno...
- if (OkTemp)
- {
- // colore in base al valore...
- var currTemp = tempRil;
- if (currTemp >= (decimal)37.5)
- {
- answ = "text-danger";
- }
- else if (currTemp >= 37)
- {
- answ = "text-warning";
- }
- else
- {
- answ = "text-success";
- }
- }
- else
- {
- answ = "text-secondary";
- }
- return answ;
- }
- }
-
[Parameter]
public DailyDataDTO? DayDTO { get; set; }
+ [Parameter]
+ public DateTime DtRif { get; set; } = DateTime.MinValue.Date;
+
[Parameter]
public bool EnableActionMenu { get; set; } = true;
@@ -91,11 +35,11 @@ namespace GPW.CORE.WRKLOG.Components
[Parameter]
public List
ListFasi { get; set; } = null!;
+ [Parameter]
+ public bool MultiUser { get; set; } = false;
+
[Parameter]
public EventCallback PeriodSelected { get; set; }
-#if false
- //public EventCallback?> PeriodSelected { get; set; }
-#endif
[Parameter]
public EventCallback ReqDayAgenda { get; set; }
@@ -128,7 +72,7 @@ namespace GPW.CORE.WRKLOG.Components
{
await PeriodSelected.InvokeAsync(DayDTO);
#if false
- //await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
+ //await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
#endif
}
}
@@ -179,7 +123,7 @@ namespace GPW.CORE.WRKLOG.Components
{
await PeriodSelected.InvokeAsync(DayDTO);
#if false
- //await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
+ //await PeriodSelected.InvokeAsync(DayDTO.ListTimbr);
#endif
}
}
@@ -188,6 +132,78 @@ namespace GPW.CORE.WRKLOG.Components
#region Private Properties
+ private string Cognome
+ {
+ get
+ {
+ string answ = "NA";
+ if (DayDTO != null)
+ {
+ answ = DayDTO.TimbrExpl.CognomeNome.Split(" ")[0] ?? " NA";
+ }
+ return answ;
+ }
+ }
+
+ private string cssBadgeLav
+ {
+ get
+ {
+ string bCtr = "btn";
+ string answ = $"{bCtr}-light";
+ var deltaComm = oreComm - oreLav;
+ if (Math.Abs(deltaComm) < 0.5)
+ {
+ answ = $"{bCtr}-primary bg-opacity-75";
+ }
+ else if (Math.Abs(deltaComm) < 1)
+ {
+ answ = $"{bCtr}-warning";
+ }
+ else
+ {
+ answ = $"{bCtr}-danger";
+ }
+ return answ;
+ }
+ }
+
+ private string cssCheck
+ {
+ get => OkVC19 ? "text-success" : "text-secondary";
+ }
+
+ private string cssThermo
+ {
+ get
+ {
+ string answ = "";
+ // verifico in base a ok temp o meno...
+ if (OkTemp)
+ {
+ // colore in base al valore...
+ var currTemp = tempRil;
+ if (currTemp >= (decimal)37.5)
+ {
+ answ = "text-danger";
+ }
+ else if (currTemp >= 37)
+ {
+ answ = "text-warning";
+ }
+ else
+ {
+ answ = "text-success";
+ }
+ }
+ else
+ {
+ answ = "text-secondary";
+ }
+ return answ;
+ }
+ }
+
private string dayCardCss
{
get => hasTimb ? "border border-dark text-dark rounded shadow" : "text-secondary rounded";
@@ -223,6 +239,23 @@ namespace GPW.CORE.WRKLOG.Components
get => DayDTO == null || DayDTO.ListRA == null || DayDTO.ListRA.Count == 0;
}
+ private string Nome
+ {
+ get
+ {
+ string answ = "NA";
+ if (DayDTO != null)
+ {
+ answ = DayDTO.TimbrExpl.CognomeNome.Replace($"{Cognome} ", "");
+ }
+ return answ;
+ }
+ }
+
+#if false
+ //public EventCallback?> PeriodSelected { get; set; }
+#endif
+
private bool OkTemp
{
get
diff --git a/GPW.CORE.WRKLOG/Data/GpwDataService.cs b/GPW.CORE.WRKLOG/Data/GpwDataService.cs
index 39c129f..a021a62 100644
--- a/GPW.CORE.WRKLOG/Data/GpwDataService.cs
+++ b/GPW.CORE.WRKLOG/Data/GpwDataService.cs
@@ -770,6 +770,48 @@ namespace GPW.CORE.WRKLOG.Data
Log.Debug($"DailyDetails | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
+ ///
+ /// Recupera l'elenco dei dettaglio giornaliero attività di tutti i dipendenti, dato giorno riferimento
+ ///
+ /// Data di riferimento
+ ///
+ public async Task> DailyDetailAllDip(DateTime dtRif)
+ {
+ string source = "DB";
+ List? dbResult = new List();
+ string currKey = $"{rKeyDailyData}:ALL:{dtRif.ToString("yyyy-MM-dd")}";
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ string? rawData = await redisDb.StringGetAsync(currKey);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ source = "REDIS";
+ var tempResult = JsonConvert.DeserializeObject>(rawData);
+ if (tempResult == null)
+ {
+ dbResult = new List();
+ }
+ else
+ {
+ dbResult = tempResult;
+ }
+ }
+ else
+ {
+ dbResult = dbController.DailyDetailAllDip(dtRif);
+ rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
+ await redisDb.StringSetAsync(currKey, rawData, FastCache);
+ }
+ if (dbResult == null)
+ {
+ dbResult = new List();
+ }
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Debug($"DailyDetailAllDip | {source} in: {ts.TotalMilliseconds} ms");
+ return dbResult;
+ }
+
public string DeriptData(string encData)
{
diff --git a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
index 486db82..daafa53 100644
--- a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
+++ b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj
@@ -2,7 +2,7 @@
net6.0
- 3.0.2403.0517
+ 3.0.2403.0710
enable
enable
diff --git a/GPW.CORE.WRKLOG/Pages/Presenze.razor b/GPW.CORE.WRKLOG/Pages/Presenze.razor
new file mode 100644
index 0000000..791585f
--- /dev/null
+++ b/GPW.CORE.WRKLOG/Pages/Presenze.razor
@@ -0,0 +1,40 @@
+@page "/Presenze"
+@attribute [Authorize]
+
+
+
+
+
+
+
+
+ @if (ListRecords == null)
+ {
+ @for (int i = 0; i < 7; i++)
+ {
+
+ }
+ }
+ else
+ {
+ @foreach (var currItem in ListRecords)
+ {
+
+
+
+ }
+ }
+
+
+
\ No newline at end of file
diff --git a/GPW.CORE.WRKLOG/Pages/Presenze.razor.cs b/GPW.CORE.WRKLOG/Pages/Presenze.razor.cs
new file mode 100644
index 0000000..4a9360d
--- /dev/null
+++ b/GPW.CORE.WRKLOG/Pages/Presenze.razor.cs
@@ -0,0 +1,223 @@
+using GPW.CORE.Data.DbModels;
+using GPW.CORE.Data.DTO;
+using GPW.CORE.WRKLOG.Data;
+using Microsoft.AspNetCore.Components;
+
+namespace GPW.CORE.WRKLOG.Pages
+{
+ public partial class Presenze : IDisposable
+ {
+ #region Public Methods
+
+ public void Dispose()
+ {
+ UITimer?.Dispose();
+ }
+
+ #endregion Public Methods
+
+ #region Protected Fields
+
+ protected DateTime lastRefresh = DateTime.Now;
+
+ ///
+ /// Timer per refresh dati
+ ///
+ /// https://stackoverflow.com/questions/63060065/blazor-timer-call-async-api-task-to-update-ui https://www.janduniec.blog/index.php/100/timers-in-blazor/
+ ///
+ protected System.Timers.Timer UITimer = new System.Timers.Timer();
+
+ #endregion Protected Fields
+
+ #region Protected Properties
+
+ [Inject]
+ protected MessageService AppMServ { get; set; } = null!;
+
+ [Inject]
+ protected GpwDataService GDataServ { get; set; } = null!;
+
+ #endregion Protected Properties
+
+ #region Private Fields
+
+ private int _endHour = 18;
+
+ private int _startHour = 8;
+
+ private DateTime DtSelected = DateTime.Today;
+
+ private int IdxDipendente = 0;
+
+ private List ListFasi = new List();
+
+ private List? ListRecords = null;
+
+ #endregion Private Fields
+
+ #region Private Properties
+
+ private int endHour
+ {
+ get => _endHour;
+ set
+ {
+ // fix --> max 24...
+ _endHour = value < 25 ? value : 24;
+ }
+ }
+
+ private bool isLoading { get; set; } = false;
+
+ private int startHour
+ {
+ get => _startHour;
+ set
+ {
+ // fix --> MIN 0...
+ _startHour = value > 0 ? value : 0;
+ }
+ }
+
+ #endregion Private Properties
+
+ #region Private Methods
+
+ private void checkHourRange()
+ {
+ int minHour = 12;
+ int maxHour = 14;
+ int currStart = 12;
+ int currEnd = 12;
+ int roundMin = 30;
+ //int extraEnd = 30;
+ if (ListRecords != null)
+ {
+ // per ogni giornata
+ foreach (var giornata in ListRecords)
+ {
+ if (giornata.ListTimbr != null)
+ {
+ var minRecTimb = giornata.ListTimbr
+ .Where(x => x.Entrata == true)
+ .OrderBy(x => x.DataOra)
+ .FirstOrDefault();
+ if (minRecTimb != null)
+ {
+ if (minHour > minRecTimb.DataOra.AddMinutes(roundMin / 3).Hour)
+ {
+ minHour = minRecTimb.DataOra.AddMinutes(roundMin / 3).Hour;
+ }
+ }
+ var maxRecTimb = giornata.ListTimbr
+ .Where(x => x.Entrata == false)
+ .OrderByDescending(x => x.DataOra)
+ .FirstOrDefault();
+ if (maxRecTimb != null)
+ {
+ if (maxHour < maxRecTimb.DataOra.AddMinutes(-roundMin / 3).Hour)
+ {
+ maxHour = maxRecTimb.DataOra.AddMinutes(-roundMin / 3).Hour + 1;
+ }
+ }
+ }
+
+ if (giornata.ListRA != null)
+ {
+ var minRecRa = giornata.ListRA
+ .OrderBy(x => x.Inizio)
+ .FirstOrDefault();
+ if (minRecRa != null)
+ {
+ // verifico se cambia giorno inizio/fine --> seleziono la mezzanotte
+ currStart = minRecRa.Inizio.AddMinutes(-roundMin).Date.Equals(minRecRa.Fine.Date) ? minRecRa.Inizio.AddMinutes(-roundMin).Hour : 0;
+ if (minHour > currStart)
+ {
+ minHour = currStart;
+ }
+ }
+ var maxRecRa = giornata.ListRA
+ .OrderByDescending(x => x.Fine)
+ .FirstOrDefault();
+ if (maxRecRa != null)
+ {
+ // verifico se cambia giorno inizio/fine --> seleziono la mezzanotte
+ currEnd = maxRecRa.Inizio.Date.Equals(maxRecRa.Fine.AddMinutes(roundMin).Date) ? maxRecRa.Fine.AddMinutes(roundMin).Hour + 1 : 24;
+ if (maxHour < currEnd)
+ {
+ maxHour = currEnd;
+ }
+ }
+ }
+ }
+ }
+ startHour = minHour;// - 1;
+ checkOrarioDip();
+ // minimo 6 h... x cui "allungo" verso fine
+ if (maxHour - minHour < AppMServ.orarioDip)
+ {
+ minHour--;
+ maxHour = minHour + AppMServ.orarioDip;
+ }
+ endHour = maxHour;// + 1;
+ }
+
+ protected override async Task OnParametersSetAsync()
+ {
+ ListRecords = null;
+ await InvokeAsync(StateHasChanged);
+ await Task.Delay(1);
+
+ await TryReload();
+ // avvio un timer infinito x refresh pagina COMUNQUE ogni 60 sec anche non succedesse nulla...
+ UITimer = new System.Timers.Timer
+ {
+ Interval = 1000 * 60,
+ AutoReset = true,
+ Enabled = true
+ };
+ UITimer.Elapsed += async (s, ea) => await TryReload();
+ }
+
+ protected async Task TryReload()
+ {
+ // effettuo reload SOLO SE no ho editing in corso...
+ await ReloadData();
+ await InvokeAsync(StateHasChanged);
+ }
+
+ private void checkOrarioDip()
+ {
+ // calcolo minimo da cod orario dipendente
+ if (AppMServ.orarioDip == 0)
+ {
+ AnagOrariModel? schemaOrario = null;
+ // recupero da DB schema settimanale...
+ var pUpd = Task.Run(async () =>
+ {
+ schemaOrario = await GDataServ.AnagOrarioByDip(AppMServ.IdxDipendente);
+ });
+ pUpd.Wait();
+ if (schemaOrario != null)
+ {
+ AppMServ.orarioDip = (int)(Math.Ceiling(schemaOrario.oreOrdSett / 5));
+ }
+ }
+ }
+
+ private async Task ReloadData()
+ {
+ isLoading = true;
+ UITimer.Stop();
+ ListRecords = await GDataServ.DailyDetailAllDip(DtSelected);
+ await Task.Delay(1);
+ checkHourRange();
+ await Task.Delay(1);
+ lastRefresh = DateTime.Now;
+ UITimer.Start();
+ isLoading = false;
+ }
+
+ #endregion Private Methods
+ }
+}
\ No newline at end of file
diff --git a/GPW.CORE.WRKLOG/Pages/WeekPlan.razor.cs b/GPW.CORE.WRKLOG/Pages/WeekPlan.razor.cs
index ef1c9d6..5057550 100644
--- a/GPW.CORE.WRKLOG/Pages/WeekPlan.razor.cs
+++ b/GPW.CORE.WRKLOG/Pages/WeekPlan.razor.cs
@@ -577,8 +577,5 @@ namespace GPW.CORE.WRKLOG.Pages
#endregion Private Methods
-#if false
- //protected void PeriodoSelect(List newList)
-#endif
}
}
\ No newline at end of file
diff --git a/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor b/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor
index 14cfe40..cf8c216 100644
--- a/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor
+++ b/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor
@@ -26,18 +26,16 @@
@if (isAdmin)
{
- @if (!string.IsNullOrEmpty(lblDisplay))
- {
-
+
+ @if (!string.IsNullOrEmpty(lblDisplay))
+ {
@lblDisplay
-
- }
- else
- {
-
- Presenti: @numPres di @numTot
-
- }
+ }
+ else
+ {
+
Presenti: @numPres di @numTot
+ }
+
}
diff --git a/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor.cs b/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor.cs
index 2e2ada2..d66d81b 100644
--- a/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor.cs
+++ b/GPW.CORE.WRKLOG/Shared/LoginDisplay.razor.cs
@@ -3,6 +3,7 @@ using GPW.CORE.Data.DbModels;
using GPW.CORE.WRKLOG.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
+using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
namespace GPW.CORE.WRKLOG.Shared
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 99a97fe..2a04a50 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@