diff --git a/Client/Interop.cs b/Client/Interop.cs
index 73f008a..78135c5 100644
--- a/Client/Interop.cs
+++ b/Client/Interop.cs
@@ -11,5 +11,20 @@ namespace SZUAbsolventenverein.Module.EventRegistration
{
_jsRuntime = jsRuntime;
}
+
+ public async Task CreateChart(string divid, string type, string[] labels, object[] datasets, object options)
+ {
+ try
+ {
+ await _jsRuntime.InvokeVoidAsync(
+ "SZUAbsolventenverein.EventRegistration.createChart",
+ divid, type, (object) labels, (object) datasets, options);
+ }
+ catch
+ {
+ // handle exception
+ }
+ }
+
}
}
diff --git a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor
index 6edc5af..d13d989 100644
--- a/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor
+++ b/Client/Modules/SZUAbsolventenverein.Module.EventRegistration/Edit.razor
@@ -42,6 +42,7 @@
{
}
+
@code {
@@ -53,7 +54,9 @@
public override List Resources => new List()
{
- new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
+ new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
+ new Resource { ResourceType = ResourceType.Script, Bundle = "ChartJS", Url = "https://cdn.jsdelivr.net/npm/chart.js" },
+ new Resource { ResourceType = ResourceType.Script, Bundle = "ChartJS", Url = ModulePath() + "Module.js"}
};
@@ -71,6 +74,9 @@
private DateTime _createdon;
private string _modifiedby;
private DateTime _modifiedon;
+
+ bool _refresh = false;
+ private List _responses;
protected override async Task OnInitializedAsync()
{
@@ -92,6 +98,10 @@
_modifiedby = EventRegistration.ModifiedBy;
_modifiedon = EventRegistration.ModifiedOn;
}
+
+ _responses = await EventRegistrationService.GetEventResponses(_id, ModuleState.ModuleId);
+ Console.WriteLine("Responses count: " + (_responses != null ? _responses.Count.ToString() : "null"));
+ _refresh = true;
}
}
catch (Exception ex)
@@ -101,6 +111,37 @@
}
}
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ try
+ {
+ await base.OnAfterRenderAsync(firstRender);
+
+ Console.WriteLine("Responses count: " + (_responses != null ? _responses.Count.ToString() : "null"));
+
+ if (_refresh && _responses != null)
+ {
+ List labels = new List();
+ List