Merge branch 'feature/HardwareParameterMod' of https://gitlab.steamware.net/egalware-web/special/webdoorcreator into feature/HardwareParameterMod
This commit is contained in:
@@ -1,30 +1,65 @@
|
||||
<select class="form-select" @bind="@folderName">
|
||||
@if (listValuesFname != null)
|
||||
{
|
||||
@foreach (var folder in listValuesFname)
|
||||
@if (currVal == null)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<select class="form-select" @bind="@folderName">
|
||||
@if (listValuesFname != null)
|
||||
{
|
||||
<option value="@folder.Value">@folder.Label</option>
|
||||
@foreach (var folder in listValuesFname)
|
||||
{
|
||||
<option value="@folder.Value">@folder.Label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="Template">Template</span>
|
||||
@if (listValuesFiles != null && listValuesFiles.Count > 0)
|
||||
{
|
||||
<select class="form-select" @bind="@templateName">
|
||||
@foreach (var val in listValuesFiles)
|
||||
{
|
||||
<option value="@val.Value">@val.Label</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input class="form-select" disabled>
|
||||
}
|
||||
</div>
|
||||
@foreach (var item in currVal)
|
||||
{
|
||||
@if (item.Key != "folder" && item.Key != "template")
|
||||
{
|
||||
if (isCombo(item.Key))
|
||||
{
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">@translate(item.Key)</span>
|
||||
<select class="form-select" @bind="@currVal[item.Key]">
|
||||
@foreach (var param in comboSet(item.Key))
|
||||
{
|
||||
<option value="@param.Split("/")[0]">
|
||||
@(
|
||||
translate(@param.Split("/")[1])
|
||||
)
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">@translate(item.Key)</span>
|
||||
<input type="text" class="form-control" @bind="@currVal[item.Key]">
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text" id="Template">Template</span>
|
||||
@if (listValuesFiles != null && listValuesFiles.Count > 0)
|
||||
{
|
||||
<select class="form-select">
|
||||
@foreach (var val in listValuesFiles)
|
||||
{
|
||||
<option value="@val.Value">@val.Label</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input class="form-select" disabled>
|
||||
}
|
||||
</div>
|
||||
|
||||
@foreach (var graph in getGraphicParams())
|
||||
}
|
||||
@*@foreach (var graph in getGraphicParams())
|
||||
{
|
||||
@foreach (var graphParam in graph.Value)
|
||||
{
|
||||
@@ -49,12 +84,13 @@
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}*@
|
||||
|
||||
<div class="row">
|
||||
<div class="btn btn-danger col-6 px-1">
|
||||
<div class="btn btn-danger col-6 px-1" @onclick="() => doCancel()">
|
||||
Cancel
|
||||
</div>
|
||||
<button class="btn btn-success col-6 px-1" @onclick="() => doSave()">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Newtonsoft.Json;
|
||||
using WebDoorCreator.Data.DbModels;
|
||||
using WebDoorCreator.UI.Data;
|
||||
@@ -23,21 +22,51 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public Dictionary<string, Dictionary<string, List<string>>> getGraphicParams()
|
||||
public void setupCurrValues()
|
||||
{
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, List<string>>>>(DoorOpInst.JsoncConfigVal!);
|
||||
//currVal = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(DoorOpInst.JsoncActVal))
|
||||
{
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(DoorOpInst.JsoncActVal!);
|
||||
if (deserialized != null)
|
||||
{
|
||||
currVal = deserialized;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setupGraphicParams()
|
||||
{
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(DoorOpInst.JsoncConfigVal!);
|
||||
if (deserialized != null)
|
||||
{
|
||||
graphicParams = deserialized;
|
||||
}
|
||||
return graphicParams;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string _folderName { get; set; } = "";
|
||||
//public Dictionary<string, Dictionary<string, List<string>>> getGraphicParams()
|
||||
//{
|
||||
// var deserialized = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, List<string>>>>(DoorOpInst.JsoncConfigVal!);
|
||||
// if (deserialized != null)
|
||||
// {
|
||||
// graphicParams = deserialized;
|
||||
// }
|
||||
// return graphicParams;
|
||||
//}
|
||||
protected string _folderName
|
||||
{
|
||||
get => currVal != null ? currVal["folder"] : "";
|
||||
set => currVal["folder"] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array dati
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> currVal { get; set; } = null!;
|
||||
|
||||
protected string folderName
|
||||
{
|
||||
@@ -52,7 +81,13 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
}
|
||||
}
|
||||
|
||||
protected Dictionary<string, Dictionary<string, List<string>>> graphicParams { get; set; } = null!;
|
||||
protected string templateName
|
||||
{
|
||||
get => currVal != null ? currVal["template"] : "";
|
||||
set => currVal["template"] = value;
|
||||
}
|
||||
|
||||
protected Dictionary<string, List<string>> graphicParams { get; set; } = null!;
|
||||
protected List<ListValuesModel>? listValuesFiles { get; set; } = null!;
|
||||
|
||||
protected List<ListValuesModel>? listValuesFname { get; set; } = null!;
|
||||
@@ -67,9 +102,44 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool isCombo(string pKey)
|
||||
{
|
||||
bool answ = false;
|
||||
if (graphicParams.ContainsKey(pKey))
|
||||
{
|
||||
answ = graphicParams[pKey].Count > 1;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected List<string> comboSet(string pKey)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
if (graphicParams.ContainsKey(pKey))
|
||||
{
|
||||
answ = graphicParams[pKey].ToList();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
protected async Task doSave()
|
||||
{
|
||||
// ri-serializzo i graphics parameters...
|
||||
string serVal = JsonConvert.SerializeObject(currVal);
|
||||
DoorOpInst.JsoncActVal = serVal;
|
||||
// salvo!
|
||||
await WDCService.DoorOpUpdate(DoorOpInst);
|
||||
}
|
||||
|
||||
protected async Task doCancel()
|
||||
{
|
||||
await FullReloadData(true);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData(true);
|
||||
await FullReloadData(true);
|
||||
}
|
||||
|
||||
protected string translate(string lemma)
|
||||
@@ -81,10 +151,18 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task FullReloadData(bool isFirst)
|
||||
{
|
||||
setupCurrValues();
|
||||
setupGraphicParams();
|
||||
await ReloadData(isFirst);
|
||||
}
|
||||
private async Task ReloadData(bool isFirst)
|
||||
{
|
||||
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
|
||||
@@ -107,15 +185,6 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task doSave()
|
||||
{
|
||||
// ri-serializzo i graphics parameters...
|
||||
string serVal = JsonConvert.SerializeObject(graphicParams);
|
||||
DoorOpInst.JsoncActVal = serVal;
|
||||
// salvo!
|
||||
await WDCService.DoorOpUpdate(DoorOpInst);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace WebDoorCreator.UI.Data
|
||||
|
||||
public string Traduci(string lingua, string lemma)
|
||||
{
|
||||
string answ = $"[{lemma}]";
|
||||
string answ = lemma;
|
||||
|
||||
if (VocabularyLemmas != null && VocabularyLemmas.ContainsKey(lingua))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user