fix 2 variabili x statRecord e currRecord

This commit is contained in:
zaccaria.majid
2022-10-18 09:55:29 +02:00
parent 460eb769dc
commit 41a00ffa45
7 changed files with 69 additions and 60 deletions
+27 -27
View File
@@ -110,7 +110,7 @@ else
<b>@record.DurataMinuti</b>
</div>
<div>
<button class="btn btn-sm btn-primary py-0" type="button" @onclick="() => selectRecord(record)" data-bs-toggle="modal" data-bs-target="#myModal" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
<button class="btn btn-sm btn-primary py-0" type="button" @onclick="() => selectStatRecord(record)" data-bs-toggle="modal" data-bs-target="#myModal" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
</div>
<!-- Modal -->
</td>
@@ -122,26 +122,26 @@ else
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header bg-primary col-12">
@if (currRecord != null)
@if (statRecord != null)
{
<div class="col-3">
<b class="modal-title fs-1" id="staticBackdropLabel"><b>ODL @currRecord.IdxOdl</b></b>
<b class="modal-title fs-1" id="staticBackdropLabel"><b>ODL @statRecord.IdxOdl</b></b>
</div>
<div class="col-6 fs-5">
<b>@currRecord.CodArticolo</b>
<div class="small textConsensed text-light">@currRecord.ArticoloNav.DescArticolo</div>
<b>@statRecord.CodArticolo</b>
<div class="small textConsensed text-light">@statRecord.ArticoloNav.DescArticolo</div>
</div>
<div class="col-2 fs-5">
<b>@currRecord.IdxMacchina</b>
<div class="small textConsensed text-light">@currRecord.MachineNav.Descrizione</div>
<b>@statRecord.IdxMacchina</b>
<div class="small textConsensed text-light">@statRecord.MachineNav.Descrizione</div>
</div>
}
<div class="col-1 text-end">
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="TriggerDotNetInstanceMethod"></button>
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
<div class="modal-body col-12">
@if (currRecord != null && showStats)
@if (statRecord != null && showStats)
{
<div class="d-flex justify-content-between">
<div class="col-8">
@@ -150,23 +150,23 @@ else
<tbody>
<tr>
<td style="width: 270px">
<div class="small textConsensed"><b>N° pezzi:</b> @currRecord.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @currRecord.Tcassegnato.ToString("N3")</div>
<div class="small textConsensed"><b>N° pezzi:</b> @statRecord.NumPezzi</div>
<div class="small textConsensed"><b>T. Ciclo:</b> @statRecord.Tcassegnato.ToString("N3")</div>
</td>
<td style="width: 300px">
<div class="small d-flex justify-content-between">
<div>
<div><b>@($"{@currRecord.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@currRecord.DataInizio:ddd HH:mm:ss}")</div>
<div><b>@($"{@statRecord.DataInizio:yyyy/MM/dd}")</b></div>
<div>@($"{@statRecord.DataInizio:ddd HH:mm:ss}")</div>
</div>
<div class="p-0">
<i class="fa-solid fa-angles-right"></i>
</div>
<div>
@if (@currRecord.DataFine != null)
@if (@statRecord.DataFine != null)
{
<div><b>@($"{@currRecord.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@currRecord.DataFine:ddd HH:mm:ss}")</div>
<div><b>@($"{@statRecord.DataFine:yyyy/MM/dd}")</b></div>
<div>@($"{@statRecord.DataFine:ddd HH:mm:ss}")</div>
}
else
{
@@ -192,12 +192,12 @@ else
<tr>
<td>
<div>
@tradFase(currRecord.KeyRichiesta)
@tradFase(statRecord.KeyRichiesta)
</div>
@if (currRecord.Note != "")
@if (statRecord.Note != "")
{
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
<b class="text-dark"></b> <span class="text-wrap text-start"> @currRecord.Note </span>
<b class="text-dark"></b> <span class="text-wrap text-start"> @statRecord.Note </span>
</div>
}
</td>
@@ -206,25 +206,25 @@ else
</table>
</div>
<div>
@if (currRecord != null)
@if (statRecord != null)
{
@if (ListOdlStats != null)
{
@foreach (var statRecord in ListOdlStats)
@foreach (var stat in ListOdlStats)
{
<div class="p-1">
<div class="d-flex justify-content-between">
<div class="text-uppercase">
@statRecord.Descrizione
@stat.Descrizione
</div>
<div>
<b>@(formDurata(statRecord.TotDurata))</b>
<b>@(formDurata(stat.TotDurata))</b>
</div>
</div>
<div class="progress">
<div class="progress-bar @colorChanger(@statRecord.Css)" role="progressbar" aria-valuenow="0" aria-valuemin="0" style="width: @Math.Round(calcolaPerc(statRecord.TotDurata),0)%; background-color:@statRecord.Css;" aria-valuemax="100">@($"{calcolaPerc(statRecord.TotDurata):N1}%")</div>
<div class="progress-bar @colorChanger(@stat.Css)" role="progressbar" aria-valuenow="0" aria-valuemin="0" style="width: @Math.Round(calcolaPerc(stat.TotDurata),0)%; background-color:@stat.Css;" aria-valuemax="100">@($"{calcolaPerc(stat.TotDurata):N1}%")</div>
</div>
</div>
@@ -234,14 +234,14 @@ else
</div>
</div>
<div class="col-4 dcContainer">
@if (currRecord != null && ListOdlStats != null)
@if (statRecord != null && ListOdlStats != null)
{
<div class="dcBox">
<ODLPlot SelectedOdl="@currRecord.IdxOdl"></ODLPlot>
<ODLPlot SelectedOdl="@statRecord.IdxOdl"></ODLPlot>
</div>
<div class="dcBox dcOverlay d-flex">
<div class="align-self-center text-center w-100">
<b class="fs-3">@currRecord.DurataMinuti</b>
<b class="fs-3">@statRecord.DurataMinuti</b>
</div>
</div>
}
+26 -6
View File
@@ -48,19 +48,19 @@ namespace MP.SPEC.Components
//oggetto contenente le funzioni del code behind che sono jsInvokable
private DotNetObjectReference<ListODL>? objRef;
#if true //FUNZIONA SE IL METODO TriggerDotNetInstanceMethod() E' IN ONCLOCK BOTTONE
#if false //FUNZIONA SE IL METODO TriggerDotNetInstanceMethod() E' IN ONCLICK BOTTONE
[JSInvokable]
public void setHelper()
{
objRef = DotNetObjectReference.Create(this);
}
[JSInvokable]
public void svuotaRecord()
{
currRecord = null;
}
[JSInvokable]
public void setHelper()
{
objRef = DotNetObjectReference.Create(this);
}
public async Task TriggerDotNetInstanceMethod()
{
await JSRuntime.InvokeVoidAsync("recordDeselect", objRef);
@@ -71,6 +71,8 @@ namespace MP.SPEC.Components
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -162,6 +164,22 @@ namespace MP.SPEC.Components
ListOdlStats = null;
}
}
protected async Task selectStatRecord(ODLModel? currRec)
{
showStats = true;
await Task.Delay(1);
statRecord = currRec;
if (currRec != null)
{
showStats = true;
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
}
else
{
showStats = false;
ListOdlStats = null;
}
}
protected async Task selRecord(ODLModel? currRec)
{
@@ -184,6 +202,8 @@ namespace MP.SPEC.Components
private ODLModel? currRecord = null;
private ODLModel? statRecord = null;
private List<StatODLModel>? ListOdlStats;
private List<ODLModel>? ListRecords;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2210.1715</Version>
<Version>6.16.2210.1809</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2210.1715</h4>
<h4>Versione: 6.16.2210.1809</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2210.1715
6.16.2210.1809
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2210.1715</version>
<version>6.16.2210.1809</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+12 -23
View File
@@ -1,15 +1,4 @@
//window.recordDeselect = (dotNetHelper) => {
// var myModalEl = document.getElementById('myModal')
// myModalEl.addEventListener('hidden.bs.modal', function (event) {
// // do something...
// //dotNetHelper.invokeMethodAsync('TriggerDotNetInstanceMethod');
// return dotNetHelper.invokeMethodAsync('svuotaRecord');
// console.log("fatto");
// });
//};
//TENTATIVO POPOLAMENTO HELPER PER POTER INVOCARE IL METODO DOPO
////TENTATIVO POPOLAMENTO HELPER PER POTER INVOCARE IL METODO DOPO
//let helper;
//window.setHelper = (dotNetHelper) => {
@@ -18,15 +7,15 @@
// return dotNetHelper.invokeMethodAsync('setHelper');
//}
//BECCA QUANDO LA MODALE VIENE CHIUSA ED ESEGUE
document.addEventListener('click', function (e) {
if (e.target.id === 'myModal') {
console.log('chiuso');
////BECCA QUANDO LA MODALE VIENE CHIUSA ED ESEGUE
//document.addEventListener('click', function (e) {
// if (e.target.id === 'myModal') {
// console.log('chiuso');
return helper.invokeMethodAsync('svuotaRecord');
console.log("fatto");
} else {
console.log('aperto');
}
e.stopPropagation();
}, false);
// //return helper.invokeMethodAsync('svuotaRecord');
// console.log("fatto");
// } else {
// console.log('aperto');
// }
// e.stopPropagation();
//}, false);