Review funktion mit melde funktion ersetzt
This commit is contained in:
@@ -1,179 +0,0 @@
|
|||||||
@using SZUAbsolventenverein.Module.PremiumArea.Services
|
|
||||||
@using SZUAbsolventenverein.Module.PremiumArea.Models
|
|
||||||
@namespace SZUAbsolventenverein.Module.PremiumArea
|
|
||||||
@inherits ModuleBase
|
|
||||||
@inject IEngineerApplicationService ApplicationService
|
|
||||||
@inject NavigationManager NavManager
|
|
||||||
|
|
||||||
<h3>Ingenieur-Anträge Prüfen</h3>
|
|
||||||
|
|
||||||
@if (_applications == null)
|
|
||||||
{
|
|
||||||
<p>Laden...</p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-7">
|
|
||||||
<div class="mb-3">
|
|
||||||
<div class="btn-group" role="group">
|
|
||||||
<input type="radio" class="btn-check" name="statusfilter" id="filterValidation" autocomplete="off" checked="@(_filterStatus == "Validation")" @onchange="@(() => _filterStatus = "Validation")">
|
|
||||||
<label class="btn btn-outline-primary" for="filterValidation">Validierung (Entwurf/Eingereicht)</label>
|
|
||||||
|
|
||||||
<input type="radio" class="btn-check" name="statusfilter" id="filterApproved" autocomplete="off" checked="@(_filterStatus == "Approved")" @onchange="@(() => _filterStatus = "Approved")">
|
|
||||||
<label class="btn btn-outline-success" for="filterApproved">Genehmigt</label>
|
|
||||||
|
|
||||||
<input type="radio" class="btn-check" name="statusfilter" id="filterRejected" autocomplete="off" checked="@(_filterStatus == "Rejected")" @onchange="@(() => _filterStatus = "Rejected")">
|
|
||||||
<label class="btn btn-outline-danger" for="filterRejected">Abgelehnt</label>
|
|
||||||
|
|
||||||
<input type="radio" class="btn-check" name="statusfilter" id="filterReported" autocomplete="off" checked="@(_filterStatus == "Reported")" @onchange="@(() => _filterStatus = "Reported")">
|
|
||||||
<label class="btn btn-outline-warning" for="filterReported">Gemeldet</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (FilteredApplications.Count == 0)
|
|
||||||
{
|
|
||||||
<p>Keine Anträge gefunden.</p>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<table class="table table-striped table-hover">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Benutzer ID</th>
|
|
||||||
<th>Dateiname</th>
|
|
||||||
<th>Datum</th>
|
|
||||||
<th>Status</th>
|
|
||||||
@if (_filterStatus == "Reported")
|
|
||||||
{
|
|
||||||
<th>Meldegrund</th>
|
|
||||||
}
|
|
||||||
<th>Aktionen</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var app in FilteredApplications)
|
|
||||||
{
|
|
||||||
<tr @onclick="@(() => SelectApp(app))" style="cursor: pointer;" class="@(_selectedApp == app ? "table-active" : "")">
|
|
||||||
<td>@app.UserId</td>
|
|
||||||
<td>@app.PdfFileName</td>
|
|
||||||
<td>@(app.SubmittedOn?.ToShortDateString() ?? app.CreatedOn.ToShortDateString())</td>
|
|
||||||
<td>
|
|
||||||
@app.Status
|
|
||||||
@if(app.IsReported) { <span class="badge bg-warning text-dark">Gemeldet</span> }
|
|
||||||
</td>
|
|
||||||
@if (_filterStatus == "Reported")
|
|
||||||
{
|
|
||||||
<td class="text-danger">@app.ReportReason</td>
|
|
||||||
}
|
|
||||||
<td>
|
|
||||||
<button class="btn btn-sm btn-primary" @onclick="@((e) => SelectApp(app))">Prüfen</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div class="col-md-5">
|
|
||||||
@if (_selectedApp != null)
|
|
||||||
{
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
Antragsdetails
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<dl class="row">
|
|
||||||
<dt class="col-sm-4">Benutzer ID</dt>
|
|
||||||
<dd class="col-sm-8">@_selectedApp.UserId</dd>
|
|
||||||
<dt class="col-sm-4">Datei</dt>
|
|
||||||
<dd class="col-sm-8">@_selectedApp.PdfFileName</dd>
|
|
||||||
<dt class="col-sm-4">Status</dt>
|
|
||||||
<dd class="col-sm-8">@_selectedApp.Status</dd>
|
|
||||||
@if (_selectedApp.IsReported)
|
|
||||||
{
|
|
||||||
<dt class="col-sm-4 text-danger">Meldegrund</dt>
|
|
||||||
<dd class="col-sm-8 text-danger">@_selectedApp.ReportReason (Anzahl: @_selectedApp.ReportCount)</dd>
|
|
||||||
}
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<div class="ratio ratio-16x9">
|
|
||||||
<iframe src="@((NavManager.BaseUri + "api/engineerapplication") + "/download/" + _selectedApp.ApplicationId + "?moduleid=" + ModuleState.ModuleId)" allowfullscreen></iframe>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="d-grid gap-2">
|
|
||||||
@if (_selectedApp.Status != "Approved" || _selectedApp.IsReported)
|
|
||||||
{
|
|
||||||
<button class="btn @(_selectedApp.IsReported ? "btn-warning" : "btn-success")" @onclick="ApproveApp">
|
|
||||||
@(_selectedApp.IsReported ? "Meldung verwerfen / Behalten" : "Genehmigen & Premium gewähren")
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
@if (_selectedApp.Status != "Rejected")
|
|
||||||
{
|
|
||||||
<button class="btn btn-danger" @onclick="RejectApp">Ablehnen / Löschen</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit; // Admin Only
|
|
||||||
|
|
||||||
private List<EngineerApplication> _applications;
|
|
||||||
private EngineerApplication _selectedApp;
|
|
||||||
private string _filterStatus = "Validation";
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
await LoadApps();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadApps()
|
|
||||||
{
|
|
||||||
// Load All applications
|
|
||||||
_applications = await ApplicationService.GetApplicationsAsync(ModuleState.ModuleId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<EngineerApplication> FilteredApplications
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_applications == null) return new List<EngineerApplication>();
|
|
||||||
if (_filterStatus == "Validation")
|
|
||||||
return _applications.Where(a => a.Status == "Draft" || a.Status == "Submitted" || a.Status == "Published").ToList();
|
|
||||||
|
|
||||||
if (_filterStatus == "Reported")
|
|
||||||
return _applications.Where(a => a.IsReported).ToList();
|
|
||||||
|
|
||||||
return _applications.Where(a => a.Status == _filterStatus).ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SelectApp(EngineerApplication app)
|
|
||||||
{
|
|
||||||
_selectedApp = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ApproveApp()
|
|
||||||
{
|
|
||||||
if (_selectedApp == null) return;
|
|
||||||
await ApplicationService.ApproveApplicationAsync(_selectedApp.ApplicationId, ModuleState.ModuleId);
|
|
||||||
await LoadApps();
|
|
||||||
_selectedApp = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task RejectApp()
|
|
||||||
{
|
|
||||||
if (_selectedApp == null) return;
|
|
||||||
// Basic rejection without custom reason for now since UI input was removed
|
|
||||||
await ApplicationService.RejectApplicationAsync(_selectedApp.ApplicationId, ModuleState.ModuleId, "Abgelehnt durch Admin");
|
|
||||||
await LoadApps();
|
|
||||||
_selectedApp = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Oqtane.Databases.Interfaces;
|
|
||||||
using Oqtane.Migrations;
|
|
||||||
using SZUAbsolventenverein.Module.PremiumArea.Migrations.EntityBuilders;
|
|
||||||
using SZUAbsolventenverein.Module.PremiumArea.Repository;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.PremiumArea.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(PremiumAreaContext))]
|
|
||||||
[Migration("SZUAbsolventenverein.Module.PremiumArea.01.00.00.01")]
|
|
||||||
public class AddPremiumTables : MultiDatabaseMigration
|
|
||||||
{
|
|
||||||
public AddPremiumTables(IDatabase database) : base(database)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
var engAppBuilder = new EngineerApplicationEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
engAppBuilder.Create();
|
|
||||||
|
|
||||||
var userPremBuilder = new UserPremiumEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
userPremBuilder.Create();
|
|
||||||
|
|
||||||
var premEventBuilder = new PremiumEventEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
premEventBuilder.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
var engAppBuilder = new EngineerApplicationEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
engAppBuilder.Drop();
|
|
||||||
|
|
||||||
var userPremBuilder = new UserPremiumEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
userPremBuilder.Drop();
|
|
||||||
|
|
||||||
var premEventBuilder = new PremiumEventEntityBuilder(migrationBuilder, ActiveDatabase);
|
|
||||||
premEventBuilder.Drop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Oqtane.Databases.Interfaces;
|
|
||||||
using Oqtane.Migrations;
|
|
||||||
using SZUAbsolventenverein.Module.PremiumArea.Migrations.EntityBuilders;
|
|
||||||
using SZUAbsolventenverein.Module.PremiumArea.Repository;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace SZUAbsolventenverein.Module.PremiumArea.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(PremiumAreaContext))]
|
|
||||||
[Migration("SZUAbsolventenverein.Module.PremiumArea.01.00.00.02")]
|
|
||||||
public class AddReportAndFileColumns : MultiDatabaseMigration
|
|
||||||
{
|
|
||||||
public AddReportAndFileColumns(IDatabase database) : base(database)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
// Add FileId (nullable int) - assuming missing
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "FileId",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
// Add PdfFileName (string 256)
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PdfFileName",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
maxLength: 256,
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
// Add ApprovedOn (DateTime nullable) - might exist but adding if missing?
|
|
||||||
// MigrationBuilder will fail if exists. We assume schema drift needs this.
|
|
||||||
// If it exists, user must handle.
|
|
||||||
migrationBuilder.AddColumn<DateTime>(
|
|
||||||
name: "ApprovedOn",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
// Add IsReported (bool not null default false)
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "IsReported",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
|
|
||||||
// Add ReportReason (string max nullable)
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "ReportReason",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
// Add ReportCount (int not null default 0)
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "ReportCount",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "IsReported",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ReportReason",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ReportCount",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "FileId",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PdfFileName",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ApprovedOn",
|
|
||||||
table: "SZUAbsolventenvereinEngineerApplications");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user