diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor index ea5ed0a..a3e89c3 100644 --- a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor @@ -6,6 +6,6 @@ else { @foreach (var item in CurrBaseDoorOp) { - + } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs index 1d311f3..0518018 100644 --- a/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/BaseParamList.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using WebDoorCreator.Data.DbModels; +using WebDoorCreator.UI.Data; namespace WebDoorCreator.UI.Components.DoorDef { @@ -13,6 +14,9 @@ namespace WebDoorCreator.UI.Components.DoorDef [Parameter] public List? CurrBaseDoorOp { get; set; } = null; + [Inject] + protected WebDoorCreatorService WDService { get; set; } = null!; + #endregion Public Properties #region Protected Properties @@ -22,6 +26,14 @@ namespace WebDoorCreator.UI.Components.DoorDef /// protected string userLang { get; set; } = "EN"; + protected async Task doSaveParams(DoorOpModel savingDoorOp) + { + if (savingDoorOp != null) + { + await WDService.DoorOpUpdate(savingDoorOp); + } + } + #endregion Protected Properties } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor index cc7d992..dd73f06 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor @@ -1,12 +1,43 @@ -
-
@BlockDoorOp.ObjectId
-
- -@if (bdpList != null) +@if (bdpList != null) { - foreach (var item in bdpList) - { - - } -
+
+
+
+
@BlockDoorOp.ObjectId
+
+ @foreach (var item in bdpList) + { + + } +
+
+
+ @if (paramsChanged) + { +
+
+ + +
+
+ } + else + { +
+
+ + +
+
+ } +
+
} \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs index f6e0835..96a20b5 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDataBlock.razor.cs @@ -34,7 +34,14 @@ namespace WebDoorCreator.UI.Components.DoorDef /// [Parameter] public DoorOpModel BlockDoorOp { get; set; } = null!; + /// + /// Evento per salvataggio oggetto serializzato + /// + [Parameter] + public EventCallback E_doorOp2Save { get; set; } + protected string userLang { get; set; } = "EN"; + protected bool paramsChanged { get; set; } = false; /// /// spacchetto componenti @@ -80,6 +87,7 @@ namespace WebDoorCreator.UI.Components.DoorDef protected async Task doSaveBlock(Dictionary> updSet) { + await Task.Delay(1); if (bdpList != null) { if (updSet != null && updSet.Count > 0) @@ -88,7 +96,17 @@ namespace WebDoorCreator.UI.Components.DoorDef if (bdpList.ContainsKey(currSet.Key)) { bdpList[currSet.Key] = currSet.Value; + paramsChanged = true; // serializzo e salvo, rimandando evento ad obj contenitore + var serVal2Save = JsonConvert.SerializeObject(bdpList); + + if (serVal2Save != null) + { + BlockDoorOp.JsoncActVal = serVal2Save; + + await E_doorOp2Save.InvokeAsync(BlockDoorOp); + await InvokeAsync(StateHasChanged); + } // FixMe ToDo !!! } diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor index a3cd51d..c955700 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor @@ -10,6 +10,7 @@ else
@HwCode
+ @doCheckVal() @foreach (var item in currVal) { @if (isCombo(item.Key)) @@ -38,32 +39,7 @@ else } } - @if (doCheckVal()) - { -
-
- - -
-
- } - else - { -
-
- - -
-
- } + diff --git a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs index cc2911a..c7392c9 100644 --- a/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs +++ b/WebDoorCreator.UI/Components/DoorDef/DoorDefSizingSI.razor.cs @@ -41,10 +41,19 @@ namespace WebDoorCreator.UI.Components.DoorDef #region Protected Properties + Dictionary _currVal = new Dictionary(); + /// /// Array dati effettivo x gestione modifiche /// - protected Dictionary currVal { get; set; } = new Dictionary(); + protected Dictionary currVal + { + get => _currVal; + set + { + _currVal = value; + } + } [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -89,6 +98,10 @@ namespace WebDoorCreator.UI.Components.DoorDef if (k.Value != currValRef[k.Key]) { answ = true; + if (answ) + { + Task.Run(async () => await doSave()); + } } } }