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
|
## 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.
|
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
|
else
|
||||||
{
|
{
|
||||||
<MudText Class="mb-4">Wähle eine Person aus:</MudText>
|
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Class="mb-2">
|
||||||
<MudList T="PersonDto" Dense="true" @bind-SelectedValue="_selectedPerson" SelectionMode="SelectionMode.SingleSelection">
|
<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))
|
@foreach (var person in AvailablePersons.OrderByDescending(p => p.PersonStatus == PersonStatus.Member).ThenBy(p => p.Name))
|
||||||
{
|
{
|
||||||
<MudListItem T="PersonDto" Value="person">
|
<MudListItem T="PersonDto" Value="person">
|
||||||
|
|
@ -34,8 +40,15 @@
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton OnClick="Cancel">Abbrechen</MudButton>
|
<MudButton OnClick="Cancel">Abbrechen</MudButton>
|
||||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="@(_selectedPerson is null)" OnClick="Submit">
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="@(_selectedPersons.Count == 0)" OnClick="Submit">
|
||||||
Hinzufügen
|
@if (_selectedPersons.Count > 0)
|
||||||
|
{
|
||||||
|
<text>@_selectedPersons.Count hinzufügen</text>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<text>Hinzufügen</text>
|
||||||
|
}
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|
@ -50,13 +63,24 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Guid DayId { get; set; }
|
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 Cancel() => MudDialog?.Cancel();
|
||||||
|
|
||||||
private void Submit()
|
private void Submit()
|
||||||
{
|
{
|
||||||
if (_selectedPerson is null) return;
|
if (_selectedPersons.Count == 0) return;
|
||||||
MudDialog?.Close(DialogResult.Ok(_selectedPerson.Id));
|
var personIds = _selectedPersons.Select(p => p.Id).ToList();
|
||||||
|
MudDialog?.Close(DialogResult.Ok(personIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -567,15 +567,18 @@ else
|
||||||
var dialog = await DialogService.ShowAsync<AddParticipantDialog>("Teilnehmer hinzufügen", parameters);
|
var dialog = await DialogService.ShowAsync<AddParticipantDialog>("Teilnehmer hinzufügen", parameters);
|
||||||
var result = await dialog.Result;
|
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)
|
||||||
{
|
{
|
||||||
var dto = new AddDayParticipantDto
|
foreach (var personId in personIds)
|
||||||
{
|
{
|
||||||
DayId = Day.Id,
|
var dto = new AddDayParticipantDto
|
||||||
PersonId = personId
|
{
|
||||||
};
|
DayId = Day.Id,
|
||||||
Dispatcher.Dispatch(new AddDayParticipantAction(dto));
|
PersonId = personId
|
||||||
Snackbar.Add("Teilnehmer wird hinzugefügt...", Severity.Info);
|
};
|
||||||
|
Dispatcher.Dispatch(new AddDayParticipantAction(dto));
|
||||||
|
}
|
||||||
|
Snackbar.Add($"{personIds.Count} Teilnehmer werden hinzugefügt...", Severity.Info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue