Inizio riorganizzazione sotto-componenti

This commit is contained in:
Samuele Locatelli
2025-10-10 17:05:25 +02:00
parent c6867f4c0d
commit 01f7e5b072
9 changed files with 8 additions and 7 deletions
+26
View File
@@ -0,0 +1,26 @@
<div class="border mb-2 shadow-sm rounded">
<div class="card-body py-2">
<div class="row my-2">
<div class="col-4">
<h3 class="card-title">Area frame</h3>
</div>
<div class="col-sm-4">
@if (CurrSashList.Count == 0 && CurrSplitList.Count == 0)
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="RaiseAddSash">Aggiungi window</button>
</div>
}
</div>
<div class="col-sm-4">
@if (!(CurrFrameWindow.AreaList[0] is Split))
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="RaiseAddSplit">Aggiungi split</button>
</div>
}
</div>
</div>
</div>
</div>
+49
View File
@@ -0,0 +1,49 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class AreaFrame
{
#region Public Properties
[Parameter]
public Frame CurrFrameWindow { get; set; } = null!;
[Parameter]
public List<Sash> CurrSashList { get; set; } = null!;
[Parameter]
public List<Split> CurrSplitList { get; set; } = null!;
[Parameter]
public EventCallback<bool> EC_AddSash { get; set; }
[Parameter]
public EventCallback<bool> EC_AddWindow { get; set; }
#endregion Public Properties
#region Private Methods
/// <summary>
/// Sollevo evento richiesta aggiunta sash
/// </summary>
/// <returns></returns>
private async Task RaiseAddSash()
{
await EC_AddSash.InvokeAsync(true);
}
/// <summary>
/// Sollevo evento richiesta aggiunta window
/// </summary>
/// <returns></returns>
private async Task RaiseAddSplit()
{
await EC_AddWindow.InvokeAsync(true);
}
#endregion Private Methods
}
}
+30
View File
@@ -0,0 +1,30 @@
<div class="border mb-2 shadow-sm rounded">
<div class="card-body py-2">
<div class="row my-2">
<div class="col-sm-4 justify-content-center">
@if (CurrSplittedList.Count > 1)
{
<h3 class="card-title text-center">Area split @(CurrSplittedList.IndexOf(CurrSplitted) + 1)</h3>
}
else
{
<h3 class="card-title text-center">Area split</h3>
}
</div>
<div class="col-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CurrSplitted.AddFirstSash()">Add Sash</button>
</div>
</div>
@for (int j = 0; j < CurrSashList.Count; j++)
{
int Index = j;
<div class="col-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(Index)">Copy Sash @(CurrSashList.Count == 1 ? "" : (Index + 1))</button>
</div>
</div>
}
</div>
</div>
</div>
+37
View File
@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class AreaSplit
{
#region Public Properties
[Parameter]
public List<Sash> CurrSashList { get; set; } = null;
[Parameter]
public Splitted CurrSplitted { get; set; } = null;
[Parameter]
public List<Splitted> CurrSplittedList { get; set; } = null;
[Parameter]
public EventCallback<int> EC_CopySash { get; set; }
#endregion Public Properties
#region Private Methods
/// <summary>
/// Sollevo evento richiesta copia sash
/// </summary>
/// <returns></returns>
private async Task RaiseCopySash(int indexCurrSash)
{
await EC_CopySash.InvokeAsync(indexCurrSash);
}
#endregion Private Methods
}
}
+87
View File
@@ -0,0 +1,87 @@
<div class="card shadow-sm">
<div class="card-header bg-light bg-opacity-25">
<div class="d-flex justify-content-between align-middle">
<div class="px-2">
<h5>General</h5>
</div>
<div class="px-2">
<button class="btn btn-close" @onclick="ReqClose"></button>
</div>
</div>
</div>
<div class="card-body py-2">
<div class="row">
<div class="col-sm-6">
<div class="input-group mb-2 justify-content-center">
<label class="input-group-text" for="MaterialWindow">Material</label>
<select class="form-select @(cssValid("Material"))" id="MaterialWindow" @bind="CurrMaterial">
@foreach (var item in ListPayload.Material)
{
<option value="@item">@item</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>
<hr />
<div class="row">
<div class="col-sm-6">
<div class="row">
<h5>Fill type</h5>
</div>
<div class="row">
<div class="input-group mb-2">
<label class="input-group-text" for="GlassWindow">Glass</label>
<select class="form-select @(cssValid("Glass"))" id="GlassWindow" @bind="@CurrGlass">
@foreach (string glass in ListPayload.Glass)
{
<option value="@glass">@glass</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 class="col-sm-6">
<div class="row">
<h5 class="card-title">Color</h5>
</div>
<div class="row">
<div class="input-group mb-2">
<label class="input-group-text" for="ColorWindow">Window</label>
<select class="form-select @(cssValid("ColorMaterial"))" id="ColorWindow" @bind="@CurrColor">
@foreach (string colorMaterial in ListPayload.ColorMaterial)
{
<option value="@colorMaterial">@colorMaterial</option>
}
</select>
</div>
<div class="input-group mb-2">
<label class="input-group-text" for="Trunking">Trunking</label>
<select class="form-select" id="Trunking">
<option value="0">Black</option>
<option value="1">Silver</option>
<option value="2">White</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
+111
View File
@@ -0,0 +1,111 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class General
{
#region Public Properties
/// <summary>
/// Finestra corrente
/// </summary>
[Parameter]
public Window CurrWindow { get; set; } = null!;
[Parameter]
public EventCallback<string> EC_SelColor { get; set; }
[Parameter]
public EventCallback<string> EC_SelGlass { get; set; }
[Parameter]
public EventCallback<string> EC_SelWindMat { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Elenco anagrafiche di base
/// </summary>
[Parameter]
public BaseListPayload ListPayload { get; set; } = null!;
/// <summary>
/// Elenco Warnings attivi
/// </summary>
[Parameter]
public Dictionary<string, string> ListWarnings { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
#region Protected Properties
protected string CurrColor
{
get => currColor;
set
{
currColor = value;
_ = EC_SelColor.InvokeAsync(value);
}
}
protected string CurrGlass
{
get => currGlass;
set
{
currGlass = value;
_ = EC_SelGlass.InvokeAsync(value);
}
}
protected string CurrMaterial
{
get => currMaterial;
set
{
currMaterial = value;
_ = EC_SelWindMat.InvokeAsync(value);
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Calcola CSS warning
/// </summary>
/// <param name="fKey"></param>
/// <returns></returns>
protected string cssValid(string fKey)
{
return ListWarnings.ContainsKey(fKey) ? "border border-danger" : "";
}
protected override void OnParametersSet()
{
currColor = CurrWindow.sColorMaterial;
currGlass = CurrWindow.sGlass;
currMaterial = CurrWindow.sMaterial;
}
#endregion Protected Methods
#region Private Fields
private string currColor = "";
private string currGlass = "";
private string currMaterial = "";
#endregion Private Fields
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
}