From 6a35c5c871fff3d5501d254c8cffc2a2dc593afe Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 10 Oct 2025 09:40:51 +0200 Subject: [PATCH] Fix validazione preliminare liste parametri --- Test.UI/Components/Pages/EditJWD.razor | 14 +- Test.UI/Components/Pages/EditJWD.razor.cs | 97 +- WebWindowComplex/DTO/BaseListPayload.cs | 14 +- WebWindowComplex/TableComp.razor | 1602 +++++++++-------- WebWindowComplex/TableComp.razor.cs | 246 +-- WebWindowComplex/WebWindowComplex.csproj | 24 +- .../WebWindowConfigurator.csproj | 24 +- 7 files changed, 1017 insertions(+), 1004 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor b/Test.UI/Components/Pages/EditJWD.razor index 48e4a75..4b6c9cb 100644 --- a/Test.UI/Components/Pages/EditJWD.razor +++ b/Test.UI/Components/Pages/EditJWD.razor @@ -10,6 +10,7 @@ EC_OnClose="CloseObj"> + @if (!string.IsNullOrEmpty(outClose)) {
@@ -25,16 +26,3 @@ else if (!string.IsNullOrEmpty(outSave))

@currJwd

- -@* - IN_ColorMaterialList="@AvailColorMaterialList" - IN_FamilyHardwareList="@AvailFamilyHardwareList" - IN_GlassList="@AvailGlassList" - IN_HardwareList="@AvailHardwareList" - IN_MaterialList="@AvailMaterialList" - LiveSVG="@currSvg" - CurrJwd="@InitialJwd" - IN_SelFamilyHardware="@SelFamilyHardware" - IN_SelColorMaterial="@SelColorMaterial" - IN_SelMaterial="@SelMaterial" - IN_SelGlass="@SelGlass" *@ \ No newline at end of file diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index c32518f..20a632a 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -14,9 +14,15 @@ namespace Test.UI.Components.Pages { public partial class EditJWD : IDisposable { - #region Public Properties + + #region Public Fields public string InitialJwd = ""; + + #endregion Public Fields + + #region Public Properties + public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", ""); #endregion Public Properties @@ -32,32 +38,36 @@ namespace Test.UI.Components.Pages #region Protected Fields + /// + /// Predisposizione valori live SVG/JWD + /// + protected LivePayload CurrData = new LivePayload(); + protected string currJwd = "..."; - protected string prevJwd = ""; protected Dictionary m_CurrArgs = new Dictionary(); + protected string prevJwd = ""; + /// + /// Configurazione elenchi anagrafiche + /// + protected BaseListPayload SetupList = new BaseListPayload(); #endregion Protected Fields #region Protected Properties - protected List AvailTemplateList { get; set; } = new List(); - protected List AvailHardwareList { get; set; } = new List(); - protected List AvailFamilyHardwareList { get; set; } = new List() - { - new string("Arc"), - new string("Profilo78") - }; protected List AvailColorMaterialList { get; set; } = new List() { new string("White"), new string("Black"), new string("Blu") }; - protected List AvailMaterialList { get; set; } = new List() + + protected List AvailFamilyHardwareList { get; set; } = new List() { - new string("Pino"), - new string("Abete") + new string("Arc"), + new string("Profilo78") }; + protected List AvailGlassList { get; set; } = new List() { new string("Vetro BE 2S 4/12/4"), @@ -67,11 +77,15 @@ namespace Test.UI.Components.Pages new string("Vetro BE 2S 4T/12/4T"), new string("Vetro BE 2S 4T/16/4T") }; - protected string SelFamilyHardware { get; set; } = ""; - protected string SelColorMaterial { get; set; } = ""; - protected string SelMaterial { get; set; } = ""; - protected string SelGlass { get; set; } = ""; + protected List AvailHardwareList { get; set; } = new List(); + protected List AvailMaterialList { get; set; } = new List() + { + new string("Pino"), + new string("Abete") + }; + + protected List AvailTemplateList { get; set; } = new List(); [Inject] protected IConfiguration Config { get; set; } = null!; @@ -86,6 +100,11 @@ namespace Test.UI.Components.Pages get => (MarkupString)currJwd.Replace(Environment.NewLine, "
").Replace(" ", " "); } + protected string SelColorMaterial { get; set; } = ""; + protected string SelFamilyHardware { get; set; } = ""; + protected string SelGlass { get; set; } = ""; + protected string SelMaterial { get; set; } = ""; + #endregion Protected Properties #region Protected Methods @@ -93,10 +112,6 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); - //SelFamilyHardware = "Natura"; - //SelColorMaterial = "Black"; - //SelColorMaterial = "Pine"; - //SelGlass = "4T/16/4T"; InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati @@ -107,6 +122,8 @@ namespace Test.UI.Components.Pages ColorMaterial = AvailColorMaterialList, FamilyHardware = AvailFamilyHardwareList, Glass = AvailGlassList, + //Hardware = new List(), + //Material = new List(), Hardware = AvailHardwareList, Material = AvailMaterialList, TemplateDTO = null @@ -119,16 +136,6 @@ namespace Test.UI.Components.Pages DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; } - - /// - /// Configurazione elenchi anagrafiche - /// - protected BaseListPayload SetupList = new BaseListPayload(); - /// - /// Predisposizione valori live SVG/JWD - /// - protected LivePayload CurrData = new LivePayload(); - #endregion Protected Methods #region Private Fields @@ -136,14 +143,15 @@ namespace Test.UI.Components.Pages private string apiUrl = ""; private string calcTag = ""; private string CalcUid = "CurrWindow"; - private string cFileTemplate = "Data/Setup.json"; private string cFileHardware = "Hardware/Setup.json"; + private string cFileTemplate = "Data/Setup.json"; private TemplateSelectDTO? currSel = null; private string currSvg = ""; - private string imgBasePath = ""; private string GenericBasePath = ""; - + private string imgBasePath = ""; + private string outClose = ""; + private string outSave = ""; private string subChannel = ""; private string windowUid = "CurrWindow"; @@ -169,6 +177,16 @@ namespace Test.UI.Components.Pages await Task.Delay(1); } + /// + /// Effettua chiusura oggetto con eventuale save + /// + /// + private void CloseObj(bool reqSave) + { + outClose = !reqSave ? "Richiesto chiusura!" : ""; + outSave = reqSave ? "Richiesto salvataggio!" : ""; + } + private void ConfInit() { apiUrl = Config.GetValue("ServerConf:Prog.ApiUrl") ?? ""; @@ -252,18 +270,5 @@ namespace Test.UI.Components.Pages } #endregion Private Methods - - /// - /// Effettua chiusura oggetto con eventuale save - /// - /// - private void CloseObj(bool reqSave) - { - outClose = !reqSave ? "Richiesto chiusura!" : ""; - outSave = reqSave ? "Richiesto salvataggio!" : ""; - } - - private string outClose = ""; - private string outSave = ""; } } \ No newline at end of file diff --git a/WebWindowComplex/DTO/BaseListPayload.cs b/WebWindowComplex/DTO/BaseListPayload.cs index e0ba2bf..f9ece32 100644 --- a/WebWindowComplex/DTO/BaseListPayload.cs +++ b/WebWindowComplex/DTO/BaseListPayload.cs @@ -50,7 +50,6 @@ namespace WebWindowComplex.DTO /// public bool IsValid() { - //bool templateOK = TemplateDTO != null && TemplateDTO.Count > 0; bool famHwOK = FamilyHardware != null && FamilyHardware.Count > 0; bool hwOK = Hardware != null && Hardware.Count > 0; bool glassOK = Glass != null && Glass.Count > 0; @@ -58,5 +57,18 @@ namespace WebWindowComplex.DTO bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0; return famHwOK && glassOK && hwOK && colorOK && matOK; } + /// + /// Verifica che Payload sia almeno parzialmente popolato + /// + /// + public bool IsPopulated() + { + bool famHwOK = FamilyHardware != null && FamilyHardware.Count > 0; + bool hwOK = Hardware != null && Hardware.Count > 0; + bool glassOK = Glass != null && Glass.Count > 0; + bool matOK = Material != null && Material.Count > 0; + bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0; + return famHwOK || glassOK || hwOK || colorOK || matOK; + } } } diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index c9d5e7f..4015483 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -1,855 +1,881 @@ 
-
-
-
-
-
- -
-
-
- @if (currStep != CompileStep.Template) - { - - } -
-
- -
-
- -
-
+ @if (isLoading) + { + + } + else + { + + @if (validErrors != null && validErrors.Count > 0) + { +
+
Errori validazione!
+
+ +
    + @foreach (var item in validErrors) + { +
  • @item
  • + } +
-
-
- @if (string.IsNullOrEmpty(LiveData.CurrJwd)) - { - @if (currStep == CompileStep.Template && ListPayload.TemplateDTO != null) - { - - - - - - - - - - @foreach (var item in ListPayload.TemplateDTO) + } + else + { +
+
+
+
+
+
- - - - - } - -
#ImageDescription
@item.Index@item.Description
- } - } - @if (currStep == CompileStep.Tree) - { -
- - - @for (int i = 0; i < ItemTableList.Count; i++) - { - - @for (int j = 0; j < m_maxCol; j++) + - } - else - { - - } + } - + else + { + + } + } - -
- - @FillTable(i, j)
+ @if (FrameWindow != null) + { + + + } + +
+
+
+ @if (currStep != CompileStep.Template) + { + + } +
+
+ +
+
+ +
+
- - } - else if (currStep == CompileStep.Frame) - { - @if (m_CurrWindow != null) - { - m_PreviousWindow = m_CurrWindow; - } -
-
-
-
-
-
-
-
-
-

Frame

-
-
-
-
-
- - -
-
-
-
-
-
-
Dimension
- @foreach (FrameDimension dimension in FrameWindow.DimensionList) +
+
+
+ @if (string.IsNullOrEmpty(LiveData.CurrJwd)) + { + @if (currStep == CompileStep.Template && ListPayload.TemplateDTO != null) + { + + + + + + + + + + @foreach (var item in ListPayload.TemplateDTO) + { + string colorClass = ""; + @if (SelTemplateDTO != null && item.Index == SelTemplateDTO.Index) + colorClass = "table-success"; + else + colorClass = ""; + + + + + + } + +
#ImageDescription
@item.Index@item.Description
+ } + } + @if (currStep == CompileStep.Tree) + { +
+ + + @for (int i = 0; i < ItemTableList.Count; i++) + { + + @for (int j = 0; j < m_maxCol; j++) + { + CompileStep cs = CompileStep.Frame; + int ind = -1; + @if (j + 1 == ItemTableList[i].Col) + { + @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) { -
- @dimension.sName - - mm -
+ cs = CompileStep.Frame; } - -
-
Threshold
-
- - -
-
- -
-
-
-
-
-
Joints
-
-
-
- -
-
-
-
- -
-
-
-
- -
+ else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + cs = CompileStep.Split; + ind = ItemTableList[i].IndexItem; + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) + { + cs = CompileStep.Sash; + ind = ItemTableList[i].IndexItem; + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) + { + cs = CompileStep.Fill; + ind = ItemTableList[i].IndexItem; + } +
+ } + else + { + + } + } + + } + +
+ + @FillTable(i, j)
+
+ + } + else if (currStep == CompileStep.Frame) + { + @if (m_CurrWindow != null) + { + m_PreviousWindow = m_CurrWindow; + } +
+
+
+
+
+
+
+
+
+

Frame

- @foreach (Joint joint in FrameWindow.JointList) - { +
- - + + + + + + + +
- } -
-
-
- @if (m_SashList.Count == 0) - { -
-
Bottom rail
-
+
+
+
+
+
Dimension
+ @foreach (FrameDimension dimension in FrameWindow.DimensionList) + { +
+ @dimension.sName + + mm +
+ } +
+
+
Threshold
- Quantity - + +
- } -
- -
-
-
- @if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0)) - { -
-
-
-
-

Area frame

-
- @if (SashList.Count == 0 && SplitList.Count == 0) - { - -
- -
- } -
-
- @if (!(FrameWindow.AreaList[0] is Split)) - { -
- -
- } -
-
-
-
- } -
-
-
-
-
- } - else if (currStep == CompileStep.Split) - { - @if (currSplit >= SplitList.Count || currSplit == -1) - { - currStep = CompileStep.Tree; - } - else - { - Split item = SplitList[currSplit]; -
-
-
-
-
-
-
-
-
-
@(descParentSplit(item))
-
-
-
-
-
+
+
+
-
-
Split
+
+
Joints
-
- @if ((item.nSplitQtyVert == 1 && item.nSplitQtyHoriz == 0) || (item.nSplitQtyVert == 0 && item.nSplitQtyHoriz == 1)) - { -
- -
- } -
-
+
- + +
+
+
+
+ +
+
+
+
+
-
+ @foreach (Joint joint in FrameWindow.JointList) + {
- - + + +
-
-
-
- @if (item.nSplitQtyVert > 0) - { -
-
- QtyVert - -
-
- } - @if (item.nSplitQtyHoriz > 0) - { -
-
- QtyHoriz - -
-
}
-
- @if (item.SplitVertList.Count > 0 && item.SplitHorizList.Count > 0) - { -
- @foreach (var dim in item.SplitVertList) - { -
- Width - - % -
- } -
-
- @foreach (var dim in item.SplitHorizList) - { -
- Height - - % -
- - } -
- } - else if (item.SplitHorizList.Count > 0) - { - @foreach (var dim in item.SplitHorizList) - { -
-
- Height - - % -
-
- } - } - else if (item.SplitVertList.Count > 0) - { - @foreach (var dim in item.SplitVertList) - { -
-
- Width - - % -
-
- } - } -
- @if (item.SelSplitShape == Json.WindowConst.SplitShapes.GRID) +
+
+ @if (m_SashList.Count == 0) {
-
-
-
- -
-
- -
-
+
Bottom rail
+
+
+
+ Quantity +
}
-
-
-
-
-
-
-
-
-
- } - } - else if (currStep == CompileStep.Sash) - { - @if (currSash >= SashList.Count || currSash == -1) - { - currStep = CompileStep.Tree; - } - else - { - Sash item = SashList[currSash]; -
-
-
-
-
-
-
-
-
- @if (SashList.Count > 1) - { -

Window @(currSash + 1)

- } - else - { -

Window

- } -
-
-
- -
-
-
-
-
-
- Qty sash - -
-
-
-
-
-
- - -
-
-
-
- Qty bottom rail - -
-
-
-
-
-
-
-
-
Joints
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- @foreach (Joint joint in item.JointList) - { -
-
- - -
-
- }
-
-
-
-
Hardware
-
-
-
-
-
- - -
-
- - -
-
-
-
-
-
-
-
-
-
- @for (int i = 0; i <= item.SashList.Count / 2; i++) - { - for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) - { - SashDimension sash = item.SashList[i * 2 + j]; - Area anta; - @if (item.AreaList[i * 2 + j] is Splitted) - { - anta = item.AreaList[i * 2 + j]; - } - else - { - anta = item; - } -
- @if (item.SashList.Count == 1) - { -
Sash
- } - else - { -
Sash @(i * 2 + j + 1)
- } -
- - -
-
- Dimension - - % -
-
-
- -
-
- -
-
- @if (!(anta.AreaList[0] is Split)) - { -
-
-
- -
-
-
-
- -
-
-
- } -
- @for (int k = 0; k <= item.SashList.Count - 1; k++) - { - @if (k != i * 2 + j) - { - int IndexCopy = k; - int IndexModify = i * 2 + j; -
-
- -
-
- } - } -
-
- - } - } -
-
-
-
-
-
-
-
- } - } - else if (currStep == CompileStep.Fill) - { - @if (currFill >= FillList.Count || currFill == -1) - { - currStep = CompileStep.Tree; - } - else - { - Fill item = FillList[currFill]; -
-
-
-
-
-
-
-
-
-

Fill @(currFill + 1)

-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
Selected all fill
-
-
-
- -
-
-
-
- -
-
-
-
-
- @foreach(var currSplitted in SplittedList) - @* @for (int i = 0; i < SplittedList.Count; i++) *@ - { - @* Splitted currSplitted = SplittedList[i]; *@ - @if (currSplitted.AreaList[0].Equals(item)) + @if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0)) {
-
- @if (SplittedList.Count > 1) - { -

Area split @(SplittedList.IndexOf(currSplitted) + 1)

- } - else - { -

Area split

- } -
-
- -
+

Area frame

- @foreach(var Index in SashList) - @* @for (int j = 0; j < SashList.Count; j++) *@ - { - @* int Index = j; *@ -
+
+ @if (SashList.Count == 0 && SplitList.Count == 0) + { +
- +
-
- } + } +
+
+ @if (!(FrameWindow.AreaList[0] is Split)) + { +
+ +
+ } +
} - } +
-
- } - } - else if (currStep == CompileStep.General) - { -
-
-
-
-
-
-
-
-
-
General
+ } + else if (currStep == CompileStep.Split) + { + @if (currSplit >= SplitList.Count || currSplit == -1) + { + currStep = CompileStep.Tree; + } + else + { + Split item = SplitList[currSplit]; +
+
+
+
+
+
+
+
+
+
@(descParentSplit(item))
+
+
+
+
+
+
+
+
Split
+
+
+ @if ((item.nSplitQtyVert == 1 && item.nSplitQtyHoriz == 0) || (item.nSplitQtyVert == 0 && item.nSplitQtyHoriz == 1)) + { +
+ +
+ } +
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ @if (item.nSplitQtyVert > 0) + { +
+
+ QtyVert + +
+
+ } + @if (item.nSplitQtyHoriz > 0) + { +
+
+ QtyHoriz + +
+
+ } +
+
+ @if (item.SplitVertList.Count > 0 && item.SplitHorizList.Count > 0) + { +
+ @foreach (var dim in item.SplitVertList) + { +
+ Width + + % +
+ } +
+
+ @foreach (var dim in item.SplitHorizList) + { +
+ Height + + % +
+ + } +
+ } + else if (item.SplitHorizList.Count > 0) + { + @foreach (var dim in item.SplitHorizList) + { +
+
+ Height + + % +
+
+ } + } + else if (item.SplitVertList.Count > 0) + { + @foreach (var dim in item.SplitVertList) + { +
+
+ Width + + % +
+
+ } + } +
+ @if (item.SelSplitShape == Json.WindowConst.SplitShapes.GRID) + { +
+
+
+
+ +
+
+ +
+
+
+
+ } +
+
+
+
-
-
-
- - +
+
+
+
+
+
+ + +
+
+
+
+ Qty bottom rail + +
+
+
+
+
+
+
+
+
Joints
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ @foreach (Joint joint in item.JointList) + { +
+
+ + +
+
+ } + +
+
+
+
+
Hardware
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+ @for (int i = 0; i <= item.SashList.Count / 2; i++) { - + for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) + { + SashDimension sash = item.SashList[i * 2 + j]; + Area anta; + @if (item.AreaList[i * 2 + j] is Splitted) + { + anta = item.AreaList[i * 2 + j]; + } + else + { + anta = item; + } +
+ @if (item.SashList.Count == 1) + { +
Sash
+ } + else + { +
Sash @(i * 2 + j + 1)
+ } +
+ + +
+
+ Dimension + + % +
+
+
+ +
+
+ +
+
+ @if (!(anta.AreaList[0] is Split)) + { +
+
+
+ +
+
+
+
+ +
+
+
+ } +
+ @for (int k = 0; k <= item.SashList.Count - 1; k++) + { + @if (k != i * 2 + j) + { + int IndexCopy = k; + int IndexModify = i * 2 + j; +
+
+ +
+
+ } + } +
+
+ + } } - -
-
- - +
-
-
-
-
-
Fill type
-
-
-
- - +
+
+
+
+ } + } + else if (currStep == CompileStep.Fill) + { + @if (currFill >= FillList.Count || currFill == -1) + { + currStep = CompileStep.Tree; + } + else + { + Fill item = FillList[currFill]; +
+
+
+
+
+
+
+
+
+

Fill @(currFill + 1)

+
+
+
+ +
+
+
+
+ +
+
-
- - +
+
+
+
Selected all fill
+
+
+
+ +
+
+
+
+ +
+
-
-
-
Color
+ @foreach (var currSplitted in SplittedList) + @* @for (int i = 0; i < SplittedList.Count; i++) *@ + { + @* Splitted currSplitted = SplittedList[i]; *@ + @if (currSplitted.AreaList[0].Equals(item)) + { +
+
+
+
+ @if (SplittedList.Count > 1) + { +

Area split @(SplittedList.IndexOf(currSplitted) + 1)

+ } + else + { +

Area split

+ } +
+
+
+ +
+
+ @foreach (var Index in SashList) + @* @for (int j = 0; j < SashList.Count; j++) *@ + { + @* int Index = j; *@ +
+
+ +
+
+ } +
+
+
+ } + } +
+
+
+
+
+ } + } + else if (currStep == CompileStep.General) + { +
+
+
+
+
+
+
+
+
+
General
+
-
- - +
+
+ + +
+
+ + +
-
- - +
+
+
+
+
+
Fill type
+
+
+
+ + +
+
+ + +
+
+
+
+
+
Color
+
+
+
+ + +
+
+ + +
+
@@ -859,18 +885,18 @@
-
+ }
- } +
-
-
- @if (currStep != CompileStep.Template) - { -
- @outSvg -
+ @if (currStep != CompileStep.Template) + { +
+ @outSvg +
+ } + } }
diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 5e372b3..0845818 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -49,6 +49,12 @@ namespace WebWindowComplex [Parameter] public EventCallback> EC_OnUpdate { get; set; } + /// + /// Sollevo evento errore validazione con una lista di errori rilevati + /// + [Parameter] + public EventCallback> EC_ValidError { get; set; } + /// /// Elenco anagrafiche di base /// @@ -85,122 +91,6 @@ namespace WebWindowComplex #endregion Protected Fields -#if false - [Parameter] - public string CurrJwd - { - get => m_CurrJwd; - set - { - // Se viene passato un JWD - if (m_CurrJwd != value && value != "") - { - m_CurrJwd = value; - // Aggiornati parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - if (m_CurrWindow != null) - { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; - m_CurrWindow = null; - } - m_CurrWindow = WindowFromJson.Deserialize(); - m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // Recupero dimensioni Frame e Joint del frame della finestra precedente - if (m_PreviousWindow != null) - { - for (int i = 0; i < 2; i++) - m_CurrWindow.AreaList[0].DimensionList[i] = m_PreviousWindow.AreaList[0].DimensionList[i]; - for (int i = 0; i < 4; i++) - m_CurrWindow.AreaList[0].JointList[i] = m_PreviousWindow.AreaList[0].JointList[i]; - } - } - if (m_CurrWindow != null) - { - // Aggiornate liste di sash, split, splitted, fill e itemTable - UpdateLists(); - } - } - } - [Parameter] - public string LiveSVG - { - get => m_SelSVG; - set => m_SelSVG = value; - } -#endif - -#if false - [Parameter] - public Template IN_SelTemplate - { - get => m_SelTemplate; - set - { - // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione - if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD)) - { - m_SelTemplate = value; - // Aggiornamento parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - if (m_CurrWindow != null) - { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; - m_CurrWindow = null; - } - m_CurrWindow = WindowFromJson.Deserialize(); - m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - // Recupero dimensioni Frame e Joint del frame della finestra precedente - if (m_PreviousWindow != null) - { - for (int i = 0; i < 2; i++) - m_CurrWindow.AreaList[0].DimensionList[i] = m_PreviousWindow.AreaList[0].DimensionList[i]; - for (int i = 0; i < 4; i++) - m_CurrWindow.AreaList[0].JointList[i] = m_PreviousWindow.AreaList[0].JointList[i]; - } - } - if (m_CurrWindow != null) - { - // Aggiornamento liste sash, split, splitted, fill e itemTable - UpdateLists(); - } - } - } - - [Parameter] - public List IN_TemplateDTOList { get; set; } = null!; - - [Parameter] - public List IN_FamilyHardwareList { get; set; } = null!; - - [Parameter] - public List IN_HardwareList { get; set; } = null!; - - [Parameter] - public List IN_ColorMaterialList { get; set; } = null!; - - [Parameter] - public List IN_MaterialList { get; set; } = null!; - - [Parameter] - public List IN_GlassList { get; set; } = null!; -#endif - -#if false - [Parameter] - public string IN_SelFamilyHardware { get; set; } = null!; - - [Parameter] - public string? IN_SelColorMaterial { get; set; } = null; - - [Parameter] - public string? IN_SelMaterial { get; set; } = null; - - [Parameter] - public string? IN_SelGlass { get; set; } = null; -#endif - #region Protected Enums protected enum CompileStep @@ -669,66 +559,114 @@ namespace WebWindowComplex editLock = false; // reset variabile errori bError = false; + validErrors = new List(); } + protected override void OnAfterRender(bool firstRender) + { + isLoading = false; + } + + /// + /// Booleana fase loading + /// + private bool isLoading = false; + /// /// Gestione update post ricezione parametri da controllo chiamante /// protected override async Task OnParametersSetAsync() { - bool updateSvg = false; - // controllo elenchi BasePayload siano validi... - if (ListPayload.IsValid()) + isLoading = true; + // SOLO SE sono presenti... + if (ListPayload.IsPopulated() && LiveData.IsValid()) { - // controllo sia popolato anche per la componente LIVE - if (LiveData.IsValid()) + bool updateSvg = false; + validErrors = new List(); + // controllo elenchi BasePayload siano validi... + if (ListPayload.IsValid()) { - // SOLO SE modificato live data... - if (prevLiveData == null || !prevLiveData.Equals(LiveData)) + // controllo sia popolato anche per la componente LIVE + if (LiveData.IsValid()) { - prevLiveData = new LivePayload() + // SOLO SE modificato live data... + if (prevLiveData == null || !prevLiveData.Equals(LiveData)) { - CurrJwd = LiveData.CurrJwd, - SvgPreview = LiveData.SvgPreview - }; - m_SelSVG = LiveData.SvgPreview; - // Aggiornati parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - //SOLO SE non sono in edit... - if (!editLock) + prevLiveData = new LivePayload() + { + CurrJwd = LiveData.CurrJwd, + SvgPreview = LiveData.SvgPreview + }; + m_SelSVG = LiveData.SvgPreview; + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); + JsonWindow WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + setCurrWindow(WindowFromJson); + //SOLO SE non sono in edit... + if (!editLock) + { + currStep = CompileStep.Tree; + } + updateSvg = true; + } + } + else if (CurrSelection != null && CurrSelection.Template != null) + { + // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione + if (m_SelTemplate == null || (m_SelTemplate != null && CurrSelection.Template.nIndex != m_SelTemplate.nIndex) && !string.IsNullOrEmpty(CurrSelection.Template.JWD)) { - currStep = CompileStep.Tree; + m_SelTemplate = CurrSelection.Template; + // Aggiornamento parametri di ingresso selezionati + UpdateSelParameter(); + JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + setCurrWindow(WindowFromJson); + currStep = CompileStep.Template; } updateSvg = true; } - } - else if (CurrSelection != null && CurrSelection.Template != null) - { - // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione - if (m_SelTemplate == null || (m_SelTemplate != null && CurrSelection.Template.nIndex != m_SelTemplate.nIndex) && !string.IsNullOrEmpty(CurrSelection.Template.JWD)) + if (SashList.Count > 0) { - m_SelTemplate = CurrSelection.Template; - // Aggiornamento parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - currStep = CompileStep.Template; + currAnta = 0; + } + if (updateSvg) + { + await DoPreviewSvg(); } - updateSvg = true; } - if (SashList.Count > 0) + else { - currAnta = 0; - } - if (updateSvg) - { - await DoPreviewSvg(); + // verifico 1:1 le liste e indico cosa manca + if (ListPayload.Hardware == null || ListPayload.Hardware.Count == 0) + { + validErrors.Add("Missing Hardware List!"); + } + else + { + if (ListPayload.FamilyHardware == null || ListPayload.FamilyHardware.Count == 0) + { + validErrors.Add("Missing Famly HW List!"); + } + } + if (ListPayload.Glass == null || ListPayload.Glass.Count == 0) + { + validErrors.Add("Missing Glass List!"); + } + if (ListPayload.Material == null || ListPayload.Material.Count == 0) + { + validErrors.Add("Missing Material List!"); + } + if (ListPayload.ColorMaterial == null || ListPayload.ColorMaterial.Count == 0) + { + validErrors.Add("Missing ColorMaterial List!"); + } } + isLoading = false; } } - + /// + /// Elenco errori preliminari di validazione + /// + private List validErrors = new List(); protected void setCurrWindow(JsonWindow WindowFromJson) { if (m_CurrWindow != null) diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 13688c3..d6131cb 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.918 + 2.7.10.1009 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -123,6 +123,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 7c2a0b7..be92b44 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.918 + 2.7.10.1009 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -159,6 +159,28 @@ + + + + + + + + + + + + + + + + + + + + + +