Add Feedback Functions

This commit is contained in:
Andre Beging
2025-04-01 11:34:11 +02:00
parent bf64239625
commit 6d6d79f55a
9 changed files with 435 additions and 42 deletions

View File

@@ -24,7 +24,13 @@ namespace FoodsharingSiegen.Server.Dialogs
#region Parameters
[Parameter]
public string? InfoName { get; set; }
public bool AllowFeedback { get; set; }
[Parameter]
public string? Info1Name { get; set; }
[Parameter]
public string? Info2Name { get; set; }
[Parameter]
public Interaction Interaction { get; set; } = new();
@@ -35,9 +41,6 @@ namespace FoodsharingSiegen.Server.Dialogs
[Parameter]
public bool ShowAlert { get; set; }
[Parameter]
public bool ShowInfo { get; set; }
[Parameter]
public bool ShowNotNeeded { get; set; }
@@ -55,21 +58,26 @@ namespace FoodsharingSiegen.Server.Dialogs
/// </returns>
public static async Task ShowAsync(IModalService modalService, InteractionDialogParameter parameter)
{
var showInfo = parameter.Type switch
var allowFeedback = parameter.Type switch
{
InteractionType.EinAb => true,
InteractionType.Complete => true,
InteractionType.IdCheck => true,
InteractionType.PrintPass => true,
InteractionType.ReleasedForVerification => true,
_ => false
};
var infoName = parameter.Type switch
var info1Name = parameter.Type switch
{
InteractionType.EinAb => "Welcher Betrieb?",
InteractionType.Complete => "Kommentar",
InteractionType.IdCheck => "Kommentar",
InteractionType.PrintPass => "Kommentar",
InteractionType.ReleasedForVerification => "Hinweis",
_ => "Kommentar"
_ => null
};
var info2Name = parameter.Type switch
{
InteractionType.EinAb => "Mit wem?",
_ => null
};
var showAlert = parameter.Type switch
@@ -95,8 +103,9 @@ namespace FoodsharingSiegen.Server.Dialogs
await modalService.Show<InteractionDialog>(parameter.HeaderText, p =>
{
p.Add(nameof(Interaction), interaction);
p.Add(nameof(ShowInfo), showInfo);
p.Add(nameof(InfoName), infoName);
p.Add(nameof(AllowFeedback), allowFeedback);
p.Add(nameof(Info1Name), info1Name);
p.Add(nameof(Info2Name), info2Name);
p.Add(nameof(ShowAlert), showAlert);
p.Add(nameof(ShowNotNeeded), showNotNeeded);
p.Add(nameof(OnSuccess), parameter.OnSuccess);
@@ -124,5 +133,22 @@ namespace FoodsharingSiegen.Server.Dialogs
}
#endregion
#region Private Method SetFeedbackAsync
/// <summary>
/// Sets the feedback type for the interaction and updates the feedback property.
/// </summary>
/// <param name="feedback">The feedback type to be set for the interaction.</param>
/// <returns>
/// A task representing the asynchronous operation.
/// </returns>
private async Task SetFeedbackAsync(InteractionFeedback feedback)
{
Interaction.Feedback = feedback;
await Task.CompletedTask;
}
#endregion
}
}