Fix conteggio istanze in HwDetails
This commit is contained in:
@@ -4,11 +4,7 @@
|
||||
@if (HwToShow != null)
|
||||
{
|
||||
<div class="row m-0">
|
||||
<HardwareNewPanel HwInst="getInstNumber(HwToShow.Value)" HwLabel="@HwToShow.Label" E_act2Rel="setRefOnDelete" Lingua="@Lingua" HwCode="@HwToShow.TableName" HwAdded="@hwAdd" DoorId="@DoorId"></HardwareNewPanel>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-info" @onclick="()=>backToList()">BACK TO LIST</button>
|
||||
<HardwareNewPanel HwLabel="@HwToShow.Label" E_act2Rel="setRefOnDelete" Lingua="@Lingua" HwCode="@HwToShow.TableName" HwAdded="@hwAdd" DoorId="@DoorId"></HardwareNewPanel>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
|
||||
@@ -47,12 +47,6 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task backToList()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
HwToShow = null;
|
||||
}
|
||||
|
||||
protected async Task hwToAdd()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -250,6 +244,7 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
{
|
||||
if (isDel)
|
||||
{
|
||||
HwToShow = null;
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,14 @@ else
|
||||
{
|
||||
@if (DoorOpList != null)
|
||||
{
|
||||
@*<div class="text-center">
|
||||
<div class="row col-4">
|
||||
<div class="rectangle">
|
||||
@(translate(HwLabel))
|
||||
<div class="circle" @onclick="()=>hwToAdd()"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@(()=> backToList())" ObjId="@HwCode" ItemName="Back to List" ItemCount="0" ShowPlus="false" ImagePath=""></HwSvgObj>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4">
|
||||
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExePlus="@(()=> hwToAdd(""))" ObjId="@HwCode" ItemName="@(translate(HwLabel))" ItemCount="@HwInst" ShowPlus="true" ImagePath=""></HwSvgObj>
|
||||
</div>
|
||||
</div>*@
|
||||
<div class="row col-4">
|
||||
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExePlus="@(()=> hwToAdd(""))" ObjId="@HwCode" ItemName="@(translate(HwLabel))" ItemCount="@HwInst" ShowPlus="true" ImagePath=""></HwSvgObj>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using WebDoorCreator.Data;
|
||||
using WebDoorCreator.Data.DbModels;
|
||||
using WebDoorCreator.UI.Components.DoorMan;
|
||||
using WebDoorCreator.UI.Data;
|
||||
using static WebDoorCreator.UI.Data.WDCRefreshService;
|
||||
|
||||
@@ -33,25 +31,81 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
[Parameter]
|
||||
public string HwLabel { get; set; } = "";
|
||||
|
||||
[Parameter]
|
||||
public int HwInst { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string Lingua { get; set; } = "EN";
|
||||
|
||||
[CascadingParameter]
|
||||
public string UserId { get; set; } = "";
|
||||
|
||||
protected bool _isDoorOpConf { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
WDCRefresh.EA_ConfDoorOp -= WDCRefresh_EA_ConfDoorOp;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<DoorOpModel>? DoorOpList { get; set; } = null!;
|
||||
protected bool _isDoorOpConf { get; set; } = false;
|
||||
|
||||
protected bool B_doorOpUpd
|
||||
{
|
||||
get => WDCRService.isDoorOpUpd;
|
||||
set => WDCRService.isDoorOpUpd = value;
|
||||
}
|
||||
|
||||
protected List<DoorOpModel> DoorOp2ModList { get; set; } = new List<DoorOpModel>();
|
||||
|
||||
protected List<DoorOpModel>? DoorOpList { get; set; } = null!;
|
||||
|
||||
protected int HwInst
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (DoorOpList != null)
|
||||
{
|
||||
answ = DoorOpList
|
||||
.Where(x => x.ObjectId == HwCode)
|
||||
.ToList()
|
||||
.Count();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
//protected int instNum { get; set; } = 1;
|
||||
|
||||
protected bool isLoading { get; set; } = false;
|
||||
|
||||
protected List<DoorOpModel>? ListRecord { get; set; } = null;
|
||||
|
||||
[Inject]
|
||||
protected WDCRefreshService WDCRefresh { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WDCRefreshService WDCRService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WDCVocabularyService WDVService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task backToList()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await E_act2Rel.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected int getDoorOpInstNum(int doorOpId)
|
||||
{
|
||||
int answ = 0;
|
||||
@@ -62,56 +116,6 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
return answ + 1;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected WDCRefreshService WDCRefresh { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
||||
[Inject]
|
||||
protected WDCVocabularyService WDVService { get; set; } = null!;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
WDCRefresh.EA_ConfDoorOp -= WDCRefresh_EA_ConfDoorOp;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
|
||||
//return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected string translate(string lemma)
|
||||
{
|
||||
string answ = "";
|
||||
|
||||
answ = WDVService.Traduci(Lingua, lemma);
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void WDCRefresh_EA_ConfDoorOp(object? sender, EventArgs e)
|
||||
{
|
||||
DOPEventArgs currArgs = (DOPEventArgs)e;
|
||||
// SE sono sula porta indicata + objId corretto --> refresh
|
||||
if (currArgs.DoorId == DoorId && currArgs.ObjectId == HwCode)
|
||||
{
|
||||
var pupd = InvokeAsync(async () => await ReloadData());
|
||||
}
|
||||
}
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool B_doorOpUpd
|
||||
{
|
||||
get => WDCRService.isDoorOpUpd;
|
||||
set => WDCRService.isDoorOpUpd = value;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected WDCRefreshService WDCRService { get; set; } = null!;
|
||||
protected async Task hwToAdd(string message)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -236,22 +240,21 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
await Task.Delay(1);
|
||||
B_doorOpUpd = true;
|
||||
DoorOp2ModList.Add(currItem);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
|
||||
//return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
protected bool isLoading { get; set; } = false;
|
||||
|
||||
protected List<DoorOpModel>? ListRecord { get; set; } = null;
|
||||
|
||||
protected async Task setRefOnDelete(bool isDel)
|
||||
{
|
||||
if (isDel)
|
||||
@@ -260,6 +263,19 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
}
|
||||
}
|
||||
|
||||
protected string translate(string lemma)
|
||||
{
|
||||
string answ = "";
|
||||
|
||||
answ = WDVService.Traduci(Lingua, lemma);
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
@@ -275,11 +291,20 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
DoorOpList = ListRecord.Where(x => (x.DoorId == DoorId) && (x.ObjectId == HwCode)).ToList();
|
||||
}
|
||||
isLoading = false;
|
||||
//await Task.Delay(50);
|
||||
//await Task.Delay(50);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void WDCRefresh_EA_ConfDoorOp(object? sender, EventArgs e)
|
||||
{
|
||||
DOPEventArgs currArgs = (DOPEventArgs)e;
|
||||
// SE sono sula porta indicata + objId corretto --> refresh
|
||||
if (currArgs.DoorId == DoorId && currArgs.ObjectId == HwCode)
|
||||
{
|
||||
var pupd = InvokeAsync(async () => await ReloadData());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user