Refactor interaction handling with utility for translations
Introduced `TermHelper.Translate` to centralize string mappings for `InteractionType`, reducing duplication across components. Updated related code to leverage this utility and streamline interaction row implementation by removing the `Caption` parameter. Minor UI adjustments were also made to align button positioning and styling.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using FoodsharingSiegen.Shared.Helper;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Controls
|
||||
@@ -20,19 +21,7 @@ namespace FoodsharingSiegen.Server.Controls
|
||||
{
|
||||
if (Prospect != null && OnDataChanged != null)
|
||||
{
|
||||
var headerText = type switch
|
||||
{
|
||||
InteractionType.EinAb => "Einführung eintragen",
|
||||
InteractionType.Welcome => "Begrüßung eintragen",
|
||||
InteractionType.IdCheck => "Ausweisprüfung eintragen",
|
||||
InteractionType.PrintPass => "FS-Ausweis (Print)",
|
||||
InteractionType.PdfPass => "FS-Ausweis (PDF)",
|
||||
InteractionType.Verify => "Verifizierung eintragen",
|
||||
InteractionType.Complete => "Als fertig markieren",
|
||||
InteractionType.StepInBriefing => $"{AppSettings.Terms.StepInName} absolviert",
|
||||
InteractionType.ReleasedForVerification => "Zur Verifizierung freigegeben",
|
||||
_ => "Neuer Eintrag"
|
||||
};
|
||||
var headerText = $"{type.Translate(AppSettings)} eintragen";
|
||||
|
||||
await InteractionDialog.ShowAsync(ModalService, new(type, Prospect.Id, headerText, OnDataChanged));
|
||||
}
|
||||
@@ -57,7 +46,10 @@ namespace FoodsharingSiegen.Server.Controls
|
||||
|
||||
private async Task RemoveInteraction(Guid arg)
|
||||
{
|
||||
var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o =>
|
||||
var type = Prospect?.Interactions.FirstOrDefault(x => x.Id == arg)?.Type;
|
||||
var typeName = type != null ? type.Value.Translate(AppSettings) : "Interaktion";
|
||||
|
||||
var confirm = await Message.Confirm($"{typeName} wirklich entfernen?", "Bestätigen", o =>
|
||||
{
|
||||
o.ConfirmButtonText = "Ja, wirklich!";
|
||||
o.CancelButtonText = "Abbrechen";
|
||||
|
||||
Reference in New Issue
Block a user