Ingenieur Anträge: UI und Services

This commit is contained in:
2026-02-11 10:56:15 +01:00
parent 54f90ea3fb
commit 51b8f1c916
9 changed files with 1311 additions and 58 deletions

View File

@@ -1,5 +1,7 @@
@using SZUAbsolventenverein.Module.PremiumArea.Services
@using SZUAbsolventenverein.Module.PremiumArea.Models
@using Oqtane.Security
@using Oqtane.Shared
@namespace SZUAbsolventenverein.Module.PremiumArea
@inherits ModuleBase
@@ -7,35 +9,14 @@
@inject NavigationManager NavigationManager
@inject IStringLocalizer<Index> Localizer
@if (_PremiumAreas == null)
{
<p><em>Loading...</em></p>
}
else
{
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add PremiumArea" ResourceKey="Add" />
<br />
<br />
@if (@_PremiumAreas.Count != 0)
<div class="mb-3">
<ActionLink Action="Apply" Text="Ingenieur Antrag hochladen" />
@if (Oqtane.Security.UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
<Pager Items="@_PremiumAreas">
<Header>
<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.PremiumAreaId.ToString())" ResourceKey="Edit" /></td>
<td><ActionDialog Header="Delete PremiumArea" Message="Are You Sure You Wish To Delete This PremiumArea?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.PremiumAreaId.ToString()" /></td>
<td>@context.Name</td>
</Row>
</Pager>
<ActionLink Action="AdminReview" Text="Admin Bereich" Security="SecurityAccessLevel.Edit" />
}
else
{
<p>@Localizer["Message.DisplayNone"]</p>
}
}
<ActionLink Action="ApplicationList" Text="Liste alle Ingenieur Anträge" />
</div>
@code {
public override string RenderMode => RenderModes.Static;
@@ -45,35 +26,4 @@ else
new Stylesheet("_content/SZUAbsolventenverein.Module.PremiumArea/Module.css"),
new Script("_content/SZUAbsolventenverein.Module.PremiumArea/Module.js")
};
List<PremiumArea> _PremiumAreas;
protected override async Task OnInitializedAsync()
{
try
{
_PremiumAreas = await PremiumAreaService.GetPremiumAreasAsync(ModuleState.ModuleId);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading PremiumArea {Error}", ex.Message);
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
}
}
private async Task Delete(PremiumArea PremiumArea)
{
try
{
await PremiumAreaService.DeletePremiumAreaAsync(PremiumArea.PremiumAreaId, ModuleState.ModuleId);
await logger.LogInformation("PremiumArea Deleted {PremiumArea}", PremiumArea);
_PremiumAreas = await PremiumAreaService.GetPremiumAreasAsync(ModuleState.ModuleId);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting PremiumArea {PremiumArea} {Error}", PremiumArea, ex.Message);
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
}
}
}