BlazorStart/Start/Client/Components/CreateContainer.razor

80 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

2021-12-17 06:06:41 +00:00
@using Start.Client.Components.Shared
@using Start.Client.Store.Features.CreateContainer
2021-12-04 00:44:02 +00:00
@using Fluxor
2021-12-04 00:44:02 +00:00
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
2021-12-04 00:44:02 +00:00
@inject IDispatcher dispatch
@inject IState<CreateContainerState> state
2021-12-17 06:06:41 +00:00
<Dialog Active="this.state.Value.ShowCreateContainerForm" OnClose="this.OnDialogClose">
<Header>
Create Container
</Header>
<Body>
<EditForm Model="this.Model" OnValidSubmit="this.OnSubmit">
<DataAnnotationsValidator />
2021-12-05 23:52:56 +00:00
2021-12-17 06:06:41 +00:00
@if (this.state.Value.CreateContainerErrorMessage != null)
{
<Alert Type="Alert.AlertType.Error">
@this.state.Value.CreateContainerErrorMessage
</Alert>
}
2021-12-05 23:50:48 +00:00
2021-12-17 06:06:41 +00:00
<ValidationSummary />
2021-12-05 23:52:56 +00:00
2021-12-17 06:06:41 +00:00
<div class="form-group">
<div class="container">
<div class="columns">
<div class="column col-12">
<div>
<label for="createBookmarkContainerTitle" class="form-label">Title</label>
<InputText id="createBookmarkContainerTitle" name="createBookmarkContainerTitle"
class="form-input" @bind-Value="this.Model.Title" />
</div>
</div>
</div>
</div>
2021-12-17 06:06:41 +00:00
<div class="container">
<div class="columns">
<div class="column col-12 text-right">
<div>
@if (this.state.Value.IsLoadingCreateContainer)
{
<button type="submit" disabled class="btn btn-primary loading">
<i class="icon icon-plus"></i> Create
</button>
}
else
{
<button type="submit" class="btn btn-primary">
<i class="icon icon-plus"></i> Create
</button>
}
</div>
</div>
</div>
</div>
</div>
2021-12-17 06:06:41 +00:00
</EditForm>
</Body>
</Dialog>
@code {
[Parameter]
public EventCallback<BookmarkContainerDto> OnCreated { get; set; }
2022-04-19 20:04:38 +00:00
private BookmarkContainerDto Model { get; set; } = new BookmarkContainerDto("", 0);
2021-12-04 00:44:02 +00:00
protected void OnSubmit()
{
2021-12-04 00:44:02 +00:00
dispatch.Dispatch(new SubmitCreateContainerAction(this.Model));
}
2021-12-04 00:44:02 +00:00
protected void OnDialogClose()
{
2021-12-04 00:44:02 +00:00
dispatch.Dispatch(new HideCreateContainerFormAction());
}
}