Seasons dropdown

This commit is contained in:
Tracy Pearson
2023-02-19 23:45:57 -05:00
parent 436d99e8dc
commit df57fae27d

View File

@@ -5,15 +5,20 @@
@if (Series != null)
{
<div role="dialog">
<div class="toast-container p-3 @showClass" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast-container p-6 @showClass" data-bs-autohide="true" data-bs-delay="5000">
<div class="toast show" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<strong class="me-auto">@Series?.Name</strong>
<select @onchange="ChangeSeason">
@foreach (var s in Seasons)
{
<option value=@s>@s</option>
}
</select>
<button type="button" class="btn-close" aria-label="Close" @onclick="Close"></button>
</div>
<div class="toast-body">
@foreach (var episode in Series?.Seasons.Season[0].Episodes.Episode)
@foreach (var episode in currentSeason.Episodes.Episode)
{
<EpisodeComponent Episode="@episode"></EpisodeComponent>
}
@@ -27,6 +32,8 @@
[Parameter]
public DvdSeries Series { get; set; }
private bool IsVisible { get; set; } = false;
private List<string> Seasons { get; set; } = new();
private DvdSeason currentSeason { get; set; }
public void Close()
{
@@ -35,6 +42,20 @@
protected override void OnParametersSet()
{
IsVisible = Series != null;
if (Series != null)
{
currentSeason = Series.Seasons.Season[0];
Seasons.Clear();
foreach (var item in Series.Seasons.Season)
{
Seasons.Add(item.Season_name);
}
}
base.OnParametersSet();
}
private void ChangeSeason(ChangeEventArgs e)
{
currentSeason = Series.Seasons.Season.FirstOrDefault(s => s.Season_name == (string)e.Value);
}
}