105 lines
2.7 KiB
C#
105 lines
2.7 KiB
C#
namespace Lux.UI.Components.Pages
|
|
{
|
|
public partial class Items
|
|
{
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
isLoading = true;
|
|
await ReloadBaseData();
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private ItemModel? editRecItem = 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()
|
|
{
|
|
editRecItem = new ItemModel()
|
|
{
|
|
CodGroup = ListItemGroup.FirstOrDefault()?.CodGroup ?? "",
|
|
ItemType = Enums.ItemClassType.ND,
|
|
IsService = false,
|
|
ItemCode = 0,
|
|
ExtItemCode = "NEW-ITEM",
|
|
SupplCode = "",
|
|
Description = $"Nuovo ITEM {DateTime.Today:ddd yyyy.MM.dd}",
|
|
Cost = 0,
|
|
Margin = 0,
|
|
QtyMin = 0,
|
|
QtyMax = 0,
|
|
UM = "#"
|
|
};
|
|
}
|
|
|
|
private void DoCancel()
|
|
{
|
|
editRecItem = null;
|
|
}
|
|
|
|
private async Task DoSaveItem(ItemModel currRec)
|
|
{
|
|
isLoading = true;
|
|
// salvo
|
|
await IService.UpsertAsync(currRec);
|
|
editRecItem = null;
|
|
await Task.Delay(100);
|
|
isLoading = false;
|
|
}
|
|
|
|
private void EditItem(ItemModel editRec)
|
|
{
|
|
editRecItem = 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
|
|
}
|
|
} |