172 lines
4.1 KiB
C#
172 lines
4.1 KiB
C#
using EgwCoreLib.Razor;
|
|
using Microsoft.AspNetCore.Components;
|
|
using SHERPA.AD.Data;
|
|
using SHERPA.Data.DbModels;
|
|
|
|
namespace SHERPA.AD.Pages
|
|
{
|
|
public partial class Customers
|
|
{
|
|
#region Protected Fields
|
|
|
|
protected bool isLoading = false;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected SelectCli ActFilter { get; set; } = new SelectCli();
|
|
|
|
protected int currPage
|
|
{
|
|
get => ActFilter.CurrPage;
|
|
set => ActFilter.CurrPage = value;
|
|
}
|
|
|
|
protected List<vSelTipoModel> ListSelTipo { get; set; } = new List<vSelTipoModel>();
|
|
|
|
protected int numRecord
|
|
{
|
|
get => ActFilter.NumRecord;
|
|
set => ActFilter.NumRecord = value;
|
|
}
|
|
|
|
[Inject]
|
|
protected SADDataService SDService { get; set; } = null!;
|
|
|
|
protected string SearchVal
|
|
{
|
|
get => ActFilter.SearchVal;
|
|
set => ActFilter.SearchVal = value;
|
|
}
|
|
|
|
protected int SelAnno
|
|
{
|
|
get => ActFilter.Anno;
|
|
set => ActFilter.Anno = value;
|
|
}
|
|
|
|
protected string SelTipo
|
|
{
|
|
get => ActFilter.CodTipo;
|
|
set => ActFilter.CodTipo = value;
|
|
}
|
|
|
|
protected bool showAll
|
|
{
|
|
get => ActFilter.ShowFilt;
|
|
set => ActFilter.ShowFilt = value;
|
|
}
|
|
|
|
protected Toggler.SelectGlobalToggle toggleSync { get; set; } = new Toggler.SelectGlobalToggle();
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
ActFilter.EditEnab = true;
|
|
SelAnno = DateTime.Today.Year;
|
|
ListSelTipo = await SDService.VSelTipoGetAll();
|
|
toggleSync.leftString = "Tutti";
|
|
toggleSync.rightString = "Filtro Tipo Doc + Anno";
|
|
}
|
|
|
|
protected void SetCount(int newNum)
|
|
{
|
|
if (totalCount != newNum)
|
|
{
|
|
totalCount = newNum;
|
|
}
|
|
}
|
|
|
|
protected void SetCurrPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
}
|
|
|
|
protected void SetNumRec(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private string mainCss
|
|
{
|
|
get => SelRecord == null ? "col-12" : "col-8 pe-0";
|
|
}
|
|
|
|
private CustomerModel? SelRecord { get; set; } = null;
|
|
private int totalCount { get; set; } = 0;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Processa task cancel edit
|
|
/// </summary>
|
|
private async Task doEditCancel(bool reload)
|
|
{
|
|
if (reload)
|
|
{
|
|
isLoading = true;
|
|
SelRecord = null;
|
|
await Task.Delay(1);
|
|
isLoading = false;
|
|
}
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Processa task update record
|
|
/// </summary>
|
|
private async Task doEditSave(CustomerModel itemSel)
|
|
{
|
|
isLoading = true;
|
|
await SDService.CustomerUpdate(itemSel);
|
|
SelRecord = null;
|
|
isLoading = false;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
private void ResetAnno()
|
|
{
|
|
SelAnno = DateTime.Today.Year;
|
|
}
|
|
|
|
private void ResetSearch()
|
|
{
|
|
SearchVal = "";
|
|
}
|
|
|
|
private void ResetTipo()
|
|
{
|
|
SelTipo = "*";
|
|
}
|
|
|
|
private void SetClonedRec(CustomerModel itemSel)
|
|
{
|
|
// imposto filtro toggle + ricerca...
|
|
toggleSync.isActive = false;
|
|
SearchVal = itemSel.RagSoc ?? "";
|
|
}
|
|
|
|
private void SetCurrRec(CustomerModel itemSel)
|
|
{
|
|
SelRecord = itemSel;
|
|
}
|
|
|
|
private void updToggSync(Toggler.SelectGlobalToggle newTogg)
|
|
{
|
|
currPage = 1;
|
|
showAll = newTogg.isActive;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |