Aggiunta planner vuoto
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
@using EgwCoreLib.Lux.Core.Generic
|
||||
|
||||
<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 TodayText="Oggi"
|
||||
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="Month.January" MaxAppointmentsInSlot="3" />
|
||||
<RadzenYearView StartMonth="Month.January" />
|
||||
</ChildContent>
|
||||
</RadzenScheduler>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
using EgwCoreLib.Lux.Core.Generic;
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Radzen;
|
||||
using Radzen.Blazor;
|
||||
using static WebWindowComplex.TableComp;
|
||||
|
||||
namespace Lux.UI.Components.Compo.Planner
|
||||
{
|
||||
public partial class CalendarPlanner
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public DtUtils.Periodo CurrPeriodo { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DateTime> EC_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 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; }
|
||||
|
||||
[Parameter]
|
||||
public bool ShowNeedConf { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected RadzenScheduler<EventDto> scheduler = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected DialogService DialogService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int selectedIndex = 2;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int cMonth { get; set; } = 3;
|
||||
|
||||
private List<EventDto> EvDtoFilt { get; set; } = new List<EventDto>();
|
||||
|
||||
private string schedHeight { get; set; } = "height: 50rem;";
|
||||
|
||||
private DateTime SelDate { get; set; } = DateTime.Today;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sistemazione colore sfonto di ogni evento mostrato
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
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};";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione evento per display
|
||||
/// </summary>
|
||||
/// <param name="selEv"></param>
|
||||
/// <returns></returns>
|
||||
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 string currView { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Gestione richeista caricamento dati dal controllo x avere nuovo set da mostrare
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
private async Task OnLoadData(SchedulerLoadDataEventArgs args)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currView = scheduler.SelectedView.Text.ToLowerInvariant();
|
||||
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 = dtMid;
|
||||
await EC_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 EC_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 EC_DtReq.InvokeAsync(SelDate);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
@using EgwCoreLib.Lux.Core.Generic
|
||||
@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).TotalDays < 1 && model.CodTipo != "FER")
|
||||
{
|
||||
<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>
|
||||
}
|
||||
@if (!model.Conf)
|
||||
{
|
||||
<li class="list-group-item text-center bg-danger text-warning">
|
||||
<b>NON CONFERMATO</b>
|
||||
</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;
|
||||
get => 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<ol class="list-group">
|
||||
<li class="list-group-item align-items-lg-start bg-success text-light d-flex justify-content-between">
|
||||
<div class="px-0">Job Eseguiti</div>
|
||||
@if (QueueAll.Count > 0 && EnableReset)
|
||||
{
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-warning" @onclick="() => ResetQueue()">Reset All <i class="fa-solid fa-arrow-turn-up"></i></button>
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
@if (QueuePaged == null || QueuePaged?.Count() == 0)
|
||||
{
|
||||
<li class="list-group-item align-items-lg-start">Nessun Job Eseguito!</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in QueuePaged)
|
||||
{
|
||||
<li class="list-group-item align-items-lg-start">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
@item
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => ReRunJob(item)"><i class="fa-solid fa-share-from-square" title="Riesecuzione Estimate"></i> Re-Run</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
@if (totalCount >= numRecord)
|
||||
{
|
||||
<nav>
|
||||
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</nav>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_ReRunJob { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_ResetQueue { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<string> QueueAll { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public string QueueType { get; set; } = "Run";
|
||||
|
||||
[Parameter]
|
||||
public bool EnableReset { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task ReRunJob(string? JobCode)
|
||||
{
|
||||
await EC_ReRunJob.InvokeAsync(JobCode);
|
||||
}
|
||||
|
||||
protected async Task ResetQueue()
|
||||
{
|
||||
await EC_ResetQueue.InvokeAsync(QueueType);
|
||||
}
|
||||
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// pagina attuale
|
||||
/// </summary>
|
||||
private int currPage = 1;
|
||||
|
||||
/// <summary>
|
||||
/// elementi per pagina
|
||||
/// </summary>
|
||||
private int numRecord = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Numero tot records
|
||||
/// </summary>
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private IEnumerable<string>? QueuePaged { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Filtro e paginazione
|
||||
/// </summary>
|
||||
private void UpdateTable()
|
||||
{
|
||||
// fix paginazione
|
||||
QueuePaged = QueueAll
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord);
|
||||
totalCount = QueueAll.Count();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
@@ -32,13 +32,13 @@
|
||||
</div>
|
||||
}
|
||||
</li>
|
||||
@if (ListRecords == null || ListRecords?.Count() == 0)
|
||||
@if (QueueRunPaged == null || QueueRunPaged?.Count() == 0)
|
||||
{
|
||||
<li class="list-group-item align-items-lg-start">Nessun Job Eseguito!</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in ListRecords)
|
||||
foreach (var item in QueueRunPaged)
|
||||
{
|
||||
<li class="list-group-item align-items-lg-start">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
@@ -14,11 +14,14 @@ namespace Lux.UI.Components.Compo.WorkLoad
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_ResetQueue { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<string> QueueWait { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> QueueRun { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> QueueWait { get; set; } = new List<string>();
|
||||
public List<string> QueueDone { get; set; } = new List<string>();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -79,7 +82,8 @@ namespace Lux.UI.Components.Compo.WorkLoad
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private IEnumerable<string>? ListRecords { get; set; } = null;
|
||||
private IEnumerable<string>? QueueRunPaged { get; set; } = null;
|
||||
private IEnumerable<string>? QueueDonePaged { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -91,7 +95,7 @@ namespace Lux.UI.Components.Compo.WorkLoad
|
||||
private void UpdateTable()
|
||||
{
|
||||
// fix paginazione
|
||||
ListRecords = QueueRun
|
||||
QueueRunPaged = QueueRun
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord);
|
||||
totalCount = QueueRun.Count();
|
||||
|
||||
Reference in New Issue
Block a user