Aggiornato gestione AGBOptionText
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@using static WebWindowComplex.LayoutConst
|
||||
@using static WebWindowComplex.Json.WindowConst
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
@@ -123,25 +123,22 @@
|
||||
<h6 class="fw-bold">Hardware option</h6>
|
||||
</div>
|
||||
</div>
|
||||
@if (CurrItem.HwdOptionList.Count > 0)
|
||||
@if (CurrItem.HwOptionList.Count > 0)
|
||||
{
|
||||
@foreach (var currOpt in CurrItem.HwdOptionList)
|
||||
@foreach (var currOpt in CurrItem.HwOptionList)
|
||||
{
|
||||
switch (currOpt.Type)
|
||||
{
|
||||
case AGBOption.HDWOPTIONTYPES.COMBO:
|
||||
case HwOptionTypes.COMBO:
|
||||
{
|
||||
AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt;
|
||||
<EditOptionCombo CurrOpt="currOptCombo" EC_Update="UpdateOpt"></EditOptionCombo>
|
||||
<EditOptionCombo CurrOpt="currOptCombo" EC_Update="UpdateOptCombo"></EditOptionCombo>
|
||||
break;
|
||||
}
|
||||
case AGBOption.HDWOPTIONTYPES.TEXT:
|
||||
case HwOptionTypes.TEXT:
|
||||
{
|
||||
AGBOptionText currOptText = (AGBOptionText)currOpt;
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">@(currOptText.sName)</span>
|
||||
<input type="text" class="form-control" @bind="@currOptText.sValue">
|
||||
</div>
|
||||
<EditOptionText CurrOpt="currOptText" EC_Update="UpdateOptText"></EditOptionText>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowComplex.Models;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Compo
|
||||
{
|
||||
@@ -169,10 +170,27 @@ namespace WebWindowComplex.Compo
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateOpt(AGBOptionCombo updRec)
|
||||
private async Task UpdateOptCombo(AGBOptionCombo updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.HwdOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateSash.InvokeAsync(CurrItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento Option Text
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateOptText(AGBOptionText updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">@(CurrOpt.sName)</label>
|
||||
<select class="form-select" @bind="CurrValue">
|
||||
@foreach (var currValueCombo in CurrOpt.ValueList)
|
||||
{
|
||||
<option value="@currValueCombo">@currValueCombo</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowComplex.Models;
|
||||
|
||||
namespace WebWindowComplex.Compo
|
||||
{
|
||||
public partial class EditOptionText
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AGBOptionText CurrOpt { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionText> EC_Update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string CurrValue
|
||||
{
|
||||
get => CurrOpt.sValue;
|
||||
set
|
||||
{
|
||||
if (CurrOpt.sValue != value)
|
||||
{
|
||||
CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x == value);
|
||||
_ = EC_Update.InvokeAsync(CurrOpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user