Skip to content

Commit

Permalink
Merge pull request #314 from ministryofjustice/CFODEV-813
Browse files Browse the repository at this point in the history
CFODEV-813: Accessibility - dialogs for dates
  • Loading branch information
carlsixsmith-moj authored Nov 22, 2024
2 parents 2f084c1 + f465875 commit 2a17bfc
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 79 deletions.
1 change: 1 addition & 0 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Humanizer.Core.uk" Version="2.14.1" />
Expand Down
1 change: 1 addition & 0 deletions src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Immediate="true" />
</MudItem>
<MudItem xs="12">
<MudDatePicker Label="Date Of Birth" @bind-Date="Query.DateOfBirth" For="(() => Query.DateOfBirth)"
<MudDatePicker Label="Date Of Birth" @bind-Date="Query.DateOfBirth" For="(() => Query.DateOfBirth)" PickerVariant="PickerVariant.Dialog"
ImmediateText="true" Editable="true" MaxDate="DateTime.Today.AddYears(-18)" />
</MudItem>
</MudFocusTrap>
Expand Down
1 change: 1 addition & 0 deletions src/Server.UI/Pages/Enrolments/Components/Consent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
For="() => Model.ConsentDate"
Label="@Model.GetMemberDescription(x => x.ConsentDate)"
MaxDate="DateTime.Now.Date"
PickerVariant="PickerVariant.Dialog"
Editable="true" />

<div class="mb-4 mt-8">
Expand Down
6 changes: 4 additions & 2 deletions src/Server.UI/Pages/Enrolments/Components/RightToWork.razor
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
Label="@Model.GetMemberDescription(x => x.ValidFrom)"
MaxDate="DateTime.Now.Date"
MinDate="DateTime.Now.AddYears(-5).Date"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>

@if (Model.IndefiniteRightToWork is false)
{
Expand All @@ -65,7 +66,8 @@
Label="@Model.GetMemberDescription(x => x.ValidTo)"
MaxDate="DateTime.MaxValue.Date"
MinDate="DateTime.Now.Date"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
}

<div class="mb-4 mt-8">
Expand Down
3 changes: 2 additions & 1 deletion src/Server.UI/Pages/Objectives/Tasks/AddTaskDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
MinDate="new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1)"
Label="@Model.GetMemberDescription(x => x.Due)"
For="@(() => Model.Due)"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
</MudForm>
</DialogContent>
<DialogActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
MinDate="new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1)"
Label="@Model.GetMemberDescription(x => x.Due)"
For="@(() => Model.Due)"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
</MudForm>
</DialogContent>
<DialogActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@

<MudDialog>
<DialogContent>
@if(Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid>
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.InductionDate)"
@bind-Date="Model.InductionDate"
For="(() => Model.InductionDate)"
ImmediateText="true" Editable="false" MaxDate="DateTime.Today.Date" />
</MudItem>
<MudItem xs="12">
<MudAutocomplete T="LocationDto" Label="@Model.GetMemberDescription(x => x.Location)" @bind-Value="Model.Location" SearchFunc="@SearchLocations"
Required="true" RequiredError="Location is required"
ResetValueOnEmptyText="true" CoerceText="true" CoerceValue="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
AdornmentColor="Color.Primary" ToStringFunc="@(e=> e==null?null : e.Name)" />
</MudItem>
</MudGrid>
</MudForm>
}
<MudPaper Height="300px" Elevation="0">
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid>
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.InductionDate)" PickerVariant="PickerVariant.Dialog"
@bind-Date="Model.InductionDate"
For="(() => Model.InductionDate)"
ImmediateText="true" Editable="false" MaxDate="DateTime.Today.Date"/>
</MudItem>
<MudItem xs="12">
<MudAutocomplete T="LocationDto" Label="@Model.GetMemberDescription(x => x.Location)" @bind-Value="Model.Location" SearchFunc="@SearchLocations"
Required="true" RequiredError="Location is required"
ResetValueOnEmptyText="true" CoerceText="true" CoerceValue="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
AdornmentColor="Color.Primary" ToStringFunc="@(e => e == null ? null : e.Name)"/>
</MudItem>
</MudGrid>
</MudForm>
}
</MudPaper>

</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">@ConstantString.Cancel</MudButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@

<MudDialog>
<DialogContent>
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid xs="12">
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.StartDate)"
@bind-Date="Model.StartDate"
For="(() => Model.StartDate)"
ImmediateText="true" Editable="false"
MinDate="EarliestStartDate"
MaxDate="DateTime.Today.Date"/>
</MudItem>
</MudGrid>
</MudForm>
}
<MudPaper Height="300px" Elevation="0">
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid xs="12">
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.StartDate)"
@bind-Date="Model.StartDate"
For="(() => Model.StartDate)"
ImmediateText="true" Editable="false"
MinDate="EarliestStartDate"
MaxDate="DateTime.Today.Date" PickerVariant="PickerVariant.Dialog"/>
</MudItem>
</MudGrid>
</MudForm>
}
</MudPaper>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">@ConstantString.Cancel</MudButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@

<MudDialog>
<DialogContent>
@if(Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid>
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.InductionDate)"
@bind-Date="Model.InductionDate"
For="(() => Model.InductionDate)"
ImmediateText="true" Editable="false" MaxDate="DateTime.Today.Date" />
</MudItem>
<MudItem xs="12">
<MudAutocomplete T="LocationDto" Label="@Model.GetMemberDescription(x => x.Location)" @bind-Value="Model.Location" SearchFunc="@SearchLocations"
Required="true" RequiredError="Location is required"
ResetValueOnEmptyText="true" CoerceText="true" CoerceValue="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
AdornmentColor="Color.Primary" ToStringFunc="@(e=> e==null?null : e.Name)" />
</MudItem>
</MudGrid>
</MudForm>
}
<MudPaper Height="300px" Elevation="0">
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid>
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.InductionDate)"
@bind-Date="Model.InductionDate"
For="(() => Model.InductionDate)"
ImmediateText="true" Editable="false" MaxDate="DateTime.Today.Date" PickerVariant="PickerVariant.Dialog"/>
</MudItem>
<MudItem xs="12">
<MudAutocomplete T="LocationDto" Label="@Model.GetMemberDescription(x => x.Location)" @bind-Value="Model.Location" SearchFunc="@SearchLocations"
Required="true" RequiredError="Location is required"
ResetValueOnEmptyText="true" CoerceText="true" CoerceValue="true" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search"
AdornmentColor="Color.Primary" ToStringFunc="@(e => e == null ? null : e.Name)"/>
</MudItem>
</MudGrid>
</MudForm>
}
</MudPaper>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">@ConstantString.Cancel</MudButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@

<MudDialog>
<DialogContent>
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid xs="12">
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.CompletionDate)"
@bind-Date="Model.CompletionDate"
For="(() => Model.CompletionDate)"
ImmediateText="true" Editable="false"
MinDate="EarliestCompletionDate"
MaxDate="DateTime.Today.Date"/>
</MudItem>
</MudGrid>
</MudForm>
}
<MudPaper Height="300px;" Elevation="0">
@if (Model is not null)
{
<MudForm @ref="form" Model="Model" Validation="@(Validator.ValidateValue(Model))">
<MudGrid xs="12">
<MudItem xs="12">
<MudDatePicker Label="@Model.GetMemberDescription(x => x.CompletionDate)"
@bind-Date="Model.CompletionDate"
For="(() => Model.CompletionDate)"
ImmediateText="true" Editable="false"
MinDate="EarliestCompletionDate"
MaxDate="DateTime.Today.Date" PickerVariant="PickerVariant.Dialog"/>
</MudItem>
</MudGrid>
</MudForm>
}
</MudPaper>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">@ConstantString.Cancel</MudButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
For="@(() => Model.ReferredOn)"
MaxDate="DateTime.UtcNow.Date"
Editable="true"
Class="mt-4"/>
Class="mt-4"
PickerVariant="PickerVariant.Dialog"/>
</CatsMudStep>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
For="@(() => Model.LicenseEnd)"
MinDate="DateTime.UtcNow.Date"
Class="mt-4"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
</CatsMudStep>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
For="@(() => Model.ActivityRecommendationsReceived)"
MaxDate="DateTime.UtcNow.Date"
Class="mt-4"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
</CatsMudStep>
}

Expand Down
6 changes: 4 additions & 2 deletions src/Server.UI/Pages/Risk/RiskComponents/Restrictions.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
For="@(() => Model.ActivityRestrictionsReceived)"
MaxDate="DateTime.UtcNow.Date"
Class="mt-4"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>

<MudDivider Class="mt-8 mb-8"/>

Expand All @@ -34,7 +35,8 @@
For="@(() => Model.PSFRestrictionsReceived)"
MaxDate="DateTime.UtcNow.Date"
Class="mt-4"
Editable="true" />
Editable="true"
PickerVariant="PickerVariant.Dialog"/>
</CatsMudStep>
}

Expand Down
3 changes: 2 additions & 1 deletion src/Server.UI/Server.UI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<RootNamespace>Cfo.Cats.Server.UI</RootNamespace>
Expand All @@ -14,6 +14,7 @@
<LangVersion>default</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>CS8785</WarningsNotAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions test/Application.UnitTests/Application.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<LangVersion>default</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions test/ArchitectureTests/ArchitectureTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<LangVersion>default</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>


Expand Down

0 comments on commit 2a17bfc

Please sign in to comment.