Delete Button für eigenen Antrag
This commit is contained in:
@@ -74,7 +74,18 @@ else
|
|||||||
<p>
|
<p>
|
||||||
<strong>Datum:</strong> @_existingApp.CreatedOn.ToShortDateString()
|
<strong>Datum:</strong> @_existingApp.CreatedOn.ToShortDateString()
|
||||||
</p>
|
</p>
|
||||||
<button class="btn btn-primary" @onclick="EditApp">Antrag aktualisieren</button>
|
<div class="d-flex gap-2">
|
||||||
|
<button class="btn btn-primary" @onclick="EditApp">Antrag aktualisieren</button>
|
||||||
|
@if (!_confirmDelete)
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-danger" @onclick="() => _confirmDelete = true">Antrag löschen</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-danger" @onclick="DeleteApp">Wirklich löschen?</button>
|
||||||
|
<button class="btn btn-secondary" @onclick="() => _confirmDelete = false">Abbrechen</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -85,6 +96,7 @@ else
|
|||||||
|
|
||||||
private EngineerApplication _existingApp = new EngineerApplication();
|
private EngineerApplication _existingApp = new EngineerApplication();
|
||||||
private bool _showForm = true;
|
private bool _showForm = true;
|
||||||
|
private bool _confirmDelete = false;
|
||||||
private string _message = "";
|
private string _message = "";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
@@ -160,6 +172,23 @@ else
|
|||||||
NavManager.NavigateTo(NavigateUrl());
|
NavManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task DeleteApp()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await ApplicationService.DeleteApplicationAsync(_existingApp.ApplicationId, ModuleState.ModuleId);
|
||||||
|
_existingApp = new EngineerApplication { Status = "New" };
|
||||||
|
_showForm = true;
|
||||||
|
_confirmDelete = false;
|
||||||
|
_message = "Antrag erfolgreich gelöscht.";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_message = "Fehler beim Löschen: " + ex.Message;
|
||||||
|
_confirmDelete = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Task OnSelectFile(int fileId)
|
private Task OnSelectFile(int fileId)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user