Refactored frontend to work with the latest mooncore changes
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
@using MoonCore.Blazor.FlyonUi.Components
|
||||
@using MoonCore.Blazor.Tailwind.Modals.Components
|
||||
@using MoonlightServers.Shared.Enums
|
||||
@using MoonlightServers.Shared.Http.Requests.Admin.StarVariables
|
||||
@using MoonlightServers.Frontend.UI.Components.Forms
|
||||
@using MoonCore.Blazor.Tailwind.Components
|
||||
@using MoonCore.Helpers
|
||||
@using MoonlightServers.Shared.Http.Responses.Admin.StarVariables
|
||||
|
||||
@inherits MoonCore.Blazor.FlyonUi.Modals.Components.BaseModal
|
||||
@@ -14,38 +11,38 @@
|
||||
<HandleForm @ref="HandleForm" Model="Form" OnValidSubmit="OnValidSubmit">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="form-input w-full"/>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Name</label>
|
||||
<input @bind="Form.Name" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="form-input w-full"/>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Description</label>
|
||||
<input @bind="Form.Description" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="form-input w-full"/>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Key</label>
|
||||
<input @bind="Form.Key" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="form-input w-full"/>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Default Value</label>
|
||||
<input @bind="Form.DefaultValue" type="text" class="input w-full"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Allow Viewing</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Viewing</label>
|
||||
<Switch @bind-Value="Form.AllowViewing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Allow Editing</label>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Allow Editing</label>
|
||||
<Switch @bind-Value="Form.AllowEditing"/>
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Type</label>
|
||||
<select @bind="Form.Type" class="form-select w-full">
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Type</label>
|
||||
<select @bind="Form.Type" class="select w-full">
|
||||
@foreach (var val in Enum.GetValues<StarVariableType>())
|
||||
{
|
||||
<option value="@val">@val</option>
|
||||
@@ -54,8 +51,8 @@
|
||||
</div>
|
||||
|
||||
<div class="col-span-1">
|
||||
<label class="block text-sm font-medium leading-6 text-white">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="form-input w-full"/>
|
||||
<label class="block text-sm font-medium leading-6 text-base-content">Filter</label>
|
||||
<input @bind="Form.Filter" type="text" class="input w-full"/>
|
||||
</div>
|
||||
</div>
|
||||
</HandleForm>
|
||||
@@ -75,7 +72,17 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Form = Mapper.Map<UpdateStarVariableRequest>(Variable);
|
||||
Form = new()
|
||||
{
|
||||
Name = Variable.Name,
|
||||
AllowEditing = Variable.AllowEditing,
|
||||
AllowViewing = Variable.AllowViewing,
|
||||
DefaultValue = Variable.DefaultValue,
|
||||
Description = Variable.Description,
|
||||
Filter = Variable.Filter,
|
||||
Key = Variable.Key,
|
||||
Type = Variable.Type
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnValidSubmit()
|
||||
|
||||
Reference in New Issue
Block a user