Add Feedback Functions
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user