Skip to content

Commit

Permalink
Merge pull request #150 from ministryofjustice/hotfix/qa-validation
Browse files Browse the repository at this point in the history
Validation fixes for QA screens
  • Loading branch information
carlsixsmith-moj authored Aug 20, 2024
2 parents 18279a6 + 56cbc8d commit dd365af
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 dd365af

Please sign in to comment.