diff --git a/GPW.CORE.UI/Components/DayHoriz.razor b/GPW.CORE.UI/Components/DayHoriz.razor index 3f1f904..f737847 100644 --- a/GPW.CORE.UI/Components/DayHoriz.razor +++ b/GPW.CORE.UI/Components/DayHoriz.razor @@ -46,7 +46,7 @@ { @foreach (var item in ListRegAtt()) { - + } } diff --git a/GPW.CORE.UI/Components/DayHoriz.razor.cs b/GPW.CORE.UI/Components/DayHoriz.razor.cs index c5299b4..a3920ad 100644 --- a/GPW.CORE.UI/Components/DayHoriz.razor.cs +++ b/GPW.CORE.UI/Components/DayHoriz.razor.cs @@ -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; + /// + /// record prima timbratura x + /// + 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 ListFasi { get; set; } = null!; - - - [Parameter] - public EventCallback?> PeriodSelected { get; set; } - - [Parameter] - public EventCallback ItemSelected { get; set; } - - [Parameter] - public EventCallback ItemUpdated { get; set; } - - [Parameter] - public EventCallback 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 ItemSelected { get; set; } + + [Parameter] + public EventCallback ItemUpdated { get; set; } + + [Parameter] + public List ListFasi { get; set; } = null!; + + [Parameter] + public EventCallback?> PeriodSelected { get; set; } + + [Parameter] + public EventCallback ReqTempList { get; set; } + + [Parameter] + public int StartHour { get; set; } + + #endregion Public Properties + + #region Private Methods + + private List ListRegAtt() { - get + // init + DateTime currHour = DayDTO.DtRif.AddHours(StartHour); + DateTime lastHour = DayDTO.DtRif.AddHours(EndHour); + List result = new List(); + // 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; - } - } - /// - /// record prima timbratura x - /// - 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 ListTimb() { @@ -319,74 +369,9 @@ namespace GPW.CORE.UI.Components return result; } + #endregion Private Methods - private List ListRegAtt() - { - // init - DateTime currHour = DayDTO.DtRif.AddHours(StartHour); - DateTime lastHour = DayDTO.DtRif.AddHours(EndHour); - List result = new List(); - // 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; - } - - /// - /// Indico item selezionato - /// - protected async void ReportSelected(RegAttivitaModel selRecord) - { - await ItemSelected.InvokeAsync(selRecord); - } - - /// - /// Indico item selezionato - /// - protected async void ReportCloned() - { - await ItemSelected.InvokeAsync(null); - } - - /// - /// Indico item aggiornato - /// - protected async void ReportUpdated() - { - await ItemUpdated.InvokeAsync(null); - } + #region Protected Methods /// /// Indico item selezionato @@ -399,13 +384,30 @@ namespace GPW.CORE.UI.Components } } - protected async void SelTimbrature() + /// + /// Indico item selezionato + /// + protected async void ReportCloned() { - if (DayDTO != null) - { - await PeriodSelected.InvokeAsync(DayDTO.ListTimbr); - } + await ItemSelected.InvokeAsync(null); } + + /// + /// Indico item selezionato + /// + protected async void ReportSelected(RegAttivitaModel selRecord) + { + await ItemSelected.InvokeAsync(selRecord); + } + + /// + /// Indico item aggiornato + /// + 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 } } \ No newline at end of file diff --git a/GPW.CORE.UI/Components/RecFaseStart.razor b/GPW.CORE.UI/Components/RecFaseStart.razor index 8a2c004..fe8ccd0 100644 --- a/GPW.CORE.UI/Components/RecFaseStart.razor +++ b/GPW.CORE.UI/Components/RecFaseStart.razor @@ -98,9 +98,12 @@ else
- @if (CalcOreProj != null && CalcOreProj.timeRem > 0) + @if (AppMServ.PayloadOk) { - + if (CalcOreProj != null && CalcOreProj.timeRem > 0) + { + + } }
diff --git a/GPW.CORE.UI/Components/RegAtt.razor b/GPW.CORE.UI/Components/RegAtt.razor index 07538cc..aa0e4d4 100644 --- a/GPW.CORE.UI/Components/RegAtt.razor +++ b/GPW.CORE.UI/Components/RegAtt.razor @@ -23,42 +23,45 @@
@($"{CurrData.OreTot*60:N0}'")
} - @if (!IsClipboard) + @if (!IsClipboard && EnableActionMenu) { - diff --git a/GPW.CORE.UI/Components/RegAtt.razor.cs b/GPW.CORE.UI/Components/RegAtt.razor.cs index 0ff67a2..57e09a5 100644 --- a/GPW.CORE.UI/Components/RegAtt.razor.cs +++ b/GPW.CORE.UI/Components/RegAtt.razor.cs @@ -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; diff --git a/GPW.CORE.UI/Components/RegAttEditor.razor b/GPW.CORE.UI/Components/RegAttEditor.razor index c90afa0..f67eb68 100644 --- a/GPW.CORE.UI/Components/RegAttEditor.razor +++ b/GPW.CORE.UI/Components/RegAttEditor.razor @@ -107,20 +107,16 @@
diff --git a/GPW.CORE.UI/Data/GpwDataService.cs b/GPW.CORE.UI/Data/GpwDataService.cs index 64bad04..5cfa43a 100644 --- a/GPW.CORE.UI/Data/GpwDataService.cs +++ b/GPW.CORE.UI/Data/GpwDataService.cs @@ -123,30 +123,6 @@ namespace GPW.CORE.UI.Data return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp)); } - /// - /// Calcola HASH del codice impiego - /// - /// - /// - 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 diff --git a/GPW.CORE.UI/Data/MessageService.cs b/GPW.CORE.UI/Data/MessageService.cs index 8b92d1f..66a0c3a 100644 --- a/GPW.CORE.UI/Data/MessageService.cs +++ b/GPW.CORE.UI/Data/MessageService.cs @@ -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; + /// + /// Calcola HASH del codice impiego = payload utente + /// + /// + /// + 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; diff --git a/GPW.CORE.UI/GPW.CORE.UI.csproj b/GPW.CORE.UI/GPW.CORE.UI.csproj index 115db0c..dcedd20 100644 --- a/GPW.CORE.UI/GPW.CORE.UI.csproj +++ b/GPW.CORE.UI/GPW.CORE.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 3.0.2201.1717 + 3.0.2201.1718 enable enable diff --git a/GPW.CORE.UI/Pages/FastRec.razor b/GPW.CORE.UI/Pages/FastRec.razor index e16dbfc..0d120aa 100644 --- a/GPW.CORE.UI/Pages/FastRec.razor +++ b/GPW.CORE.UI/Pages/FastRec.razor @@ -60,7 +60,7 @@ @foreach (var currItem in ListRecords) { - + }
diff --git a/GPW.CORE.UI/Shared/LoginDisplay.razor b/GPW.CORE.UI/Shared/LoginDisplay.razor index d7ee76f..560701f 100644 --- a/GPW.CORE.UI/Shared/LoginDisplay.razor +++ b/GPW.CORE.UI/Shared/LoginDisplay.razor @@ -10,12 +10,12 @@
@userName
-
-
@@ -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 ///
/// - protected async Task checkUserLicense() + protected async Task 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"; } } \ No newline at end of file diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 4d67aa9..65abc75 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 3.0.2201.1717

+

Versione: 3.0.2201.1718


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 4b0bc75..184cfe0 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -3.0.2201.1717 +3.0.2201.1718 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 43036fb..7b1c837 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 3.0.2201.1717 + 3.0.2201.1718 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false