Gestione componente CardFill

This commit is contained in:
Samuele Locatelli
2025-10-10 17:35:31 +02:00
parent 01f7e5b072
commit 89bcf9e396
5 changed files with 157 additions and 32 deletions
+76
View File
@@ -0,0 +1,76 @@
<div class="card shadow-sm">
<div class="card-header bg-light bg-opacity-25">
<div class="row my-2">
<div class="col-sm-4 justify-content-center">
<h3 class="card-title text-center">Fill @(CurrIndex + 1)</h3>
</div>
<div class="col-sm-4 justify-content-center">
<div class="input-group mb-2 justify-content-center">
<button class="@buttonFillCss(WebWindowComplex.Json.WindowConst.FillTypes.GLASS)" @onclick="() => ChangeOneFill(WebWindowComplex.Json.WindowConst.FillTypes.GLASS)">Glass</button>
</div>
</div>
<div class="col-sm-4 justify-content-center">
<div class="input-group mb-2 justify-content-center">
<button class="@buttonFillCss(WebWindowComplex.Json.WindowConst.FillTypes.WOOD)" @onclick="() => ChangeOneFill(WebWindowComplex.Json.WindowConst.FillTypes.WOOD)">Wood</button>
</div>
</div>
</div>
</div>
<div class="card-body py-2">
<hr />
<div class="row">
<div class="col-sm-4">
<h5 class="text-center">Selected all fill</h5>
</div>
<div class="col-sm-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowComplex.Json.WindowConst.FillTypes.GLASS)">All glass</button>
</div>
</div>
<div class="col-sm-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowComplex.Json.WindowConst.FillTypes.WOOD)">All wood</button>
</div>
</div>
</div>
</div>
</div>
@foreach (var currSplitted in SplittedList)
{
@if (currSplitted.AreaList[0].Equals(CurrItem))
{
@* <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 (SplittedList.Count > 1)
{
<h3 class="card-title text-center">Area split @(SplittedList.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>
@foreach (var Index in SashList)
{
<div class="col-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CopySash(currSplitted, SashList.IndexOf(Index))">Copy sash @(SashList.Count == 1 ? "" : (SashList.IndexOf(Index) + 1))</button>
</div>
</div>
}
</div>
</div>
</div> *@
<AreaSplit CurrSashList="SashList" CurrSplittedList="SplittedList" CurrSplitted="currSplitted"></AreaSplit>
@* <AreaSplit CurrSashList="SashList" CurrSplittedList="SplittedList" CurrSplitted="currSplitted" EC_CopySash="() => CopySash()"></AreaSplit> *@
}
}
+68
View File
@@ -0,0 +1,68 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.Models;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Compo
{
public partial class CardFill
{
#region Public Properties
[Parameter]
public int CurrIndex { get; set; } = 0;
[Parameter]
public Fill CurrItem { get; set; } = null!;
[Parameter]
public EventCallback<FillTypes> EC_ChangeAllType { get; set; }
[Parameter]
public EventCallback<FillTypes> EC_ChangeType { get; set; }
[Parameter]
public List<Fill> FillList { get; set; } = null!;
[Parameter]
public List<Sash> SashList { get; set; } = null!;
[Parameter]
public List<Splitted> SplittedList { get; set; } = null!;
#endregion Public Properties
#region Protected Methods
protected async Task ChangeAllFill(FillTypes reqFillType)
{
await EC_ChangeAllType.InvokeAsync(reqFillType);
}
protected async Task ChangeOneFill(FillTypes reqFillType)
{
await EC_ChangeType.InvokeAsync(reqFillType);
}
#endregion Protected Methods
#region Private Methods
/// <summary>
/// Calcola bottone selezionato per il Fill
/// </summary>
/// <returns></returns>
private string buttonFillCss(FillTypes reqFillTypes)
{
return (FillList.ElementAt(CurrIndex).SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm";
#if false
if (FillList.ElementAt(CurrIndex).SelFillType == reqFillTypes)
return "btn btn-secondary btn-sm";
else
return "btn btn-outline-secondary btn-sm";
#endif
}
#endregion Private Methods
}
}
+3 -32
View File
@@ -696,7 +696,8 @@
else
{
Fill item = FillList[currFill];
<div class="container">
<CardFill CurrIndex="currFill" CurrItem="item" FillList="m_FillList" SashList="m_SashList" SplittedList="m_SplittedList" EC_ChangeAllType="ChangeAllFill" EC_ChangeType="ChangeOneFill"></CardFill>
@* <div class="container">
<div class="row">
<div class="text-start p-1 display-4 ">
<div class="row">
@@ -740,44 +741,14 @@
{
@if (currSplitted.AreaList[0].Equals(item))
{
@* <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 (SplittedList.Count > 1)
{
<h3 class="card-title text-center">Area split @(SplittedList.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>
@foreach (var Index in SashList)
{
<div class="col-4">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CopySash(currSplitted, SashList.IndexOf(Index))">Copy sash @(SashList.Count == 1 ? "" : (SashList.IndexOf(Index) + 1))</button>
</div>
</div>
}
</div>
</div>
</div> *@
<AreaSplit CurrSashList="SashList" CurrSplittedList="SplittedList" CurrSplitted="currSplitted" ></AreaSplit>
@* <AreaSplit CurrSashList="SashList" CurrSplittedList="SplittedList" CurrSplitted="currSplitted" EC_CopySash="() => CopySash()"></AreaSplit> *@
}
}
</div>
</div>
</div>
</div>
</div>
</div> *@
}
}
else if (currStep == CompileStep.General)
+3
View File
@@ -53,6 +53,9 @@