Merge branch 'release/TryFixCalWrkLog_05'

This commit is contained in:
Samuele Locatelli
2025-06-10 06:59:48 +02:00
21 changed files with 354 additions and 416 deletions
@@ -52,7 +52,7 @@ namespace GPW.CORE.ADM.Components.Compo
// arrotondo ingresso/uscita ai 5 minuti secondo sia entrata o uscita...
var dtTimb = Utils.DateRounded(selItem.DataOra, 5, !(selItem.Entrata ?? false));
selItem.DataOra = dtTimb;
}
}
// indico approvato
selItem.Approv = true;
// salvo!
@@ -178,7 +178,7 @@ namespace GPW.CORE.ADM.Components.Compo
{
SearchRecords = null;
await Task.Delay(1);
SearchRecords = await GDataServ.CalFestFeriePeriodo(DtStart, DtEnd);
SearchRecords = GDataServ.CalFestFeriePeriodo(DtStart, DtEnd);
// conteggio!
totalCount = SearchRecords.Count;
// paginazione
@@ -17,15 +17,15 @@
</div>
<div class="col-4 text-end">
<div class="d-flex justify-content-around">
@if (currView == "year" || currView == "planner")
@* @if (currView == "year" || currView == "planner")
{
<div class="small">
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem" class="rz-px-2">
<RadzenLabel Text="Mese:" />
<RadzenDropDown @bind-Value="@startMonth" Change="StartMonthChange" TextProperty="Text" ValueProperty="Value" Data="@(Enum.GetValues(typeof(Month)).Cast<Month>().Where(x => ((int)x % 3 == 0)).Select(t => new { Text = $"{t}", Value = t }))" class="rz-display-inline-flex small" />
<RadzenDropDown @bind-Value="@StartMonth" Change="StartMonthChange" TextProperty="Text" ValueProperty="Value" Data="@(Enum.GetValues(typeof(Month)).Cast<Month>().Where(x => ((int)x % 3 == 0)).Select(t => new { Text = $"{t}", Value = t }))" class="rz-display-inline-flex small" />
</RadzenStack>
</div>
}
} *@
</div>
</div>
</div>
@@ -53,9 +53,8 @@
<RadzenDayView />
<RadzenWeekView />
<RadzenMonthView MaxAppointmentsInSlot="4" />
<RadzenYearPlannerView StartMonth="@startMonth" MaxAppointmentsInSlot="3" />
@* <RadzenYearTimelineView StartMonth="@startMonth" /> *@
<RadzenYearView StartMonth="@startMonth" />
<RadzenYearPlannerView StartMonth="Month.January" MaxAppointmentsInSlot="3" />
<RadzenYearView StartMonth="Month.January" />
</ChildContent>
</RadzenScheduler>
</div>
@@ -1,13 +1,14 @@
using GPW.CORE.Data.DTO;
using Microsoft.AspNetCore.Components;
using Microsoft.Identity.Client;
using Radzen.Blazor.Rendering;
using Radzen.Blazor;
using static EgwCoreLib.Razor.Toggler;
using NLog;
using Radzen;
using Radzen.Blazor;
using Radzen.Blazor.Rendering;
using System;
using static System.Runtime.InteropServices.JavaScript.JSType;
using GPW.CORE.Data.DTO;
using System.Diagnostics;
using static EgwCoreLib.Razor.Toggler;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace GPW.CORE.ADM.Components.Compo
{
@@ -24,9 +25,6 @@ namespace GPW.CORE.ADM.Components.Compo
[Parameter]
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
[Parameter]
public bool ShowNeedConf { get; set; } = false;
[Parameter]
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
@@ -43,6 +41,9 @@ namespace GPW.CORE.ADM.Components.Compo
[Parameter]
public EventCallback<int> MonthReq { get; set; }
[Parameter]
public bool ShowNeedConf { get; set; } = false;
#endregion Public Properties
#region Protected Fields
@@ -82,6 +83,19 @@ namespace GPW.CORE.ADM.Components.Compo
[Inject]
protected DialogService DialogService { get; set; } = null!;
protected Month StartMonth
{
get => _startMonth;
set
{
if (_startMonth != value)
{
_startMonth = value;
}
}
}
private Month _startMonth { get; set; } = Month.January;
#endregion Protected Properties
#region Protected Methods
@@ -101,17 +115,60 @@ namespace GPW.CORE.ADM.Components.Compo
await Task.Delay(1);
}
protected string btnSel(string bName)
{
bool answ = false;
switch (bName)
{
case "CHIU":
answ = showChiu;
break;
case "FER":
answ = showFer;
break;
case "FEST":
answ = showFest;
break;
case "MAL":
answ = showMal;
break;
case "PER":
answ = showPer;
break;
default:
break;
}
return answ ? "btn-primary" : "btn-secondary";
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
// il mese viene preimpostato sul trimestre corrente...
startMonth = (Month)((DateTime.Today.Month / 6) * 6);
#if false
// il mese viene preimpostato sul semestre corrente...
StartMonth = (Month)((DateTime.Today.Month / 6) * 6);
#endif
}
protected override void OnParametersSet()
protected override async Task OnParametersSetAsync()
{
FilterData();
scheduler.Reload();
if (EvDtoList != null && EvDtoList.Count > 0 && firstDate != new DateTime(DateTime.Today.Year, 1, 1))
{
FilterData();
try
{
await scheduler.Reload();
}
catch (Exception exc)
{
Log.Error($"eccezione durante OnParametersSet{Environment.NewLine}{exc}");
}
}
}
protected async Task StartMonthChange()
@@ -119,10 +176,41 @@ namespace GPW.CORE.ADM.Components.Compo
await scheduler.Reload();
}
protected void ToggChiu()
{
showChiu = !showChiu;
FilterData();
}
protected void ToggFer()
{
showFer = !showFer;
FilterData();
}
protected void ToggFest()
{
showFest = !showFest;
FilterData();
}
protected void ToggMal()
{
showMal = !showMal;
FilterData();
}
protected void ToggPer()
{
showPer = !showPer;
FilterData();
}
#endregion Protected Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private int selectedIndex = 2;
#endregion Private Fields
@@ -134,13 +222,20 @@ namespace GPW.CORE.ADM.Components.Compo
private List<EventDTO> EvDtoFilt { get; set; } = new List<EventDTO>();
private string schedHeight { get; set; } = "height: 50rem;";
private DateTime SelDate { get; set; } = DateTime.Today;
private Month startMonth { get; set; } = Month.January;
private bool showChiu { get; set; } = true;
private bool showFer { get; set; } = true;
private bool showFest { get; set; } = true;
private bool showMal { get; set; } = true;
private bool showPer { get; set; } = true;
#endregion Private Properties
#region Private Methods
private void FilterData()
{
// in primis copio tutto
@@ -180,69 +275,6 @@ namespace GPW.CORE.ADM.Components.Compo
.Where(x => !x.CodTipo.Equals("PERM", StringComparison.InvariantCultureIgnoreCase) && !x.CodTipo.Equals("104", StringComparison.InvariantCultureIgnoreCase))
.ToList();
}
}
private bool showChiu { get; set; } = true;
private bool showFer { get; set; } = true;
private bool showFest { get; set; } = true;
private bool showMal { get; set; } = true;
private bool showPer { get; set; } = true;
protected string btnSel(string bName)
{
bool answ = false;
switch (bName)
{
case "CHIU":
answ = showChiu;
break;
case "FER":
answ = showFer;
break;
case "FEST":
answ = showFest;
break;
case "MAL":
answ = showMal;
break;
case "PER":
answ = showPer;
break;
default:
break;
}
return answ ? "btn-primary" : "btn-secondary";
}
protected void ToggMal()
{
showMal = !showMal;
FilterData();
}
protected void ToggPer()
{
showPer = !showPer;
FilterData();
}
protected void ToggFer()
{
showFer = !showFer;
FilterData();
}
protected void ToggFest()
{
showFest = !showFest;
FilterData();
}
protected void ToggChiu()
{
showChiu = !showChiu;
FilterData();
}
private void OnAppointmentRender(SchedulerAppointmentRenderEventArgs<EventDTO> args)
@@ -262,12 +294,17 @@ namespace GPW.CORE.ADM.Components.Compo
{
await Task.Delay(1);
currView = scheduler.SelectedView.Text.ToLowerInvariant();
// controllo se sia cambiata data... di almeno 1 anno in questo caso...
if (SelDate != scheduler.Date || Math.Abs(scheduler.Date.Subtract(args.Start).TotalDays) > 365)
DateTime dtMid = args.Start.AddDays(args.End.Subtract(args.Start).TotalDays / 2);
// controllo se sia cambiata data anno precedente...
if (dtMid.Year != SelDate.Year)
{
SelDate = args.Start.AddMonths(1);
// riporto data al controller parent...
SelDate = dtMid;
await DtReq.InvokeAsync(SelDate);
}
// di almeno 1 anno in questo caso...
else if (SelDate != scheduler.Date || Math.Abs(scheduler.Date.Subtract(args.Start).TotalDays) > 365)
{
SelDate = args.Start.AddDays(4);
await DtReq.InvokeAsync(SelDate);
}
@@ -201,7 +201,7 @@ namespace GPW.CORE.ADM.Components.Compo
{
SearchRecords = null;
await Task.Delay(1);
SearchRecords = await GDataServ.RegMalattieGetByPeriod(DtStart, DtEnd);
SearchRecords = GDataServ.RegMalattieGetByPeriod(DtStart, DtEnd);
// conteggio!
totalCount = SearchRecords.Count;
// paginazione
@@ -364,7 +364,7 @@ namespace GPW.CORE.ADM.Components.Compo
await initConf();
await Task.Delay(1);
// carico richieste di TUTTI
SearchRecords = await GDataServ.RegRichiesteGetByDip(0, dtInizio, dtFine);
SearchRecords = GDataServ.RegRichiesteGetByDip(0, dtInizio, dtFine);
// filtro x tipo richieste...
if (ShowNeedConf)
{
@@ -322,7 +322,7 @@ namespace GPW.CORE.ADM.Components.Compo
{
foreach (var item in list2fix)
{
// escludo date da oggi in poi...
// escludo date da DateRif in poi...
if (item.DataLav < DateTime.Today)
{
GiustificativiModel rec2del = new GiustificativiModel()
@@ -162,7 +162,8 @@ namespace GPW.CORE.ADM.Components.Pages
{
isLoading = true;
// recupero direttamente da oggetto DB
SchedEvList = await DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
SchedEvList = DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
await Task.Delay(1);
isLoading = false;
}
@@ -88,7 +88,8 @@ namespace GPW.CORE.ADM.Components.Pages
{
isLoading = true;
// recupero direttamente da oggetto DB
SchedEvList = await DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
SchedEvList = DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
await Task.Delay(1);
isLoading = false;
}
@@ -22,7 +22,14 @@
}
</div>
<div class="col-8 ps-0">
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate" ShowNeedConf="@OnlyNeedConf"></CalendarioAziendale>
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate" ShowNeedConf="@OnlyNeedConf"></CalendarioAziendale>
}
</div>
</div>
</div>
@@ -48,13 +48,19 @@ namespace GPW.CORE.ADM.Components.Pages
int.TryParse(monthConf.valore, out intVal);
numMesi = intVal > 0 ? intVal : numMesi;
}
DateRif = DateTime.Today;
dtMin = new DateTime(DateRif.Year, 1, 1);
dtMax = dtMin.AddYears(1);
#if false
// fix iniziale date... setup periodo (da rivedere in funzione eventi cambio mese dei controlli?!?)
DateTime oggi = DateTime.Today;
dtMin = new DateTime(oggi.Year - 1, 1, 1);
dtMax = dtMin.AddYears(3);
await ReloadData();
dtMin = new DateTime(DateRif.Year - 1, 1, 1);
dtMax = dtMin.AddYears(3);
#endif
ReloadData();
}
private DateTime DateRif = DateTime.Today;
#endregion Protected Methods
#region Private Fields
@@ -91,9 +97,9 @@ namespace GPW.CORE.ADM.Components.Pages
await Task.Delay(1);
}
private async Task ForceReloadCal()
private void ForceReloadCal()
{
await ReloadData();
ReloadData();
}
private void initToggler()
@@ -106,19 +112,24 @@ namespace GPW.CORE.ADM.Components.Pages
};
}
private async Task ReloadData()
private void ReloadData()
{
isLoading = true;
// recupero direttamente da oggetto DB
SchedEvList = await DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
SchedEvList = DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
isLoading = false;
}
private async Task SetDate(DateTime newDate)
private void SetDate(DateTime newDate)
{
// se la data fosse esterna all'intervallo considerato...)
if (newDate < dtMin || newDate > dtMax)
{
DateRif = newDate;
// ricalcolo periodo
dtMin = new DateTime(DateRif.Year, 1, 1);
dtMax = dtMin.AddYears(1);
#if false
// verifico se "allargare" alla minima o alla massima
if (newDate < dtMin)
{
@@ -127,18 +138,19 @@ namespace GPW.CORE.ADM.Components.Pages
else
{
dtMax = new DateTime(newDate.Year + 1, 1, 1);
}
await ReloadData();
}
#endif
ReloadData();
}
}
private async Task SetMonth(int newNum)
private void SetMonth(int newNum)
{
if (numMesi != newNum)
{
numMesi = newNum;
}
await ReloadData();
ReloadData();
}
#endregion Private Methods
+5 -5
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2502.0418</Version>
<Version>4.1.2506.1006</Version>
</PropertyGroup>
<ItemGroup>
@@ -33,14 +33,14 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Blazored.FluentValidation" Version="2.2.0" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2501.1716" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2501.1716" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2504.907" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2504.907" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="8.0.8" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
<PackageReference Include="Radzen.Blazor" Version="5.9.7" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
<PackageReference Include="Radzen.Blazor" Version="7.0.8" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>
<ItemGroup>
+2 -1
View File
@@ -4,5 +4,6 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
},
"DetailedErrors": true
}
+1
View File
@@ -5,6 +5,7 @@
"Microsoft.AspNetCore": "Warning"
}
},
"DetailedErrors": true,
"NLog": {
"variables": {
"baseFileDir": "${basedir}/logs/",
+5 -9
View File
@@ -1842,7 +1842,6 @@ namespace GPW.CORE.Data.Services
}
else
{
#if true
// recupero le fermate aziendali
var ListFermateAzienda = CalFestFeriePeriodo(dtStart, dtEnd);
if (ListFermateAzienda.Count > 0)
@@ -1864,10 +1863,8 @@ namespace GPW.CORE.Data.Services
Tooltip = $"{x.codGiust} | {x.descrizione}",
}).ToList();
SchedEvList.AddRange(evAzienda);
}
#endif
}
#if true
// recupero e converto le richieste dipendente...
var ListRichiesteDip = RegRichiesteGetByDip(0, dtStart, dtEnd);
if (ListRichiesteDip.Count > 0)
@@ -1876,7 +1873,7 @@ namespace GPW.CORE.Data.Services
var evDip = ListRichiesteDip.Select(x => new EventDTO
{
DtStart = x.DtStart,
DtEnd = x.NumDays > 1 ? x.DtEnd.AddHours(20) : x.DtEnd,
DtEnd = x.NumDays >= 1 ? x.DtEnd.AddHours(20) : x.DtEnd,
CodTipo = x.CodGiust,
Titolo = x.DipNav.Abbrev,
IdxDipendente = x.IdxDipendente,
@@ -1891,9 +1888,7 @@ namespace GPW.CORE.Data.Services
}).ToList();
SchedEvList.AddRange(evDip);
}
#endif
#if true
// recupero e converto le malattie...
var ListMalattie = RegMalattieGetByPeriod(dtStart, dtEnd);
if (ListMalattie.Count > 0)
@@ -1916,8 +1911,8 @@ namespace GPW.CORE.Data.Services
Tooltip = $"MAL | {x.DipNav.Abbrev} {x.DtInizio:yyyy/MM/dd} -> {x.DtInizio.AddDays(x.NumGG - 1):yyyy/MM/dd}"
}).ToList();
SchedEvList.AddRange(evDip);
}
#endif
}
rawData = JsonConvert.SerializeObject(SchedEvList, JSSettings);
redisDb.StringSet(currKey, rawData, LongCache);
}
@@ -2804,6 +2799,7 @@ namespace GPW.CORE.Data.Services
await ExecFlushRedisPattern($"{rKeyLastRegAtt}:*");
await ExecFlushRedisPattern($"{rKeyParetoRegAtt}:*");
await ExecFlushRedisPattern($"{rKeyWeekStats}:*");
await ExecFlushRedisPattern($"{rKeyEventListDip}:*");
}
catch
{ }
@@ -8,7 +8,7 @@
<Toggler SelFilter="@ToggleData" FilterChanged="evToggled"></Toggler>
</div>
<div class="col-4 text-center text-uppercase h5">
<b>Calendario Aziendale</b>
<b><button class="btn btn-small btn-outline-light py-0 px-2" @onclick="SelToday" title="Oggi"><i class="fa-solid fa-calendar-day"></i></button> Calendario Aziendale</b>
</div>
<div class="col-4 text-end">
<div class="d-flex justify-content-around">
@@ -20,72 +20,59 @@ namespace GPW.CORE.WRKLOG.Components.Compo
{
public partial class CalendarioAziendale
{
#region Public Fields
public int MoveBlock = 7;
public int NumDays = 7;
#endregion Public Fields
#region Public Properties
[Parameter]
public ParamSet CData { get; set; } = null!;
[Parameter]
public EventCallback<DateTime> DtReq { get; set; }
[Parameter]
public EventCallback<int> MonthReq { get; set; }
#endregion Public Properties
#region Public Classes
public class ParamSet
{
public List<EventDTO> EvDtoList { get; set; } = new List<EventDTO>();
public int IdxDip { get; set; } = 0;
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
public DateTime minDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
public DisplayedView ModoDisplay { get; set; } = DisplayedView.Annual;
public int MonthDispl { get; set; } = 3;
#region Public Properties
/// <summary>
/// Tipo calendario:
/// Tipo calendario:
/// 1 - Egw
/// 2 - base
/// 3 - Radzen
/// </summary>
public int CalType { get; set; } = 1;
public List<RegRichiesteModel>? ListRecordsRichieste { get; set; }
public List<EventDTO> EvDtoList { get; set; } = new List<EventDTO>();
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
public int IdxDip { get; set; } = 0;
public List<CalFesteFerieModel>? ListFermateAzienda { get; set; }
public List<RegRichiesteModel>? ListRecordsRichieste { get; set; }
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
public DateTime minDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
public DisplayedView ModoDisplay { get; set; } = DisplayedView.Annual;
public int MonthDispl { get; set; } = 3;
#endregion Public Properties
}
#region Public Properties
[Parameter]
public ParamSet CData { get; set; } = null!;
#if false
[Parameter]
public List<EventDTO> EvDtoList { get; set; } = null!;
[Parameter]
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
[Parameter]
public int IdxDip { get; set; } = 0;
[Parameter]
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
[Parameter]
public DateTime minDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
[Parameter]
public DisplayedView ModoDisplay { get; set; } = DisplayedView.Annual;
[Parameter]
public int MonthDispl
{
get => cMonth;
set => cMonth = value;
}
#endif
[Parameter]
public EventCallback<int> MonthReq { get; set; }
[Parameter]
public EventCallback<DateTime> DtReq { get; set; }
#endregion Public Properties
#endregion Public Classes
#region Protected Fields
protected List<DateTime> ListDate = new List<DateTime>();
protected RadzenScheduler<EventDTO> scheduler = null!;
#endregion Protected Fields
@@ -108,9 +95,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
protected string CalModeText
{
get => CData.ModoDisplay == DisplayedView.Annual ? "Mensile" : "Multi Mese";
#if false
get => ModoDisplay == DisplayedView.Annual ? "Mensile" : "Multi Mese";
#endif
}
protected int currMonth
@@ -121,44 +105,19 @@ namespace GPW.CORE.WRKLOG.Components.Compo
if (CData.MonthDispl != value)
{
CData.MonthDispl = value;
#if false
MonthReq.InvokeAsync(value);
#endif
}
}
#if false
get => cMonth;
set
{
if (cMonth != value)
{
cMonth = value;
MonthReq.InvokeAsync(value);
}
}
#endif
}
protected string CurrMonth
{
get => CData.ModoDisplay == DisplayedView.Monthly ? $"{CData.firstDate:MMMM}" : "Multi";
#if false
get => ModoDisplay == DisplayedView.Monthly ? $"{firstDate:MMMM}" : "Multi";
#endif
}
[Inject]
protected DialogService DialogService { get; set; } = null!;
#if false
protected bool UseRadz
{
get => CData.CalType == 3;
}
#endif
#if false
protected bool UseRadz { get; set; } = true;
#endif
protected List<CalendarEvent> EventListWeek { get; set; } = new List<CalendarEvent>();
#endregion Protected Properties
@@ -176,18 +135,29 @@ namespace GPW.CORE.WRKLOG.Components.Compo
{
CData.firstDate = CData.firstDate < CData.minDate ? CData.minDate : CData.firstDate;
}
#if false
firstDate = firstDate.AddMonths(numMesi);
// verifico limiti...
if (numMesi > 0)
{
firstDate = firstDate > maxDate ? maxDate : firstDate;
}
else
{
firstDate = firstDate < minDate ? minDate : firstDate;
}
#endif
SelDate = CData.firstDate;
ReloadWeekData();
await Task.Delay(1);
}
protected void SelToday()
{
SelDate = DateTime.Today;
CData.firstDate = SelDate;
ReloadWeekData();
}
protected async Task backToCal(bool isMode)
{
await Task.Delay(1);
}
protected async Task ChangePeriod(int numStep)
{
ListDate = new List<DateTime>();
await Task.Delay(1);
SelDate = SelDate.AddDays(MoveBlock * numStep);
ReloadWeekData();
await Task.Delay(1);
}
@@ -218,9 +188,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
protected override void OnParametersSet()
{
#if false
FilterData();
#endif
if (CData.CalType == 3)
{
FilterData();
@@ -246,24 +213,25 @@ namespace GPW.CORE.WRKLOG.Components.Compo
FixCalendar();
}
protected void SetDayDetail(DateTime selDate)
{
var tmpDays = ListDate.Where(x => x.Equals(selDate)).ToList();
var tmpEv = EventListWeek.Where(x => x.Inizio.Date.Equals(selDate)).ToList();
// salvo valori simulati
ListDate = tmpDays;
EventListWeek = tmpEv;
}
protected void SetWeek(ClickTaskParameter taskVal)
{
CData.firstDate = taskVal.Day;
CData.ModoDisplay = DisplayedView.Weekly;
#if false
firstDate = taskVal.Day;
ModoDisplay = DisplayedView.Weekly;
#endif
}
protected void SetWeek(ClickEmptyDayParameter taskVal)
{
CData.firstDate = taskVal.Day;
CData.ModoDisplay = DisplayedView.Weekly;
#if false
firstDate = taskVal.Day;
ModoDisplay = DisplayedView.Weekly;
#endif
}
protected async Task StartMonthChange()
@@ -280,33 +248,26 @@ namespace GPW.CORE.WRKLOG.Components.Compo
{
CData.firstDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
}
#if false
ModoDisplay = ModoDisplay == DisplayedView.Annual ? DisplayedView.Monthly : DisplayedView.Annual;
await Task.Delay(1);
// se annuale --> riporto firstDate
if (ModoDisplay == DisplayedView.Annual)
{
firstDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
}
#endif
}
#endregion Protected Methods
#region Private Fields
private List<CalendarEvent> CalEventList = new List<CalendarEvent>();
private Dictionary<DateTime, string> DateCFF = new Dictionary<DateTime, string>();
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
private DateTime oggi = DateTime.Today;
private int selectedIndex = 2;
#endregion Private Fields
#region Private Properties
#if false
private int cMonth { get; set; } = 3;
#endif
private string currView { get; set; } = "";
private List<EventDTO> EvDtoFilt { get; set; } = new List<EventDTO>();
private string schedHeight { get; set; } = "height: 50rem;";
private DateTime SelDate { get; set; } = DateTime.Today;
private Month startMonth { get; set; } = Month.January;// = DateTime.Today.Month <= 6 ? Month.January : Month.July;
private List<Tasks> TaskList { get; set; } = new List<Tasks>();
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
@@ -315,6 +276,77 @@ namespace GPW.CORE.WRKLOG.Components.Compo
#region Private Methods
private string CssBlockByGiust(string codGiust, int idxDip)
{
string cssSpec = "";
switch (codGiust)
{
case "PERM":
cssSpec = "blockPerm";
break;
case "104":
cssSpec = "block104";
break;
case "MAL":
cssSpec = "blockMal";
break;
case "FEST":
cssSpec = "blockFest";
break;
case "FER":
default:
cssSpec = idxDip == 0 ? "blockChius" : "blockFerie";
break;
}
return cssSpec;
}
private string CssDayByGiust(string codGiust, bool isConf)
{
string cssSpec = "";
string cssMal = "bg-dark text-light rounded-pill py-1 px-3";
string cssFerie = "bg-success text-light rounded-pill py-1 px-3";
string cssPerm = "bg-info text-light rounded-pill py-1 px-3";
string css104 = "bg-warning text-light rounded-pill py-1 px-3";
string cssReq = " opacity-50";
switch (codGiust)
{
case "PERM":
cssSpec = cssPerm;
break;
case "104":
cssSpec = css104;
break;
case "MAL":
cssSpec = cssMal;
break;
case "FER":
default:
cssSpec = cssFerie;
break;
}
// fix display confermato/non confermato
if (!isConf)
cssSpec += cssReq;
return cssSpec;
}
private void DisplayDate(DateTime dtSel)
{
SelDate = dtSel;
ReloadWeekData();
}
private async Task evToggled(SelectGlobalToggle newTogData)
{
ToggleData = newTogData;
@@ -334,10 +366,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
await Task.Delay(1);
}
private Dictionary<DateTime, string> DateCFF = new Dictionary<DateTime, string>();
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
private List<CalendarEvent> CalEventList = new List<CalendarEvent>();
private void FilterData()
{
// filtro risultati richiesti...
@@ -351,18 +379,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
.Where(x => x.IdxDipendente == CData.IdxDip || x.IdxDipendente == 0)
.ToList();
}
#if false
if (ToggleData.isActive)
{
EvDtoFilt = EvDtoList;
}
else
{
EvDtoFilt = EvDtoList
.Where(x => x.IdxDipendente == IdxDip || x.IdxDipendente == 0)
.ToList();
}
#endif
}
private void FixCalendar()
@@ -373,14 +389,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
{
CData.firstDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
}
#if false
ModoDisplay = ToggleData.isActive ? DisplayedView.Annual : DisplayedView.Monthly;
// se annuale --> riporto firstDate
if (ModoDisplay == DisplayedView.Annual)
{
firstDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
}
#endif
}
private void OnAppointmentRender(SchedulerAppointmentRenderEventArgs<EventDTO> args)
@@ -477,69 +485,14 @@ namespace GPW.CORE.WRKLOG.Components.Compo
await DtReq.InvokeAsync(SelDate);
}
private DateTime SelDate { get; set; } = DateTime.Today;
#endregion Private Methods
private async Task ReloadMonth(DateTime dtSel)
{
SelDate = dtSel;
CData.firstDate = dtSel;
#if false
dtCurr = dtSel;
MService.targetDate = dtSel;
showDetail = false;
await Task.Delay(1);
MService.ReportDateChange();
#endif
await Task.Delay(1);
//CData.firstDate = CData.firstDate.AddMonths(numMesi);
//// verifico limiti...
//if (numMesi > 0)
//{
// CData.firstDate = CData.firstDate > CData.maxDate ? CData.maxDate : CData.firstDate;
//}
//else
//{
// CData.firstDate = CData.firstDate < CData.minDate ? CData.minDate : CData.firstDate;
//}
}
private void DisplayDate(DateTime dtSel)
{
SelDate = dtSel;
ReloadWeekData();
#if false
dtCurr = dtSel;
MService.targetDate = dtSel;
MService.targetDateMancTimb = dtCurr;
showDetail = true;
// se sono in calendario --> mostro dettagli...
if (currMode == CalendarModeEnum.modoControllo.showCalendar)
{
setModeDetail();
}
updateDetail();
MService.ReportDateChange();
#endif
}
private DateTime oggi = DateTime.Today;
protected List<DateTime> ListDate = new List<DateTime>();
protected List<CalendarEvent> EventListWeek { get; set; } = new List<CalendarEvent>();
public int MoveBlock = 7;
public int NumDays = 7;
protected async Task ChangePeriod(int numStep)
{
ListDate = new List<DateTime>();
await Task.Delay(1);
SelDate = SelDate.AddDays(MoveBlock * numStep);
ReloadWeekData();
await Task.Delay(1);
}
private void ReloadWeekData()
{
ListDate = new List<DateTime>();
@@ -557,77 +510,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
EventListWeek = CalEventList.Where(x => ListDate.Contains(x.Inizio.Date)).ToList();
}
protected async Task backToCal(bool isMode)
{
await Task.Delay(1);
}
protected void SetDayDetail(DateTime selDate)
{
var tmpDays = ListDate.Where(x => x.Equals(selDate)).ToList();
var tmpEv = EventListWeek.Where(x => x.Inizio.Date.Equals(selDate)).ToList();
// salvo valori simulati
ListDate = tmpDays;
EventListWeek = tmpEv;
}
private string CssDayByGiust(string codGiust, bool isConf)
{
string cssSpec = "";
string cssMal = "bg-dark text-light rounded-pill py-1 px-3";
string cssFerie = "bg-success text-light rounded-pill py-1 px-3";
string cssPerm = "bg-info text-light rounded-pill py-1 px-3";
string css104 = "bg-warning text-light rounded-pill py-1 px-3";
string cssReq = " opacity-50";
switch (codGiust)
{
case "PERM":
cssSpec = cssPerm;
break;
case "104":
cssSpec = css104;
break;
case "MAL":
cssSpec = cssMal;
break;
case "FER":
default:
cssSpec = cssFerie;
break;
}
// fix display confermato/non confermato
if (!isConf)
cssSpec += cssReq;
return cssSpec;
}
private string CssBlockByGiust(string codGiust, int idxDip)
{
string cssSpec = "";
switch (codGiust)
{
case "PERM":
cssSpec = "blockPerm";
break;
case "104":
cssSpec = "block104";
break;
case "MAL":
cssSpec = "blockMal";
break;
case "FEST":
cssSpec = "blockFest";
break;
case "FER":
default:
cssSpec = idxDip == 0 ? "blockChius" : "blockFerie";
break;
}
return cssSpec;
}
private void SetEgwCal()
{
DateCheck = new Dictionary<DateTime, string>();
@@ -649,10 +531,13 @@ namespace GPW.CORE.WRKLOG.Components.Compo
cssSpec = item.codGiust == "FEST" ? cssFest : cssChius;
if (!DateCFF.ContainsKey(item.data))
{
#if false
if (item.data.DayOfWeek != DayOfWeek.Saturday && item.data.DayOfWeek != DayOfWeek.Sunday)
{
DateCFF.Add(item.data, cssSpec);
}
}
#endif
DateCFF.Add(item.data, cssSpec);
}
}
}
@@ -671,10 +556,13 @@ namespace GPW.CORE.WRKLOG.Components.Compo
DateTime currDay = item.DtStart.AddDays(i);
if (!DateCheck.ContainsKey(currDay))
{
#if false
if (currDay.DayOfWeek != DayOfWeek.Saturday && currDay.DayOfWeek != DayOfWeek.Sunday)
{
DateCheck.Add(currDay.Date, cssSpec);
}
}
#endif
DateCheck.Add(currDay.Date, cssSpec);
}
}
}
@@ -695,8 +583,14 @@ namespace GPW.CORE.WRKLOG.Components.Compo
{
for (int i = 0; i < NumDays; i++)
{
var dtEvInizio = item.DtStart.AddDays(i).AddHours(startEv);
var dtEvFine = item.DtStart.AddDays(i).AddHours(endEv);
DateTime currDate = item.DtStart.AddDays(i).Date;
// se c'è già un evento aziendale aggiungo una trasparenza 50%...
if(CData.ListFermateAzienda!=null && CData.ListFermateAzienda.Where(x => x.data== currDate).FirstOrDefault() !=null)
{
css += " opacity-50";
}
var dtEvInizio = currDate.AddHours(startEv);
var dtEvFine = currDate.AddHours(endEv);
var evDescr = item.CognomeNome;
// var evDescr = $"{item.DipNav.Nome.Substring(0, 1)}. {item.DipNav.Cognome}";
// 2024.08.27 cerco se esistesse già...
@@ -709,8 +603,8 @@ namespace GPW.CORE.WRKLOG.Components.Compo
CalEventList.Add(new CalendarEvent()
{
id = iCnt++,
Inizio = item.DtStart.AddDays(i).AddHours(startEv),
Fine = item.DtStart.AddDays(i).AddHours(endEv),
Inizio = currDate.AddHours(startEv),
Fine = currDate.AddHours(endEv),
Description = evDescr,
Type = item.CodTipo,
CssClass = css
@@ -742,20 +636,9 @@ namespace GPW.CORE.WRKLOG.Components.Compo
});
}
}
#if false
CalEventList = CData.EvDtoList.Select(x => new CalendarEvent()
{
id = iCnt++,
Inizio = x.DtStart.Hour > 0 ? x.DtStart : x.DtStart.AddHours(9),
Fine = x.DtEnd.Hour > 0 ? x.DtEnd : x.DtStart.AddHours(19),
Type = x.CodTipo,
Description = x.CognomeNome,
CssClass = CssBlockByGiust(x.CodTipo)
}).ToList();
#endif
}
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2506.0915</Version>
<Version>4.1.2506.0919</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 4.1.2506.0915</h4>
<h4>Versione: 4.1.2506.1006</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
4.1.2506.0915
4.1.2506.1006
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>4.1.2506.0915</version>
<version>4.1.2506.1006</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>