mod: multiselect participants
This commit is contained in:
parent
1e9cf520f6
commit
bef4309e0e
|
|
@ -1,4 +1,10 @@
|
|||
|
||||
- neuer Tag -> optional Gäste und nicht alle Teilnehmer
|
||||
- Tag beendnden -> alle Teilnehmer hinzufügen, und strafen hinzufügen
|
||||
- offene Sachstrafen von einem Tag zum nächsten fortschreiben
|
||||
-
|
||||
|
||||
|
||||
## Optimierung Spieltag-Details
|
||||
Blende die Erledigt-Kennzeichnung (Als bezahlt markieren) in der Tabelle mit den Staten (<!-- Expense Table -->) für Geldstrafen aus. Nur Sachstrafen sollen sich manuell erledigen lassen. Geldstrafen werden später zentral über die Abrechnung des gesamten Tages erledigt.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,14 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<MudText Class="mb-4">Wähle eine Person aus:</MudText>
|
||||
<MudList T="PersonDto" Dense="true" @bind-SelectedValue="_selectedPerson" SelectionMode="SelectionMode.SingleSelection">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Class="mb-2">
|
||||
<MudText>Wähle Personen aus:</MudText>
|
||||
<MudStack Row="true" Spacing="1">
|
||||
<MudButton Size="Size.Small" Variant="Variant.Text" OnClick="SelectAll">Alle</MudButton>
|
||||
<MudButton Size="Size.Small" Variant="Variant.Text" OnClick="SelectNone">Keine</MudButton>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
<MudList T="PersonDto" Dense="true" @bind-SelectedValues="_selectedPersons" SelectionMode="SelectionMode.MultiSelection">
|
||||
@foreach (var person in AvailablePersons.OrderByDescending(p => p.PersonStatus == PersonStatus.Member).ThenBy(p => p.Name))
|
||||
{
|
||||
<MudListItem T="PersonDto" Value="person">
|
||||
|
|
@ -34,8 +40,15 @@
|
|||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel">Abbrechen</MudButton>
|
||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="@(_selectedPerson is null)" OnClick="Submit">
|
||||
Hinzufügen
|
||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="@(_selectedPersons.Count == 0)" OnClick="Submit">
|
||||
@if (_selectedPersons.Count > 0)
|
||||
{
|
||||
<text>@_selectedPersons.Count hinzufügen</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<text>Hinzufügen</text>
|
||||
}
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
|
@ -50,13 +63,24 @@
|
|||
[Parameter]
|
||||
public Guid DayId { get; set; }
|
||||
|
||||
private PersonDto? _selectedPerson;
|
||||
private IReadOnlyCollection<PersonDto> _selectedPersons = [];
|
||||
|
||||
private void SelectAll()
|
||||
{
|
||||
_selectedPersons = AvailablePersons.ToList();
|
||||
}
|
||||
|
||||
private void SelectNone()
|
||||
{
|
||||
_selectedPersons = [];
|
||||
}
|
||||
|
||||
private void Cancel() => MudDialog?.Cancel();
|
||||
|
||||
private void Submit()
|
||||
{
|
||||
if (_selectedPerson is null) return;
|
||||
MudDialog?.Close(DialogResult.Ok(_selectedPerson.Id));
|
||||
if (_selectedPersons.Count == 0) return;
|
||||
var personIds = _selectedPersons.Select(p => p.Id).ToList();
|
||||
MudDialog?.Close(DialogResult.Ok(personIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,9 @@ else
|
|||
var dialog = await DialogService.ShowAsync<AddParticipantDialog>("Teilnehmer hinzufügen", parameters);
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (result != null && !result.Canceled && result.Data is Guid personId)
|
||||
if (result != null && !result.Canceled && result.Data is List<Guid> personIds)
|
||||
{
|
||||
foreach (var personId in personIds)
|
||||
{
|
||||
var dto = new AddDayParticipantDto
|
||||
{
|
||||
|
|
@ -575,7 +577,8 @@ else
|
|||
PersonId = personId
|
||||
};
|
||||
Dispatcher.Dispatch(new AddDayParticipantAction(dto));
|
||||
Snackbar.Add("Teilnehmer wird hinzugefügt...", Severity.Info);
|
||||
}
|
||||
Snackbar.Add($"{personIds.Count} Teilnehmer werden hinzugefügt...", Severity.Info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue