Files
Nemera/src/Lumina.Presentation.Web/Pages/Library/Management/Item.razor
T

196 lines
11 KiB
Plaintext

@page "/library/manage/item"
@page "/library/manage/item/{id:guid}"
@using Lumina.Presentation.Web.Common.Enums.AudioLibrary
@using Lumina.Presentation.Web.Common.Enums.BookLibrary
@using Lumina.Presentation.Web.Common.Enums.Library
@using Lumina.Presentation.Web.Common.Enums.PhotoLibrary
@using Lumina.Presentation.Web.Common.Enums.VideoLibrary
@using Lumina.Presentation.Web.Common.Models.Libraries
@using Lumina.Presentation.Web.Common.Models.UI
@using Lumina.Presentation.Web.Common.Utilities
@using Lumina.Presentation.Web.Components
<h3 class="text-light-two f-22 mb-10 mt-0 pt-10 text-center">@(Id is null ? "Add New Library" : "Edit Library")</h3>
<div class="enlightenment-panel shadow-effect pl-0 pr-0 pb-0 mx-auto panel mt-10" style="width: 350px; min-width: 350px;">
<div class="shine-effect"></div>
<table class="w-90 mx-auto">
<!-- section Title -->
<tr>
<td class="w-100">
<label class="text-light-one">Title</label>
<EnlightenmentInput Type="text" Name="title" AutoComplete="true" @bind-Value="dataSource.Title" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionTitle</small>
</td>
</tr>
<!-- section Library Type -->
<tr>
<td class="w-100">
<label class="text-light-one">Library Type</label>
<EnlightenmentCombobox Items="@items" @bind-SelectedItem="selectedValue" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionLibraryType</small>
</td>
</tr>
<!-- section Directories -->
<tr>
<td class="w-100">
<label class="text-light-one">Directories</label>
<table class="table">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Directories</th>
</tr>
</thead>
<tbody>
@foreach (var item in tableData)
{
<tr>
<td>@item.Column1</td>
<td>@item.Column2</td>
<td>
@* <MultiDirectorySelector /> *@
</td>
</tr>
}
</tbody>
</table>
<small class="text-disabled" style="margin-left: 25px;">DescriptionURL</small>
</td>
</tr>
<!-- section Port -->
<tr>
<td class="w-100">
<label class="text-light-one">Port</label>
<EnlightenmentInput Type="number" Name="port" AutoComplete="true" @bind-Value="dataSource.Title" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionPort</small>
</td>
</tr>
<!-- section Username -->
<tr>
<td class="w-100">
<label class="text-light-one">Username</label>
<EnlightenmentInput Type="text" Name="username" AutoComplete="true" @bind-Value="dataSource.Title" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionUsername</small>
</td>
</tr>
<!-- section Password -->
<tr>
<td class="w-100">
<label class="text-light-one">Password</label>
<EnlightenmentInput Type="password" Name="password" AutoComplete="true" @bind-Value="dataSource.Title" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionPassword</small>
</td>
</tr>
<tr>
<td class="w-100">
<label class="text-light-one">Platform</label>
<EnlightenmentCheckbox Checked="false" Label="Is Platform" />
<small class="text-disabled" style="margin-left: 25px;">DescriptionPlatform</small>
</td>
</tr>
<tr>
<td colspan="2" class="w-100 text-center">
<EnlightenmentButton IsConfirmButton="false" OnClick="@CancelOperation" IsDisabled="@isSaving">Cancel</EnlightenmentButton>
<EnlightenmentButton OnClick="@SaveData" IsDisabled="@isSaving">Save</EnlightenmentButton>
</td>
</tr>
<tr>
<td colspan="2">
<span class="invalid-feedback hidden"></span>
</td>
</tr>
</table>
</div>
@code {
[Parameter]
public Guid? Id { get; set; }
private LibraryModel dataSource = new();
private List<ComboboxItem<string>> items = new()
{
new ComboboxItem<string>{ Text = nameof(LibraryType.WrittenContent).SplitCamelCase(), IsEnabled = false },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Book).SplitCamelCase(), Value = nameof(WrittenContentType.Book) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.EBook).SplitCamelCase(), Value = nameof(WrittenContentType.EBook) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.BookSeries).SplitCamelCase(), Value = nameof(WrittenContentType.BookSeries) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.ComicBook).SplitCamelCase(), Value = nameof(WrittenContentType.ComicBook) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.ComicSeries).SplitCamelCase(), Value = nameof(WrittenContentType.ComicSeries) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Magazine).SplitCamelCase(), Value = nameof(WrittenContentType.Magazine) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Manga).SplitCamelCase(), Value = nameof(WrittenContentType.Manga) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.GraphicNovel).SplitCamelCase(), Value = nameof(WrittenContentType.GraphicNovel) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.AcademicPaper).SplitCamelCase(), Value = nameof(WrittenContentType.AcademicPaper) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.SheetMusic).SplitCamelCase(), Value = nameof(WrittenContentType.SheetMusic) },
new ComboboxItem<string>{ Text = nameof(WrittenContentType.Screenplay).SplitCamelCase(), Value = nameof(WrittenContentType.Screenplay) },
new ComboboxItem<string>{ Text = nameof(LibraryType.VideoContent).SplitCamelCase(), IsEnabled = false },
new ComboboxItem<string>{ Text = nameof(VideoContentType.TvShow).SplitCamelCase(), Value = nameof(VideoContentType.TvShow) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Movie).SplitCamelCase(), Value = nameof(VideoContentType.Movie) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.FilmSeries).SplitCamelCase(), Value = nameof(VideoContentType.FilmSeries) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.FilmFranchise).SplitCamelCase(), Value = nameof(VideoContentType.FilmFranchise) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Concert).SplitCamelCase(), Value = nameof(VideoContentType.Concert) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Documentary).SplitCamelCase(), Value = nameof(VideoContentType.Documentary) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Tutorial).SplitCamelCase(), Value = nameof(VideoContentType.Tutorial) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Personal).SplitCamelCase(), Value = nameof(VideoContentType.Personal) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Anime).SplitCamelCase(), Value = nameof(VideoContentType.Anime) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Youtube).SplitCamelCase(), Value = nameof(VideoContentType.Youtube) },
new ComboboxItem<string>{ Text = nameof(VideoContentType.Videoclip).SplitCamelCase(), Value = nameof(VideoContentType.Videoclip) },
new ComboboxItem<string>{ Text = nameof(LibraryType.AudioContent).SplitCamelCase(), IsEnabled = false },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Music).SplitCamelCase(), Value = nameof(AudioContentType.Music) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.AudioBook).SplitCamelCase(), Value = nameof(AudioContentType.AudioBook) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.LivePerformance).SplitCamelCase(), Value = nameof(AudioContentType.LivePerformance) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Interview).SplitCamelCase(), Value = nameof(AudioContentType.Interview) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Cover).SplitCamelCase(), Value = nameof(AudioContentType.Cover) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Remix).SplitCamelCase(), Value = nameof(AudioContentType.Remix) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Soundeffect).SplitCamelCase(), Value = nameof(AudioContentType.Soundeffect) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.Podcast).SplitCamelCase(), Value = nameof(AudioContentType.Podcast) },
new ComboboxItem<string>{ Text = nameof(AudioContentType.RadioShow).SplitCamelCase(), Value = nameof(AudioContentType.RadioShow) },
new ComboboxItem<string>{ Text = nameof(LibraryType.VisualContent).SplitCamelCase(), IsEnabled = false },
new ComboboxItem<string>{ Text = nameof(VisualContentType.PhotoAlbum).SplitCamelCase(), Value = nameof(VisualContentType.PhotoAlbum) },
new ComboboxItem<string>{ Text = nameof(LibraryType.MiscellaneousContent).SplitCamelCase(), IsEnabled = false },
new ComboboxItem<string>{ Text = nameof(MiscellaneousContentType.Other).SplitCamelCase(), Value = nameof(MiscellaneousContentType.Other) },
};
private ComboboxItem<string>? selectedValue;
private ComboboxItem<string>? selectedValue2;
private bool isSaving = false;
private bool isCancelling = false;
private async Task SaveData()
{
isSaving = true;
// Perform save operation
isSaving = false;
Console.WriteLine("saved");
await Task.CompletedTask;
}
private async Task CancelOperation()
{
isCancelling = true;
// Perform cancel operation
if (!isCancelling)
isCancelling = false;
selectedValue2 = new ComboboxItem<string>();
if (selectedValue2 is not null)
Console.WriteLine("cancelled");
await Task.CompletedTask;
}
private List<TableItem> tableData = new List<TableItem>
{
new TableItem { Column1 = "Value 1", Column2 = "Value 2", Directories = new List<string>() },
new TableItem { Column1 = "Value 3", Column2 = "Value 4", Directories = new List<string>() }
};
public class TableItem
{
public string? Column1 { get; set; }
public string? Column2 { get; set; }
public List<string>? Directories { get; set; }
}
}