Bozza gestione richieste
- approvazione/rifiuto - gest base calendari
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
|
||||
<div class="card bg-dark text-light">
|
||||
<div class="card-header ">
|
||||
<div class="row">
|
||||
<div class="col-4 text-start">
|
||||
<Toggler SelFilter="@ToggleData" FilterChanged="evToggled"></Toggler>
|
||||
</div>
|
||||
<div class="col-4 text-center text-uppercase h5">
|
||||
<b>Calendario Aziendale</b>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<div class="d-flex justify-content-around">
|
||||
@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" />
|
||||
</RadzenStack>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body bg-body text-dark p-1">
|
||||
<div style="@schedHeight">
|
||||
<RadzenScheduler @ref=@scheduler style="height: 100%;" Culture=@(new System.Globalization.CultureInfo("it-IT"))
|
||||
TItem="EventDTO" Data="@EvDtoFilt" SelectedIndex="@selectedIndex" Date="@SelDate"
|
||||
StartProperty="DtStart" EndProperty="DtEnd" TextProperty="CodTipo"
|
||||
SlotRender=@OnSlotRender SlotSelect=@OnSlotSelect
|
||||
AppointmentSelect=@OnAppointmentSelect AppointmentRender=@OnAppointmentRender
|
||||
LoadData=OnLoadData>
|
||||
<Template Context="EvDTO">
|
||||
<div>
|
||||
<strong>@EvDTO.CodTipo</strong> | @EvDTO.Abbrev
|
||||
</div>
|
||||
<small>
|
||||
@if (EvDTO.CodTipo == "PERM" || EvDTO.CodTipo == "104")
|
||||
{
|
||||
@($"{EventDTO.DateForm(EvDTO.CodTipo, EvDTO.DtStart)} --> {EventDTO.DateForm(EvDTO.CodTipo, EvDTO.DtEnd)}")
|
||||
}
|
||||
</small>
|
||||
</Template>
|
||||
<ChildContent>
|
||||
<RadzenDayView />
|
||||
<RadzenWeekView />
|
||||
<RadzenMonthView MaxAppointmentsInSlot="4" />
|
||||
<RadzenYearPlannerView StartMonth="@startMonth" MaxAppointmentsInSlot="3" />
|
||||
@* <RadzenYearTimelineView StartMonth="@startMonth" /> *@
|
||||
<RadzenYearView StartMonth="@startMonth" />
|
||||
</ChildContent>
|
||||
</RadzenScheduler>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,265 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Identity.Client;
|
||||
using Radzen.Blazor.Rendering;
|
||||
using Radzen.Blazor;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
using Radzen;
|
||||
using System;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class CalendarioAziendale
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> DtReq { get; set; }
|
||||
|
||||
[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 int MonthDispl
|
||||
{
|
||||
get => cMonth;
|
||||
set => cMonth = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> MonthReq { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected RadzenScheduler<EventDTO> scheduler = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Enums
|
||||
|
||||
protected enum Viste
|
||||
{
|
||||
Day,
|
||||
Week,
|
||||
Month,
|
||||
Planner,
|
||||
Year
|
||||
}
|
||||
|
||||
#endregion Protected Enums
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int currMonth
|
||||
{
|
||||
get => cMonth;
|
||||
set
|
||||
{
|
||||
if (cMonth != value)
|
||||
{
|
||||
cMonth = value;
|
||||
MonthReq.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task addMonth(int numMesi)
|
||||
{
|
||||
firstDate = firstDate.AddMonths(numMesi);
|
||||
// verifico limiti...
|
||||
if (numMesi > 0)
|
||||
{
|
||||
firstDate = firstDate > maxDate ? maxDate : firstDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstDate = firstDate < minDate ? minDate : firstDate;
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
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()
|
||||
{
|
||||
FilterData();
|
||||
scheduler.Reload();
|
||||
}
|
||||
|
||||
protected async Task StartMonthChange()
|
||||
{
|
||||
await scheduler.Reload();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int selectedIndex = 2;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int cMonth { get; set; } = 3;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
EvDtoFilt = EvDtoList;
|
||||
}
|
||||
else
|
||||
{
|
||||
EvDtoFilt = EvDtoList
|
||||
.Where(x => x.IdxDipendente == IdxDip || x.IdxDipendente == 0)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAppointmentRender(SchedulerAppointmentRenderEventArgs<EventDTO> args)
|
||||
{
|
||||
// Never call StateHasChanged in AppointmentRender - would lead to infinite loop
|
||||
args.Attributes["style"] = $"background: {args.Data.Color}; color: {args.Data.ForeColor};";
|
||||
}
|
||||
|
||||
private async Task OnAppointmentSelect(SchedulerAppointmentSelectEventArgs<EventDTO> selEv)
|
||||
{
|
||||
var copy = selEv.Data.Clone();
|
||||
await Task.Delay(1);
|
||||
var data = await DialogService.OpenAsync<TaskDetail>("", new Dictionary<string, object> { { "ThisTask", copy } });
|
||||
}
|
||||
|
||||
private async Task OnLoadData(SchedulerLoadDataEventArgs args)
|
||||
{
|
||||
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)
|
||||
{
|
||||
SelDate = args.Start.AddMonths(1);
|
||||
// riporto data al controller parent...
|
||||
await DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
|
||||
//schedHeight = (currView == "year" || currView == "planner") ? "height: 60rem;" : "height: 50rem;";
|
||||
// // Get the appointments for between the Start and End
|
||||
// data = await MyAppointmentService.GetData(selEv.Start, selEv.End);
|
||||
}
|
||||
|
||||
private void OnSlotRender(SchedulerSlotRenderEventArgs args)
|
||||
{
|
||||
// Highlight today in month view
|
||||
if (args.View.Text == "Month" && args.Start.Date == DateTime.Today)
|
||||
{
|
||||
args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));";
|
||||
}
|
||||
|
||||
// Highlight working hours (9-18)
|
||||
if ((args.View.Text == "Week" || args.View.Text == "Day") && args.Start.Hour > 8 && args.Start.Hour < 19)
|
||||
{
|
||||
args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));";
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnSlotSelect(SchedulerSlotSelectEventArgs args)
|
||||
{
|
||||
int prevIdx = selectedIndex;
|
||||
await Task.Delay(1);
|
||||
// verifico indice corretto della vista...
|
||||
switch (args.View.Text)
|
||||
{
|
||||
case "Day":
|
||||
selectedIndex = 0;
|
||||
break;
|
||||
|
||||
case "Week":
|
||||
selectedIndex = 1;
|
||||
break;
|
||||
|
||||
case "Month":
|
||||
selectedIndex = 2;
|
||||
break;
|
||||
|
||||
case "Planner":
|
||||
selectedIndex = 3;
|
||||
break;
|
||||
|
||||
case "Year":
|
||||
selectedIndex = 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (prevIdx != selectedIndex)
|
||||
{
|
||||
await scheduler.Reload();
|
||||
}
|
||||
await Task.Delay(1);
|
||||
if (selectedIndex > 0)
|
||||
{
|
||||
selectedIndex--;
|
||||
}
|
||||
// imposto al data selezionata
|
||||
SelDate = args.Start;
|
||||
// riporto data al controller parent...
|
||||
await DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@
|
||||
<span class="input-group-text">
|
||||
<i class="far fa-object-group"></i>
|
||||
</span>
|
||||
<select @bind="@Gruppo" class="form-select form-select-sm" title="Gruppo" style="width:10rem;" @bind:after=@ReloadData>
|
||||
<select @bind="@Gruppo" class="form-select form-select-sm" title="Gruppo" style="width:10rem;" @bind:after=@ForceReload>
|
||||
<option value="">--- Selezionare ---</option>
|
||||
@foreach (var item in ListGruppi)
|
||||
{
|
||||
@@ -101,7 +101,7 @@
|
||||
<span class="input-group-text">
|
||||
<i class="far fa-object-group"></i>
|
||||
</span>
|
||||
<select @bind="@IdxCliente" class="form-select form-select-sm" title="Cliente" style="width:10rem;" @bind:after=@ReloadData>
|
||||
<select @bind="@IdxCliente" class="form-select form-select-sm" title="Cliente" style="width:10rem;" @bind:after=@ForceReload>
|
||||
<option value="0">--- Selezionare ---</option>
|
||||
@foreach (var item in ListClienti)
|
||||
{
|
||||
|
||||
@@ -131,10 +131,8 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
|
||||
protected async Task ForceReload()
|
||||
{
|
||||
// salvo le preferenze...
|
||||
await AppMServ.UserPrefSet("ShowPrjArc", $"{ShowPrjArc}");
|
||||
await AppMServ.UserPrefSet("ShowPrjStr", $"{ShowPrjStr}");
|
||||
await AppMServ.UserPrefSet("ShowPrjZH", $"{ShowPrjZH}");
|
||||
await salvaFiltToggle();
|
||||
await salvaFiltGrpCli();
|
||||
FullEdit = false;
|
||||
ShowFasi = false;
|
||||
RecordEdit = null;
|
||||
@@ -215,13 +213,21 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool FullEdit = false;
|
||||
|
||||
private string gridKey = "ProgettiMan";
|
||||
|
||||
private AnagProgettiModel? RecordEdit = null;
|
||||
|
||||
private CalcOreProgettiModel? RecordSel = null;
|
||||
|
||||
private bool ShowFasi = false;
|
||||
|
||||
private bool sortAsc = true;
|
||||
|
||||
private string sortField = "";
|
||||
|
||||
private double warnRatio = 50;
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -229,11 +235,17 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private string CurrSearch { get; set; } = "";
|
||||
|
||||
private string Gruppo { get; set; } = "";
|
||||
|
||||
private int IdxCliente { get; set; } = 0;
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private List<AnagFasiExplModel>? ListFasiSel { get; set; } = null;
|
||||
|
||||
private List<CalcOreProgettiModel>? ListRecords { get; set; } = null;
|
||||
|
||||
private string modalSize
|
||||
@@ -325,6 +337,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
IdxCliente = 0;
|
||||
}
|
||||
currPage = 1;
|
||||
await salvaFiltGrpCli();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -340,8 +353,12 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
ShowPrjArc = await AppMServ.UserPrefGet<bool>("ShowPrjArc");
|
||||
ShowPrjStr = await AppMServ.UserPrefGet<bool>("ShowPrjStr");
|
||||
ShowPrjZH = await AppMServ.UserPrefGet<bool>("ShowPrjZH");
|
||||
ShowGruppo = await AppMServ.UserPrefGet<bool>("ShowGruppo");
|
||||
ShowCli = await AppMServ.UserPrefGet<bool>("ShowCli");
|
||||
Gruppo = await AppMServ.UserPrefGet<string>("Gruppo") ?? "";
|
||||
IdxCliente = await AppMServ.UserPrefGet<int>("IdxCliente");
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in InitUserPref{Environment.NewLine}{exc}");
|
||||
}
|
||||
@@ -374,6 +391,23 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task salvaFiltGrpCli()
|
||||
{
|
||||
// salvo
|
||||
await AppMServ.UserPrefSet("ShowGruppo", $"{ShowGruppo}");
|
||||
await AppMServ.UserPrefSet("ShowCli", $"{ShowCli}");
|
||||
await AppMServ.UserPrefSet("Gruppo", $"{Gruppo}");
|
||||
await AppMServ.UserPrefSet("IdxCliente", $"{IdxCliente}");
|
||||
}
|
||||
|
||||
private async Task salvaFiltToggle()
|
||||
{
|
||||
// salvo le preferenze...
|
||||
await AppMServ.UserPrefSet("ShowPrjArc", $"{ShowPrjArc}");
|
||||
await AppMServ.UserPrefSet("ShowPrjStr", $"{ShowPrjStr}");
|
||||
await AppMServ.UserPrefSet("ShowPrjZH", $"{ShowPrjZH}");
|
||||
}
|
||||
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{ @if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="1000"></ProgressDisplay>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showAdd)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<b>Inizio Malattia</b>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="date" aria-label="Last name" class="form-control text-end" @bind="@currRecord.DtInizio">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<b>Giorni Malattia</b>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="number" aria-label="Last name" class="form-control text-end" @bind="@currRecord.NumGG">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<b>Codice Certificato (INPS)</b>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" aria-label="Last name" class="form-control text-end" @bind="@currRecord.CodCert">
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-warning w-100" @onclick="() => toggleAddNew()"><i class="fas fa-window-close"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (currRecord.CodCert != "")
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="() => insertRecord()"><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100" disabled><i class="far fa-save"></i> Update</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<h4>Nessu record registrato!</h4>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()"><i class="fas fa-plus"></i> Inserisci Malattia</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light">
|
||||
<th>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()"><i class="fas fa-plus"></i></button>
|
||||
</th>
|
||||
<th>Data</th>
|
||||
<th class="text-center">Giorni</th>
|
||||
<th class="text-end">Codice</th>
|
||||
<th class="text-end"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords.OrderByDescending(x => x.DtInizio))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => editRec(item)"><i class="fas fa-pen"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.DtInizio.ToString("dd MMM yyyy"), <b>@item.DtInizio.ToString("dddd")</b>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@item.NumGG
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@item.CodCert
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRec(item)"><i class="fas fa-trash-alt"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class RegMalattia
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int IdxDipendente { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ReportUpdate { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService DataService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool isSendingData = false;
|
||||
private List<RegMalattieModel>? ListRecords = null;
|
||||
private int sendDataMaxVal = 100;
|
||||
private int sendDataNextVal = 0;
|
||||
private int sendDataVal = 0;
|
||||
private bool showAdd = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private RegMalattieModel currRecord { get; set; } = new RegMalattieModel();
|
||||
|
||||
private string NomeDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "per cortesia";
|
||||
if (AppMServ != null && AppMServ.RigaDip != null)
|
||||
{
|
||||
answ = $"{AppMServ.RigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task DeleteRec(RegMalattieModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record selezionato??"))
|
||||
return;
|
||||
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 90;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await Task.Delay(1);
|
||||
var updTask = Task.Run(async () =>
|
||||
await DataService.RegMalattieDelete(selItem)
|
||||
);
|
||||
await updTask;
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private void editRec(RegMalattieModel selItem)
|
||||
{
|
||||
currRecord = selItem;
|
||||
showAdd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra il record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task insertRecord()
|
||||
{
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 5;
|
||||
await Task.Delay(1);
|
||||
// forzo dipendente
|
||||
currRecord.IdxDipendente = AppMServ.IdxDipendente;
|
||||
await Task.Delay(1);
|
||||
// effettuo insert...
|
||||
sendDataVal = 5;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
var updTask = Task.Run(async () =>
|
||||
await DataService.RegMalattieUpsert(currRecord)
|
||||
);
|
||||
await updTask;
|
||||
// effettuo insert...
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
// aggiorno display...
|
||||
await Task.Delay(1);
|
||||
showAdd = false;
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
ListRecords = await DataService.RegMalattieGetByDip(IdxDipendente, 10);
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async Task toggleAddNew()
|
||||
{
|
||||
showAdd = !showAdd;
|
||||
await Task.Delay(1);
|
||||
if (showAdd)
|
||||
{
|
||||
currRecord = new RegMalattieModel() { IdxDipendente = AppMServ.IdxDipendente };
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (isSendingData)
|
||||
{
|
||||
<ProgressDisplay Title="Salvataggio ed invio richiesta" CurrVal="@sendDataVal" NextVal="@sendDataNextVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="1000"></ProgressDisplay>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData DisplaySize="LoadingData.CtrlSize.Small"></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showAdd)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<b>Causale</b>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<div class="input-group input-group-sm">
|
||||
<select @bind="@CodGiust" class="form-select">
|
||||
<option value="">--- Selezionare Causale ---</option>
|
||||
@if (ListGiust != null)
|
||||
{
|
||||
@foreach (var giust in ListGiust)
|
||||
{
|
||||
<option value="@giust.codGiust">@giust.descrizione</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<b>Inizio Periodo</b>
|
||||
<div class="small">min: @($"{minDate(currRecord.CodGiust):dd.MM.yyyy}")</div>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
@if (@CodGiust == "PERM" || @CodGiust == "104")
|
||||
{
|
||||
<input type="datetime-local" aria-label="Last name" class="form-control text-end" @bind="@dtStart" min="@($"{minDate(CodGiust):yyyy-MM-dd HH:mm}")" max="@($"{maxDate(CodGiust):yyyy-MM-dd HH:mm}")">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="date" aria-label="Last name" class="form-control text-end" @bind="@dtStart" min="@($"{minDate(CodGiust):yyyy-MM-dd}")" max="@($"{maxDate(CodGiust):yyyy-MM-dd}")">
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<b>Fine Periodo</b>
|
||||
<div class="small">max: @($"{maxDate(currRecord.CodGiust):dd.MM.yyyy}")</div>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
|
||||
@if (@CodGiust == "PERM" || @CodGiust == "104")
|
||||
{
|
||||
<input type="datetime-local" aria-label="Last name" class="form-control text-end" @bind="@dtEnd" min="@($"{minDate(CodGiust):yyyy-MM-dd HH:mm}")" max="@($"{maxDate(CodGiust):yyyy-MM-dd HH:mm}")">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="date" aria-label="Last name" class="form-control text-end" @bind="@dtEnd" min="@($"{minDate(CodGiust):yyyy-MM-dd}")" max="@($"{maxDate(CodGiust):yyyy-MM-dd}")">
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<b>Note</b>
|
||||
<div class="small">(opzionali)</div>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<textarea class="form-control form-control-sm small" @bind="@currRecord.Note"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<b>Stato</b>
|
||||
<div class="small">(conferma)</div>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" @bind="@currRecord.Conf">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-warning w-100" @onclick="() => toggleAddNew()"><i class="fas fa-window-close"></i> Cancel</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
@if (CodGiust != "")
|
||||
{
|
||||
<button class="btn btn-success w-100" @onclick="() => insertRecord()"><i class="far fa-save"></i> Registra evento</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary w-100" disabled><i class="far fa-save"></i> Registra evento</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
@if (ListRecords.Count == 0)
|
||||
{
|
||||
<div class="alert alert-warning d-flex justify-content-between">
|
||||
<div>
|
||||
Nessu record registrato
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()">Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped table-responsive-md border border-dark">
|
||||
<thead>
|
||||
<tr class="bg-dark text-light">
|
||||
<th>
|
||||
@* <button class="btn btn-success btn-sm" @onclick="() => toggleAddNew()"><i class="fas fa-plus"></i></button> *@
|
||||
</th>
|
||||
<th>Dipendente</th>
|
||||
<th>Periodo</th>
|
||||
<th class="text-end">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => editRec(item)">
|
||||
<b>@item.CodGiustTrim</b>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="btn btn-sm btn-secondary disabled">
|
||||
<b>@item.CodGiustTrim</b>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="fs-5">@item.DipNav.Abbrev</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@if (item.CodGiust == "PERM")
|
||||
{
|
||||
<div class="d-flex justify-content-between pe-2">
|
||||
<div>
|
||||
@item.DtStart.ToString("dd MMM yyyy"), <b>@item.DtStart.ToString("HH:mm")</b>
|
||||
<i class="fas fa-caret-right"></i>
|
||||
<b>@item.DtEnd.ToString("HH:mm")</b>
|
||||
</div>
|
||||
<div>
|
||||
<b>@item.Durata</b>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="d-flex justify-content-between pe-2">
|
||||
<div>
|
||||
<b>@item.DtStart.ToString("dd MMM")</b> @item.DtStart.ToString("yyyy")
|
||||
<i class="fas fa-caret-right"></i>
|
||||
<b>@item.DtEnd.ToString("dd MMM")</b> @item.DtEnd.ToString("yyyy")
|
||||
</div>
|
||||
<div>
|
||||
<b>@item.Durata</b>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="small">
|
||||
@item.Note
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@if (!item.Conf)
|
||||
{
|
||||
<button class="btn btn-success btn-sm" @onclick="() => DoApprove(item)"><i class="fa-solid fa-thumbs-up"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => editRec(item)">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
public partial class RegRichieste
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
|
||||
protected int IdxDipendente { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public bool isLoading
|
||||
{
|
||||
get => loading;
|
||||
set => loading = value;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int months { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ReportUpdate { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected bool loading
|
||||
{
|
||||
get => _loading;
|
||||
set
|
||||
{
|
||||
if (_loading != value)
|
||||
{
|
||||
_loading = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
dtInizio = new DateTime(DateTime.Today.Year, 1, 1);
|
||||
dtFine = dtInizio.AddYears(2);
|
||||
currRecord.IdxDipendente = AppMServ.IdxDipendente;
|
||||
CodGiust = "";
|
||||
var rawGiust = await GDataServ.AnagGiust();
|
||||
if (rawGiust != null)
|
||||
{
|
||||
ListGiust = rawGiust.Where(x => x.showReq).ToList();
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool isSendingData = false;
|
||||
private List<AnagGiustModel>? ListGiust = null;
|
||||
private List<RegRichiesteModel>? ListRecords = null;
|
||||
|
||||
/// <summary>
|
||||
/// Numero giorni minimo per richiesta ferie
|
||||
/// </summary>
|
||||
private int NumDayFerieRichAntic = 14;
|
||||
|
||||
/// <summary>
|
||||
/// NUmero giorni massimo per richiesta permessi
|
||||
/// </summary>
|
||||
private int NumDayPermMax = 21;
|
||||
|
||||
private int sendDataMaxVal = 100;
|
||||
private int sendDataNextVal = 0;
|
||||
private int sendDataVal = 0;
|
||||
private bool showAdd = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool _loading { get; set; } = false;
|
||||
|
||||
private string CodGiust
|
||||
{
|
||||
get => currRecord.CodGiust;
|
||||
set
|
||||
{
|
||||
currRecord.CodGiust = value;
|
||||
// imposto dataOra min/max da tipo cod Giust
|
||||
if (value == "FER")
|
||||
{
|
||||
dtStart = minDate(value);
|
||||
dtEnd = minDate(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
int ora = DateTime.Now.Hour;
|
||||
dtStart = minDate(value).AddHours(ora);
|
||||
dtEnd = minDate(value).AddHours(ora + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RegRichiesteModel currRecord { get; set; } = new RegRichiesteModel();
|
||||
|
||||
private DateTime dtEnd
|
||||
{
|
||||
get => currRecord.DtEnd;
|
||||
set
|
||||
{
|
||||
currRecord.DtEnd = value;
|
||||
// verifico coerenza date...
|
||||
if (dtStart > dtEnd)
|
||||
{
|
||||
dtStart = dtEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime dtFine { get; set; } = DateTime.Today;
|
||||
|
||||
private DateTime dtInizio { get; set; } = DateTime.Today;
|
||||
|
||||
private DateTime dtStart
|
||||
{
|
||||
get => currRecord.DtStart;
|
||||
set
|
||||
{
|
||||
currRecord.DtStart = value;
|
||||
// verifico coerenza date...
|
||||
if (dtEnd < dtStart)
|
||||
{
|
||||
dtEnd = dtStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string NomeDip
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "per cortesia";
|
||||
if (AppMServ != null && AppMServ.RigaDip != null)
|
||||
{
|
||||
answ = $"{AppMServ.RigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#if false
|
||||
private async Task DeleteRec(RegRichiesteModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record selezionato??"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
var updTask = Task.Run(async () =>
|
||||
await GDataServ.RegRichiesteDelete(selItem)
|
||||
);
|
||||
await updTask;
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await Task.Delay(1);
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
private async Task DoApprove(RegRichiesteModel selItem)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi approvazione?"))
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await GDataServ.RegRichiesteApprova(selItem);
|
||||
//var updTask = Task.Run(async () =>
|
||||
// await GDataServ.RegRichiesteApprova(selItem)
|
||||
// );
|
||||
//await updTask;
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
|
||||
private void editRec(RegRichiesteModel selItem)
|
||||
{
|
||||
currRecord = selItem;
|
||||
showAdd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// init valori da config
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task initConf()
|
||||
{
|
||||
// leggo conf standard giorni permessi/ferie
|
||||
var sNumDayFerieRichAntic = await GDataServ.ConfigGetKey("NumDayFerieRichAntic");
|
||||
if (sNumDayFerieRichAntic != null)
|
||||
{
|
||||
int.TryParse(sNumDayFerieRichAntic.valore, out NumDayFerieRichAntic);
|
||||
}
|
||||
var sNumDayPermMax = await GDataServ.ConfigGetKey("NumDayPermMax");
|
||||
if (sNumDayPermMax != null)
|
||||
{
|
||||
int.TryParse(sNumDayPermMax.valore, out NumDayPermMax);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra il record
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task insertRecord()
|
||||
{
|
||||
isSendingData = true;
|
||||
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;
|
||||
await Task.Delay(1);
|
||||
var updTask = Task.Run(async () =>
|
||||
await GDataServ.RegRichiesteUpsert(currRecord)
|
||||
);
|
||||
await updTask;
|
||||
// effettuo insert...
|
||||
sendDataVal = 100;
|
||||
sendDataNextVal = 100;
|
||||
await Task.Delay(1);
|
||||
showAdd = false;
|
||||
await ReloadData();
|
||||
await ReportUpdate.InvokeAsync(true);
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
private DateTime maxDate(string codGiust)
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddDays(NumDayPermMax);
|
||||
switch (codGiust)
|
||||
{
|
||||
case "FER":
|
||||
answ = new DateTime(answ.Year, answ.Month, 1).AddMonths(months);
|
||||
break;
|
||||
|
||||
case "104":
|
||||
case "PERM":
|
||||
default:
|
||||
DateTime.Today.AddDays(NumDayPermMax);
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private DateTime minDate(string codGiust)
|
||||
{
|
||||
DateTime answ = DateTime.Today;
|
||||
switch (codGiust)
|
||||
{
|
||||
case "FER":
|
||||
answ = DateTime.Today.AddDays(NumDayFerieRichAntic);
|
||||
break;
|
||||
|
||||
case "104":
|
||||
case "PERM":
|
||||
default:
|
||||
answ = DateTime.Today;
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
await initConf();
|
||||
await Task.Delay(1);
|
||||
// carico richieste di TUTTI
|
||||
ListRecords = await GDataServ.RegRichiesteGetByDip(0, dtInizio, dtFine);
|
||||
}
|
||||
|
||||
private async Task toggleAddNew()
|
||||
{
|
||||
showAdd = !showAdd;
|
||||
await Task.Delay(1);
|
||||
if (showAdd)
|
||||
{
|
||||
currRecord = new RegRichiesteModel() { IdxDipendente = AppMServ.IdxDipendente };
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
@inject DialogService DialogService
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="@($"background: {model.Color}; color: {model.ForeColor};")">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Tipologia:</div>
|
||||
<div class="px-0"><b>@model.CodTipo</b></div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Nome:</div>
|
||||
@if (@model.IdxDipendente > 0)
|
||||
{
|
||||
<div class="px-0"><b>@model.Abbrev</b></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="px-0"><b>@model.Descrizione</b></div>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
@if (model.DtEnd.Subtract(model.DtStart).TotalHours < 24)
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Data:</div>
|
||||
<div class="px-0"><b>@($"{model.DtStart:ddd yyyy-MM-dd}")</b></div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Inizio:</div>
|
||||
<div class="px-0"><b>@(EventDTO.DateForm(model.CodTipo, model.DtStart))</b></div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Fine:</div>
|
||||
<div class="px-0"><b>@(EventDTO.DateForm(model.CodTipo, model.DtEnd))</b></div>
|
||||
</div>
|
||||
</li>
|
||||
@if (model.IdxDipendente == idxDipendente)
|
||||
{
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">Note:</div>
|
||||
<div class="px-0"><b>@model.Note</b></div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventDTO ThisTask { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
EventDTO model = new EventDTO();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
model = ThisTask;
|
||||
}
|
||||
protected int idxDipendente
|
||||
{
|
||||
get => AppMServ.IdxDipendente;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,41 @@
|
||||
@page "/RichiesteDip"
|
||||
|
||||
<WIP></WIP>
|
||||
<div class="card shadow-lg">
|
||||
<div class="card-header table-primary d-flex justify-content-between">
|
||||
<div>
|
||||
<h3>Gestione Permessi, Ferie e Malattie</h3>
|
||||
</div>
|
||||
<div>
|
||||
<Toggler SelFilter="@ToggleData" FilterChanged="evToggled"></Toggler>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (showMalattie)
|
||||
{
|
||||
<RegMalattia IdxDipendente="@idxDipendente" isLoading="@isLoading" ReportUpdate="()=>ForceReloadCal()"></RegMalattia>
|
||||
}
|
||||
else
|
||||
{
|
||||
<RegRichieste ReportUpdate="()=>ForceReloadCal()" months="@numMesi"></RegRichieste>
|
||||
}
|
||||
}
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using static EgwCoreLib.Razor.Toggler;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Pages
|
||||
{
|
||||
public partial class RichiesteDip
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int anno = DateTime.Today.Year;
|
||||
|
||||
protected DateTime dtMax = DateTime.Today.AddYears(1);
|
||||
|
||||
protected DateTime dtMin = DateTime.Today;
|
||||
|
||||
protected int numMesi = 6;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService DataService { get; set; } = null!;
|
||||
|
||||
protected int idxDipendente
|
||||
{
|
||||
get => AppMServ.IdxDipendente;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
initToggler();
|
||||
// recupero mesi da gestire
|
||||
var monthConf = await DataService.ConfigGetKey("NumMesiCalAzienda");
|
||||
if (monthConf != null)
|
||||
{
|
||||
int intVal = 0;
|
||||
int.TryParse(monthConf.valore, out intVal);
|
||||
numMesi = intVal > 0 ? intVal : numMesi;
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<CalFesteFerieModel> ListFermateAzienda { get; set; } = new List<CalFesteFerieModel>();
|
||||
|
||||
private List<RegMalattieModel> ListMalattie { get; set; } = new List<RegMalattieModel>();
|
||||
|
||||
private List<RegRichiesteModel> ListRichiesteDip { get; set; } = new List<RegRichiesteModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco eventi formato originale (EventDTO)
|
||||
/// </summary>
|
||||
private List<EventDTO> SchedEvList { get; set; } = new List<EventDTO>();
|
||||
|
||||
private bool showMalattie { get; set; } = false;
|
||||
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task evToggled(SelectGlobalToggle newTogData)
|
||||
{
|
||||
ToggleData = newTogData;
|
||||
showMalattie = !ToggleData.isActive;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private async Task ForceReloadCal()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private void initToggler()
|
||||
{
|
||||
ToggleData = new SelectGlobalToggle()
|
||||
{
|
||||
leftString = "Malattie",
|
||||
rightString = "Ferie e Permessi",
|
||||
placardCss = "bg-light border-light text-dark",
|
||||
};
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
// recupero direttamente da oggetto DB
|
||||
SchedEvList = await DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SetDate(DateTime newDate)
|
||||
{
|
||||
// se la data fosse esterna all'intervallo considerato...)
|
||||
if (newDate < dtMin || newDate > dtMax)
|
||||
{
|
||||
// verifico se "allargare" alla minima o alla massima
|
||||
if (newDate < dtMin)
|
||||
{
|
||||
dtMin = new DateTime(newDate.Year - 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dtMax = new DateTime(newDate.Year + 1, 1, 1);
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetMonth(int newNum)
|
||||
{
|
||||
if (numMesi != newNum)
|
||||
{
|
||||
numMesi = newNum;
|
||||
}
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>4.1.2409.1117</Version>
|
||||
<Version>4.1.2409.1118</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<PropertyGroup>
|
||||
<TimeStampOfAssociatedLegacyPublishXmlFile />
|
||||
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAADrbAogtj/xpZqylbgs9Hb3AAAAAASAAACgAAAAEAAAAFm1lcdH7oj+NFy4QgZ7q18YAAAAROPsyRR12dhPTKfMEQ5yNCAZJ5K7C4pvFAAAAEFBVTwItjyYP2BlOTsuK1g9myQ8</EncryptedPassword>
|
||||
<History>True|2024-09-10T15:58:48.6965236Z||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
|
||||
<History>True|2024-09-11T15:21:29.6285775Z||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -2031,6 +2031,40 @@ namespace GPW.CORE.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna record registro richieste approvando la richiesta
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
public bool RegRichiesteApprova(RegRichiesteModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
using (GPWContext localDbCtx = new GPWContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetRegRichieste
|
||||
.FirstOrDefault(x => x.IdxRegRich == currItem.IdxRegRich);
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.Conf = true;
|
||||
|
||||
localDbCtx
|
||||
.DbSetRegRichieste
|
||||
.Update(currRec);
|
||||
|
||||
localDbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in RegRichiesteApprova{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina record registro richieste (SE non confermato)
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.EntityFrameworkCore.Update;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
@@ -1896,6 +1897,71 @@ namespace GPW.CORE.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra approvazione x la richiesta indicata
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RegRichiesteApprova(RegRichiesteModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// modifico approvata sul record
|
||||
currItem.Conf = true;
|
||||
// scrivo su DB
|
||||
answ = dbController.RegRichiesteApprova(currItem);
|
||||
if (answ)
|
||||
{
|
||||
// recupero info dipendente
|
||||
var listDip = await DipendentiGetAll();
|
||||
var currDip = listDip.FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente);
|
||||
// gestisco email notifica...
|
||||
string emailDest = _configuration.GetValue<string>("MailDest:InfoRich") ?? "info@egalware.com";
|
||||
if (!emailDest.Contains(currDip.Email))
|
||||
{
|
||||
emailDest += $",{currDip.Email}";
|
||||
}
|
||||
if (currDip.idxResp > 0)
|
||||
{
|
||||
string mailResp = await emailResp(currDip.idxResp);
|
||||
if (!string.IsNullOrEmpty(mailResp) && !emailDest.Contains(mailResp))
|
||||
{
|
||||
emailDest += $",{mailResp}";
|
||||
}
|
||||
}
|
||||
string urlRedir = _configuration.GetValue<string>("AdmApp:LinkRich") ?? "";
|
||||
DateTime adesso = DateTime.Now;
|
||||
StringBuilder sbMain = new StringBuilder();
|
||||
sbMain.AppendLine($"Il giorno {adesso:yyyy.MM.dd} alle ore {adesso:HH:mm:ss} è stata <b>modificata</b> la richiesta in oggetto.");
|
||||
sbMain.AppendLine("");
|
||||
sbMain.Append("<div style=\"font-size: 1.3em; color: #CC0066;\">");
|
||||
sbMain.Append($"<b>{currDip.Cognome}</b> {currDip.Nome} ({currDip.Matricola})");
|
||||
sbMain.Append("</div>");
|
||||
sbMain.AppendLine("<hr/>");
|
||||
sbMain.AppendLine($"Richiesta: <b>{currItem.CodGiust}</b>");
|
||||
string stato = currItem.Conf ? "CONFERMATA" : "RIFIUTATA";
|
||||
sbMain.AppendLine($"Stato: <b>{stato}</b>");
|
||||
sbMain.AppendLine($"Inizio: <b>{currItem.DtStart}</b>");
|
||||
sbMain.AppendLine($"Fine: <b>{currItem.DtEnd}</b>");
|
||||
sbMain.AppendLine($"Note: <b>{currItem.Note}</b>");
|
||||
sbMain.AppendLine("<hr/>");
|
||||
|
||||
string msgBody = sbMain.ToString().Replace($"{Environment.NewLine}", "<br/>");
|
||||
await sendEmail(emailDest, $"Aggiornamento Richiesta n.{currItem.IdxRegRich} ({currItem.CodGiust})", msgBody);
|
||||
}
|
||||
// invalido la cache...
|
||||
await ExecFlushRedisPattern($"{rKeyDipendenti}:*");
|
||||
await ExecFlushRedisPattern($"{rKeyDailyData}:*");
|
||||
await ExecFlushRedisPattern($"{rKeyLastRegAtt}:*");
|
||||
await ExecFlushRedisPattern($"{rKeyParetoRegAtt}:*");
|
||||
await ExecFlushRedisPattern($"{rKeyWeekStats}:*");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua eliminazione record registro richieste dipendente (SE non confermato)
|
||||
/// </summary>
|
||||
@@ -2006,6 +2072,7 @@ namespace GPW.CORE.Data.Services
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
bool isNew = currItem.IdxRegRich == 0;
|
||||
// scrivo su DB
|
||||
answ = dbController.RegRichiesteUpsert(currItem);
|
||||
if (answ)
|
||||
@@ -2015,6 +2082,10 @@ namespace GPW.CORE.Data.Services
|
||||
var currDip = listDip.FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente);
|
||||
// gestisco email notifica...
|
||||
string emailDest = _configuration.GetValue<string>("MailDest:InfoRich") ?? "info@egalware.com";
|
||||
if (!emailDest.Contains(currDip.Email))
|
||||
{
|
||||
emailDest += $",{currDip.Email}";
|
||||
}
|
||||
if (currDip.idxResp > 0)
|
||||
{
|
||||
string mailResp = await emailResp(currDip.idxResp);
|
||||
@@ -2033,13 +2104,19 @@ namespace GPW.CORE.Data.Services
|
||||
sbMain.Append("</div>");
|
||||
sbMain.AppendLine("<hr/>");
|
||||
sbMain.AppendLine($"Richiesta: <b>{currItem.CodGiust}</b>");
|
||||
if(!isNew)
|
||||
{
|
||||
string stato = currItem.Conf ? "CONFERMATA" : "RIFIUTATA";
|
||||
sbMain.AppendLine($"Stato: <b>{stato}</b>");
|
||||
}
|
||||
sbMain.AppendLine($"Periodo: <b>{currItem.DtStart}</b> --> <b>{currItem.DtEnd}</b>");
|
||||
sbMain.AppendLine($"Note: <b>{currItem.Note}</b>");
|
||||
sbMain.AppendLine("<hr/>");
|
||||
sbMain.AppendLine($"Cliccare sul <a href=\"{urlRedir}\">seguente link</a> per accedere alla pagina di gestione");
|
||||
|
||||
string msgBody = sbMain.ToString();
|
||||
await sendEmail(emailDest, $"Nuovo record Richiesta {currItem.CodGiust} Dipendente", msgBody.Replace($"{Environment.NewLine}", "<br/>"));
|
||||
string subj = isNew ? $"Nuovo record Richiesta {currItem.CodGiust} Dipendente" : $"Aggiornamento Richiesta n.{currItem.IdxRegRich} ({currItem.CodGiust})";
|
||||
await sendEmail(emailDest, subj, msgBody.Replace($"{Environment.NewLine}", "<br/>"));
|
||||
}
|
||||
// invalido la cache...
|
||||
await ExecFlushRedisPattern($"{rKeyDipendenti}:*");
|
||||
|
||||
@@ -179,7 +179,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
|
||||
|
||||
await Task.Delay(1);
|
||||
isSendingData = true;
|
||||
isSendingData = true;
|
||||
sendDataVal = 0;
|
||||
sendDataNextVal = 90;
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 4.1.2409.1117</h4>
|
||||
<h4>Versione: 4.1.2409.1118</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.1.2409.1117
|
||||
4.1.2409.1118
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>4.1.2409.1117</version>
|
||||
<version>4.1.2409.1118</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>
|
||||
|
||||
Reference in New Issue
Block a user