inizio gestione currRecord dopo chiusura modal

This commit is contained in:
zaccaria.majid
2022-10-17 17:27:39 +02:00
parent 91083b6c4a
commit 460eb769dc
10 changed files with 70 additions and 21 deletions
+4 -3
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="#staticBackdrop" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
<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>
</div>
<!-- Modal -->
</td>
@@ -118,7 +118,7 @@ else
}
</tbody>
</table>
<div class="modal fade" id="staticBackdrop" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header bg-primary col-12">
@@ -137,7 +137,7 @@ else
</div>
}
<div class="col-1 text-end">
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="TriggerDotNetInstanceMethod"></button>
</div>
</div>
<div class="modal-body col-12">
@@ -255,3 +255,4 @@ else
</div>
</div>
}
+28 -3
View File
@@ -3,7 +3,8 @@ using Microsoft.JSInterop;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using System.Formats.Asn1;
using MP.SPEC.Pages;
using System.Xml.Linq;
namespace MP.SPEC.Components
{
@@ -41,9 +42,31 @@ namespace MP.SPEC.Components
public string formDurata(double durataMin)
{
return Utils.FormDurata(durataMin);
return MP.Data.Utils.FormDurata(durataMin);
}
//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
[JSInvokable]
public void svuotaRecord()
{
currRecord = null;
}
[JSInvokable]
public void setHelper()
{
objRef = DotNetObjectReference.Create(this);
}
public async Task TriggerDotNetInstanceMethod()
{
await JSRuntime.InvokeVoidAsync("recordDeselect", objRef);
}
#endif
#endregion Public Methods
#region Protected Properties
@@ -80,6 +103,8 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
objRef = DotNetObjectReference.Create(this);
//await JSRuntime.InvokeVoidAsync("setHelper", objRef);
}
protected override async Task OnParametersSetAsync()
@@ -90,7 +115,7 @@ namespace MP.SPEC.Components
protected string colorChanger(string colorCSS)
{
string answ = "";
if(colorCSS == "yellow")
if (colorCSS == "yellow")
{
answ = "text-dark";
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2210.1711</Version>
<Version>6.16.2210.1715</Version>
</PropertyGroup>
<ItemGroup>
-1
View File
@@ -102,4 +102,3 @@
</div>
</div>
+1 -1
View File
@@ -32,8 +32,8 @@
<script src="lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="_framework/blazor.server.js" autostart="false"></script>
<script src="lib/chartjs-adapter-luxon/chartjs-adapter-luxon.js"></script>
<script src="lib/chartBoot.js"></script>
<script src="lib/modalHandler.js"></script>
<script src="lib/Chart.js/chart.js"></script>
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2210.1711</h4>
<h4>Versione: 6.16.2210.1715</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2210.1711
6.16.2210.1715
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2210.1711</version>
<version>6.16.2210.1715</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>
+1 -9
View File
@@ -1,20 +1,12 @@
///Setup del chart desiderato con id univoco
window.setup = (id, config) => {
var ctx = document.getElementById(id).getContext('2d');
//let currentDate = new Date();
//console.log(currentDate + " - Calling setup...");
console.log(id);
if (window['myChart'] instanceof Chart) {
//window.myChart.destroy();
window['myChart'].destroy();
console.log("Chart " + id + " destroyed!");
window['myChart'] = new Chart(ctx, config);
}
else
{
else {
window['myChart'] = new Chart(ctx, config);
//console.log("Chart " + id + " created!");
console.log(window['myChart']);
}
}
+32
View File
@@ -0,0 +1,32 @@
//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
//let helper;
//window.setHelper = (dotNetHelper) => {
// helper = dotNetHelper.invokeMethodAsync('setHelper');
// console.log(helper);
// 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');
return helper.invokeMethodAsync('svuotaRecord');
console.log("fatto");
} else {
console.log('aperto');
}
e.stopPropagation();
}, false);