Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation fixes for QA screens #150

Merged
merged 1 commit into from
Aug 20, 2024
Merged
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
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
Loading