Fix display testo in obj svg

This commit is contained in:
Samuele Locatelli
2023-05-03 18:10:50 +02:00
parent 1f96279c91
commit e95650bfdf
4 changed files with 150 additions and 123 deletions
@@ -15,7 +15,7 @@
imgPath = $"images/LogoEgw{idxCount % 5:00}.png";
idxCount++;
<div class="col-3 py-1" @onclick="()=>editRec(door.DoorId)" style="cursor: pointer">
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" ImagePath="@imgPath" ObjId="idxCount" Text01="@($"Doors N°: {door.Quantity}")" Text02="@($"Model N°: {door.TypeNav?.TypeId}")" Text03="@($"DoorPrice: {(door.Quantity * door.UnitCost):C2}")"></DoorSvgObj>
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" ImagePath="@imgPath" ObjId="idxCount" TextData="@textDictSetup(door)"></DoorSvgObj>
</div>
}
}
@@ -20,8 +20,6 @@ namespace WebDoorCreator.UI.Components.DoorMan
#region Protected Properties
protected List<DoorModel>? DoorsList { get; set; } = null;
protected int orderStatus { get; set; } = 10;
protected bool IsChanged { get; set; } = false;
[Inject]
@@ -30,6 +28,8 @@ namespace WebDoorCreator.UI.Components.DoorMan
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
protected int orderStatus { get; set; } = 10;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
@@ -64,11 +64,31 @@ namespace WebDoorCreator.UI.Components.DoorMan
NavManager.NavigateTo($"/DoorDefinition?idOrd={currOrderId}&idDoor={doorId}");
}
protected async Task getBackStatus()
{
await Task.Delay(1);
if (orderStatus > 10 && orderStatus <= 70)
{
await WDService.OrderUpdate(currOrderId, (orderStatus - 10));
}
await ReloadData();
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected async Task proceedStatus()
{
await Task.Delay(1);
if (orderStatus >= 10 && orderStatus < 70)
{
await WDService.OrderUpdate(currOrderId, (orderStatus + 10));
}
await ReloadData();
}
protected async Task ReloadData()
{
if (currOrderId != -1)
@@ -86,24 +106,18 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
protected async Task proceedStatus()
/// <summary>
/// Prepara il dictionary dei testi da riportare nell'oggetto ordine
/// </summary>
/// <param name="door"></param>
/// <returns></returns>
protected Dictionary<string, string> textDictSetup(DoorModel door)
{
await Task.Delay(1);
if (orderStatus >= 10 && orderStatus < 70)
{
await WDService.OrderUpdate(currOrderId, (orderStatus + 10));
}
await ReloadData();
}
protected async Task getBackStatus()
{
await Task.Delay(1);
if (orderStatus > 10 && orderStatus <= 70)
{
await WDService.OrderUpdate(currOrderId, (orderStatus - 10));
}
await ReloadData();
Dictionary<string, string> answ = new Dictionary<string, string>();
answ.Add("Doors N°:", $"{door.Quantity}");
answ.Add("Model N°:", $"{door.TypeNav?.TypeId}");
answ.Add("DoorPrice:", $"{(door.Quantity * door.UnitCost):C2}");
return answ;
}
#endregion Protected Methods
@@ -5,35 +5,14 @@
@foreach (var item in TextData)
{
<div class="col-4">
<i>@item.Key</i>
@item.Key
</div>
<div class="col-8">
<div class="col-8 text-end">
<b>@item.Value</b>
</div>
}
@*<div class="col-4">
<i>01</i>
</div>
<div class="col-8">
<b>@Text01</b>
</div>
<div class="col-4">
<i>02</i>
</div>
<div class="col-8">
<b>@Text02</b>
</div>
<div class="col-4">
<i>03</i>
</div>
<div class="col-8">
<b>@Text03</b>
</div>*@
</div>
</foreignObject>
@* <text id="TitleElem" style="@TextStyle" x="0" y="0">@Text01</text>
<text id="TitleElem" style="@TextStyle" x="0" y="@(1*LineDist)">@Text02</text>
<text id="TitleElem" style="@TextStyle" x="0" y="@(2*LineDist)">@Text03</text>*@
</g>
<line x1="@BaseLine.p1.px" y1="@BaseLine.p1.py" x2="@BaseLine.p2.px" y2="@BaseLine.p2.py" stroke="@LineColor" stroke-width="@LineWidth" />
@@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using System.Data.SqlTypes;
namespace WebDoorCreator.UI.Components.SvgComp
{
@@ -7,38 +6,130 @@ namespace WebDoorCreator.UI.Components.SvgComp
{
#region Public Properties
[Parameter]
public int ObjId { get; set; } = 0;
[Parameter]
public string Text01 { get; set; } = "Example Text 01";
[Parameter]
public string Text02 { get; set; } = "Example Text 02";
[Parameter]
public string Text03 { get; set; } = "Example Text 03";
[Parameter]
public Dictionary<string,string> TextData { get; set; } = new Dictionary<string, string>();
[Parameter]
public string ImagePath { get; set; } = "images/LogoEgw.png";
[Parameter]
public string LineColor { get; set; } = "#00838F";
[Parameter]
public int ObjH { get; set; } = 204;
[Parameter]
public int ObjW { get; set; } = 450;
[Parameter]
public int LineWidth { get; set; } = 8;
[Parameter]
public string TextStyle { get; set; } = "font-size: 1.5em; font-weight:bold; fill: #000;";
public int ObjH { get; set; } = 204;
[Parameter]
public int ObjId { get; set; } = 0;
[Parameter]
public int ObjW { get; set; } = 450;
[Parameter]
public Dictionary<string, string> TextData { get; set; } = new Dictionary<string, string>();
[Parameter]
public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;";
#endregion Public Properties
#region Protected Properties
protected LineData BaseLine { get; set; } = null!;
protected CircleData CircleImg { get; set; } = null!;
protected CircleData CircleLine { get; set; } = null!;
protected int LineDist { get; set; } = 20;
protected int TextAreaHeight
{
get => (ObjH * 96 / 100);
}
protected int TextAreaWidth
{
get => ObjW - (ObjH * 120 / 100);
}
#endregion Protected Properties
#region Protected Methods
protected override void OnParametersSet()
{
setupGraphParams();
}
#endregion Protected Methods
#region Protected Classes
protected class CircleData
{
#region Public Constructors
public CircleData(int px, int py, int radius)
{
cx = px;
cy = py;
rad = radius;
}
#endregion Public Constructors
#region Public Properties
public int cx { get; set; } = 0;
public int cy { get; set; } = 0;
public int rad { get; set; } = 100;
#endregion Public Properties
}
protected class LineData
{
#region Public Constructors
public LineData(PointData pA, PointData pB)
{
p1 = pA;
p2 = pB;
}
#endregion Public Constructors
#region Public Properties
public PointData p1 { get; set; }
public PointData p2 { get; set; }
#endregion Public Properties
}
protected class PointData
{
#region Public Constructors
public PointData(int valx, int valy)
{
px = valx;
py = valy;
}
#endregion Public Constructors
#region Public Properties
public int px { get; set; } = 0;
public int py { get; set; } = 0;
#endregion Public Properties
}
#endregion Protected Classes
#region Private Methods
private void setupGraphParams()
{
@@ -49,63 +140,6 @@ namespace WebDoorCreator.UI.Components.SvgComp
LineDist = ObjH / 4;
}
protected override void OnParametersSet()
{
// fixme: togliere auto-compilazione text-data...
TextData.Add("riga01", "valore riga 01");
TextData.Add("riga02", "valore riga 02");
TextData.Add("riga03", "valore riga 03");
setupGraphParams();
}
#endregion Public Properties
protected CircleData CircleLine { get; set; } = null!;
protected CircleData CircleImg { get; set; } = null!;
protected LineData BaseLine { get; set; } = null!;
protected int LineDist { get; set; } = 20;
protected int TextAreaWidth
{
get => ObjW - (ObjH * 120 / 100);
}
protected int TextAreaHeight
{
get => (ObjH * 96 / 100);
}
protected class CircleData
{
public CircleData(int px, int py, int radius)
{
cx = px;
cy = py;
rad = radius;
}
public int cx { get; set; } = 0;
public int cy { get; set; } = 0;
public int rad { get; set; } = 100;
}
protected class PointData
{
public PointData(int valx, int valy)
{
px = valx;
py = valy;
}
public int px { get; set; } = 0;
public int py { get; set; } = 0;
}
protected class LineData
{
public LineData(PointData pA, PointData pB)
{
p1 = pA;
p2 = pB;
}
public PointData p1 { get; set; }
public PointData p2 { get; set; }
}
#endregion Private Methods
}
}