COmpilazione preliminare calendario richieste dip!

This commit is contained in:
Samuele Locatelli
2023-01-18 19:33:18 +01:00
parent 7a6f08343c
commit 4c9b662e4c
2 changed files with 65 additions and 6 deletions
+1 -2
View File
@@ -33,8 +33,7 @@
<div class="col-12">
@if (!isLoading)
{
@*<CalendarioAziendale TasksList="@CalendarTasksList" months="@numMesi" firstDate="@dtMin" minDate="@dtMin" maxDate="@dtMax"></CalendarioAziendale>*@
<CalendarMonth DtRif="@dtCurr" MainCss="table table-dark table-borderless" DateSelected="DisplayDate" MonthChanged="ReloadMonth" DateCheckBlock="@DateFerFestCheck" SingleWeek="@showDetail" SelDayCss="selDate rounded-top p-2" HeadStyle="color: #E67E22"></CalendarMonth>
<CalendarMonth DtRif="@dtCurr" MainCss="table table-dark table-borderless" DateSelected="DisplayDate" MonthChanged="ReloadMonth" DateCheckBlock="@DateCFF" DateCheck="@DateRDip" SingleWeek="@showDetail" SelDayCss="selDate rounded-top p-2" HeadStyle="color: #E67E22"></CalendarMonth>
}
</div>
</div>
+64 -4
View File
@@ -173,7 +173,7 @@ namespace GPW.CORE.Smart.Pages
{
isLoading = true;
CalendarTasksList = new List<Tasks>();
DateFerFestCheck = new Dictionary<DateTime, string>();
DateCFF = new Dictionary<DateTime, string>();
DateTime oggi = DateTime.Today;
dtMin = new DateTime(oggi.Year, oggi.Month, 1);
// recupero mesi da gestire
@@ -186,6 +186,17 @@ namespace GPW.CORE.Smart.Pages
}
dtMax = dtMin.AddMonths(numMesi);
// dichiaraizone codici CSS di base
string cssOkComm = "bg-success text-light rounded-circle p-2";
string cssOkLav = "bg-warning text-light rounded-circle p-2";
string cssToday = "bg-info text-dark rounded-circle p-2";
string cssFest = "bg-danger text-warning";
string cssChius = "bg-warning text-dark";
string cssRichFer = "bg-warning text-dark rounded-circle p-2";
string cssRichPerm = "bg-info text-light rounded-circle p-2";
string cssMal = "bg-dark text-light rounded-circle p-2";
// recupero le fermate aziendali
ListFermateAzienda = await CDService.CalFestFeriePeriodo(dtMin, dtMax);
if (ListFermateAzienda.Count > 0)
@@ -207,8 +218,11 @@ namespace GPW.CORE.Smart.Pages
string cssSpec = "";
foreach (var item in ListFermateAzienda)
{
cssSpec = item.codGiust == "FEST" ? "bg-danger text-warning" : "bg-warning text-dark";
DateFerFestCheck.Add(item.data, cssSpec);
cssSpec = item.codGiust == "FEST" ? cssFest : cssChius;
if (!DateCFF.ContainsKey(item.data))
{
DateCFF.Add(item.data, cssSpec);
}
}
}
// recupero e converto le richieste dipendente...
@@ -228,6 +242,36 @@ namespace GPW.CORE.Smart.Pages
NotBeDraggable = x.IdxDipendente != idxDipendente
}).ToList();
CalendarTasksList.AddRange(taskDip);
string cssSpec = "";
DateTime dtIns = DateTime.Today;
foreach (var item in ListRichiesteDip)
{
switch (item.CodGiust)
{
case "PERM":
case "104":
cssSpec = cssRichPerm;
break;
case "FER":
cssSpec = cssRichFer;
break;
default:
break;
}
// aggiungo x tutte le date richieste...
int numGG = item.DtEnd.Subtract(item.DtStart).Days;
for (int i = 0; i <= numGG; i++)
{
dtIns = item.DtStart.Date.AddDays(i);
if (!DateRDip.ContainsKey(dtIns))
{
DateRDip.Add(dtIns, cssSpec);
}
}
}
}
// recupero e converto le malattie...
ListMalattie = await CDService.RegMalattieGetAll(100);
@@ -246,6 +290,21 @@ namespace GPW.CORE.Smart.Pages
NotBeDraggable = x.IdxDipendente != idxDipendente
}).ToList();
CalendarTasksList.AddRange(taskDip);
string cssSpec = cssMal;
DateTime dtIns = DateTime.Today;
foreach (var item in ListMalattie)
{
// aggiungo x tutte le date richieste...
for (int i = 0; i < item.NumGG; i++)
{
dtIns = item.DtInizio.Date.AddDays(i - 1);
if (!DateRDip.ContainsKey(dtIns))
{
DateRDip.Add(dtIns, cssSpec);
}
}
}
}
await Task.Delay(1);
isLoading = false;
@@ -265,7 +324,8 @@ namespace GPW.CORE.Smart.Pages
updateDetail();
MService.ReportDateChange();
}
private Dictionary<DateTime, string> DateFerFestCheck = new Dictionary<DateTime, string>();
private Dictionary<DateTime, string> DateCFF = new Dictionary<DateTime, string>();
private Dictionary<DateTime, string> DateRDip = new Dictionary<DateTime, string>();
private async void updateDetail()
{