Rename 'Deleted' state to 'Archived' and update related logic

Replaced 'Deleted' with 'Archived' across the codebase to better reflect the intent of the state. Adjusted related features, including filters, UI labels, navigation, and permissions. Introduced a 'Recent Activity' filter for improved activity tracking.
This commit is contained in:
Andre Beging
2025-04-02 08:40:38 +02:00
parent b7ba95b716
commit 6389da4bc1
10 changed files with 40 additions and 17 deletions

View File

@@ -6,7 +6,7 @@
var divClass = $"{CssClass} pc-main";
if (Prospect is { Complete: true }) divClass += " complete";
if (Prospect is { Warning: true }) divClass += " warning";
if (Prospect is { RecordState: RecordState.Deleted }) divClass += " deleted";
if (Prospect is { RecordState: RecordState.Archived }) divClass += " deleted";
}
<div class="@divClass">
@@ -23,13 +23,13 @@
<a href="@(CurrentUser.NetworkLink)/profile/@Prospect?.FsId" target="_blank"><i class="fa-solid fa-eye"></i></a>
@if (CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador))
{
if (Prospect?.RecordState != RecordState.Deleted)
if (Prospect?.RecordState != RecordState.Archived)
{
<i class="fa-solid fa-trash link ml-2" @onclick="DeleteProspectAsync" @onclick:preventDefault></i>
<i class="fa-solid fa-box-archive link ml-2" @onclick="ArchiveProspectAsync" title="Archivieren" @onclick:preventDefault></i>
}
else if(CurrentUser.IsAdmin())
else
{
<i class="fa-solid fa-recycle link ml-2" @onclick="RestoreProspectAsync" @onclick:preventDefault></i>
<i class="fa-solid fa-recycle link ml-2" @onclick="RestoreProspectAsync" title="Wiederherstellen" @onclick:preventDefault></i>
}
}

View File

@@ -55,13 +55,13 @@ namespace FoodsharingSiegen.Server.Controls
/// Deletes the currently selected prospect after user confirmation. This action is irreversible and will update the record state to "Deleted".
/// </summary>
/// <returns>A task that represents the asynchronous delete operation.</returns>
private async Task DeleteProspectAsync()
private async Task ArchiveProspectAsync()
{
if (Prospect == null) return;
await ConfirmDialog.ShowAsync(ModalService, $"⚠️ {Prospect.Name} löschen", $"Soll {Prospect.Name} mit der FS-ID {Prospect.FsId} wirklich gelöscht werden? Das kann nicht rückgängig gemacht werden!!", async () =>
await ConfirmDialog.ShowAsync(ModalService, $"{Prospect.Name} archivieren", $"Soll {Prospect.Name} mit der FS-ID {Prospect.FsId} wirklich ins Archiv verschoben werden?", async () =>
{
Prospect.RecordState = RecordState.Deleted;
Prospect.RecordState = RecordState.Archived;
var updateR = await ProspectService.UpdateAsync(Prospect);
if (updateR.Success && OnDataChanged != null) await OnDataChanged();
});

View File

@@ -40,6 +40,12 @@
await FilterChanged.InvokeAsync(Filter);
}
private async Task RecentActivityChangedAsync(bool arg)
{
Filter.RecentActivity = arg;
await FilterChanged.InvokeAsync(Filter);
}
}
<div class="card">
@@ -64,11 +70,19 @@
</div>
}
@* RECENT ACTIVITY *@
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
{
<div style="margin-left: 1rem;">
<Switch TValue="bool" Checked="Filter.RecentActivity" CheckedChanged="RecentActivityChangedAsync" Color="Color.Primary">Kürzlich geändert (&lt; 6 Monate)</Switch>
</div>
}
@* NO ACTIVITY *@
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
{
<div style="margin-left: 1rem;">
<Switch TValue="bool" Checked="Filter.NoActivity" CheckedChanged="NoActivityChangedAsync" Color="Color.Primary">Lange keine Aktivität (6 Monate)</Switch>
<Switch TValue="bool" Checked="Filter.NoActivity" CheckedChanged="NoActivityChangedAsync" Color="Color.Primary">Lange keine Aktivität (&gt; 6 Monate)</Switch>
</div>
}