Merge branch 'release/AddTaskFromListPage'

This commit is contained in:
Samuele Locatelli
2022-10-14 16:48:08 +02:00
11 changed files with 331 additions and 249 deletions
@@ -23,9 +23,14 @@
foreach (var item in DayDTO.ListRA)
{
<div class="col-12 p-0 @getItemCss(item)">
<DettAtt CurrData="item" Periodo="@(item.Durata.TotalHours)" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemSelected="ReportSelected" MaxChar="@MaxChar"></DettAtt>
<DettAtt CurrData="item" Periodo="@(item.Durata.TotalHours)" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemSelected="ReportSelected" ItemDeleted="() => ReportDeleted()" MaxChar="@MaxChar"></DettAtt>
</div>
}
@if (clonedRA != null)
{
<AddRA NewItemCreated="ReportSelected" InizioPer="@LastTimb" IdxDip="@IdxDipSel" EnableAction="true"></AddRA>
}
}
</div>
</div>
@@ -22,6 +22,8 @@ namespace GPW.CORE.WRKLOG.Components
[Parameter]
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemDeleted { get; set; }
[Parameter]
public List<AnagFasiModel> ListFasi { get; set; } = null!;
@@ -33,12 +35,34 @@ namespace GPW.CORE.WRKLOG.Components
#region Protected Properties
/// <summary>
/// record prima timbratura utile
/// </summary>
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();
}
/// <summary>
/// Indico item selezionato
/// </summary>
@@ -70,7 +94,30 @@ namespace GPW.CORE.WRKLOG.Components
await ItemSelected.InvokeAsync(selRecord);
}
/// <summary>
/// Indico item selezionato
/// </summary>
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
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ namespace GPW.CORE.WRKLOG.Components
#region Protected Fields
/// <summary>
/// record prima timbratura x
/// record prima timbratura x inserimento
/// </summary>
protected DateTime FirstTimb = DateTime.Now;
+6 -3
View File
@@ -6,17 +6,20 @@
<div class="py-0 my-1 small flex-fill @blockCss">
<div class="d-flex">
<button @onclick="() => Edit()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-primary btn-sm py-1" style="font-size: 1.1rem; width: 10em;">
<button @onclick="() => Edit()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-info btn-sm py-1" style="font-size: 1.1rem; width: 10em;" title="Edit">
<div>@CurrData.Inizio.ToString("HH:mm") - @CurrData.Fine.ToString("HH:mm")</div>
<div class="badge badge-dark p-1 w-100" style="font-size: 1.1rem;">@($"{@CurrData.Durata.Hours}h {@CurrData.Durata.Minutes:00}'")</div>
</button>
<button @onclick="() => Clone()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-primary btn-sm py-1" style="font-size: 1.4rem; width:3.4em;" title="Copy">
<i class="fas fa-paste"></i>
</button>
<div class="px-2 py-0 text-left textTrim flex-fill" style="font-size: 1.1rem;">
<div class="text-dark textTrim @cssTrim" title="@CurrData.FasiNav?.ProgettoNav?.ClienteNav?.RagSociale - @CurrData.FasiNav?.ProgettoNav?.NomeProj"><b>@(trimLine($"{CurrData.FasiNav?.ProgettoNav?.ClienteNav?.RagSociale}",MaxChar))</b> - @(trimLine($"{CurrData.FasiNav?.ProgettoNav?.NomeProj}",MaxChar))</div>
<div class="text-secondary textTrim @cssTrim" title="@CurrData.FasiNav?.DescrizioneFase">@(trimLine($"{CurrData.FasiNav?.DescrizioneFase}",100))</div>
<div class="text-trim @cssTrim" title="@CurrData.Descrizione">@(trimLine($"{CurrData.Descrizione}",MaxChar))</div>
</div>
<button @onclick="() => Clone()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-dark btn-sm py-1" style="font-size: 1.4rem; width:3.4em;">
<i class="fas fa-paste"></i>
<button @onclick="() => Delete()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-danger btn-sm py-1" style="font-size: 1.4rem; width:3.4em;">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
+20 -1
View File
@@ -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<RegAttivitaModel> ItemDeleted { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
@@ -70,7 +74,7 @@ namespace GPW.CORE.WRKLOG.Components
#region Protected Methods
/// <summary>
/// Indico item selezionato
/// Clono item selezionato
/// </summary>
protected async void Clone()
{
@@ -80,6 +84,21 @@ namespace GPW.CORE.WRKLOG.Components
await ItemSelected.InvokeAsync(null);
}
/// <summary>
/// Elimino item selezionato
/// </summary>
protected async void Delete()
{
// chiedo verifica
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record selezionato??"))
return;
// aggiorno
await GDataServ.RegAttDelete(CurrData);
// registro fatto
await ItemDeleted.InvokeAsync(null);
}
/// <summary>
/// Indico item selezionato
/// </summary>
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2210.0311</Version>
<Version>3.0.2210.1416</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+1 -1
View File
@@ -104,7 +104,7 @@
}
@if (showDay)
{
<DayAgendaDetail DayDTO="@SelDayDTO" CloseReq="ResetDayAgenda" ItemSelected="ReportSelect" ItemCloned="ReportSelect" MaxChar="60"></DayAgendaDetail>
<DayAgendaDetail DayDTO="@SelDayDTO" CloseReq="ResetDayAgenda" ItemSelected="ReportSelect" ItemCloned="ReportSelect" ItemDeleted="() => ReportDeleted()" MaxChar="60"></DayAgendaDetail>
}
@if (showTemp)
{
+246 -238
View File
@@ -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<AnagFasiModel> ListFasi = new List<AnagFasiModel>();
private List<DailyDataDTO>? ListRecords = null;
private List<TimbratureModel>? ListTimbr = null;
private DailyDataDTO? SelDayDTO = null;
private bool selPeriod = false;
private bool showDay = false;
private bool showTemp = false;
private bool showTimb = false;
private List<WeekStatDTO>? 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
/// <summary>
/// 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/
/// </summary>
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}'";
}
/// <summary>
/// Reinit dei dati
/// </summary>
/// <param name="dateReset"></param>
/// <returns></returns>
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<AnagFasiModel> ListFasi = new List<AnagFasiModel>();
private List<DailyDataDTO>? ListRecords = null;
private List<TimbratureModel>? ListTimbr = null;
private DailyDataDTO? SelDayDTO = null;
private bool selPeriod = false;
private bool showDay = false;
private bool showTemp = false;
private bool showTimb = false;
private List<WeekStatDTO>? 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}'";
}
/// <summary>
/// Reinit dei dati
/// </summary>
/// <param name="dateReset"></param>
/// <returns></returns>
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
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2210.0311</h4>
<h4>Versione: 3.0.2210.1416</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2210.0311
3.0.2210.1416
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2210.0311</version>
<version>3.0.2210.1416</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>