New: Report-System using globally available Interfaces.

This commit is contained in:
2026-02-12 19:01:30 +01:00
parent a94527f294
commit 28925a3cfa
21 changed files with 847 additions and 8 deletions

View File

@@ -0,0 +1,79 @@
@namespace SZUAbsolventenverein.Module.ReportSystem
@using Microsoft.VisualBasic.FileIO
@using SZUAbsolventenverein.Module.ReportSystem.Models
@using SZUAbsolventenverein.Module.ReportSystem.Services
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IReportSystemReportingService ReportingService
@inject IStringLocalizer<Index> Localizer
@if (reportings == null)
{
<p><em>Loading...</em></p>
}
else
{
<br />
<br />
@if (reportings.Count != 0)
{
<Pager Items="@reportings">
<Header>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>@Localizer["Name"]</th>
</Header>
<Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ReportingID)" ResourceKey="Edit" /></td>
<td><ActionDialog Header="Delete AdminModules" Message="Are You Sure You Wish To Delete This AdminModules?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.ReportingID.ToString()" /></td>
<td><ActionLink Action="Send" Parameters="@($"id=" + context.ReportingID)" ResourceKey="Send" /></td>
<td>@context.Reason</td>
</Row>
</Pager>
}
else
{
<p>@Localizer["Message.DisplayNone"]</p>
}
}
@code {
public override string RenderMode => RenderModes.Interactive;
public override List<Resource> Resources => new List<Resource>()
{
new Stylesheet("_content/SZUAbsolventenverein.Module.ReportSystem/Module.css"),
new Script("_content/SZUAbsolventenverein.Module.ReportSystem/Module.js")
};
private List<Reporting> reportings = new List<Reporting>();
protected override async Task OnInitializedAsync()
{
try
{
reportings = await ReportingService.GetReportsAsync(ModuleState.ModuleId);
}
catch (Exception ex)
{
logger.LogError("Error fetching reportings: {Message}", ex.Message);
};
}
private async Task Delete(Reporting reporting)
{
try
{
await ReportingService.DeleteReportingAsync(reporting.ReportingID, ModuleState.ModuleId);
reportings.Remove(reporting);
StateHasChanged();
}
catch (Exception ex)
{
logger.LogError("Error deleting reporting: {Message}", ex.Message);
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using Oqtane.Models;
using Oqtane.Modules;
namespace SZUAbsolventenverein.Module.ReportSystem
{
public class ModuleInfo : IModule
{
public ModuleDefinition ModuleDefinition => new ModuleDefinition
{
Name = "ReportSystem",
Description = "Handle Systemwide Reporting",
Version = "1.0.0",
ServerManagerType =
"SZUAbsolventenverein.Module.ReportSystem.Manager.ReportSystemManager, SZUAbsolventenverein.Module.AdminModules.Server.Oqtane",
ReleaseVersions = "1.0.0",
Dependencies = "SZUAbsolventenverein.Module.ReportSystem.Shared.Oqtane",
PackageName = "SZUAbsolventenverein.Module.ReportSystem",
};
}
}

View File

@@ -0,0 +1,49 @@
@namespace SZUAbsolventenverein.Module.ReportSystem
@inherits ModuleBase
@inject ISettingService SettingService
@inject IStringLocalizer<Settings> Localizer
<div class="container">
<div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="value" HelpText="Enter a value" ResourceKey="SettingName"
ResourceType="@resourceType">Name: </Label>
<div class="col-sm-9">
<input id="value" type="text" class="form-control" @bind="@_value"/>
</div>
</div>
</div>
@code {
private string resourceType = "SZUAbsolventenverein.Module.ReportSystem.Settings, SZUAbsolventenverein.Module.AdminModules.Client.Oqtane"; // for localization
public override string Title => "ReportSystem Settings";
string _value;
protected override async Task OnInitializedAsync()
{
try
{
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
_value = SettingService.GetSetting(settings, "SettingName", "");
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
public async Task UpdateSettings()
{
try
{
Dictionary<string, string> settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
SettingService.SetSetting(settings, "SettingName", _value);
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
}