79 lines
2.7 KiB
Plaintext
79 lines
2.7 KiB
Plaintext
@using Koogle.Application.DTOs
|
|
@using Koogle.Domain.Enums
|
|
|
|
<MudDialog>
|
|
<TitleContent>
|
|
<MudText Typo="Typo.h6">GIF von URL importieren</MudText>
|
|
</TitleContent>
|
|
<DialogContent>
|
|
<MudTextField @bind-Value="_url"
|
|
Label="URL"
|
|
Placeholder="https://..."
|
|
Required="true"
|
|
Class="mb-4" />
|
|
|
|
<MudTextField @bind-Value="_name"
|
|
Label="Name"
|
|
Required="true"
|
|
Class="mb-4" />
|
|
|
|
<MudText Typo="Typo.subtitle2" Class="mb-2">Ereignisse zuweisen</MudText>
|
|
<MudStack Row="true" Wrap="Wrap.Wrap" Class="mb-4">
|
|
<MudCheckBox @bind-Value="_strike" Label="Alle 9" Color="Color.Success" />
|
|
<MudCheckBox @bind-Value="_circle" Label="Kranz" Color="Color.Primary" />
|
|
<MudCheckBox @bind-Value="_bell" Label="Glocke" Color="Color.Warning" />
|
|
<MudCheckBox @bind-Value="_gutter" Label="Rinne" Color="Color.Error" />
|
|
<MudCheckBox @bind-Value="_noWood" Label="kein Holz" Color="Color.Tertiary" />
|
|
</MudStack>
|
|
|
|
<MudTextField @bind-Value="_description"
|
|
Label="Beschreibung (optional)"
|
|
Lines="2" />
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel">Abbrechen</MudButton>
|
|
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="Submit" Disabled="@(!IsValid)">
|
|
Importieren
|
|
</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
[CascadingParameter] IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
private string _url = "";
|
|
private string _name = "";
|
|
private string _description = "";
|
|
private bool _strike, _circle, _bell, _gutter, _noWood;
|
|
|
|
private bool IsValid => !string.IsNullOrWhiteSpace(_url)
|
|
&& !string.IsNullOrWhiteSpace(_name)
|
|
&& (_strike || _circle || _bell || _gutter || _noWood)
|
|
&& Uri.TryCreate(_url, UriKind.Absolute, out _);
|
|
|
|
private ThrowEventType GetEvents()
|
|
{
|
|
var events = ThrowEventType.None;
|
|
if (_strike) events |= ThrowEventType.Strike;
|
|
if (_circle) events |= ThrowEventType.Circle;
|
|
if (_bell) events |= ThrowEventType.Bell;
|
|
if (_gutter) events |= ThrowEventType.Gutter;
|
|
if (_noWood) events |= ThrowEventType.NoWood;
|
|
return events;
|
|
}
|
|
|
|
private void Submit()
|
|
{
|
|
var dto = new ImportClubGifDto
|
|
{
|
|
Name = _name,
|
|
SourceUrl = _url,
|
|
AssignedEvents = GetEvents(),
|
|
Description = string.IsNullOrWhiteSpace(_description) ? null : _description
|
|
};
|
|
MudDialog.Close(DialogResult.Ok(dto));
|
|
}
|
|
|
|
private void Cancel() => MudDialog.Cancel();
|
|
}
|