118 lines
3.3 KiB
C#
118 lines
3.3 KiB
C#
using EgwCoreLib.Lux.Data.DbModel.Cost;
|
|
using EgwCoreLib.Lux.Data.DbModel.Items;
|
|
using EgwCoreLib.Lux.Data.DbModel.Task;
|
|
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
|
using EgwCoreLib.Lux.Data.Services;
|
|
using Lux.UI.Components.Compo;
|
|
using Lux.UI.Components.Compo.JobTask;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
|
|
namespace Lux.UI.Components.Pages
|
|
{
|
|
public partial class JobRoute
|
|
{
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected DataLayerServices DLService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void ResetSearch()
|
|
{
|
|
searchVal = "";
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private JobTaskModel? editRecord = null;
|
|
private bool isLoading = false;
|
|
private List<CostDriverModel> ListCostDrivers = new List<CostDriverModel>();
|
|
private List<JobTaskModel> ListJobTask = new List<JobTaskModel>();
|
|
private List<PhaseModel> ListPhases = new List<PhaseModel>();
|
|
private List<ResourceModel> ListResources = new List<ResourceModel>();
|
|
private List<JobStepModel>? ListStep = null;
|
|
private List<string> ListTagsAvailable = new List<string>();
|
|
private JobTaskModel? selRecord = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private string mainCss
|
|
{
|
|
get => selRecord == null ? "col-6" : "col-4";
|
|
}
|
|
|
|
private string searchVal { get; set; } = string.Empty;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ForceReloadAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
var rawTags = await DLService.TagsGetAllAsync();
|
|
ListTagsAvailable = rawTags.Select(x => x.CodTag).ToList();
|
|
ListCostDrivers = await DLService.CostDriverGetAllAsync();
|
|
ListPhases = await DLService.PhasesGetAllAsync();
|
|
ListResources = await DLService.ResourcesGetAllAsync();
|
|
ListJobTask = await DLService.JobTaskGetAllAsync();
|
|
ListStep = null;
|
|
isLoading = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reload dettagli ciclo
|
|
/// </summary>
|
|
/// <param name="args"></param>
|
|
/// <returns></returns>
|
|
private async Task ReloadDetail(bool args)
|
|
{
|
|
if (selRecord != null)
|
|
{
|
|
ListStep = await DLService.JobStepGetAsync(selRecord.JobID);
|
|
}
|
|
else
|
|
{
|
|
ListStep = null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Salva ID sel e mostra dettagli JobTask
|
|
/// </summary>
|
|
/// <param name="selRec"></param>
|
|
private async Task ShowDetail(JobTaskModel? selRec)
|
|
{
|
|
selRecord = selRec;
|
|
// ricarico dal DB
|
|
if (selRec != null)
|
|
{
|
|
ListStep = await DLService.JobStepGetAsync(selRec.JobID);
|
|
}
|
|
else
|
|
{
|
|
ListStep = null;
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |