Fix display vert + editing progetti

This commit is contained in:
Samuele Locatelli
2023-06-29 16:35:18 +02:00
parent 1dd4b4ae30
commit 7d9d3ccbef
14 changed files with 374 additions and 64 deletions
+8 -4
View File
@@ -36,6 +36,7 @@ namespace GPW.CORE.Data.DTO
// calcolo totali x progetto...
int idxProj = 0;
string gruppo = "";
string cliente = "";
string nomeProj = "";
string descProj = "";
decimal durItem = 0;
@@ -43,12 +44,13 @@ namespace GPW.CORE.Data.DTO
{
idxProj = recRA.FasiNav.ProgettoNav.IdxProgetto;
gruppo = recRA.FasiNav.ProgettoNav.Gruppo;
cliente = recRA.FasiNav.ProgettoNav.ClienteNav?.RagSociale ?? $"{recRA.FasiNav.ProgettoNav.IdxCliente}";
nomeProj = recRA.FasiNav.ProgettoNav.NomeProj;
descProj = recRA.FasiNav.ProgettoNav.DescrProj;
durItem = recRA.OreTot ?? 0;
// cerco proj...
var currProj = ProjTotal.FirstOrDefault(x => x.idxProj == idxProj);
if (currProj!=null)
if (currProj != null)
{
currProj.TotOre += durItem;
}
@@ -58,9 +60,10 @@ namespace GPW.CORE.Data.DTO
{
NomeProj = nomeProj,
TotOre = durItem,
idxProj=idxProj,
DescProj=descProj,
Gruppo =gruppo
idxProj = idxProj,
DescProj = descProj,
Gruppo = gruppo,
Cliente = cliente
};
ProjTotal.Add(newProj);
}
@@ -168,6 +171,7 @@ namespace GPW.CORE.Data.DTO
public int idxProj { get; set; } = 0;
public string Gruppo { get; set; } = "";
public string Cliente { get; set; } = "";
public string NomeProj { get; set; } = "";
public string DescProj { get; set; } = "";
public decimal TotOre { get; set; } = 0;
+4
View File
@@ -7,6 +7,10 @@
<div class="py-0 my-1 small flex-fill ">
<div class="d-flex shadow">
<button @onclick="() => Edit()" class="px-1 text-center border border-secondary border-top-0 border-bottom-0 border-left-0 btn btn-warning bg-opacity-25 btn-sm py-1 me-2" style="font-size: 1.1rem; width: 10em;" title="Edit">
@if(ShowDate)
{
<div class="badge bg-primary w-100">@CurrData.Inizio.ToString("yyyy/MM/dd")</div>
}
<div>@CurrData.Inizio.ToString("HH:mm") - @CurrData.Fine.ToString("HH:mm")</div>
<div class="badge bg-dark p-1 w-100" style="font-size: 1.1rem;">@($"{@CurrData.Durata.Hours}h {@CurrData.Durata.Minutes:00}'")</div>
</button>
@@ -29,6 +29,9 @@ namespace GPW.CORE.WRKLOG.Components
[Parameter]
public double Periodo { get; set; } = 1;
[Parameter]
public bool ShowDate { get; set; } = false;
#endregion Public Properties
#region Protected Fields
+13 -6
View File
@@ -27,10 +27,10 @@
<div class="fw-bold">@($"{CurrData.OreComm:N2}")</div>
</div>
</div>
<div class="row mt-2 mb-5" style="min-height: 30rem;">
<div class="row my-2" style="min-height: 30rem;">
@if (ShowVert)
{
<div class="col-6">
<div class="col-6 overflow-auto" style="min-height: 30rem; max-height: 60rem;">
<div class="card shadow">
<div class="card-header">
Progetti
@@ -38,9 +38,9 @@
<ul class="list-group list-group-flush">
@foreach (var item in paretoDetail)
{
<li class="list-group-item">
<li class="list-group-item @checkCss(item.idxProj)" @onclick="() => selectProj(item.idxProj)">
<div class="d-flex justifi-content-between">
<div class="px-2">@item.NomeProj</div>
<div class="px-2">@item.Cliente | @item.NomeProj</div>
<div class="px-2">@($"{item.TotOre:N1}")</div>
</div>
<div class="progress">
@@ -52,8 +52,15 @@
</ul>
</div>
</div>
<div class="col-6">
dettaglio
<div class="col-6 overflow-auto" style="min-height: 30rem; max-height: 60rem;">
@if (selProj != 0)
{
<ProjAgendaDetail ListRA="@selRA" CloseReq="ResetDayAgenda" ItemSelected="ReportSelect" ItemCloned="ReportSelect" ItemDeleted="() => ReportDeleted()" MaxChar="60"></ProjAgendaDetail>
}
@if (currRecord != null)
{
<RegAttEditor currRecord="@currRecord" ItemReset="UpdRegAttData" ItemUpdated="UpdRegAttData"></RegAttEditor>
}
</div>
}
else
+143 -47
View File
@@ -1,4 +1,6 @@
using GPW.CORE.Data.DbModels;
using GPW.CORE.Data.DTO;
using GPW.CORE.WRKLOG.Data;
using Microsoft.AspNetCore.Components;
using static GPW.CORE.Data.DTO.ReportDataDTO;
@@ -8,10 +10,6 @@ namespace GPW.CORE.WRKLOG.Components
{
#region Public Properties
[Parameter]
public bool ShowVert { get; set; }
[Parameter]
public ReportDataDTO? CurrData
{
@@ -20,16 +18,153 @@ namespace GPW.CORE.WRKLOG.Components
{
currData = value;
// sistemazione etichette e dati grafico..
firHist();
fixHist();
}
}
private void firHist()
[Parameter]
public EventCallback<bool> E_ReqReload { get; set; }
[Parameter]
public bool ShowVert { get; set; }
#endregion Public Properties
#region Protected Fields
protected decimal maxVal = 1;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
protected RegAttivitaModel? clonedRA
{
get
{
return AppMServ.clonedRA;
}
set
{
AppMServ.clonedRA = value;
}
}
[Inject]
protected GpwDataService DataService { get; set; } = null!;
protected string[]? histData { get; set; } = null;
protected string[]? histLabel { get; set; } = null;
protected int numDays
{
get => (CurrData != null) ? CurrData.TimbrExpl.Count : 0;
}
protected int numProj
{
get => (CurrData != null) ? CurrData.ProjTotal.Count : 0;
}
protected int numRA
{
get => (CurrData != null) ? CurrData.ListRA.Count : 0;
}
protected List<ProjData>? paretoDetail { get; set; } = null;
protected int selProj { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected string progrWidth(decimal itemVal)
{
return $"{itemVal / maxVal:P1}".Replace(",", ".");
}
protected async Task ReportDeleted()
{
selProj = 0;
await Task.Delay(1);
}
/// <summary>
/// Indico item selezionato
/// </summary>
protected void ReportSelect(RegAttivitaModel selRecord)
{
// recupero attivita selezionata in curr record
currRecord = selRecord;
}
protected void ResetClone()
{
clonedRA = null;
}
protected async Task ResetDayAgenda()
{
selProj = 0;
await Task.Delay(1);
}
protected async Task selectProj(int idxProj)
{
await Task.Delay(1);
selProj = idxProj;
if (currData.ListRA != null)
{
selRA = currData.ListRA
.Where(x => x.FasiNav.IdxProgetto == idxProj)
.OrderByDescending(x => x.Inizio)
.ToList();
}
}
protected string checkCss(int idxProj)
{
return selProj == idxProj ? "bg-dark text-light" : "";
}
protected async Task UpdRegAttData()
{
currRecord = null;
// resetto tutte le cache report
await DataService.ReportResetCacheDip(0);
// evento x reload...
await E_ReqReload.InvokeAsync(true);
}
#endregion Protected Methods
#region Private Fields
private RegAttivitaModel? currRecord = null;
#endregion Private Fields
#region Private Properties
private ReportDataDTO? currData { get; set; }
private List<RegAttivitaModel>? selRA { get; set; } = null;
#endregion Private Properties
#region Private Methods
private void fixHist()
{
// prendo i dati progetti ordinati...
if (currData != null && currData.ProjTotal != null)
{
var pareto = currData.ProjTotal.OrderByDescending(x => x.TotOre).ToDictionary(x => x.NomeProj, x => $"{x.TotOre:N1}".Replace(",", "."));
var pareto = currData.ProjTotal.OrderByDescending(x => x.TotOre).ToDictionary(x => x.Cliente + "|" + x.NomeProj, x => $"{x.TotOre:N1}".Replace(",", "."));
// costruisco elenco valori
histData = pareto.Values.ToArray();
// elenco labels
@@ -40,45 +175,6 @@ namespace GPW.CORE.WRKLOG.Components
}
}
#endregion Public Properties
#region Protected Properties
protected int numDays
{
get => (CurrData != null) ? CurrData.TimbrExpl.Count : 0;
}
protected int numRA
{
get => (CurrData != null) ? CurrData.ListRA.Count : 0;
}
protected int numProj
{
get => (CurrData != null) ? CurrData.ProjTotal.Count : 0;
}
#endregion Protected Properties
#region Private Properties
private ReportDataDTO? currData { get; set; }
protected string[]? histData { get; set; } = null;
protected string[]? histLabel { get; set; } = null;
protected decimal maxVal = 1;
protected List<ProjData>? paretoDetail { get; set; } = null;
protected string progrWidth(decimal itemVal)
{
return $"{itemVal / maxVal:P1}".Replace(",", ".");
}
#endregion Private Properties
#endregion Private Methods
}
}
@@ -0,0 +1,39 @@
@using CORE.Data.DbModels
@using WRKLOG.Data
@inject IJSRuntime JSRuntime
@inject GpwDataService GDataServ
@inject MessageService AppMServ
<div class="card">
<div class="card-header bg-dark text-light py-1">
<div class="row">
<div class="col-9">
<h4>Project Activity Detail</h4>
</div>
<div class="col-3 py-1">
<button type="button" class="btn w-100 btn-warning py-1" @onclick="DoClose"><i class="fas fa-times"></i> Chiudi</button>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
@if (ListRA != null)
{
foreach (var item in ListRA)
{
<div class="col-12 p-0 @getItemCss(item)">
<DettAtt CurrData="item" Periodo="@(item.Durata.TotalHours)" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemSelected="ReportSelected" ItemDeleted="() => ReportDeleted()" MaxChar="@MaxChar" ShowDate="true"></DettAtt>
</div>
}
@if (clonedRA != null)
{
<AddRA NewItemCreated="ReportSelected" InizioPer="@LastTimb" IdxDip="@IdxDipSel" EnableAction="true"></AddRA>
}
}
</div>
</div>
</div>
@@ -0,0 +1,127 @@
using GPW.CORE.Data.DbModels;
using Microsoft.AspNetCore.Components;
namespace GPW.CORE.WRKLOG.Components
{
public partial class ProjAgendaDetail
{
#region Public Properties
[Parameter]
public EventCallback<bool> CloseReq { get; set; }
[Parameter]
public int IdxDipSel { get; set; } = 0;
[Parameter]
public EventCallback<RegAttivitaModel> ItemCloned { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemDeleted { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
[Parameter]
public List<AnagFasiModel> ListFasi { get; set; } = null!;
[Parameter]
public List<RegAttivitaModel>? ListRA { get; set; }
[Parameter]
public int MaxChar { get; set; } = 100;
#endregion Public Properties
#region Protected Properties
protected RegAttivitaModel? currRecord { get; set; } = null;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void DoClose()
{
currRecord = null;
await CloseReq.InvokeAsync(true);
}
protected string getItemCss(RegAttivitaModel itemRecord)
{
string answ = "";
if (currRecord != null)
{
if (itemRecord.Equals(currRecord))
{
answ = "bg-info bg-opacity-25";
}
}
return answ;
}
protected override Task OnParametersSetAsync()
{
if (ListRA != null)
{
// sistemo la prima timbratura
if (ListRA.Count > 0)
{
var lastRec = 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>
protected async void ReportDeleted()
{
await ItemDeleted.InvokeAsync(null);
}
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void ReportSelected(RegAttivitaModel selRecord)
{
currRecord = selRecord;
await ItemSelected.InvokeAsync(selRecord);
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// record prima timbratura utile
/// </summary>
private DateTime LastTimb = DateTime.Now;
#endregion Private Fields
#region Private Properties
private RegAttivitaModel? clonedRA
{
get
{
return AppMServ.clonedRA;
}
set
{
AppMServ.clonedRA = value;
}
}
#endregion Private Properties
}
}
+17
View File
@@ -1300,6 +1300,23 @@ namespace GPW.CORE.WRKLOG.Data
return dbResult;
}
/// <summary>
/// Reset dati report x dipendente, se 0 = tutti
/// </summary>
/// <param name="idxDipendente"></param>
/// <returns></returns>
public async Task ReportResetCacheDip(int idxDipendente)
{
if (idxDipendente == 0)
{
await ExecFlushRedisPattern($"{rKeyReportData}:*");
}
else
{
await ExecFlushRedisPattern($"{rKeyReportData}:{idxDipendente}:*");
}
}
/// <summary>
/// Recupera l'elenco dei Rilievi temperatura nel periodo indicato x dipendente
/// </summary>
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2306.2912</Version>
<Version>3.0.2306.2916</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+1 -1
View File
@@ -20,7 +20,7 @@
}
else
{
<MyRepStats CurrData="@userReportData" ShowVert="@showVert"></MyRepStats>
<MyRepStats CurrData="@userReportData" ShowVert="@showVert" E_ReqReload="ForceReload"></MyRepStats>
}
</div>
</div>
+15 -2
View File
@@ -44,6 +44,15 @@ namespace GPW.CORE.WRKLOG.Pages
}
}
private async Task ForceReload(bool doReload)
{
await Task.Delay(1);
if (doReload)
{
await ReloadData();
}
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
@@ -52,11 +61,15 @@ namespace GPW.CORE.WRKLOG.Pages
private async Task ReloadData()
{
isLoading = true;
userReportData = null;
//userReportData = null;
await Task.Delay(1);
if (IdxDipendente > 0)
{
userReportData = await DataService.ReportDetails(IdxDipendente, periodo);
var rawData = await DataService.ReportDetails(IdxDipendente, periodo);
if (rawData != null)
{
userReportData = rawData;
}
}
isLoading = false;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2306.2912</h4>
<h4>Versione: 3.0.2306.2916</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2306.2912
3.0.2306.2916
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2306.2912</version>
<version>3.0.2306.2916</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>