113 lines
4.1 KiB
Plaintext
113 lines
4.1 KiB
Plaintext
@inject IDataService DataService
|
|
|
|
<MudDialog>
|
|
<DialogContent>
|
|
<MudTable Items="@titles" Filter="@Filter" @bind-SelectedItem="@selectedTitle" Hover="true"
|
|
FixedHeader="true" Height="70vh">
|
|
<ColGroup>
|
|
<col style="width: 50px;" />
|
|
<col />
|
|
</ColGroup>
|
|
<ToolBarContent>
|
|
<MudTextField @bind-Value="searchString" Placeholder="Search" Adornment="Adornment.Start" Immediate="false"
|
|
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0">
|
|
</MudTextField>
|
|
</ToolBarContent>
|
|
<HeaderContent>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="@(new Func<Title, object>(x => x.Id))">
|
|
Title Id
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="@(new Func<Title, object>(x => x.TitleName))">
|
|
Title Name
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
Unlock Condition Type
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="@(new Func<Title, object>(x => x.UnlockRequirementJp))">
|
|
Unlock Requirement (Japanese)
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
<MudTh>
|
|
<MudTableSortLabel SortBy="@(new Func<Title, object>(x => x.UnlockRequirementEn))">
|
|
Unlock Requirement (English)
|
|
</MudTableSortLabel>
|
|
</MudTh>
|
|
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
@{
|
|
# pragma warning disable CS8602
|
|
}
|
|
<MudTd DataLabel="Id" Class="cursor-pointer">@context.Id</MudTd>
|
|
<MudTd DataLabel="Title" Class="cursor-pointer">@context.TitleName</MudTd>
|
|
<MudTd DataLabel="UnlockType" Class="cursor-pointer">@context.UnlockType</MudTd>
|
|
<MudTd DataLabel="UnlockRequirementJp" Class="cursor-pointer">@context.UnlockRequirementJp</MudTd>
|
|
<MudTd DataLabel="UnlockRequirementEn" Class="cursor-pointer">@context.UnlockRequirementEn</MudTd>
|
|
@{
|
|
# pragma warning restore CS8602
|
|
}
|
|
</RowTemplate>
|
|
<PagerContent>
|
|
<MudTablePager PageSizeOptions="new []{10, 25, 50, 100}"/>
|
|
</PagerContent>
|
|
</MudTable>
|
|
<MudText Class="mt-4 d-block" Typo="Typo.caption">
|
|
<b>Selected Title:</b> @selectedTitle?.TitleName
|
|
</MudText>
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudButton OnClick="Cancel">Cancel</MudButton>
|
|
<MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code{
|
|
|
|
[CascadingParameter]
|
|
public required MudDialogInstance MudDialog { get; set; }
|
|
|
|
[Parameter]
|
|
public required PlayOptionData Data { get; set; }
|
|
|
|
private Title? selectedTitle;
|
|
|
|
private IReadOnlyList<Title> titles = new List<Title>();
|
|
|
|
private string searchString = string.Empty;
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await base.OnInitializedAsync();
|
|
selectedTitle = DataService.GetTitleById((uint)Data.OptionPart1.TitleId);
|
|
titles = DataService.GetTitlesSortedById();
|
|
}
|
|
|
|
|
|
private bool Filter(Title? title)
|
|
{
|
|
if (title is null)
|
|
{
|
|
return false;
|
|
}
|
|
var aggregate = $"{title.TitleName}{title.UnlockRequirementEn}{title.UnlockRequirementJp}";
|
|
return string.IsNullOrEmpty(searchString) ||
|
|
aggregate.Contains(searchString, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
|
|
private void Submit()
|
|
{
|
|
if (selectedTitle is not null)
|
|
{
|
|
Data.OptionPart1.TitleId = (int)selectedTitle.Id;
|
|
}
|
|
MudDialog.Close(DialogResult.Ok(true));
|
|
}
|
|
|
|
private void Cancel() => MudDialog.Cancel();
|
|
} |