115 lines
2.9 KiB
C#
115 lines
2.9 KiB
C#
using MagMan.Core.Services;
|
|
using MagMan.Data.Admin.DbModels;
|
|
using MagMan.Data.Admin.Services;
|
|
using MagMan.Data.Tenant.DbModels;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components;
|
|
using YamlDotNet.Core.Tokens;
|
|
|
|
namespace MagMan.UI.Pages
|
|
{
|
|
[Authorize(Roles = "SuperAdmin, Admin, User")]
|
|
public partial class WareHouse : ComponentBase, IDisposable
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
AppMService.EA_CustomerSel -= AppMService_EA_CustomerSel;
|
|
AppMService.EA_KeySel -= AppMService_EA_KeySel;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected int nKey = 0;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MessageService AppMService { get; set; } = null!;
|
|
|
|
protected string mainCss
|
|
{
|
|
get => MaterialSel == null ? "col-12" : "col-6 small";
|
|
}
|
|
|
|
[Inject]
|
|
protected MTAdminService MTService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
AppMService.ShowSearch = true;
|
|
AppMService.ShowCustomers = true;
|
|
AppMService.PageName = "Magazzino";
|
|
AppMService.PageIcon = "fa-solid fa-warehouse pr-2";
|
|
AppMService.EA_CustomerSel += AppMService_EA_CustomerSel;
|
|
AppMService.EA_KeySel += AppMService_EA_KeySel;
|
|
CustomerID = AppMService.CustomerID;
|
|
nKey = AppMService.KeyNum;
|
|
// rileggo dati
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void SaveItem(RawItemModel selRawItem)
|
|
{
|
|
RawItemSel = selRawItem;
|
|
}
|
|
|
|
protected void SaveMat(MaterialModel? newMat)
|
|
{
|
|
MaterialSel = newMat;
|
|
RawItemSel = null;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private MaterialModel? MaterialSel = null;
|
|
|
|
private RawItemModel? RawItemSel = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private int CustomerID { get; set; } = 0;
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async void AppMService_EA_CustomerSel()
|
|
{
|
|
CustomerID = AppMService.CustomerID;
|
|
//await Task.Delay(1);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
private async void AppMService_EA_KeySel()
|
|
{
|
|
nKey = AppMService.KeyNum;
|
|
//await Task.Delay(1);
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
isLoading = true;
|
|
await Task.Delay(50);
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |