Skip to content

Commit

Permalink
Validation fixes for QA screens
Browse files Browse the repository at this point in the history
  • Loading branch information
samgibsonmoj committed Aug 19, 2024
1 parent 74dc1e8 commit 4f12e52
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ public A_IsValidRequest()
.NotNull()
.WithMessage("You must accept or return the request");

When(x => x.Accept == false, () => {
When(x => x.Accept is false, () =>
{
RuleFor(x => x.Message)
.NotNull()
.WithMessage("A message is required when returning")
.NotEmpty()
.WithMessage("A message is required when returning")
.Matches(ValidationConstants.Notes)
.WithMessage(string.Format(ValidationConstants.NotesMessage, "Message"));
});

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ public A_IsValidRequest()
.NotNull()
.WithMessage("You must accept or return the request");

When(x => x.Accept == false, () => {
When(x => x.Accept is false, () => {
RuleFor(x => x.Message)
.NotNull()
.WithMessage("A message is required when returning")
.NotEmpty()
.WithMessage("A message is required when returning")
.Matches(ValidationConstants.Notes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ public A_IsValidRequest()
.NotNull()
.WithMessage("You must accept or return the request");

When(x => x.Accept == false, () => {
When(x => x.Accept is false, () => {
RuleFor(x => x.Message)
.NotNull()
.WithMessage("A message is required when returning")
.NotEmpty()
.WithMessage("A message is required when returning")
.Matches(ValidationConstants.Notes)
Expand Down
4 changes: 2 additions & 2 deletions src/Server.UI/Pages/QA/Enrolments/PQA.razor
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{
<MudForm Model="@Command" @ref="_form" Validation="@(Validator.ValidateValue(Command))">
<MudItem xs="12">
<MudRadioGroup T="bool?" @bind-Value="Command.Accept" Required="true">
<MudRadioGroup T="bool?" @bind-Value="Command.Accept" For="@(() => Command.Accept)" Required="true">
<MudRadio T="bool?" Value="true" Color="Color.Primary">
Accept
</MudRadio>
Expand All @@ -97,7 +97,7 @@
</MudRadioGroup>
</MudItem>

<MudTextField T="string" Label="Message" For="(() => Command.Message)" />
<MudTextField @bind-Value="Command.Message" Label="Message" For="(() => Command.Message)" />
</MudForm>
<MudContainer Class="d-flex px-0 pt-8">
<MudButton Color="Color.Primary" OnClick="SubmitToQa" Variant="Variant.Filled">Submit</MudButton>
Expand Down
4 changes: 2 additions & 2 deletions src/Server.UI/Pages/QA/Enrolments/QA1.razor
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{
<MudForm Model="@Command" @ref="_form" Validation="@(Validator.ValidateValue(Command))">
<MudItem xs="12">
<MudRadioGroup T="bool?" @bind-Value="Command.Accept" Required="true">
<MudRadioGroup T="bool?" @bind-Value="Command.Accept" For="@(() => Command.Accept)" Required="true">
<MudRadio T="bool?" Value="true" Color="Color.Primary">
Accept
</MudRadio>
Expand All @@ -97,7 +97,7 @@
</MudRadioGroup>
</MudItem>

<MudTextField T="string" Label="Message" For="(() => Command.Message)" />
<MudTextField @bind-Value="Command.Message" Label="Message" For="(() => Command.Message)" />
</MudForm>
<MudContainer Class="d-flex px-0 pt-8">
<MudButton Color="Color.Primary" OnClick="SubmitToQa" Variant="Variant.Filled">Submit</MudButton>
Expand Down
4 changes: 2 additions & 2 deletions src/Server.UI/Pages/QA/Enrolments/QA2.razor
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
</MudRadio>
</MudRadioGroup>
</MudItem>
<MudTextField T="string" Label="Message" For="(() => Command.Message)" @bind-Value="Command.Message" Immediate="true" />

<MudTextField @bind-Value="Command.Message" Label="Message" For="(() => Command.Message)" />
</MudForm>
<MudContainer Class="d-flex px-0 pt-8">
<MudButton Color="Color.Primary" OnClick="SubmitToQa" Variant="Variant.Filled">Submit</MudButton>
Expand Down

0 comments on commit 4f12e52

Please sign in to comment.