Reporting: Add UserName
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IReportSystemReportingService ReportingService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
@inject IModuleService ModuleService
|
||||
|
||||
@if (reportings == null)
|
||||
@if (_reportings == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
@@ -16,19 +17,24 @@ else
|
||||
{
|
||||
<br />
|
||||
<br />
|
||||
@if (reportings.Count != 0)
|
||||
@if (_reportings.Count != 0)
|
||||
{
|
||||
<Pager Items="@reportings">
|
||||
<Pager Items="@_reportings">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@Localizer["Submitter"]</th>
|
||||
<th>@Localizer["Note"]</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.CreatedBy</td>
|
||||
<td>@context.CreatedOn</td>
|
||||
<td>@context.ModuleId</td>
|
||||
<td>@context.ReportingID</td>
|
||||
<td>@context.Note</td>
|
||||
<td>@context.Reason</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
@@ -39,7 +45,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
public override string RenderMode => RenderModes.Interactive;
|
||||
|
||||
@@ -49,13 +54,28 @@ else
|
||||
new Script("_content/SZUAbsolventenverein.Module.ReportSystem/Module.js")
|
||||
};
|
||||
|
||||
private List<Reporting> reportings = new List<Reporting>();
|
||||
|
||||
private List<Reporting> _reportings = new List<Reporting>();
|
||||
private Dictionary<int, Module> _modules = new Dictionary<int, Module>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
reportings = await ReportingService.GetReportsAsync(ModuleState.ModuleId);
|
||||
_reportings = await ReportingService.GetReportsAsync(ModuleState.ModuleId);
|
||||
foreach (var moduleId in _reportings.Select(r => r.ModuleId).Distinct())
|
||||
{
|
||||
Console.WriteLine(moduleId);
|
||||
try
|
||||
{
|
||||
_modules.Add(moduleId, await ModuleService.GetModuleAsync(moduleId));
|
||||
await logger.LogDebug(LogFunction.Create, "Module found {ModuleId} while loading Modules for Reportings.", moduleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_modules.Add(moduleId, new Module {Title = $"Module not found {ex.Message}"});
|
||||
await logger.LogDebug("Module not found {ModuleId} while loading Modules for Reportings. {error}", moduleId, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -68,7 +88,7 @@ else
|
||||
try
|
||||
{
|
||||
await ReportingService.DeleteReportingAsync(reporting.ReportingID, ModuleState.ModuleId);
|
||||
reportings.Remove(reporting);
|
||||
_reportings.Remove(reporting);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user