206 lines
5.4 KiB
C#
206 lines
5.4 KiB
C#
using Blazored.SessionStorage;
|
|
using EgwCoreLib.Razor;
|
|
using Microsoft.AspNetCore.Components;
|
|
using WebDoorCreator.Data.DbModels;
|
|
using WebDoorCreator.Data.DTO;
|
|
using WebDoorCreator.Data.Services;
|
|
using WebDoorCreator.UI.Data;
|
|
using static WebDoorCreator.UI.Data.WDCRefreshService;
|
|
|
|
namespace WebDoorCreator.UI.Components.Order
|
|
{
|
|
public partial class OrderDets
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> E_isEmpty { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<DoorModel> E_SendDoor { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<DoorModel> E_SendDoorModal { get; set; }
|
|
|
|
[Parameter]
|
|
public OrderStatusViewModel? OrderView { get; set; }
|
|
|
|
protected int CurrOrdId { get; set; } = 0;
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
if (OrderView != null)
|
|
{
|
|
CurrOrdId = OrderView.OrderId;
|
|
}
|
|
}
|
|
|
|
public string userId
|
|
{
|
|
get
|
|
{
|
|
return WDCUService.userId;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Protected Fields
|
|
|
|
protected DataPager? pagerDoors = null!;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected DoorModel? currDoor { get; set; } = null;
|
|
protected int currDoorType { get; set; } = 0;
|
|
protected DDFDto CurrentConf { get; set; } = new DDFDto();
|
|
protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter();
|
|
|
|
/// <summary>
|
|
/// Unita' di misura selezionata
|
|
/// </summary>
|
|
protected string currMeaUnit { get; set; } = "mm";
|
|
|
|
protected List<DoorModel>? DoorsList { get; set; } = null;
|
|
protected WebDoorCreator.Data.DbModels.Edges edgesFirstInst { get; set; } = new WebDoorCreator.Data.DbModels.Edges();
|
|
protected int idOrd { get; set; } = -1;
|
|
|
|
[Inject]
|
|
protected NavigationManager NavManager { get; set; } = null!;
|
|
|
|
protected int orderStat { get; set; } = -1;
|
|
protected OrderStatusViewModel? OrderStatus { get; set; } = null;
|
|
protected List<int> pageSizeList { get; set; } = new List<int>() { 4, 8, 12, 16, 20, 24, 28, 64 };
|
|
protected string stepColor { get; set; } = "";
|
|
|
|
protected int totalCount { get; set; }
|
|
|
|
protected int userCurrCompany
|
|
{
|
|
get => WDCUService.userCurrComp;
|
|
}
|
|
|
|
[Inject]
|
|
protected WDCUserService WDCUService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected WebDoorCreatorService WDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task createDoor()
|
|
{
|
|
int doorId = await WDService.createDoor(idOrd, userId, currMeaUnit);
|
|
if (doorId > 0)
|
|
{
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
// rimando alla pagina... dettaglio...
|
|
NavManager.NavigateTo($"DoorDefinition?idOrd={idOrd}&idDoor={doorId}");
|
|
}
|
|
|
|
protected void ForceReload(int newNum)
|
|
{
|
|
numRecord = newNum;
|
|
currPage = 1;
|
|
}
|
|
|
|
protected void ForceReloadPage(int newNum)
|
|
{
|
|
currPage = newNum;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
string rawVal = await sessStorage.GetItemAsStringAsync("doorsSelFilt");
|
|
if (!string.IsNullOrEmpty(rawVal))
|
|
{
|
|
currFilter = await sessStorage.GetItemAsync<DoorsSelectFilter>("doorsSelFilt");
|
|
}
|
|
else
|
|
{
|
|
numRecord = 16;
|
|
}
|
|
}
|
|
|
|
protected async Task SetCurrDoor(DoorModel door)
|
|
{
|
|
await Task.Delay(1);
|
|
await E_SendDoor.InvokeAsync(door);
|
|
}
|
|
|
|
protected async Task SetCurrDoorModal(DoorModel door)
|
|
{
|
|
await Task.Delay(1);
|
|
await E_SendDoorModal.InvokeAsync(door);
|
|
}
|
|
|
|
protected async Task setEmpty()
|
|
{
|
|
await E_isEmpty.InvokeAsync(true);
|
|
}
|
|
|
|
protected async Task setStepColor(string StepColor)
|
|
{
|
|
await Task.Delay(1);
|
|
stepColor = StepColor;
|
|
StateHasChanged();
|
|
}
|
|
|
|
protected void UpdateTotCount(int newTotCount)
|
|
{
|
|
totalCount = newTotCount;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private int currPage
|
|
{
|
|
get => currFilter.CurrPage;
|
|
set
|
|
{
|
|
currFilter.CurrPage = value;
|
|
}
|
|
}
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
private int numRecord
|
|
{
|
|
get => currFilter.NumRec;
|
|
set
|
|
{
|
|
if (currFilter.NumRec != value)
|
|
{
|
|
currFilter.NumRec = value;
|
|
currPage = 1;
|
|
InvokeAsync(() => sessStorage.SetItemAsync<DoorsSelectFilter>("doorsSelFilt", currFilter));
|
|
}
|
|
}
|
|
}
|
|
|
|
private string searchValue
|
|
{
|
|
get => currFilter.searchValue;
|
|
set => currFilter.searchValue = value;
|
|
}
|
|
|
|
[Inject]
|
|
private ISessionStorageService sessStorage { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |