102 lines
2.6 KiB
C#
102 lines
2.6 KiB
C#
namespace Lux.UI.Components.Pages
|
|
{
|
|
public partial class SellItems
|
|
{
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
isLoading = true;
|
|
await ReloadBaseData();
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private SellingItemModel? editRecord = null;
|
|
|
|
private bool isLoading = false;
|
|
|
|
private List<ItemGroupModel> ListItemGroup = new List<ItemGroupModel>();
|
|
private List<JobTaskModel> ListJobTask = new List<JobTaskModel>();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private FiltSelect CurrFilt { get; set; } = new FiltSelect();
|
|
|
|
[Inject]
|
|
private IDataLayerServices DLService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IItemGroupService IGService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IItemService IService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IJobTaskService JTService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private ISellingItemService SIService { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void DoAdd()
|
|
{
|
|
editRecord = new SellingItemModel()
|
|
{
|
|
Cost = 0,
|
|
Description = $"Nuovo PRODOTTO {DateTime.Today:ddd yyyy.MM.dd}",
|
|
ExtItemCode = "NEW-PROD",
|
|
Envir = CurrFilt.Envir,
|
|
IsService = false,
|
|
ItemCode = 0,
|
|
Margin = 0,
|
|
SupplCode = "",
|
|
UM = "#"
|
|
};
|
|
}
|
|
|
|
private void DoCancel()
|
|
{
|
|
editRecord = null;
|
|
}
|
|
|
|
private async Task DoSaveSelItem(SellingItemModel currRec)
|
|
{
|
|
isLoading = true;
|
|
// salvo
|
|
await SIService.UpsertAsync(currRec);
|
|
editRecord = null;
|
|
await Task.Delay(100);
|
|
isLoading = false;
|
|
}
|
|
|
|
private void EditSellItem(SellingItemModel editRec)
|
|
{
|
|
editRecord = editRec;
|
|
}
|
|
|
|
private async Task ReloadBaseData()
|
|
{
|
|
ListItemGroup = await IGService.GetAllAsync();
|
|
ListJobTask = await JTService.GetAllAsync();
|
|
isLoading = false;
|
|
}
|
|
|
|
private void UpdateFilt(FiltSelect newFilt)
|
|
{
|
|
isLoading = true;
|
|
CurrFilt = newFilt;
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |