Aggiunto metodi e premesse x gestione timbrature in linea con agenda..

This commit is contained in:
Samuele Locatelli
2022-01-10 12:38:43 +01:00
parent 0ab75b7731
commit ed233351f1
11 changed files with 203 additions and 16 deletions
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GPW.CORE.Data.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class PeriodoDTO
{
public DateTime Inizio { get; set; }
public DateTime Fine { get; set; }
public TipoPeriodo Tipo { get; set; } = TipoPeriodo.ND;
public decimal? OreTot { get; set; }
public TimeSpan Durata
{
get
{
TimeSpan valore = TimeSpan.FromHours(0);
if (OreTot != null)
{
try
{
valore = TimeSpan.FromHours((double)OreTot);
}
catch (Exception exc)
{ }
}
return valore;
}
}
}
}
@@ -20,6 +20,8 @@ namespace GPW.CORE.Data.DbModels
/// </summary>
public bool? Approv { get; set; }
/// <summary>
/// Navigation property to Dipendente
/// </summary>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GPW.CORE.Data
{
public enum TipoPeriodo
{
ND = 0,
Lavoro = 1
}
}
+22 -11
View File
@@ -13,18 +13,29 @@
}
</div>
<div class="p-1 flex-fill text-left">
<div class="d-flex justify-content-between text-center">
@if (IsTitle)
{
@if (IsTitle)
{
<div class="d-flex justify-content-between text-center">
@for (int i = StartHour; i <= EndHour; i++)
{
<div class="px-1 py-0">
<div class="px-1 py-0" style="font-size: 1.3em;">
<b>@i.ToString("00")</b>
</div>
}
}
else
{
</div>
}
else
{
<div class="d-flex justify-content-between text-center">
@if (@DayDTO != null && @DayDTO.ListTimbr != null)
{
@foreach (var item in ListTimb())
{
<PeriodoLav CurrPeriodo="item"></PeriodoLav>
}
}
</div>
<div class="d-flex justify-content-between text-center">
@if (@noData)
{
<AddRA NewItemCreated="ReportSelected" InizioPer="@DayDTO.DtRif.AddHours(StartHour)" IdxDip="@IdxDipSel"></AddRA>
@@ -36,14 +47,14 @@
<RegAtt CurrData="item" Periodo="periodo" ListFasi="@ListFasi" IdxDipSel="@IdxDipSel" ItemCloned="ReportCloned" ItemSelected="ReportSelected" ItemUpdated="ReportUpdated"></RegAtt>
}
}
}
</div>
</div>
}
</div>
<div class="py-2 px-1 text-right" style="width: 5.0rem;">
@if (IsTitle)
{
<div><b>Timb</b> <i class="far fa-calendar-alt"></i></div>
<div><b>Lavo</b> <i class="far fa-hourglass"></i></div>
<div class="small"><b>Timb</b> <i class="far fa-calendar-alt"></i></div>
<div class="small"><b>Lavo</b> <i class="far fa-hourglass"></i></div>
}
else
{
+74
View File
@@ -127,6 +127,80 @@ namespace GPW.CORE.UI.Components
get => OkVC19 ? "text-success" : "text-secondary";
}
private List<PeriodoDTO> ListTimb()
{
// init
List<PeriodoDTO> result = new List<PeriodoDTO>();
if (DayDTO != null)
{
// limiti estremi visualizzazione
DateTime currHour = DayDTO.DtRif.AddHours(StartHour);
DateTime lastHour = DayDTO.DtRif.AddHours(EndHour);
int idxTimb = 0;
if (DayDTO.ListTimbr != null)
{
// divido tra ingressi e uscite
var timbIN = DayDTO.ListTimbr.Where(x => x.Entrata == true).ToList();
var timbOUT = DayDTO.ListTimbr.Where(x => x.Entrata == false).ToList();
DateTime fineLav = currHour;
// ciclo partendo dal primo evento timbratura IN ed aggiungendo eventuali periodi in testa / coda / intermedi
foreach (var item in timbIN)
{
// se evento > ora corrente --> aggiungo vuoto...
if (item.DataOra > currHour)
{
PeriodoDTO emptyPeriod = new PeriodoDTO()
{
Inizio = currHour,
Fine=item.DataOra,
Tipo = CORE.Data.TipoPeriodo.ND,
OreTot = (decimal)item.DataOra.Subtract(currHour).TotalHours
};
result.Add(emptyPeriod);
}
// ...processo cercando uscita relativa oppure NOW
if (timbOUT.Count > idxTimb)
{
fineLav = timbOUT[idxTimb].DataOra;
}
else
{
DateTime adesso = DateTime.Now;
int minRound = ((int)Math.Floor((double)adesso.Minute / 5)) * 5;
fineLav = DateTime.Today.AddHours(adesso.Hour).AddMinutes(minRound);
}
PeriodoDTO workPeriod = new PeriodoDTO()
{
Inizio = item.DataOra,
Fine=fineLav,
Tipo = CORE.Data.TipoPeriodo.Lavoro,
OreTot = (decimal)fineLav.Subtract(item.DataOra).TotalHours
};
result.Add(workPeriod);
idxTimb++;
currHour = fineLav;
}
// se non sono in fondo --> aggiungo!
if (currHour < lastHour)
{
PeriodoDTO emptyPeriod = new PeriodoDTO()
{
Inizio = currHour,
Fine = lastHour,
Tipo = CORE.Data.TipoPeriodo.ND,
OreTot = (decimal)lastHour.Subtract(currHour).TotalHours
};
result.Add(emptyPeriod);
}
}
}
return result;
}
private List<CORE.Data.DbModels.RegAttivitaModel> ListRegAtt()
{
// init
+15
View File
@@ -0,0 +1,15 @@
@using CORE.Data.DbModels
@using CORE.Data.DTO
@using UI.Data
@inject GpwDataService GDataServ
@inject MessageService AppMServ
@inject IJSRuntime JSRuntime
<div class="small">@CurrPeriodo.Inizio.ToString("HH:mm")</div>
@code {
[Parameter]
public PeriodoDTO CurrPeriodo { get; set; } = null!;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2201.0518</Version>
<Version>3.0.2201.1012</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+34 -1
View File
@@ -154,7 +154,7 @@
<div>45</div>
<div class="badge badge-dark">30'</div>
</button>
<div class="dropdown-content border border-dark table-dark text-light rounded p-2" style="z-index:100;">
<div class="dropdown-content border border-dark table-dark text-light rounded p-2">
<div class="row">
<div class="col-9 pr-0">
<div class="text-light text-left"><b>Steamware</b> - <span class="small">ORG Personale</span></div>
@@ -281,6 +281,39 @@
</div>
</div>
<style>
.containerTest {
width: 100%;
height: 6rem;
position: relative;
margin: 0px;
}
.box {
height: 100%;
position: absolute;
top: 0;
left: 0;
opacity: 1;
}
.overlay {
z-index: 5;
}
.overlay:hover {
z-index: +100;
opacity: 1;
}
</style>
<div class="containerTest table-secondary">
<div class="box bg-primary overlay" style="width: 35%;">Testo 1</div>
<div class="box bg-secondary overlay" style="width: 25%; left: 20%; top: 10%;">Testo 2</div>
<div class="box bg-primary overlay" style="width: 20%; left: 40%; top: 0%;">Testo 3</div>
<div class="box bg-secondary overlay" style="width: 25%; left: 55%; top: 10%;">Testo 4</div>
</div>
@*<div class="card">
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2201.0518</h4>
<h4>Versione: 3.0.2201.1012</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2201.0518
3.0.2201.1012
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2201.0518</version>
<version>3.0.2201.1012</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>