Componente con i template
This commit is contained in:
@@ -2,22 +2,39 @@
|
||||
@page "/Home"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
<PageTitle>Select template</PageTitle>
|
||||
|
||||
@if (isLoading)
|
||||
@if(SelTemplate == null)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
<WebWindowMaker TemplateDTOList="@AvailTemplateList"
|
||||
EC_OnSelectedTemplate="SetTemplate">
|
||||
</WebWindowMaker>
|
||||
}
|
||||
else
|
||||
{
|
||||
<WebWindowMaker IN_TemplateDTOList="@AvailTemplateList"
|
||||
IN_SelTemplate="@SelTemplate"
|
||||
EC_OnUpdate="SaveJWD"
|
||||
EC_OnSelectedTemplate="SetTemplate"
|
||||
LiveSVG="@currSvg">
|
||||
</WebWindowMaker>
|
||||
<TableComp ListPayload="SetupList"
|
||||
LiveData="CurrData"
|
||||
EC_ActionReq="DoAction"
|
||||
EC_DoUpdate="ExecRequest"
|
||||
EC_OnClose="CloseObj">
|
||||
</TableComp>
|
||||
<div class="card">
|
||||
<div class="card-body small">
|
||||
@JsonSer
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(outClose))
|
||||
{
|
||||
<div class="alert alert-danger fs-4">
|
||||
@outClose
|
||||
</div>
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(outSave))
|
||||
{
|
||||
<div class="alert alert-success fs-4">
|
||||
@outSave
|
||||
</div>
|
||||
}
|
||||
|
||||
@* <p>
|
||||
@m_CurrArgs.GetValueOrDefault("Jwd")
|
||||
</p> *@
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using WebWindowConfigurator;
|
||||
using WebWindowComplex;
|
||||
using Egw.Window.Data;
|
||||
using WebWindowComplex.DTO;
|
||||
using WebWindowConfigurator.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
@@ -12,7 +15,7 @@ namespace Test.UI.Components.Pages
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", "");
|
||||
public Template SelTemplate { get; set; } = null;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -21,14 +24,29 @@ namespace Test.UI.Components.Pages
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
||||
DLService.PipeShape.EA_NewMessage -= PipeShape_EA_NewMessage;
|
||||
DLService.PipeHwOpt.EA_NewMessage -= PipeHwOption_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Dictionary<int, string> currGroupShape = new Dictionary<int, string>();
|
||||
protected Dictionary<int, string> currHwOption = new Dictionary<int, string>();
|
||||
protected string currJwd = "";
|
||||
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
|
||||
protected string prevJwd = "";
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione elenchi anagrafiche
|
||||
/// </summary>
|
||||
protected BaseListPayload SetupList = new BaseListPayload();
|
||||
|
||||
/// <summary>
|
||||
/// Predisposizione valori live SVG/JWD
|
||||
/// </summary>
|
||||
protected LivePayload CurrData = new LivePayload();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
@@ -36,6 +54,49 @@ namespace Test.UI.Components.Pages
|
||||
|
||||
protected List<TemplateSelectDTO> AvailTemplateList { get; set; } = new List<TemplateSelectDTO>();
|
||||
|
||||
protected List<string> AvailColorMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("White"),
|
||||
new string("Black"),
|
||||
new string("Blu")
|
||||
};
|
||||
|
||||
protected List<string> AvailFamilyHardwareList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("ArTech"),
|
||||
new string("ArTechPlana")
|
||||
};
|
||||
|
||||
protected List<string> AvailGlassList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Vetro BE 2S 4/12/4"),
|
||||
new string("Vetro BE 2S 4/16/4"),
|
||||
new string("Vetro BE 3S 4/12/4/12/4"),
|
||||
new string("Vetro BE 3S 4/16/4/16/4"),
|
||||
new string("Vetro BE 2S 4T/12/4T"),
|
||||
new string("Vetro BE 2S 4T/16/4T")
|
||||
};
|
||||
|
||||
protected List<Hardware> AvailHardwareList { get; set; } = new List<Hardware>();
|
||||
|
||||
protected List<string> AvailMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Pino"),
|
||||
new string("Abete")
|
||||
};
|
||||
|
||||
protected List<string> AvailProfileList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Profilo78"),
|
||||
new string("ProfiloSaomad")
|
||||
};
|
||||
|
||||
protected List<Threshold> AvailThresholdList { get; set; } = new List<Threshold>()
|
||||
{
|
||||
new Threshold(1, "Bottom"),
|
||||
new Threshold(3, "Threshold")
|
||||
};
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
@@ -58,16 +119,26 @@ namespace Test.UI.Components.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
// JS interop or data fetches go here
|
||||
isInteractive = true;
|
||||
}
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
ConfInit();
|
||||
Random random = new Random();
|
||||
CalcUid = Convert.ToString(random.Next(1000, 10000));
|
||||
windowUid = CalcUid;
|
||||
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
||||
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
|
||||
DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private bool isLoading = false;
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -75,50 +146,40 @@ namespace Test.UI.Components.Pages
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string CalcUid = "CurrWindow";
|
||||
private string cFile = "Data/Setup.json";
|
||||
private string cFileTemplate = "Data/Setup.json";
|
||||
private TemplateSelectDTO? currSel = null;
|
||||
private string currSvg = "";
|
||||
private string channelHwOpt = "";
|
||||
private string channelShape = "";
|
||||
private string channelSvg = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
private string GenericBasePath = "";
|
||||
|
||||
private string subChannel = "";
|
||||
private string cFileHardware = "Hardware/Setup.json";
|
||||
|
||||
private string outClose = "";
|
||||
private string outSave = "";
|
||||
|
||||
private string windowUid = "CurrWindow";
|
||||
|
||||
/// <summary>
|
||||
/// Semaforo x definire se sia già in modalità ionterattiva o di prerendering
|
||||
/// </summary>
|
||||
private bool isInteractive = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string windowUid = "CurrWindow";
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// string answ = "";
|
||||
// if (currSel != null)
|
||||
// {
|
||||
// answ = currSel.SVGFileName.Replace(".svg", "");
|
||||
// }
|
||||
// return answ;
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// Effettua chiusura oggetto con eventuale save
|
||||
/// </summary>
|
||||
/// <param name="reqSave"></param>
|
||||
private void CloseObj(bool reqSave)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
outClose = !reqSave ? "Richiesto chiusura!" : "";
|
||||
outSave = reqSave ? "Richiesto salvataggio!" : "";
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
@@ -127,7 +188,118 @@ namespace Test.UI.Components.Pages
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
|
||||
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
|
||||
channelSvg = Config.GetValue<string>("ServerConf:ChannelSvg") ?? "";
|
||||
channelShape = Config.GetValue<string>("ServerConf:ChannelShape") ?? "";
|
||||
channelHwOpt = Config.GetValue<string>("ServerConf:ChannelHwOpt") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione azione richiesta
|
||||
/// </summary>
|
||||
/// <param name="actReq">Azione richiesta</param>
|
||||
private void DoAction(LayoutConst.DataAction actReq)
|
||||
{
|
||||
switch (actReq)
|
||||
{
|
||||
case LayoutConst.DataAction.None:
|
||||
break;
|
||||
|
||||
case LayoutConst.DataAction.ResetDictShape:
|
||||
CurrData.DictShape = new Dictionary<int, string>();
|
||||
break;
|
||||
|
||||
case LayoutConst.DataAction.ResetHwOpt:
|
||||
CurrData.DictOptionsXml = new Dictionary<int, string>();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExecRequest(Dictionary<string, string> CurrArgs)
|
||||
{
|
||||
// Proseguo solo se sono in interattivo (NO prerender pagina)
|
||||
if (isInteractive)
|
||||
{
|
||||
outClose = "";
|
||||
outSave = "";
|
||||
// verifico se contiene JWD, lo aggiorno
|
||||
if (CurrArgs.ContainsKey("SerializedData"))
|
||||
{
|
||||
currJwd = CurrArgs["SerializedData"];
|
||||
CurrData.CurrJwd = currJwd;
|
||||
}
|
||||
// se il SSE variato --> invio
|
||||
if (!currJwd.Equals(prevJwd) || !EgwCoreLib.Utils.DictUtils.DictAreEqual(m_CurrArgs, CurrArgs))
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
prevJwd = currJwd;
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void PipeHwOption_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.StartsWith($"{channelHwOpt}:{windowUid}") && currArgs.newMessage.Length > 2)
|
||||
{
|
||||
// deserializzo il dizionario delle risposte...
|
||||
Dictionary<int, string> rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage) ?? new Dictionary<int, string>();
|
||||
if (rawDict.Count > 0)
|
||||
{
|
||||
currHwOption = rawDict;
|
||||
CurrData.DictOptionsXml = currHwOption;
|
||||
}
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{channelSvg}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
CurrData.SvgPreview = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private async void PipeShape_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2)
|
||||
{
|
||||
if (currArgs.msgUid.StartsWith($"{channelShape}:{windowUid}"))
|
||||
{
|
||||
// deserializzo il dizionario delle risposte...
|
||||
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage);
|
||||
currGroupShape = rawDict ?? new Dictionary<int, string>();
|
||||
CurrData.DictShape = currGroupShape;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -136,13 +308,13 @@ namespace Test.UI.Components.Pages
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
// Caricamento lista Template
|
||||
AvailTemplateList = new List<TemplateSelectDTO>();
|
||||
await Task.Delay(100);
|
||||
// brutale, da rivedere...
|
||||
if (File.Exists(cFile))
|
||||
if (File.Exists(cFileTemplate))
|
||||
{
|
||||
string rawVal = File.ReadAllText(cFile);
|
||||
string rawVal = File.ReadAllText(cFileTemplate);
|
||||
var rawList = JsonConvert.DeserializeObject<List<TemplateSelectDTO>>(rawVal) ?? new List<TemplateSelectDTO>();
|
||||
|
||||
// calcolo URL immagini... DTO interno da rivedere?
|
||||
@@ -153,19 +325,16 @@ namespace Test.UI.Components.Pages
|
||||
AvailTemplateList.Add(item);
|
||||
}
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SaveJWD(Dictionary<string,string> CurrArgs)
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
if (currSel != null)
|
||||
// Caricamento lista hardware
|
||||
AvailHardwareList = new List<Hardware>();
|
||||
if (File.Exists(cFileHardware))
|
||||
{
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
string rawValHW = File.ReadAllText(cFileHardware);
|
||||
var rawListHW = JsonConvert.DeserializeObject<List<Hardware>>(rawValHW) ?? new List<Hardware>();
|
||||
foreach (var item in rawListHW)
|
||||
{
|
||||
AvailHardwareList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +348,17 @@ namespace Test.UI.Components.Pages
|
||||
rawVal = File.ReadAllText(selTemp.JwdFileName);
|
||||
}
|
||||
SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal);
|
||||
CurrData.CurrJwd = rawVal;
|
||||
SetupList = new BaseListPayload()
|
||||
{
|
||||
ColorMaterial = AvailColorMaterialList,
|
||||
FamilyHardware = AvailFamilyHardwareList,
|
||||
Glass = AvailGlassList,
|
||||
Hardware = AvailHardwareList,
|
||||
Material = AvailMaterialList,
|
||||
Profile = AvailProfileList,
|
||||
Threshold = AvailThresholdList
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.12.1812</Version>
|
||||
<Version>2.7.12.1917</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione JWD per LUX</Description>
|
||||
@@ -26,7 +26,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Egw.Window.Data" Version="2.7.10.2116" />
|
||||
<PackageReference Include="Egw.Window.Data" Version="2.7.12-beta.1917" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2511.312" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2511.312" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.21" />
|
||||
@@ -494,6 +494,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,679 +1,33 @@
|
||||
<div class="row">
|
||||
<div class="@mainCss()">
|
||||
<div class="card text-center table-svg">
|
||||
<div class="card-header" style="background-color: #d5f1f2;">
|
||||
<div class="row">
|
||||
<div class="col-8 d-grid gap-2 d-md-flex justify-content-md-start">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
@if (currStep == CompileStep.Template)
|
||||
{
|
||||
<a data-target="#Template" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Template)">Template</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a data-target="#Template" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Template)">Template</a>
|
||||
}
|
||||
</li>
|
||||
@if (FrameWindow != null)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a data-target="#Frame" class="@tabNavCss(CompileStep.Frame)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.Frame)">Frame</a>
|
||||
</li>
|
||||
@if (SplitList.Count > 0)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a data-target="#Split" class="@tabNavCss(CompileStep.Split)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.Split)">Split</a>
|
||||
</li>
|
||||
}
|
||||
@if (SashList.Count > 0)
|
||||
{
|
||||
@for (int i = 0; i < SashList.Count; i++)
|
||||
{
|
||||
int Index = i;
|
||||
<li class="nav-item">
|
||||
<a data-target="#Sash" class="@tabNavCss(CompileStep.Sash, Index)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.Sash, Index)">Sash @(SashList.Count == 1 ? "" : Index + 1)</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
<li class="nav-item">
|
||||
<a data-target="#Fill" class="@tabNavCss(CompileStep.Fill)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.Fill)">Fill</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a data-target="#General" class="@tabNavCss(CompileStep.General)" aria-current="true" @onclick="() => NextStepAndPreview(CompileStep.General)">General</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-4 d-grid gap-2 d-md-flex justify-content-md-end">
|
||||
@if (currStep != CompileStep.Template)
|
||||
{
|
||||
<div class="col-4">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoReset">Reset</button>
|
||||
</div>
|
||||
}
|
||||
<div class="col-4">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoSave">Save</button>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoClose">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body bg-transparent">
|
||||
<div class="text-center display-4">
|
||||
@if (currStep == CompileStep.Template)
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5>Template</h5>
|
||||
</div>
|
||||
<div class="card-body bg-transparent">
|
||||
<div class="text-center display-4">
|
||||
<table class="table table-hover align-middle">
|
||||
<thead class="fs-5">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col" class="col-4">Image</th>
|
||||
<th scope="col" class="text-start">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider fs-5">
|
||||
@foreach (var item in TemplateDTOList)
|
||||
{
|
||||
<table class="table table-hover align-middle">
|
||||
<thead class="fs-5">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col" class="col-4">Image</th>
|
||||
<th scope="col" class="text-start">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider fs-5">
|
||||
@foreach (var item in IN_TemplateDTOList)
|
||||
{
|
||||
string colorClass = "";
|
||||
@if (SelTemplateDTO != null && item.Index == SelTemplateDTO.Index)
|
||||
colorClass = "table-success";
|
||||
else
|
||||
colorClass = "";
|
||||
<tr style="height: 120px;" class="@colorClass" @onclick="() => DoSelect(item)">
|
||||
<td>@item.Index</td>
|
||||
<td><img class="img-fluid" width="100" src="@item.ImageUrl" /></td>
|
||||
<td class="text-start">@item.Description</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@if (currStep == CompileStep.Frame)
|
||||
{
|
||||
@if(m_CurrWindow != null)
|
||||
{
|
||||
m_PreviousWindow = m_CurrWindow;
|
||||
}
|
||||
<div class="container">
|
||||
<div class="row col-sm-6">
|
||||
<div class="text-start p-1 display-4">
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="FrameShape">Shape</label>
|
||||
<select class="form-select" id="FrameShape" @bind="@FrameWindow.SelShapeIndex">
|
||||
<option value="0">Rectangle</option>
|
||||
<option value="1">Right Chamfer</option>
|
||||
<option value="2">Left Chamfer</option>
|
||||
<option value="3">Double Chamfer</option>
|
||||
<option value="4">Arc</option>
|
||||
<option value="5">Arc Full</option>
|
||||
<option value="6">Double Arc</option>
|
||||
<option value="7">Triangle</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Dimension</h5>
|
||||
@foreach (FrameDimension dimension in FrameWindow.DimensionList)
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="NameDimFrame@(FrameWindow.DimensionList.IndexOf(dimension) + 1)">@dimension.sName</span>
|
||||
<input type="number" class="form-control" aria-label="@dimension.dValue" @bind="@dimension.dValue">
|
||||
<span class="input-group-text">mm</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title m-0">Frame joints</h5>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(1, 0)">Angled</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(2, 0)">Horizontal</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(3, 0)">Vertical</button>
|
||||
</div>
|
||||
</div>
|
||||
@foreach (Joint joint in FrameWindow.JointList)
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="IndexJoint@(FrameWindow.JointList.IndexOf(joint) + 1)">@((positionJoints)(FrameWindow.JointList.IndexOf(joint)))</label>
|
||||
<select class="form-select" id="IndexJoint@(FrameWindow.JointList.IndexOf(joint) + 1)" @bind="@joint.SelJointTypeIndex">
|
||||
<option value="0">Angled</option>
|
||||
<option value="1">Full H</option>
|
||||
<option value="2">Full V</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (m_SashList.Count == 0)
|
||||
{
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Bottom rail</h5>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="BottomRailQty">Quantity</span>
|
||||
<input type="number" class="form-control" aria-label="BottomRailQty" @bind="@FrameWindow.BottomRailQty">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currStep == CompileStep.Split)
|
||||
{
|
||||
int numSplit = 0;
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="text-start p-1 display-4">
|
||||
<div class="row">
|
||||
@for (int i = 0; i < SplitList.Count; i++)
|
||||
{
|
||||
Split currSplit = SplitList[i];
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
@if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0)
|
||||
{
|
||||
@for (int j = 0; j < SashList.Count; j++)
|
||||
{
|
||||
@if (SashList[j].Equals(currSplit.ParentArea))
|
||||
{
|
||||
<h5>@("Sash " + (j + 1))</h5>
|
||||
}
|
||||
else if (SashList[j].Equals(currSplit.ParentArea.ParentArea))
|
||||
{
|
||||
@for (int k = 0; k < SashList[j].AreaList.Count; k++)
|
||||
{
|
||||
@if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit))
|
||||
{
|
||||
<h5>@("Sash " + (j + 1) + " - anta " + (k + 1))</h5>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currSplit.ParentArea is Splitted)
|
||||
{
|
||||
for(int j = 0; j < SplittedList.Count; j++)
|
||||
{
|
||||
if (SplittedList[j].Equals(currSplit.ParentArea))
|
||||
{
|
||||
numSplit++;
|
||||
<h5>@("Area di split " + numSplit)</h5>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<h5>@("Frame")</h5>
|
||||
}
|
||||
<div class="col">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5>Split</h5>
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => SwapTwoAree(currSplit)">Swap Aree</button>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="SplitQty@(m_SplitList.IndexOf(currSplit) + 1)">Number</span>
|
||||
<input type="number" class="form-control" placeholder="0" aria-label="basic-addon1Split" @bind="@currSplit.nSplitQty">
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="ShapeSplit@(m_SplitList.IndexOf(currSplit) + 1)">Shape</label>
|
||||
<select class="form-select" id="ShapeSplit@(m_SplitList.IndexOf(currSplit) + 1)" @bind="@currSplit.SelSplitShapeIndex">
|
||||
<option value="0">Vertical</option>
|
||||
<option value="1">Horizontal</option>
|
||||
<option value="2">Grid</option>
|
||||
<option value="3">Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
@foreach (var dim in currSplit.SplitPositionList)
|
||||
{
|
||||
string desc = "";
|
||||
@if (currSplit.SelSplitShape == Json.WindowConst.SplitShapes.VERTICAL)
|
||||
{
|
||||
@if (currSplit.SplitPositionList.IndexOf(dim) == 0)
|
||||
{
|
||||
desc = "Larg. area sx split";
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = "Larg. area dx split";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (currSplit.SplitPositionList.IndexOf(dim) == 0)
|
||||
{
|
||||
desc = "Altez. area sotto split";
|
||||
}
|
||||
else
|
||||
{
|
||||
desc = "Altez. area sopra split";
|
||||
}
|
||||
}
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="SplitDimension@(currSplit.SplitPositionList.IndexOf(dim) + 1)">@desc</span>
|
||||
<input type="number" class="form-control" aria-label="basic-addon2Split" @bind="@dim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currStep == CompileStep.Sash)
|
||||
{
|
||||
@if (currSash >= SashList.Count || currSash == -1)
|
||||
{
|
||||
currStep = CompileStep.Frame;
|
||||
}
|
||||
string colorClass = "";
|
||||
@if (SelTemplateDTO != null && item.Index == SelTemplateDTO.Index)
|
||||
colorClass = "table-success";
|
||||
else
|
||||
{
|
||||
Sash item = SashList[currSash];
|
||||
<div class="container">
|
||||
<div class="text-start display-4">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="NumberSash@(SashList.IndexOf(item) + 1)">Number</span>
|
||||
<input type="number" class="form-control" aria-label="NumberSash@(SashList.IndexOf(item) + 1)" @bind="@item.nSashQty">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Orientation</h5>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="OrientationSash@(SashList.IndexOf(item) + 1)">Tipology</label>
|
||||
<select class="form-select" id="OrientationSash@(SashList.IndexOf(item) + 1)" @bind="@item.SelOrientationSashTypeIndex">
|
||||
<option value="0">Vertical</option>
|
||||
<option value="1">Horizontal</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Bottom rail</h5>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text" id="BottomRailQty@(SashList.IndexOf(item) + 1)">Quantity</span>
|
||||
<input type="number" class="form-control" aria-label="BottomRailQty" @bind="@item.SashBottomRailQty">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@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];
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
@if (item.SashList.Count == 1)
|
||||
{
|
||||
<h5 class="card-title">Opening</h5>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h5 class="card-title">Sash opening @(i * 2 + j + 1)</h5>
|
||||
}
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="OpeningSash@(i * 2 + j + 1)">Tipology</label>
|
||||
<select class="form-select" id="OpeningSash@(i * 2 + j + 1)" @bind="@sash.SelOpeningTypeIndex">
|
||||
<option value="0">A sinistra</option>
|
||||
<option value="1">A destra</option>
|
||||
<option value="2">Ad anta-ribalta sinistra</option>
|
||||
<option value="3">Ad anta-ribalta destra</option>
|
||||
<option value="4">Solo verso alto</option>
|
||||
<option value="5">Solo verso basso</option>
|
||||
<option value="6">Pivot</option>
|
||||
<option value="7">Fissa</option>
|
||||
<option value="8">Complanare sinistra</option>
|
||||
<option value="9">Complanare destra</option>
|
||||
<option value="10">Scorrevole sinistra</option>
|
||||
<option value="11">Scorrevole destra</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Dimension</span>
|
||||
<input type="number" class="form-control" aria-label="DimensionSash" @bind="@sash.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Handle" id="HandleSashLabel@(i * 2 + j + 1)" checked="@sash.bHasHandle" @onclick="() => changeHandle(sash)">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark" for="HandleSashLabel@(i * 2 + j + 1)">Handle</label>
|
||||
</div>
|
||||
</div>
|
||||
@* <div class="row d-grid gap-1 d-md-flex justify-content-md-center">
|
||||
@for (int k = 1; k <= i * 2 + j; k++)
|
||||
{
|
||||
int IndexCopy = k;
|
||||
int IndexModify = i * 2 + j;
|
||||
<div class="col-sm-4">
|
||||
<div class="input-group">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CopyContent(item, IndexCopy, IndexModify)">Copy @(k)</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Sash joints</h5>
|
||||
<div class="row p-0 m-0 text-center">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(1, 1)">Angled</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(2, 1)">Horizontal</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllJointsFrame(3, 1)">Vertical</button>
|
||||
</div>
|
||||
</div>
|
||||
@foreach (Joint joint in item.JointList)
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="IndexJoint@(item.JointList.IndexOf(joint) + 1)">@((positionJoints)(item.JointList.IndexOf(joint)))</label>
|
||||
<select class="form-select" id="IndexJoint@(item.JointList.IndexOf(joint) + 1)" @bind="@joint.SelJointTypeIndex">
|
||||
<option value="0">Angled</option>
|
||||
<option value="1">Full H</option>
|
||||
<option value="2">Full V</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
@for (int i = 0; i < item.AreaList.Count; i++)
|
||||
{
|
||||
Area anta;
|
||||
@if (item.AreaList[i] is Splitted)
|
||||
{
|
||||
anta = item.AreaList[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
anta = item;
|
||||
}
|
||||
@if (!(anta.AreaList[0] is Split))
|
||||
{
|
||||
<div class="col">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Anta @(i + 1)</h5>
|
||||
<div class="input-group mb-2">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => anta.AddSplit()">Aggiungi split</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
colorClass = "";
|
||||
<tr style="height: 120px;" class="@colorClass" @onclick="() => DoSelect(item)">
|
||||
<td>@item.Index</td>
|
||||
<td><img class="img-fluid" width="100" src="@item.ImageUrl" /></td>
|
||||
<td class="text-start">@item.Description</td>
|
||||
</tr>
|
||||
}
|
||||
else if (currStep == CompileStep.Fill)
|
||||
{
|
||||
<div class="container">
|
||||
<div class="text-start p-1 display-4 ">
|
||||
<div class="row text-center">
|
||||
<div class="col-12">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<h5>Fill Area</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllFill(1)">All glass</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AllFill(2)">All wood</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@for(int i = 0; i < FillList.Count; i += 2)
|
||||
{
|
||||
Fill currFill = FillList[i];
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
@if (FillList.Count == 1)
|
||||
{
|
||||
<h5 class="card-title">Fill </h5>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h5 class="card-title">Fill @(FillList.IndexOf(currFill) + 1)</h5>
|
||||
}
|
||||
<div class="input-group mb-2">
|
||||
<select class="form-select" @bind="@currFill.SelFillTypeIndex">
|
||||
<option value="0">Glass</option>
|
||||
<option value="1">Wood</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if( i + 1 < FillList.Count)
|
||||
{
|
||||
Fill nextFill = FillList[i+1];
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
@if (FillList.Count == 1)
|
||||
{
|
||||
<h5 class="card-title">Fill </h5>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h5 class="card-title">Fill @(FillList.IndexOf(nextFill) + 1)</h5>
|
||||
}
|
||||
<div class="input-group mb-2">
|
||||
<select class="form-select" @bind="@nextFill.SelFillTypeIndex">
|
||||
<option value="0">Glass</option>
|
||||
<option value="1">Wood</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currStep == CompileStep.General)
|
||||
{
|
||||
<div class="container">
|
||||
<div class="text-start p-1 display-4 ">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Generic</h5>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="MaterialWindow">Material</label>
|
||||
<select class="form-select" id="MaterialWindow">
|
||||
<option value="0">Wood</option>
|
||||
<option value="1">PVC</option>
|
||||
<option value="2">Aluminum</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="ProfileWindow">Profile</label>
|
||||
<select class="form-select" id="ProfileWindow">
|
||||
<option value="0">Profilo 78</option>
|
||||
<option value="1">Profilo..</option>
|
||||
<option value="2">Profilo...</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Fill type</h5>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="GlassWindow">Glass</label>
|
||||
<select class="form-select" id="GlassWindow">
|
||||
<option value="0">Doppio vetro</option>
|
||||
<option value="1">Triplo vetro</option>
|
||||
<option value="2">Antieffrazione</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="PanelWindow">Pannello</label>
|
||||
<select class="form-select" id="PanelWindow">
|
||||
<option value="0">Liscio</option>
|
||||
<option value="1">Con venatura</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Color</h5>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="TreatmentWindow">Treatment</label>
|
||||
<select class="form-select" id="TreatmentWindow">
|
||||
<option value="0">Standard</option>
|
||||
<option value="1">...</option>
|
||||
<option value="2">Custom</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p class="d-inline-flex gap-1">
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Bianco)" @onclick="() => ChangeColorWindow(ColorWindow.Bianco)" data-bs-toggle =" button" aria-pressed="true">Bianco</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Grigio)" @onclick="() => ChangeColorWindow(ColorWindow.Grigio)" data-bs-toggle="button" aria-pressed="true">Grigio</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Tortora)" @onclick="() => ChangeColorWindow(ColorWindow.Tortora)" data-bs-toggle="button" aria-pressed="true">Tortora</button>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p class="d-inline-flex gap-1">
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Blu)" @onclick="() => ChangeColorWindow(ColorWindow.Blu)" data-bs-toggle="button" aria-pressed="true">Blu</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Verde)" @onclick="() => ChangeColorWindow(ColorWindow.Verde)" data-bs-toggle="button" aria-pressed="true">Verde</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" class="@buttonCss(ColorWindow.Nero)" @onclick="() => ChangeColorWindow(ColorWindow.Nero)" data-bs-toggle="button" aria-pressed="true">Nero</button>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(m_SashList.Count > 0)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="border mb-2">
|
||||
<div class="card-body py-2">
|
||||
<h5 class="card-title">Hardware</h5>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="ColorHardware">Generic color</label>
|
||||
<select class="form-select" id="ColorHardware">
|
||||
<option value="0">Oro</option>
|
||||
<option value="1">Bronzo</option>
|
||||
<option value="2">Ottone</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="CapsColor">Caps color</label>
|
||||
<select class="form-select" id="CapsColor">
|
||||
<option value="0">Oro</option>
|
||||
<option value="1">Bronzo</option>
|
||||
<option value="2">Ottone</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="HandleColor">Handle color</label>
|
||||
<select class="form-select" id="HandleColor">
|
||||
<option value="0">Oro</option>
|
||||
<option value="1">Bronzo</option>
|
||||
<option value="2">Ottone</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@if(currStep != CompileStep.Template)
|
||||
{
|
||||
<div class="col-6">
|
||||
@outSvg
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,13 +9,10 @@ using static WebWindowConfigurator.Json.WindowConst;
|
||||
|
||||
namespace WebWindowConfigurator
|
||||
{
|
||||
public partial class WebWindowMaker : IDisposable
|
||||
public partial class WebWindowMaker
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string CssSvg { get; set; } = "responsive-svg";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_OnClose { get; set; }
|
||||
|
||||
@@ -23,210 +20,25 @@ namespace WebWindowConfigurator
|
||||
public EventCallback<TemplateSelectDTO> EC_OnSelectedTemplate { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Dictionary<string,string>> EC_OnUpdate { get; set; }
|
||||
public List<TemplateSelectDTO> TemplateDTOList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public Template IN_SelTemplate
|
||||
{
|
||||
get => m_SelTemplate;
|
||||
set
|
||||
{
|
||||
// Se non ho ancora selezionato template oppure se cambio template di selezione
|
||||
if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD))
|
||||
{
|
||||
m_SelTemplate = value;
|
||||
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(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 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)
|
||||
{
|
||||
m_FillList = new List<Fill>();
|
||||
m_SashList = new List<Sash>();
|
||||
m_SplitList = new List<Split>();
|
||||
m_SplittedList = new List<Splitted>();
|
||||
CreateWindowsList(m_CurrWindow.AreaList[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public List<TemplateSelectDTO> IN_TemplateDTOList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public string LiveSVG
|
||||
{
|
||||
get => m_SelSVG;
|
||||
set => m_SelSVG = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
||||
m_CurrWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Enums
|
||||
|
||||
protected enum CompileStep
|
||||
{
|
||||
Template = 0,
|
||||
Frame = 1,
|
||||
Split,
|
||||
Sash,
|
||||
Fill,
|
||||
General
|
||||
}
|
||||
|
||||
protected enum ColorWindow
|
||||
{
|
||||
Bianco = 0,
|
||||
Grigio = 1,
|
||||
Tortora,
|
||||
Blu,
|
||||
Verde,
|
||||
Nero
|
||||
}
|
||||
|
||||
#endregion Protected Enums
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected Frame FrameWindow
|
||||
{
|
||||
get => m_Frame;
|
||||
set => m_Frame = value;
|
||||
}
|
||||
|
||||
protected string m_SelSVG { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Componente SVG da mostrare
|
||||
/// </summary>
|
||||
protected MarkupString outSvg
|
||||
{
|
||||
get
|
||||
{
|
||||
// aggiunta gestione classe svg per posizionamento con costraints
|
||||
var newSvg = LiveSVG.Replace("<svg", $"<svg class=\"{CssSvg}\"");
|
||||
return (MarkupString)newSvg;
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Sash> SashList
|
||||
{
|
||||
get => m_SashList;
|
||||
}
|
||||
protected List<Split> SplitList
|
||||
{
|
||||
get => m_SplitList;
|
||||
}
|
||||
protected List<Fill> FillList
|
||||
{
|
||||
get => m_FillList;
|
||||
}
|
||||
protected List<Splitted> SplittedList
|
||||
{
|
||||
get => m_SplittedList;
|
||||
}
|
||||
|
||||
protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per la scelta della maniglia univoca
|
||||
/// </summary>
|
||||
/// <param name="sashDim"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task changeHandle(SashDimension sashDim)
|
||||
{
|
||||
//if(m_SashList[0].AreaList.Count < 3)
|
||||
//{
|
||||
foreach (SashDimension item in SashList[0].SashList)
|
||||
{
|
||||
if (item.Equals(sashDim))
|
||||
{
|
||||
item.bHasHandle = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.bHasHandle = false;
|
||||
}
|
||||
}
|
||||
//}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
// Ancora da fare...
|
||||
protected async Task DoClose()
|
||||
{
|
||||
await EC_OnClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Anteprima SVG
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoPreviewSvg()
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented);
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Jwd", CurrJwd);
|
||||
Args.Add("Mode", 1.ToString());
|
||||
await EC_OnUpdate.InvokeAsync(Args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di reset dei dati a quelli del template
|
||||
/// </summary>
|
||||
protected async Task DoReset()
|
||||
{
|
||||
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(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;
|
||||
m_FillList = new List<Fill>();
|
||||
m_SashList = new List<Sash>();
|
||||
m_SplitList = new List<Split>();
|
||||
m_SplittedList = new List<Splitted>();
|
||||
// popolo le liste Fill, Sash e Split
|
||||
CreateWindowsList(m_CurrWindow.AreaList[0]);
|
||||
currSash = -1;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
// Ancora da fare..
|
||||
protected async Task DoSave()
|
||||
{
|
||||
@@ -245,292 +57,13 @@ namespace WebWindowConfigurator
|
||||
await EC_OnSelectedTemplate.InvokeAsync(newSel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cambiare step e aggiornare preview svg
|
||||
/// </summary>
|
||||
/// <param name="newStep"> step successivo</param>
|
||||
protected async void NextStepAndPreview(CompileStep newStep, int Index = -1)
|
||||
{
|
||||
currStep = newStep;
|
||||
if (newStep == CompileStep.Sash)
|
||||
currSash = Index;
|
||||
else
|
||||
currSash = -1;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
//protected void CreateWindowsList(Area node, bool IntoSash)
|
||||
//{
|
||||
// if (node != null)
|
||||
// {
|
||||
// bool nodeIntoSash = false;
|
||||
// if (node.ParentArea is Sash || IntoSash == true)
|
||||
// nodeIntoSash = true;
|
||||
// switch (node.AreaType)
|
||||
// {
|
||||
// case AreaTypes.FRAME:
|
||||
// {
|
||||
// FrameWindow = (Frame)node;
|
||||
// if (node.AreaList[0] is Split)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, node.AreaList[0], null));
|
||||
// else
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, null, node));
|
||||
// break;
|
||||
// }
|
||||
// case AreaTypes.SASH:
|
||||
// {
|
||||
// m_SashList.Add((Sash)node);
|
||||
// if (node.AreaList[0] is Fill)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node));
|
||||
// else if (node.AreaList[0] is Split)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash into split", nodeIntoSash, node.AreaList[0], node));
|
||||
// break;
|
||||
// }
|
||||
// case AreaTypes.FILL:
|
||||
// {
|
||||
// m_FillList.Add((Fill)node);
|
||||
// break;
|
||||
// }
|
||||
// case AreaTypes.SPLIT:
|
||||
// {
|
||||
// m_SplitList.Add((Split)node);
|
||||
// break;
|
||||
// }
|
||||
// case AreaTypes.SPLITTED:
|
||||
// {
|
||||
// m_SplittedList.Add((Splitted)node);
|
||||
// if (node.AreaList[0] is Split)
|
||||
// {
|
||||
// if (node.ParentArea is Sash)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, node.AreaList[0], node));
|
||||
// else
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, node.AreaList[0], node));
|
||||
// }
|
||||
// else if (node.AreaList[0] is Sash)
|
||||
// {
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split area with sash", nodeIntoSash, null, node));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (node.ParentArea is Sash)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node));
|
||||
// else if (nodeIntoSash)
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Area split into sash", nodeIntoSash, null, node));
|
||||
// else
|
||||
// SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, null, node));
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// foreach (var item in node.AreaList)
|
||||
// {
|
||||
// CreateWindowsList(item, nodeIntoSash);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
protected void CreateWindowsList(Area node)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
switch (node.AreaType)
|
||||
{
|
||||
case AreaTypes.FRAME:
|
||||
{
|
||||
FrameWindow = (Frame)node;
|
||||
break;
|
||||
}
|
||||
case AreaTypes.SASH:
|
||||
{
|
||||
m_SashList.Add((Sash)node);
|
||||
break;
|
||||
}
|
||||
case AreaTypes.FILL:
|
||||
{
|
||||
m_FillList.Add((Fill)node);
|
||||
break;
|
||||
}
|
||||
case AreaTypes.SPLIT:
|
||||
{
|
||||
m_SplitList.Add((Split)node);
|
||||
break;
|
||||
}
|
||||
case AreaTypes.SPLITTED:
|
||||
{
|
||||
m_SplittedList.Add((Splitted)node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (var item in node.AreaList)
|
||||
{
|
||||
CreateWindowsList(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V
|
||||
/// </summary>
|
||||
/// <param name="int_type"> tipo di giunzione (ANGLED o FULL_H o FULL_V)</param>
|
||||
/// <param name="int_place"> oggetto a cui essere applicato (Frame o Sash)</param>
|
||||
/// <returns></returns>
|
||||
private async Task AllJointsFrame(int int_type, int int_place)
|
||||
{
|
||||
Joints type = Joints.ANGLED;
|
||||
if (int_type == 2)
|
||||
{
|
||||
type = Joints.FULL_H;
|
||||
}
|
||||
else if (int_type == 3)
|
||||
{
|
||||
type = Joints.FULL_V;
|
||||
}
|
||||
if(int_place == 0)
|
||||
{
|
||||
foreach (Joint joint in FrameWindow.JointList)
|
||||
{
|
||||
joint.SetSelJointType(type);
|
||||
}
|
||||
}
|
||||
else if(int_place == 1)
|
||||
{
|
||||
foreach (Joint joint in m_SashList[0].JointList)
|
||||
{
|
||||
joint.SetSelJointType(type);
|
||||
}
|
||||
}
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V
|
||||
/// </summary>
|
||||
/// <param name="int_type"> tipo di giunzione (ANGLED o FULL_H o FULL_V)</param>
|
||||
/// <param name="int_place"> oggetto a cui essere applicato (Frame o Sash)</param>
|
||||
/// <returns></returns>
|
||||
private async Task AllFill(int int_type)
|
||||
{
|
||||
FillTypes type = FillTypes.GLASS;
|
||||
if (int_type == 2)
|
||||
{
|
||||
type = FillTypes.WOOD;
|
||||
}
|
||||
foreach (Fill currFill in m_FillList)
|
||||
{
|
||||
currFill.SetFillType(type);
|
||||
}
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
private async Task SwapTwoAree(Area currArea)
|
||||
{
|
||||
currArea.SwapAree();
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private CompileStep currStep = CompileStep.Template;
|
||||
|
||||
private ColorWindow currColorWin = ColorWindow.Bianco;
|
||||
|
||||
private Frame m_Frame;
|
||||
|
||||
private int currSash = -1;
|
||||
|
||||
private List<Sash> m_SashList = new List<Sash>();
|
||||
|
||||
private List<Split> m_SplitList = new List<Split>();
|
||||
|
||||
private List<Fill> m_FillList = new List<Fill>();
|
||||
|
||||
private List<Splitted> m_SplittedList = new List<Splitted>();
|
||||
|
||||
private enum positionJoints
|
||||
{
|
||||
BL=0, // Bottom Left
|
||||
BR=1, // Bottom Right
|
||||
TR, // Top Right
|
||||
TL // Top Left
|
||||
}
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Window? m_CurrWindow { get; set; } = null;
|
||||
|
||||
private Window? m_PreviousWindow { get; set; } = null;
|
||||
|
||||
private Template m_SelTemplate { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per andare allo step successivo
|
||||
/// </summary>
|
||||
/// <param name="newStep"> step successivo</param>
|
||||
private void AdvStep(CompileStep newStep)
|
||||
{
|
||||
currStep = newStep;
|
||||
currSash = -1;
|
||||
}
|
||||
|
||||
|
||||
private void ChangeColorWindow(ColorWindow newColorWin)
|
||||
{
|
||||
currColorWin = newColorWin;
|
||||
}
|
||||
|
||||
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
|
||||
{
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Jwd", e.sJwd);
|
||||
Args.Add("Mode", 1.ToString());
|
||||
EC_OnUpdate.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola il css del tab selezionato
|
||||
/// </summary>
|
||||
/// <param name="testStep"></param>
|
||||
/// <returns></returns>
|
||||
private string tabNavCss(CompileStep testStep, int Index = -1)
|
||||
{
|
||||
if (testStep == CompileStep.Sash)
|
||||
{
|
||||
if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1))
|
||||
{
|
||||
return "nav-link active fw-bold";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "nav-link text-secondary";
|
||||
}
|
||||
}
|
||||
return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary";
|
||||
}
|
||||
|
||||
private string buttonCss(ColorWindow testColor)
|
||||
{
|
||||
return testColor.Equals(currColorWin) ? "btn btn-outline-secondary active" : "btn btn-outline-secondary";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola larghezza colonna da mostrare
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string mainCss()
|
||||
{
|
||||
return currStep == CompileStep.Template ? "col-12" : "col-6";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user