Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<JoinPanel>
<Header>@projectName :: @(creating ? "Íîâûé ïåðñîíàæ" : "Ðåäàêòèðîâàíèå ïåðñîíàæà")</Header>
<Body>
<p>
<HelpLink Link="characters" Message="Ñïðàâêà î ïåðñîíàæàõ"/>
</p>
<EditForm FormName="EditCharacter" EditContext="@editContext" OnValidSubmit="HandleValidSubmit">
<FormHorizontal>
<ValidationSummary />
<DataAnnotationsValidator />

<FormRow Label="Âèäèìîñòü">
<EnumRadioButtonGroup @bind-SelectedValue="@Model.CharacterVisibility" />

Check failure on line 13 in src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor

View workflow job for this annotation

GitHub Actions / Build and publish

'CharacterEdtiViewModel' does not contain a definition for 'CharacterVisibility' and no accessible extension method 'CharacterVisibility' accepting a first argument of type 'CharacterEdtiViewModel' could be found (are you missing a using directive or an assembly reference?)
</FormRow>

<FormRow Label="Òèï Ïåðñîíàæà">
@if (!EditTypeDisabled)

Check failure on line 17 in src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor

View workflow job for this annotation

GitHub Actions / Build and publish

The name 'EditTypeDisabled' does not exist in the current context
{
<EnumRadioButtonGroup @bind-SelectedValue="@characterType" Name="@(Name + ".CharacterType")" />

Check failure on line 19 in src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor

View workflow job for this annotation

GitHub Actions / Build and publish

The name 'characterType' does not exist in the current context

Check failure on line 19 in src/JoinRpg.Web.CharacterGroups/CharacterEditorPanel.razor

View workflow job for this annotation

GitHub Actions / Build and publish

The name 'Name' does not exist in the current context
}
else
{
<label>@characterType.GetDisplayName()</label>
<input type="hidden" value="@characterType" Name="@(Name + ".CharacterType")" />
if (IsDefaultTemplate)
{
<InfoIcon Title="Íåëüçÿ èçìåíèòü òèï ïåðñîíàæà, ò.ê. ýòî øàáëîí ïî óìîë÷àíèþ äëÿ çàÿâîê. Ýòî ìîæíî ïîìåíÿòü â íàñòðîéêàõ" />
}
else if (!CharactersHaveNameField)
{
<InfoIcon Title="Åñëè èìÿ ïåðñîíàæà ïðèâÿçàíî ê èãðîêó, â ïðîåêòå ìîæíî ñîçäàâàòü òîëüêî øàáëîíû ïåðñîíàæåé (äðóãèå òèïû ïåðñîíàæåé ñîçäàâàòü íåëüçÿ)" />
}
else if (ActiveClaimsCount > 0)
{
<InfoIcon Title="Íåëüçÿ èçìåíèòü òèï ïåðñîíàæà, ò.ê. íà íåãî óæå åñòü çàÿâêè" />
}
}
</FormRow>

@if (characterType == CharacterTypeView.Slot)
{
<FormRow Label="Ëèìèò ïåðñîíàæåé äëÿ øàáëîíà" Description="Îñòàâüòå ïóñòûì, ÷òîáû íå îãðàíè÷èâàòü ÷èñëî ïåðñîíàæåé, êîòîðûå ìîãóò áûòü ñîçäàíû èç ýòîãî øàáëîíà.">
<NumberInput @bind-Value="@characterSlotLimit" name="@(Name + ".SlotLimit")" Min="0" />
</FormRow>

@if (!CharactersHaveNameField)
{
<FormRow Label="Íàçâàíèå øàáëîíà ïåðñîíàæåé">
<StringInput @bind-Value="@slotName" name="@(Name + ".SlotName")" Required="true" />
</FormRow>
}
}

@if (!HasApprovedClaim && (characterType == CharacterTypeView.Player || characterType == CharacterTypeView.Slot))
{
<FormRow Label="Ãîðÿ÷àÿ ðîëü" Description="Ãîðÿ÷àÿ ðîëü ñïåöèàëüíûì îáðàçîì âûäåëÿåòñÿ â ðîëåâêå">
<CheckboxInput @bind-Value="@isHot" Name="@(Name + ".IsHot")" />
</FormRow>
}


<FormRow>
<JoinButton Preset="ButtonPreset.Create" Submit="true" Disabled="@formInvalid" />
</FormRow>
</FormHorizontal>
</EditForm>
</Body>
</JoinPanel>
@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<IProjectCreateClient>().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;
}
}

}
6 changes: 6 additions & 0 deletions src/JoinRpg.Web.CharacterGroups/CharacterEdtiViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace JoinRpg.Web.CharacterGroups
{
public class CharacterEdtiViewModel
{
}
}
Loading