Add interaction removal functionality and improve ProspectContainer layout
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m28s
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m28s
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
@using FoodsharingSiegen.Contracts.Enums
|
@using FoodsharingSiegen.Contracts.Enums
|
||||||
@using FoodsharingSiegen.Shared.Helper
|
@using FoodsharingSiegen.Shared.Helper
|
||||||
|
@using System.ComponentModel
|
||||||
@inherits FsBase
|
@inherits FsBase
|
||||||
|
|
||||||
@{
|
@{
|
||||||
@@ -11,7 +12,8 @@
|
|||||||
|
|
||||||
<div class="@divClass">
|
<div class="@divClass">
|
||||||
<h5 class="mb-2 d-flex">
|
<h5 class="mb-2 d-flex">
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1 d-flex">
|
||||||
|
<div>
|
||||||
@if(string.IsNullOrWhiteSpace(Prospect?.Name))
|
@if(string.IsNullOrWhiteSpace(Prospect?.Name))
|
||||||
{
|
{
|
||||||
<i class="fa-solid fa-exclamation-triangle text-warning"></i>
|
<i class="fa-solid fa-exclamation-triangle text-warning"></i>
|
||||||
@@ -23,32 +25,20 @@
|
|||||||
{
|
{
|
||||||
@Prospect?.Name
|
@Prospect?.Name
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="flex-grow: 1;"></div>
|
||||||
|
|
||||||
@if (Prospect?.FsId != null && Prospect.FsId != 0)
|
@if (Prospect?.FsId != null && Prospect.FsId != 0)
|
||||||
{
|
{
|
||||||
<small style="font-size: .9rem; margin-left: 0.5rem;">@Prospect?.FsId</small>
|
<a href="@(CurrentUser.NetworkLink)/profile/@Prospect?.FsId" target="_blank">
|
||||||
|
<small style="font-size: .9rem;">
|
||||||
|
<i class="fa-solid fa-eye"></i> @Prospect?.FsId
|
||||||
|
</small>
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
@if (CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador))
|
|
||||||
{
|
|
||||||
<i class="fa-solid fa-pen-to-square link mr-2" @onclick="EditProspectAsync" @onclick:preventDefault></i>
|
|
||||||
}
|
|
||||||
<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.Archived)
|
|
||||||
{
|
|
||||||
<i class="fa-solid fa-box-archive link ml-2" @onclick="ArchiveProspectAsync" title="Archivieren" @onclick:preventDefault></i>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<i class="fa-solid fa-recycle link ml-2" @onclick="RestoreProspectAsync" title="Wiederherstellen" @onclick:preventDefault></i>
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Prospect?.Memo))
|
@if (!string.IsNullOrWhiteSpace(Prospect?.Memo))
|
||||||
@@ -154,27 +144,74 @@
|
|||||||
ButtonIconClass="fa-solid fa-check"
|
ButtonIconClass="fa-solid fa-check"
|
||||||
IconClass="fa-solid fa-user-check">
|
IconClass="fa-solid fa-user-check">
|
||||||
</InteractionRow>
|
</InteractionRow>
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
<hr style="margin: 10px 0;">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<InteractionRow
|
|
||||||
Prospect="Prospect"
|
|
||||||
AllowInteraction="@CurrentUser.IsInGroup(UserGroup.Ambassador)"
|
|
||||||
Type="InteractionType.Complete"
|
|
||||||
AddClick="AddInteraction"
|
|
||||||
RemoveClick="@RemoveInteraction"
|
|
||||||
ButtonIconClass="fa-solid fa-check"
|
|
||||||
IconClass="fa-solid fa-flag-checkered">
|
|
||||||
</InteractionRow>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="flex-grow-1"></div>
|
<div class="flex-grow-1"></div>
|
||||||
|
|
||||||
<small class="text-center" style="margin-top: .5rem;">Zuletzt geändert: @Prospect?.Modified?.ToLocalTime()</small>
|
<div class="text-center d-flex justify-content-center gap-2 mt-1">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Color="Color.Secondary"
|
||||||
|
Height="Height.Px(35)"
|
||||||
|
title="Bearbeiten"
|
||||||
|
Clicked="EditProspectAsync"
|
||||||
|
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||||
|
><i class="fa-solid fa-pen-to-square"></i>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
@if(StateFilter > ProspectStateFilter.OnBoarding)
|
||||||
|
{
|
||||||
|
@if(Prospect?.Complete != true)
|
||||||
|
{
|
||||||
|
<Button
|
||||||
|
Color="Color.Primary"
|
||||||
|
Height="Height.Px(35)"
|
||||||
|
title="Fertigstellen"
|
||||||
|
Clicked="@(() => AddInteraction(InteractionType.Complete))"
|
||||||
|
Visibility="@(CurrentUser.IsInGroup(UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||||
|
><i class="fa-solid fa-flag-checkered"></i>
|
||||||
|
</Button>
|
||||||
|
} else {
|
||||||
|
<Button
|
||||||
|
Color="Color.Primary"
|
||||||
|
Height="Height.Px(35)"
|
||||||
|
title="Fertigstellen rückgängig"
|
||||||
|
Clicked="@(() => AddInteraction(InteractionType.Complete))"
|
||||||
|
Visibility="@(CurrentUser.IsInGroup(UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||||
|
><i class="fa-solid fa-flag"></i>
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@if (Prospect?.RecordState != RecordState.Archived)
|
||||||
|
{
|
||||||
|
<Button
|
||||||
|
Color="Color.Danger"
|
||||||
|
Height="Height.Px(35)"
|
||||||
|
title="Archivieren"
|
||||||
|
Clicked="ArchiveProspectAsync"
|
||||||
|
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||||
|
><i class="fa-solid fa-box-archive"></i>
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Button
|
||||||
|
Color="Color.Success"
|
||||||
|
Height="Height.Px(35)"
|
||||||
|
title="Wiederherstellen"
|
||||||
|
Clicked="RestoreProspectAsync"
|
||||||
|
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||||
|
><i class="fa-solid fa-recycle"></i>
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<small class="text-center" style="margin-top: .5rem;">Geändert: @Prospect?.Modified?.ToLocalTime()</small>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,6 +106,27 @@ namespace FoodsharingSiegen.Server.Controls
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task RemoveInteraction(InteractionType type)
|
||||||
|
{
|
||||||
|
var typeName = type.Translate(AppSettings);
|
||||||
|
await ConfirmDialog.ShowAsync(ModalService, "Bestätigen", $"Alle {typeName}-Interaktionen wirklich entfernen?", async () =>
|
||||||
|
{
|
||||||
|
var interactions = Prospect?.Interactions.Where(x => x.Type == type);
|
||||||
|
|
||||||
|
var dataChanged = false;
|
||||||
|
|
||||||
|
foreach (var interaction in interactions ?? [])
|
||||||
|
{
|
||||||
|
var removeR = await ProspectService.RemoveInteraction(interaction.Id);
|
||||||
|
if (!removeR.Success) continue;
|
||||||
|
|
||||||
|
dataChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dataChanged && OnDataChanged != null) await OnDataChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Method RestoreProspectAsync
|
#region Private Method RestoreProspectAsync
|
||||||
|
|||||||
Reference in New Issue
Block a user