Autoselect interaction creator

This commit is contained in:
Andre Beging
2025-03-27 17:47:53 +01:00
parent 19796928e7
commit 6bc2757eb0
5 changed files with 16 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ namespace FoodsharingSiegen.Server.Controls
private async Task AddInteraction(InteractionType type) private async Task AddInteraction(InteractionType type)
{ {
await InteractionModal.Show(type, Prospect?.Id); await InteractionModal.ShowAsync(type, Prospect?.Id);
} }
private List<Interaction> GetTyped(InteractionType type) private List<Interaction> GetTyped(InteractionType type)

View File

@@ -24,21 +24,21 @@
} }
<div class="row"> <div class="row">
<div class="col"> @* <div class="col"> *@
<Field> @* <Field> *@
<FieldLabel>Wer?</FieldLabel> @* <FieldLabel>Wer?</FieldLabel> *@
<Select TValue="Guid" @bind-SelectedValue="SelectedUser"> @* <Select TValue="Guid" @bind-SelectedValue="SelectedUser"> *@
@foreach (var user in Users ?? new List<User>()) @* @foreach (var user in Users ?? new List<User>()) *@
{ @* { *@
<SelectItem Value="@user.Id">@user.Name</SelectItem> @* <SelectItem Value="@user.Id">@user.Name</SelectItem> *@
} @* } *@
</Select> @* </Select> *@
</Field> @* </Field> *@
</div> @* </div> *@
<div class="col"> <div class="col">
<Field> <Field>
<FieldLabel>Wann?</FieldLabel> <FieldLabel>Wann?</FieldLabel>
<DatePicker TValue="DateTime" @bind-Date="Interaction.Date" ElementId="aim-datepicker" Max="DateTime.UtcNow.AddDays(7)"/> <DatePicker TValue="DateTime" @bind-Date="Interaction.Date" ElementId="aim-datepicker" Max="DateTime.UtcNow.AddDays(7)" DisplayFormat="dd.MM.yyyy" />
</Field> </Field>
</div> </div>
</div> </div>

View File

@@ -31,7 +31,7 @@ namespace FoodsharingSiegen.Server.Dialogs
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
public async Task Show(InteractionType type, Guid? prospectId) public async Task ShowAsync(InteractionType type, Guid? prospectId)
{ {
if (prospectId == null) return; if (prospectId == null) return;
_showInfo = false; _showInfo = false;

View File

@@ -112,6 +112,7 @@ namespace FoodsharingSiegen.Server.Pages
/// <param name="arg">The arg</param> /// <param name="arg">The arg</param>
private async Task OnAddInteraction(Interaction arg) private async Task OnAddInteraction(Interaction arg)
{ {
arg.UserID = CurrentUser.Id;
await ProspectService.AddInteraction(arg); await ProspectService.AddInteraction(arg);
await LoadProspects(); await LoadProspects();
} }

View File

@@ -110,6 +110,7 @@ namespace FoodsharingSiegen.Server.Pages
/// <param name="arg">The arg</param> /// <param name="arg">The arg</param>
private async Task OnAddInteraction(Interaction arg) private async Task OnAddInteraction(Interaction arg)
{ {
arg.UserID = CurrentUser.Id;
await ProspectService.AddInteraction(arg); await ProspectService.AddInteraction(arg);
await LoadProspects(); await LoadProspects();
} }