Files
lux/Lux.UI/Components/Pages/Items.razor.cs
T
2025-09-19 18:54:25 +02:00

119 lines
2.9 KiB
C#

using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.Services;
using Lux.UI.Components.Compo;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace Lux.UI.Components.Pages
{
public partial class Items
{
#region Protected Fields
protected List<ItemGroupModel> ListItemGroup = new List<ItemGroupModel>();
#endregion Protected Fields
#region Protected Properties
protected ItemMan.FiltSelect CurrFilt { get; set; } = new ItemMan.FiltSelect();
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
protected string SearchVal
{
get => CurrFilt.SearchVal;
set
{
isLoading = true;
CurrFilt.SearchVal = value;
isLoading = false;
}
}
protected string SelCodGroup
{
get => CurrFilt.SelCodGroup;
set
{
if (CurrFilt.SelCodGroup != value)
{
isLoading = true;
CurrFilt.SelCodGroup = value;
isLoading = false;
}
}
}
protected EgwCoreLib.Lux.Core.Enums.ItemClassType SelType
{
get => CurrFilt.SelType;
set
{
if (CurrFilt.SelType != value)
{
isLoading = true;
CurrFilt.SelType = value;
isLoading = false;
}
}
}
#endregion Protected Properties
#region Protected Methods
protected void DoAdd()
{
editRecord = new ItemModel()
{
CodGroup = ListItemGroup.FirstOrDefault()?.CodGroup ?? "",
ItemType = EgwCoreLib.Lux.Core.Enums.ItemClassType.ND,
IsService = false,
ItemCode = 0,
ExtItemCode = "NEW-ITEM",
SupplCode = "",
Description = $"Nuova Offerta {DateTime.Today:ddd yyyy.MM.dd}",
Cost = 0,
Margin = 0,
QtyMin = 0,
QtyMax = 0,
UM = "#"
};
}
protected override async Task OnInitializedAsync()
{
isLoading = true;
await ReloadBaseData();
#if false
await ReloadData();
UpdateTable();
#endif
}
protected void ResetSearch()
{
SearchVal = "";
}
#endregion Protected Methods
#region Private Fields
private ItemModel? editRecord = null;
private bool isLoading = false;
#endregion Private Fields
#region Private Methods
private async Task ReloadBaseData()
{
ListItemGroup = await DLService.ItemGroupGetAllAsync();
}
#endregion Private Methods
}
}