diff --git a/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor b/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor index a0bfc04..fd912a0 100644 --- a/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor +++ b/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor @@ -23,9 +23,14 @@ foreach (var item in DayDTO.ListRA) {
- +
} + + @if (clonedRA != null) + { + + } } diff --git a/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor.cs b/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor.cs index 30e01f5..e219c95 100644 --- a/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor.cs +++ b/GPW.CORE.WRKLOG/Components/DayAgendaDetail.razor.cs @@ -22,6 +22,8 @@ namespace GPW.CORE.WRKLOG.Components [Parameter] public EventCallback ItemSelected { get; set; } + [Parameter] + public EventCallback ItemDeleted { get; set; } [Parameter] public List ListFasi { get; set; } = null!; @@ -33,12 +35,34 @@ namespace GPW.CORE.WRKLOG.Components #region Protected Properties + /// + /// record prima timbratura utile + /// + private DateTime LastTimb = DateTime.Now; + protected RegAttivitaModel? currRecord { get; set; } = null; #endregion Protected Properties #region Protected Methods + protected override Task OnParametersSetAsync() + { + if (DayDTO.ListRA != null) + { + // sistemo la prima timbratura + if (DayDTO.ListRA.Count > 0) + { + var lastRec = DayDTO.ListRA.OrderByDescending(x => x.Inizio).FirstOrDefault(); + if (lastRec != null) + { + LastTimb = CORE.Data.Utils.DateRounded(lastRec.Inizio.Add(lastRec.Durata), 5, false); + } + } + } + return base.OnParametersSetAsync(); + } + /// /// Indico item selezionato /// @@ -70,7 +94,30 @@ namespace GPW.CORE.WRKLOG.Components await ItemSelected.InvokeAsync(selRecord); } + /// + /// Indico item selezionato + /// + protected async void ReportDeleted() + { + await ItemDeleted.InvokeAsync(null); + } #endregion Protected Methods + + #region Private Properties + + private RegAttivitaModel? clonedRA + { + get + { + return AppMServ.clonedRA; + } + set + { + AppMServ.clonedRA = value; + } + } + + #endregion Private Properties } } \ No newline at end of file diff --git a/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs b/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs index 4d213f0..d852904 100644 --- a/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs +++ b/GPW.CORE.WRKLOG/Components/DayHoriz.razor.cs @@ -10,7 +10,7 @@ namespace GPW.CORE.WRKLOG.Components #region Protected Fields /// - /// record prima timbratura x + /// record prima timbratura x inserimento /// protected DateTime FirstTimb = DateTime.Now; diff --git a/GPW.CORE.WRKLOG/Components/DettAtt.razor b/GPW.CORE.WRKLOG/Components/DettAtt.razor index 26f3f13..0f82efc 100644 --- a/GPW.CORE.WRKLOG/Components/DettAtt.razor +++ b/GPW.CORE.WRKLOG/Components/DettAtt.razor @@ -6,17 +6,20 @@
- +
@(trimLine($"{CurrData.FasiNav?.ProgettoNav?.ClienteNav?.RagSociale}",MaxChar)) - @(trimLine($"{CurrData.FasiNav?.ProgettoNav?.NomeProj}",MaxChar))
@(trimLine($"{CurrData.FasiNav?.DescrizioneFase}",100))
@(trimLine($"{CurrData.Descrizione}",MaxChar))
-
diff --git a/GPW.CORE.WRKLOG/Components/DettAtt.razor.cs b/GPW.CORE.WRKLOG/Components/DettAtt.razor.cs index ed141af..7760dcd 100644 --- a/GPW.CORE.WRKLOG/Components/DettAtt.razor.cs +++ b/GPW.CORE.WRKLOG/Components/DettAtt.razor.cs @@ -1,5 +1,6 @@ using GPW.CORE.Data.DbModels; using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; namespace GPW.CORE.WRKLOG.Components { @@ -13,6 +14,9 @@ namespace GPW.CORE.WRKLOG.Components [Parameter] public int IdxDipSel { get; set; } = 0; + [Parameter] + public EventCallback ItemDeleted { get; set; } + [Parameter] public EventCallback ItemSelected { get; set; } @@ -70,7 +74,7 @@ namespace GPW.CORE.WRKLOG.Components #region Protected Methods /// - /// Indico item selezionato + /// Clono item selezionato /// protected async void Clone() { @@ -80,6 +84,21 @@ namespace GPW.CORE.WRKLOG.Components await ItemSelected.InvokeAsync(null); } + /// + /// Elimino item selezionato + /// + protected async void Delete() + { + // chiedo verifica + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare il record selezionato??")) + return; + + // aggiorno + await GDataServ.RegAttDelete(CurrData); + // registro fatto + await ItemDeleted.InvokeAsync(null); + } + /// /// Indico item selezionato /// diff --git a/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj b/GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj index 5a4545e..9ffb9b1 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.2210.0311 + 3.0.2210.1416 enable enable diff --git a/GPW.CORE.WRKLOG/Pages/ListPlan.razor b/GPW.CORE.WRKLOG/Pages/ListPlan.razor index 147926e..e3f0b56 100644 --- a/GPW.CORE.WRKLOG/Pages/ListPlan.razor +++ b/GPW.CORE.WRKLOG/Pages/ListPlan.razor @@ -104,7 +104,7 @@ } @if (showDay) { - + } @if (showTemp) { diff --git a/GPW.CORE.WRKLOG/Pages/ListPlan.razor.cs b/GPW.CORE.WRKLOG/Pages/ListPlan.razor.cs index 3c70358..5fb85c7 100644 --- a/GPW.CORE.WRKLOG/Pages/ListPlan.razor.cs +++ b/GPW.CORE.WRKLOG/Pages/ListPlan.razor.cs @@ -15,24 +15,68 @@ namespace GPW.CORE.WRKLOG.Pages //[Authorize(Roles = "SuperAdmin, Admin")] public partial class ListPlan : IDisposable { - #region Private Fields + #region Public Methods - private int _endHour = 14; - private int _startHour = 12; + public string cssBadgeLav(double oreLav, double oreComm) + { + 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; + } - private RegAttivitaModel? currRecord = null; - private DateTime DtSelected = DateTime.Today; - private List ListFasi = new List(); - private List? ListRecords = null; - private List? ListTimbr = null; - private DailyDataDTO? SelDayDTO = null; - private bool selPeriod = false; - private bool showDay = false; - private bool showTemp = false; - private bool showTimb = false; - private List? weekStatList = null; + public string cssCheck(DailyDataDTO DayDTO) + { + string answ = OkVC19(DayDTO) ? "text-success" : "text-secondary"; + return answ; + } - #endregion Private Fields + public string cssThermo(DailyDataDTO DayDTO) + { + string answ = ""; + // verifico in base a ok temp o meno... + if (OkTemp(DayDTO)) + { + // colore in base al valore... + var currTemp = tempRil(DayDTO); + 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; + } + + public void Dispose() + { + UITimer?.Dispose(); + } + + #endregion Public Methods #region Protected Fields @@ -41,57 +85,12 @@ namespace GPW.CORE.WRKLOG.Pages /// /// 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/ + /// 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 Private Properties - - private int endHour - { - get => _endHour; - set - { - // fix --> max 24... - _endHour = value < 25 ? value : 24; - } - } - - private bool isLoading { get; set; } = false; - - private double periodoClonato - { - get - { - double answ = 8; - // se ho record clonato --> uso quello - if (clonedRA != null) - { - answ = clonedRA.Durata.TotalHours; - } - else - { - answ = endHour - startHour; - } - return answ; - } - } - - private int startHour - { - get => _startHour; - set - { - // fix --> MIN 0... - _startHour = value > 0 ? value : 0; - } - } - - #endregion Private Properties - #region Protected Properties protected string actionCss @@ -102,6 +101,18 @@ namespace GPW.CORE.WRKLOG.Pages [Inject] protected MessageService AppMServ { get; set; } = null!; + protected RegAttivitaModel? clonedRA + { + get + { + return AppMServ.clonedRA; + } + set + { + AppMServ.clonedRA = value; + } + } + protected int currWeekNum { get @@ -173,126 +184,41 @@ namespace GPW.CORE.WRKLOG.Pages #endregion Protected Properties - #region Public Properties + #region Protected Methods - public RegAttivitaModel? clonedRA + protected string cssRiga(DateTime DtRifRiga) { - get + string answ = ""; + if (showTimb) { - return AppMServ.clonedRA; - } - set - { - AppMServ.clonedRA = value; - } - } - - #endregion Public Properties - - #region Private Methods - - private string ConvOre(double oreComm) - { - TimeSpan tSpan = TimeSpan.FromHours(oreComm); - return $"{tSpan.Hours}h {tSpan.Minutes}'"; - } - - /// - /// Reinit dei dati - /// - /// - /// - private async Task InitData(bool dateReset) - { - isLoading = true; - if (dateReset) - { - TargetDate = DateTime.Today; - } - weekStatList = await DataService.LastWeeks(IdxDipendente, TargetDate, 3); - currWeekNum = weekStatList.Last().WeekNumber; - isLoading = false; - } - - private bool OkTemp(DailyDataDTO DayDTO) - { - bool answ = false; - if (DayDTO != null && DayDTO.ListRilTemp != null) - { - answ = DayDTO.ListRilTemp.Count > 0; - } - return answ; - } - - private bool OkVC19(DailyDataDTO DayDTO) - { - bool answ = false; - if (DayDTO != null && DayDTO.ListCheckC19 != null) - { - answ = DayDTO.ListCheckC19.Count > 0; - } - return answ; - } - - private double oreLav(DailyDataDTO DayDTO) - { - double answ = 0; - if (DayDTO != null && DayDTO.TimbrExpl != null && DayDTO.TimbrExpl.HLav != null) - { - answ = (double)DayDTO.TimbrExpl.HLav; - if (DayDTO.DtRif == DateTime.Today) + if (ListTimbr != null) { - if (DayDTO.ListTimbr != null) + if (DtRifRiga == ListTimbr.FirstOrDefault()?.DataOra.Date) { - // 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... - if (lastIn != null) - { - if (lastOut == null || lastOut.DataOra < lastIn.DataOra) - { - DateTime adesso = DateTime.Now; - answ += adesso.Subtract(lastIn.DataOra).TotalHours; - } - } + answ = "table-info"; } } } - return answ; - } - - private async Task ReloadData() - { - isLoading = true; - UITimer.Stop(); - if (weekStatList != null) + else if (showDay) { - ListRecords = await DataService.DailyDetails(IdxDipendente, weekStatList.First().Inizio, weekStatList.Last().Fine); - } - await Task.Delay(100); - lastRefresh = DateTime.Now; - UITimer.Start(); - isLoading = false; - } - - private decimal tempRil(DailyDataDTO DayDTO) - { - decimal answ = 0; - if (OkTemp(DayDTO) && DayDTO != null) - { - if (DayDTO.ListRilTemp != null) + if (SelDayDTO != null) { - answ = DayDTO.ListRilTemp[0].TempRil; + if (DtRifRiga == SelDayDTO.DtRif) + { + answ = "table-info"; + } + } + } + else if (showTemp) + { + if (DtRifRiga == DtSelected) + { + answ = "table-info"; } } return answ; } - #endregion Private Methods - - #region Protected Methods - protected async Task MoveWeek(int numWeek) { isLoading = true; @@ -395,6 +321,19 @@ namespace GPW.CORE.WRKLOG.Pages await ReloadData(); } + protected async Task ReportDeleted() + { + selPeriod = false; + showDay = false; + showTemp = false; + showTimb = false; + currRecord = null; + ListTimbr = null; + SelDayDTO = null; + await InitData(true); + await ReloadData(); + } + protected async Task ResetDayCheck() { selPeriod = false; @@ -526,102 +465,171 @@ namespace GPW.CORE.WRKLOG.Pages await ReloadData(); } - protected string cssRiga(DateTime DtRifRiga) - { - string answ = ""; - if (showTimb) - { - if (ListTimbr != null) - { - if (DtRifRiga == ListTimbr.FirstOrDefault()?.DataOra.Date) - { - answ = "table-info"; - } - } - } - else if (showDay) - { - if (SelDayDTO != null) - { - if (DtRifRiga == SelDayDTO.DtRif) - { - answ = "table-info"; - } - } - } - else if (showTemp) - { - if (DtRifRiga == DtSelected) - { - answ = "table-info"; - } - } - return answ; - } - #endregion Protected Methods - #region Public Methods + #region Private Fields - public string cssBadgeLav(double oreLav, double oreComm) + private int _endHour = 14; + private int _startHour = 12; + + private RegAttivitaModel? currRecord = null; + private DateTime DtSelected = DateTime.Today; + private List ListFasi = new List(); + private List? ListRecords = null; + private List? ListTimbr = null; + private DailyDataDTO? SelDayDTO = null; + private bool selPeriod = false; + private bool showDay = false; + private bool showTemp = false; + private bool showTimb = false; + private List? weekStatList = null; + + #endregion Private Fields + + #region Private Properties + + private int endHour { - string bCtr = "btn"; - string answ = $"{bCtr}-light"; - var deltaComm = oreComm - oreLav; - if (Math.Abs(deltaComm) < 0.5) + get => _endHour; + set { - answ = $"{bCtr}-info"; + // fix --> max 24... + _endHour = value < 25 ? value : 24; } - else if (Math.Abs(deltaComm) < 1) - { - answ = $"{bCtr}-warning"; - } - else - { - answ = $"{bCtr}-danger"; - } - return answ; } - public string cssCheck(DailyDataDTO DayDTO) - { - string answ = OkVC19(DayDTO) ? "text-success" : "text-secondary"; - return answ; - } + private bool isLoading { get; set; } = false; - public string cssThermo(DailyDataDTO DayDTO) + private double periodoClonato { - string answ = ""; - // verifico in base a ok temp o meno... - if (OkTemp(DayDTO)) + get { - // colore in base al valore... - var currTemp = tempRil(DayDTO); - if (currTemp >= (decimal)37.5) + double answ = 8; + // se ho record clonato --> uso quello + if (clonedRA != null) { - answ = "text-danger"; - } - else if (currTemp >= 37) - { - answ = "text-warning"; + answ = clonedRA.Durata.TotalHours; } else { - answ = "text-success"; + answ = endHour - startHour; } + return answ; } - else + } + + private int startHour + { + get => _startHour; + set { - answ = "text-secondary"; + // fix --> MIN 0... + _startHour = value > 0 ? value : 0; + } + } + + #endregion Private Properties + + #region Private Methods + + private string ConvOre(double oreComm) + { + TimeSpan tSpan = TimeSpan.FromHours(oreComm); + return $"{tSpan.Hours}h {tSpan.Minutes}'"; + } + + /// + /// Reinit dei dati + /// + /// + /// + private async Task InitData(bool dateReset) + { + isLoading = true; + if (dateReset) + { + TargetDate = DateTime.Today; + } + weekStatList = await DataService.LastWeeks(IdxDipendente, TargetDate, 3); + currWeekNum = weekStatList.Last().WeekNumber; + isLoading = false; + } + + private bool OkTemp(DailyDataDTO DayDTO) + { + bool answ = false; + if (DayDTO != null && DayDTO.ListRilTemp != null) + { + answ = DayDTO.ListRilTemp.Count > 0; } return answ; } - public void Dispose() + private bool OkVC19(DailyDataDTO DayDTO) { - UITimer?.Dispose(); + bool answ = false; + if (DayDTO != null && DayDTO.ListCheckC19 != null) + { + answ = DayDTO.ListCheckC19.Count > 0; + } + return answ; } - #endregion Public Methods + private double oreLav(DailyDataDTO DayDTO) + { + double answ = 0; + if (DayDTO != null && DayDTO.TimbrExpl != null && DayDTO.TimbrExpl.HLav != null) + { + answ = (double)DayDTO.TimbrExpl.HLav; + if (DayDTO.DtRif == DateTime.Today) + { + if (DayDTO.ListTimbr != null) + { + // 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... + if (lastIn != null) + { + if (lastOut == null || lastOut.DataOra < lastIn.DataOra) + { + DateTime adesso = DateTime.Now; + answ += adesso.Subtract(lastIn.DataOra).TotalHours; + } + } + } + } + } + return answ; + } + + private async Task ReloadData() + { + isLoading = true; + UITimer.Stop(); + if (weekStatList != null) + { + ListRecords = await DataService.DailyDetails(IdxDipendente, weekStatList.First().Inizio, weekStatList.Last().Fine); + } + await Task.Delay(100); + lastRefresh = DateTime.Now; + UITimer.Start(); + isLoading = false; + } + + private decimal tempRil(DailyDataDTO DayDTO) + { + decimal answ = 0; + if (OkTemp(DayDTO) && DayDTO != null) + { + if (DayDTO.ListRilTemp != null) + { + answ = DayDTO.ListRilTemp[0].TempRil; + } + } + return answ; + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index ffb5227..bf88226 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 3.0.2210.0311

+

Versione: 3.0.2210.1416


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 6895565..a69629a 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -3.0.2210.0311 +3.0.2210.1416 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 86021fb..4187af3 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 3.0.2210.0311 + 3.0.2210.1416 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false