Skip to content

Commit

Permalink
fix: Can't save class before GM accept #29
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianKempski committed Nov 13, 2024
1 parent 525501d commit f838d09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DagoniteEmpire/Pages/CharacterPages/CharacterUpsert.razor
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

<RaceComponent OnTraitsChange="ParamChange"></RaceComponent>

<ProfessionComponent @bind-Profession="@AllParams.Profession"></ProfessionComponent>
<ProfessionComponent OnProfessionChanged="ParamChange" @bind-Profession="@AllParams.Profession"></ProfessionComponent>

<div class="traits p-2">
<MudPaper Class="p-2 m-0 w-100 h-100">
Expand Down
24 changes: 17 additions & 7 deletions DagoniteEmpire/Pages/Components/ProfessionComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
<h3 class="my-3 ml-3 text-center">CLASS</h3>
@if (AllParams.Character.IsApproved == false || UserInfo?.IsAdminOrMG == true)
{
<InputText style="width: 100%;font-size: 14px;padding: 2px 2px 2px 2px; margin: 0px; border: 1px solid RGB(206 212 218); border-radius: 4px; background-color:transparent;" @bind-Value="@Profession.Name" class=""></InputText>
<InputText style="width: 100%;font-size: 14px;padding: 2px 2px 2px 2px; margin: 0px; border: 1px solid RGB(206 212 218); border-radius: 4px; background-color:transparent;"
@bind-Value="@Profession.Name" @bind-Value:after="NotifyChange" ></InputText>
}
else
{
<InputText readonly style="width: 100%;font-size: 14px;padding: 2px 2px 2px 2px; margin: 0px; border: 1px solid RGB(206 212 218); border-radius: 4px; background-color:transparent;" @bind-Value="@Profession.Name" class=""></InputText>
<InputText readonly style="width: 100%;font-size: 14px;padding: 2px 2px 2px 2px; margin: 0px; border: 1px solid RGB(206 212 218); border-radius: 4px; background-color:transparent;"
@bind-Value="@Profession.Name" @bind-Value:after="NotifyChange"></InputText>
}
<table class="table align-middle">
<thead>
Expand Down Expand Up @@ -48,7 +50,7 @@
<label class="prof-descr-label">Class description</label>
<div class="richtext-conteiner">

<SfRichTextEditor Height="100%" @bind-Value="@Profession.Description" Readonly="true" ShowTooltip="false">
<SfRichTextEditor Height="100%" @bind-Value="@Profession.Description" @bind-Value:after="NotifyChange" Readonly="true" ShowTooltip="false">
<RichTextEditorToolbarSettings Enable="false" />
</SfRichTextEditor>

Expand Down Expand Up @@ -77,6 +79,8 @@
public ProfessionDTO Profession { get; set; } = null;
[Parameter]
public EventCallback<ProfessionDTO> ProfessionChanged { get; set; }
[Parameter]
public EventCallback OnProfessionChanged { get; set; }
private string ProfessionName { get; set; }


Expand All @@ -97,19 +101,25 @@
}
}

private async Task NotifyChange()
{
await OnProfessionChanged.InvokeAsync();
StateHasChanged();
}

private async Task EditProfession()
{
if(AllParams.Character.IsApproved == false)
{

CreateProfession.ProfessionDTO = Profession;
CreateProfession.IsVisible = true;
}
CreateProfession.ProfessionDTO = Profession;
CreateProfession.IsVisible = true;
}
else
{
_navigationManager.NavigateTo($"/profession/{AllParams.Character.Id}");
}
StateHasChanged();
await NotifyChange();
}

protected override async Task OnAfterRenderAsync(bool firstRender)
Expand Down
2 changes: 1 addition & 1 deletion DagoniteEmpire/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=5432;Database=DagoniteEmpire;User Id=postgres;Password=Admin123!;",
"TestAccountsEnable": "false",
"TestAccountsEnable": "true",
"GameMasterEmail": "[email protected]",
"GameMasterPassword": "MacierzKara5^&"
},
Expand Down

0 comments on commit f838d09

Please sign in to comment.