diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs index 1638ba9..809a506 100644 --- a/GPW.CORE.Data/Controllers/GPWController.cs +++ b/GPW.CORE.Data/Controllers/GPWController.cs @@ -1324,6 +1324,32 @@ namespace GPW.CORE.Data.Controllers return answ; } + /// + /// Elenco di tutte le timbrature richieste (= NON approvate) + /// + /// + public List TimbratureRichieste() + { + List dbResult = new List(); + using (GPWContext localDbCtx = new GPWContext(_configuration)) + { + try + { + dbResult = localDbCtx + .DbSetTimbrature + .Where(x => x.Approv == false) + .Include(d => d.DipNav) + .OrderByDescending(x => x.DataOra) + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione in TimbratureRichieste{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + public List TimbratureDay(DateTime dateRif, int IdxDip) { List dbResult = new List(); @@ -1379,6 +1405,9 @@ namespace GPW.CORE.Data.Controllers { // aggiorno solo entrata/uscita currRec.Entrata = currItem.Entrata; + currRec.Approv = currItem.Approv; + currRec.Ipv4 = currItem.Ipv4; + currRec.DataOra = currItem.DataOra; localDbCtx .DbSetTimbrature diff --git a/GPW.CORE.SMART/Components/Calendario.razor.cs b/GPW.CORE.SMART/Components/Calendario.razor.cs index f668e09..99c2d8f 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor.cs +++ b/GPW.CORE.SMART/Components/Calendario.razor.cs @@ -79,34 +79,6 @@ namespace GPW.CORE.Smart.Components MService.ReportRicTimb(); } -#if false - private async void checkApp(DateTime? dtRif) - { - isApprovedEntr = true; - isApprovedEsc = true; - DateTime dtScelta = dtRif ?? DateTime.Today; - listTimb = await CSDataService.TimbratureDay(dtScelta, IdxDipendente); - if (listTimb != null) - { - if (listTimb.Count != 0) - { - foreach (var item in listTimb) - { - if (item.Approv == false && item.Entrata == true) - { - isApprovedEntr = false; - } - else if (item.Approv == false && item.Entrata == false) - { - isApprovedEsc = false; - } - } - } - - } - } -#endif - private string cssChooseEntr(DateTime? dtRif) { string answ = ""; diff --git a/GPW.CORE.SMART/Components/InvioLinkEmail.razor.cs b/GPW.CORE.SMART/Components/InvioLinkEmail.razor.cs index 7065251..98139dc 100644 --- a/GPW.CORE.SMART/Components/InvioLinkEmail.razor.cs +++ b/GPW.CORE.SMART/Components/InvioLinkEmail.razor.cs @@ -143,9 +143,6 @@ namespace GPW.CORE.Smart.Components var rigaDip = ListaDip.FirstOrDefault(x => x.IdxDipendente == idxDipendente); if (rigaDip != null) { - //string rndTxt01 = SteamCrypto.RandomString(4, true); - //string rndTxt02 = SteamCrypto.RandomString(4, true); - //string newAuthKey = CDService.EncriptData($"{rndTxt01}|{idxDipendente}|{rigaDip.Email}|{rndTxt02}").ToUpper(); Guid newGuid = Guid.NewGuid(); string newAuthKey = $"{newGuid}"; rigaDip.AuthKey = newAuthKey.ToUpper(); diff --git a/GPW.CORE.SMART/Components/TimbAdmin.razor b/GPW.CORE.SMART/Components/TimbAdmin.razor new file mode 100644 index 0000000..47031af --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbAdmin.razor @@ -0,0 +1,25 @@ +@if (!userIsAdmin) +{ +
+

Attenzione

+ Autorizzazione richiesta per accedere alla funzionalità +
+} +else +{ + @if (ListTimbRich == null) + { + + } + else if (ListTimbRich.Count == 0) + { +
+

Timbrature da Approvare

+ Nessun record trovato +
+ } + else + { + + } +} diff --git a/GPW.CORE.SMART/Components/TimbAdmin.razor.cs b/GPW.CORE.SMART/Components/TimbAdmin.razor.cs new file mode 100644 index 0000000..d0dfec9 --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbAdmin.razor.cs @@ -0,0 +1,93 @@ +using GPW.CORE.Data.DbModels; +using GPW.CORE.Smart.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace GPW.CORE.Smart.Components +{ + public partial class TimbAdmin + { + #region Public Properties + + [Parameter] + public int IdxDipAdmin { get; set; } = 0; + + #endregion Public Properties + + #region Protected Methods + + /// + /// Aggiorno e riporto update + /// + protected async void DoUpdate(bool forceReload) + { + if (forceReload) + { + await ReloadData(); + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + } + } + + protected override async Task OnParametersSetAsync() + { + // verifico se il dip sia admin... + var listaRuoli = await CDService.Dip2RuoliGetAll(); + var rigaDip = listaRuoli.FirstOrDefault(x => x.IdxDipendente == IdxDipAdmin && x.CodRuolo == "AppMancTimb"); + userIsAdmin = rigaDip != null; + await ReloadData(); + } + + #endregion Protected Methods + + #region Private Fields + + private bool userIsAdmin = false; + + #endregion Private Fields + + #region Private Properties + + [Inject] + private CoreSmartDataService CDService { get; set; } = null!; + + private bool isLoading { get; set; } = false; + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + private List? ListTimbRich { get; set; } = null; + + [Inject] + private NavigationManager navManager { get; set; } = null!; + + #endregion Private Properties + + #region Private Methods + + private async Task ReloadData() + { + isLoading = true; + await Task.Delay(1); + //// verifico se il dip sia admin... + //var listaRuoli = await CDService.Dip2RuoliGetAll(); + //var rigaDip = listaRuoli.FirstOrDefault(x => x.IdxDipendente == IdxDipAdmin && x.CodRuolo == "AppMancTimb"); + //userIsAdmin = rigaDip != null; + + if (userIsAdmin) + { + ListTimbRich = null; + await Task.Delay(50); + ListTimbRich = await CDService.TimbratureRichieste(); + } + else + { + ListTimbRich = null; + } + await Task.Delay(1); + isLoading = true; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/GPW.CORE.SMART/Components/TimbList.razor b/GPW.CORE.SMART/Components/TimbList.razor new file mode 100644 index 0000000..d2a93d6 --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbList.razor @@ -0,0 +1,92 @@ +@using GPW.CORE.Data.DbModels +@using GPW.CORE.Smart.Data + + + + + + @if (EnableAdmin) + { + + } + + + + + + + + + @if (@isLoading) + { + + @if (EnableAdmin) + { + + } + else + { + + } + + } + else + { + @foreach (var item in ListTimb) + { + + @if (EnableAdmin) + { + + } + + + + + + + } + } + +
+ + Scambio
+ + + +
+ + + @if (EnableAdmin) + { +
+ @item.DipNav.Cognome @item.DipNav.Nome +
+ } + @item.DataOra.ToString("dd/MM - HH:mm") +
+ @if (@item.Entrata == true) + { + + } + + + + @if (@item.Entrata == false) + { + + } + + @if (EnableEdit) + { + + } + else + { + + } +
+ + diff --git a/GPW.CORE.SMART/Components/TimbList.razor.cs b/GPW.CORE.SMART/Components/TimbList.razor.cs new file mode 100644 index 0000000..8728e1a --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbList.razor.cs @@ -0,0 +1,101 @@ +using GPW.CORE.Data.DbModels; +using GPW.CORE.Smart.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace GPW.CORE.Smart.Components +{ + public partial class TimbList + { + #region Public Properties + + [Parameter] + public bool EnableAdmin { get; set; } = false; + + [Parameter] + public bool EnableEdit { get; set; } = false; + + private bool isLoading { get; set; } = false; + + [Parameter] + public List ListTimb + { + get + { + return _ListTimb.OrderByDescending(x => x.DataOra).ToList(); + } + + set + { + _ListTimb = value; + } + } + + [Parameter] + public EventCallback ReqUpdate { get; set; } + + #endregion Public Properties + + #region Protected Methods + + protected async void ApprovaTimb(TimbratureModel currRecord) + { + string message = "Sicuro di voler approvare la richiesta selezionata?"; + if (!await JSRuntime.InvokeAsync("confirm", message)) + return; + + isLoading = true; + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + currRecord.Approv = true; + // aggiorno + await CDService.TimbratureUpdate(currRecord); + await Task.Delay(1); + isLoading = false; + await ReqUpdate.InvokeAsync(true); + } + + protected async void Delete(TimbratureModel currRecord) + { + string message = "Sicuro di voler eliminare/rifiutare la richiesta selezionata?"; + if (!await JSRuntime.InvokeAsync("confirm", message)) + return; + + isLoading = true; + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + // elimino + await CDService.TimbratureDelete(currRecord); + await Task.Delay(1); + isLoading = false; + await ReqUpdate.InvokeAsync(true); + } + + protected async void ScambioInOut(TimbratureModel currRecord) + { + isLoading = true; + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + currRecord.Entrata = !currRecord.Entrata; + // aggiorno + await CDService.TimbratureUpdate(currRecord); + await Task.Delay(1); + isLoading = false; + await ReqUpdate.InvokeAsync(false); + } + + #endregion Protected Methods + + #region Private Properties + + private List _ListTimb { get; set; } = new List(); + + [Inject] + private CoreSmartDataService CDService { get; set; } = null!; + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/GPW.CORE.SMART/Components/TimbUser.razor b/GPW.CORE.SMART/Components/TimbUser.razor new file mode 100644 index 0000000..f7008b5 --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbUser.razor @@ -0,0 +1,3 @@ +

TimbUser

+ + diff --git a/GPW.CORE.SMART/Components/TimbUser.razor.cs b/GPW.CORE.SMART/Components/TimbUser.razor.cs new file mode 100644 index 0000000..2d65671 --- /dev/null +++ b/GPW.CORE.SMART/Components/TimbUser.razor.cs @@ -0,0 +1,25 @@ +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.Comp; +using GPW.CORE.Data.DbModels; +using GPW.CORE.Smart; +using GPW.CORE.Smart.Components; +using GPW.CORE.Smart.Shared; + +namespace GPW.CORE.Smart.Components +{ + public partial class TimbUser + { + } +} \ No newline at end of file diff --git a/GPW.CORE.SMART/Data/CoreSmartDataService.cs b/GPW.CORE.SMART/Data/CoreSmartDataService.cs index 6659157..b248c6f 100644 --- a/GPW.CORE.SMART/Data/CoreSmartDataService.cs +++ b/GPW.CORE.SMART/Data/CoreSmartDataService.cs @@ -517,7 +517,24 @@ namespace GPW.CORE.Smart.Data dbResult = dbController.TimbratureDay(dateRif, IdxDip); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB + caching per TimbratureDay: {ts.TotalMilliseconds} ms"); + Log.Trace($"Effettuata lettura da DB per TimbratureDay: {ts.TotalMilliseconds} ms"); + return dbResult; + } + + /// + /// Elenco di tutte le timbrature richieste (= NON approvate) + /// + /// + public async Task> TimbratureRichieste() + { + await Task.Delay(1); + List? dbResult = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbController.TimbratureRichieste(); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Effettuata lettura da DB per TimbratureRichieste: {ts.TotalMilliseconds} ms"); return dbResult; } diff --git a/GPW.CORE.SMART/Pages/Admin.razor b/GPW.CORE.SMART/Pages/Admin.razor index 6f78788..3fe00aa 100644 --- a/GPW.CORE.SMART/Pages/Admin.razor +++ b/GPW.CORE.SMART/Pages/Admin.razor @@ -32,9 +32,7 @@
-
- This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. -
+
diff --git a/GPW.CORE.WRKLOG/Components/TimbList.razor b/GPW.CORE.WRKLOG/Components/TimbList.razor index 020c0e4..2fa24dc 100644 --- a/GPW.CORE.WRKLOG/Components/TimbList.razor +++ b/GPW.CORE.WRKLOG/Components/TimbList.razor @@ -1,9 +1,4 @@ -@using CORE.Data.DbModels -@using WRKLOG.Data - -@inject IJSRuntime JSRuntime -@inject GpwDataService GDataServ -@inject MessageService AppMServ + @@ -27,14 +22,7 @@ }
- @*@if (EnableEdit) - {*@ - - @*} - else - { - - }*@ + @if (@item.Entrata == false) @@ -57,43 +45,4 @@
-@code { - private List _ListTimb { get; set; } = new List(); - - [Parameter] - public List ListTimb - { - get - { - return _ListTimb.OrderByDescending(x => x.DataOra).ToList(); - } - set - { - _ListTimb = value; - InvokeAsync(() => - { - StateHasChanged(); - }); - } - } - - [Parameter] - public bool EnableEdit { get; set; } = false; - - [Parameter] - public EventCallback ReqDelete { get; set; } - - [Parameter] - public EventCallback ReqUpdate { get; set; } - - protected async void Delete(TimbratureModel currRecord) - { - await ReqDelete.InvokeAsync(currRecord); - } - - protected async void ScambioInOut(TimbratureModel currRecord) - { - await ReqUpdate.InvokeAsync(currRecord); - } -} diff --git a/GPW.CORE.WRKLOG/Components/TimbList.razor.cs b/GPW.CORE.WRKLOG/Components/TimbList.razor.cs new file mode 100644 index 0000000..98810c6 --- /dev/null +++ b/GPW.CORE.WRKLOG/Components/TimbList.razor.cs @@ -0,0 +1,62 @@ +using GPW.CORE.Data.DbModels; +using GPW.CORE.WRKLOG.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace GPW.CORE.WRKLOG.Components +{ + public partial class TimbList + { + #region Public Properties + + [Parameter] + public bool EnableEdit { get; set; } = false; + + [Parameter] + public List ListTimb + { + get + { + return _ListTimb.OrderByDescending(x => x.DataOra).ToList(); + } + + set + { + _ListTimb = value; + InvokeAsync(() => + { + StateHasChanged(); + }); + } + } + + [Parameter] + public EventCallback ReqDelete { get; set; } + + [Parameter] + public EventCallback ReqUpdate { get; set; } + + #endregion Public Properties + + #region Protected Methods + + protected async void Delete(TimbratureModel currRecord) + { + await ReqDelete.InvokeAsync(currRecord); + } + + protected async void ScambioInOut(TimbratureModel currRecord) + { + await ReqUpdate.InvokeAsync(currRecord); + } + + #endregion Protected Methods + + #region Private Properties + + private List _ListTimb { get; set; } = new List(); + + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj index 7dc7f88..ca66ae4 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.2301.1613 + 3.0.2301.1614 enable enable diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 0fc5c8b..0e604ba 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 3.0.2301.1613

+

Versione: 3.0.2301.1614


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 4ad7461..fec5df6 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -3.0.2301.1613 +3.0.2301.1614 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 4ef7e41..9075a64 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 3.0.2301.1613 + 3.0.2301.1614 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false