244 lines
5.9 KiB
C#
244 lines
5.9 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using SHERPA.BBM.CORE.DbModels;
|
|
using SHERPA.BBM.UI.Data;
|
|
|
|
namespace SHERPA.BBM.UI.Components
|
|
{
|
|
public partial class OrderFilt
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<SelData> FilterUpdated { get; set; }
|
|
|
|
[Parameter]
|
|
public int SelBaskId
|
|
{
|
|
get => CurrFilt.BasketId;
|
|
set
|
|
{
|
|
if (CurrFilt.BasketId != value)
|
|
{
|
|
CurrFilt.BasketId = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public int SelCustId
|
|
{
|
|
get => CurrFilt.CustomerId;
|
|
set
|
|
{
|
|
if (CurrFilt.CustomerId != value)
|
|
{
|
|
CurrFilt.CustomerId = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public int SelDocId
|
|
{
|
|
get => CurrFilt.DocId;
|
|
set
|
|
{
|
|
if (CurrFilt.DocId != value)
|
|
{
|
|
CurrFilt.DocId = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public int SelYearRef
|
|
{
|
|
get => CurrFilt.YearSel;
|
|
set
|
|
{
|
|
if (CurrFilt.YearSel != value)
|
|
{
|
|
CurrFilt.YearSel = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public string Title { get; set; } = "NA";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadAllData();
|
|
}
|
|
|
|
protected async Task ReloadAllData()
|
|
{
|
|
YearsList = await BBMService.DocsYears();
|
|
BasketList = await BBMService.BasketsGetAsync(1, 0);
|
|
DocsList = await BBMService.DocsGetAsync(CurrFilt.SearchVal, CurrFilt.YearSel, CurrFilt.BasketId, CurrFilt.NegotiationId, false);
|
|
CustomersList = await BBMService.CustomersGetAll("");
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<CustomersModel>? CustomersList;
|
|
|
|
private List<int> YearsList = new List<int>();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private List<vBasketsDataModel>? BasketList { get; set; } = null;
|
|
|
|
[Inject]
|
|
private BBM_EFService BBMService { get; set; } = null!;
|
|
|
|
private string cssBtnResBask
|
|
{
|
|
get => CurrFilt.BasketId == 1 ? "btn btn-secondary" : "btn btn-primary";
|
|
}
|
|
|
|
private string cssBtnResCli
|
|
{
|
|
get => CurrFilt.CustomerId == 0 ? "btn btn-secondary" : "btn btn-primary";
|
|
}
|
|
|
|
private string cssBtnResDoc
|
|
{
|
|
get => CurrFilt.DocId == 0 ? "btn btn-secondary" : "btn btn-primary";
|
|
}
|
|
|
|
private string cssBtnResYear
|
|
{
|
|
get => CurrFilt.YearSel == 0 ? "btn btn-secondary" : "btn btn-primary";
|
|
}
|
|
|
|
private SelData CurrFilt { get; set; } = new SelData();
|
|
private List<vDocsDataModel>? DocsList { get; set; } = null;
|
|
|
|
private int numRecord { get; set; } = 10;
|
|
|
|
private int selBasketId
|
|
{
|
|
get
|
|
{
|
|
return CurrFilt.BasketId;
|
|
}
|
|
set
|
|
{
|
|
if (CurrFilt.BasketId != value)
|
|
{
|
|
CurrFilt.BasketId = value;
|
|
FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
}
|
|
|
|
private int selCustomerId
|
|
{
|
|
get
|
|
{
|
|
return CurrFilt.CustomerId;
|
|
}
|
|
set
|
|
{
|
|
if (CurrFilt.CustomerId != value)
|
|
{
|
|
CurrFilt.CustomerId = value;
|
|
FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
}
|
|
|
|
private int selDocId
|
|
{
|
|
get
|
|
{
|
|
return CurrFilt.DocId;
|
|
}
|
|
set
|
|
{
|
|
if (CurrFilt.DocId != value)
|
|
{
|
|
CurrFilt.DocId = value;
|
|
FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
}
|
|
|
|
private int yearSel
|
|
{
|
|
get
|
|
{
|
|
return CurrFilt.YearSel;
|
|
}
|
|
set
|
|
{
|
|
if (CurrFilt.YearSel != value)
|
|
{
|
|
CurrFilt.YearSel = value;
|
|
FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ResetBasket()
|
|
{
|
|
if (CurrFilt.BasketId != 1)
|
|
{
|
|
CurrFilt.BasketId = 1;
|
|
await FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
|
|
private async Task ResetCli()
|
|
{
|
|
if (CurrFilt.CustomerId != 0)
|
|
{
|
|
CurrFilt.CustomerId = 0;
|
|
await FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
|
|
private async Task ResetDoc()
|
|
{
|
|
if (CurrFilt.DocId != 0)
|
|
{
|
|
CurrFilt.DocId = 0;
|
|
await FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
|
|
private async Task ResetYear()
|
|
{
|
|
if (CurrFilt.YearSel != 0)
|
|
{
|
|
CurrFilt.YearSel = 0;
|
|
await FilterUpdated.InvokeAsync(CurrFilt);
|
|
}
|
|
}
|
|
|
|
private string trimTxt(string txtOrig, int maxChar)
|
|
{
|
|
string answ = txtOrig;
|
|
if (txtOrig.Length > maxChar)
|
|
{
|
|
answ = $"{txtOrig.Substring(0, maxChar - 3)}...";
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |