128 lines
3.2 KiB
C#
128 lines
3.2 KiB
C#
using EgwCoreLib.Lux.Data.Services.Utils;
|
|
|
|
namespace Lux.UI.Components.Pages
|
|
{
|
|
public partial class Template
|
|
{
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await base.OnInitializedAsync();
|
|
await Task.Delay(100);
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool fullPageDetail = false;
|
|
private bool isLoading = true;
|
|
|
|
private string searchVal = "";
|
|
|
|
private TemplateModel? SelRecord = null;
|
|
|
|
private TemplateModel? EditRecord = null;
|
|
|
|
private EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS CurrEnvir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
|
|
|
private Enums.ItemSourceType CurrSourceType = Enums.ItemSourceType.Jwd;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private string detailCss
|
|
{
|
|
get => fullPageDetail ? "col-12" : "col-6";
|
|
}
|
|
|
|
private string mainCss
|
|
{
|
|
get => SelRecord != null ? "col-6" : "col-12";
|
|
}
|
|
|
|
private string tableCss
|
|
{
|
|
get => EditRecord == null ? "shadow shadow-sm" : "";
|
|
}
|
|
|
|
private string btnResetCss
|
|
{
|
|
get => string.IsNullOrEmpty(searchVal) ? "btn-outline-secondary" : "btn-primary";
|
|
}
|
|
|
|
private string SearchVal
|
|
{
|
|
get => searchVal;
|
|
set
|
|
{
|
|
if (searchVal != value)
|
|
{
|
|
searchVal = value;
|
|
}
|
|
}
|
|
}
|
|
[Inject]
|
|
private ITemplateService TService { get; set; } = default!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void DoClose()
|
|
{
|
|
SelRecord = null;
|
|
EditRecord = null;
|
|
}
|
|
/// <summary>
|
|
/// Salva record ed avanza compilazione
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
private async Task DoSave(TemplateModel updRec)
|
|
{
|
|
// salvo record
|
|
await TService.UpsertAsync(updRec);
|
|
EditRecord = null;
|
|
SelRecord = null;
|
|
}
|
|
|
|
private void DoAdd()
|
|
{
|
|
DateTime adesso = DateTime.Now;
|
|
EditRecord = new TemplateModel()
|
|
{
|
|
Name = $"New Template {adesso.Year}",
|
|
Description = $"Nuovo Template {adesso:ddd yyyy.MM.dd HH:mm:ss}",
|
|
Envir = CurrEnvir,
|
|
SourceType = CurrSourceType
|
|
};
|
|
}
|
|
private void DoSelect(TemplateModel selrec)
|
|
{
|
|
SelRecord = selrec;
|
|
}
|
|
|
|
private void DoEdit(TemplateModel editrec)
|
|
{
|
|
EditRecord = editrec;
|
|
SelRecord = null;
|
|
}
|
|
|
|
private void ResetSearch()
|
|
{
|
|
searchVal = "";
|
|
}
|
|
|
|
private Task ToggleFull(bool setFull)
|
|
{
|
|
fullPageDetail = setFull;
|
|
return InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |