Completata gestione con filtraggio x calendario e elenco

This commit is contained in:
Samuele Locatelli
2024-09-12 10:02:06 +02:00
parent 08c746feb6
commit abdfd82b0a
9 changed files with 110 additions and 48 deletions
@@ -3,7 +3,14 @@
<div class="card-header ">
<div class="row">
<div class="col-4 text-start">
<Toggler SelFilter="@ToggleData" FilterChanged="evToggled"></Toggler>
<div class="btn-group" role="group">
<button type="button" class="btn btn-sm @btnSel("PER")" @onclick="ToggPer">Permessi</button>
<button type="button" class="btn btn-sm @btnSel("FER")" @onclick="ToggFer">Ferie</button>
<button type="button" class="btn btn-sm @btnSel("MAL")" @onclick="ToggMal">Malattie</button>
<button type="button" class="btn btn-sm @btnSel("FEST")" @onclick="ToggFest">Feste</button>
<button type="button" class="btn btn-sm @btnSel("CHIU")" @onclick="ToggChiu">Chiusure</button>
</div>
</div>
<div class="col-4 text-center text-uppercase h5">
<b>Calendario Aziendale</b>
@@ -25,7 +25,7 @@ namespace GPW.CORE.ADM.Components.Compo
public DateTime firstDate { get; set; } = new DateTime(DateTime.Today.Year, 1, 1);
[Parameter]
public int IdxDip { get; set; } = 0;
public bool ShowNeedConf { get; set; } = false;
[Parameter]
public DateTime maxDate { get; set; } = new DateTime(DateTime.Today.Year + 1, 1, 1);
@@ -106,12 +106,6 @@ namespace GPW.CORE.ADM.Components.Compo
await Task.Delay(1);
// il mese viene preimpostato sul trimestre corrente...
startMonth = (Month)((DateTime.Today.Month / 6) * 6);
ToggleData = new SelectGlobalToggle()
{
leftString = "Personali",
rightString = "Tutti",
placardCss = "bg-dark border-dark text-light"
};
}
protected override void OnParametersSet()
@@ -141,32 +135,114 @@ namespace GPW.CORE.ADM.Components.Compo
private string schedHeight { get; set; } = "height: 50rem;";
private DateTime SelDate { get; set; } = DateTime.Today;
private Month startMonth { get; set; } = Month.January;
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
#endregion Private Properties
#region Private Methods
private async Task evToggled(SelectGlobalToggle newTogData)
{
ToggleData = newTogData;
await Task.Delay(1);
FilterData();
}
private void FilterData()
{
// filtro risultati richiesti...
if (ToggleData.isActive)
// in primis copio tutto
EvDtoFilt = EvDtoList;
if (ShowNeedConf)
{
EvDtoFilt = EvDtoList;
EvDtoFilt = EvDtoFilt.Where(x => !x.Conf).ToList();
}
else
// controllo ogni toggle...
if (!showChiu)
{
EvDtoFilt = EvDtoList
.Where(x => x.IdxDipendente == IdxDip || x.IdxDipendente == 0)
EvDtoFilt = EvDtoFilt
.Where(x => !x.IsCompany || (x.IsCompany && !x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase)))
.ToList();
}
if (!showFer)
{
EvDtoFilt = EvDtoFilt
.Where(x => !x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase) || (x.CodTipo.Equals("FER", StringComparison.InvariantCultureIgnoreCase) && x.IsCompany))
.ToList();
}
if (!showFest)
{
EvDtoFilt = EvDtoFilt
.Where(x => !x.CodTipo.Equals("FEST", StringComparison.InvariantCultureIgnoreCase))
.ToList();
}
if (!showMal)
{
EvDtoFilt = EvDtoFilt
.Where(x => !x.CodTipo.Equals("MAL", StringComparison.InvariantCultureIgnoreCase))
.ToList();
}
if (!showPer)
{
EvDtoFilt = EvDtoFilt
.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)
@@ -299,27 +299,6 @@ namespace GPW.CORE.ADM.Components.Compo
sendDataVal = 0;
sendDataNextVal = 5;
await Task.Delay(1);
// verifica preliminare delle date compatibili...
var dtCheckMin = minDate(currRecord.CodGiust);
var dtCheckMax = maxDate(currRecord.CodGiust);
if (currRecord.DtStart < dtCheckMin)
{
currRecord.DtStart = dtCheckMin;
}
else if (currRecord.DtStart > dtCheckMax)
{
currRecord.DtStart = dtCheckMax;
currRecord.DtEnd = dtCheckMax;
}
if (currRecord.DtEnd > dtCheckMax)
{
currRecord.DtEnd = dtCheckMax;
}
else if (currRecord.DtEnd < dtCheckMin)
{
currRecord.DtStart = dtCheckMin;
currRecord.DtEnd = dtCheckMin;
}
// effettuo insert...
sendDataVal = 5;
sendDataNextVal = 90;
@@ -22,7 +22,7 @@
}
</div>
<div class="col-8 ps-0">
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate" IdxDip="@idxDipendente"></CalendarioAziendale>
<CalendarioAziendale EvDtoList="@SchedEvList" MonthDispl="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax" MonthReq="SetMonth" DtReq="SetDate" ShowNeedConf="@OnlyNeedConf"></CalendarioAziendale>
</div>
</div>
</div>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2409.1208</Version>
<Version>4.1.2409.1210</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -11,7 +11,7 @@
{
<div class="px-2">
Mostra:
<div class="btn-group" role="group" aria-label="Basic example">
<div class="btn-group" role="group">
<button type="button" class="btn btn-sm @btnSel("PER")" @onclick="toggPer">Permessi</button>
<button type="button" class="btn btn-sm @btnSel("FER")" @onclick="toggFer">Ferie</button>
<button type="button" class="btn btn-sm @btnSel("MAL")" @onclick="toggMal">Malattie</button>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 4.1.2409.1208</h4>
<h4>Versione: 4.1.2409.1210</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
4.1.2409.1208
4.1.2409.1210
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>4.1.2409.1208</version>
<version>4.1.2409.1210</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>