diff --git a/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor b/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor new file mode 100644 index 000000000..2a29a0602 --- /dev/null +++ b/src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor @@ -0,0 +1,114 @@ + +
@projectName :: @(creating ? "Новый персонаж" : "Редактирование персонажа")
+ +

+ +

+ + + + + + + + + + + @if (!EditTypeDisabled) + { + + } + else + { + + + if (IsDefaultTemplate) + { + + } + else if (!CharactersHaveNameField) + { + + } + else if (ActiveClaimsCount > 0) + { + + } + } + + + @if (characterType == CharacterTypeView.Slot) + { + + + + + @if (!CharactersHaveNameField) + { + + + + } + } + + @if (!HasApprovedClaim && (characterType == CharacterTypeView.Player || characterType == CharacterTypeView.Slot)) + { + + + + } + + + + + + + + +
+@code { + + private EditContext? editContext; + private bool formInvalid = true; + private bool creating = false; + private ValidationMessageStore? messageStore; + + + private string projectName = null; + + + + + [Parameter] + [EditorRequired] + [SupplyParameterFromForm] + public CharacterEdtiViewModel Model { get; set; } = null!; + + private async Task HandleValidSubmit() + { + try + { + creating = true; + var result = await Services.GetRequiredService().CreateProject(Model); + if (result.Error is null && result.ProjectId is ProjectIdentification id) + { + NavigationManager.NavigateTo($"/{id.Value}/home", forceLoad: true); + } + else + { + if (result.ProjectId is not null) + { + created = result.ProjectId; + } + messageStore?.Add(() => Model, result.Error ?? "Неизвестная серверная ошибка при создании проекта"); + creating = false; + } + } + catch + { + messageStore?.Add(() => Model, "Неизвестная серверная ошибка при создании проекта"); + creating = false; + } + } + +} diff --git a/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs b/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs new file mode 100644 index 000000000..8697f944f --- /dev/null +++ b/src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs @@ -0,0 +1,6 @@ +namespace JoinRpg.Web.CharacterGroups +{ + public class CharacterEdtiViewModel + { + } +}