Skip to content

Commit 4c50ef3

Browse files
Feature/225731 application status text (#34)
1 parent f79febd commit 4c50ef3

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/DfE.ExternalApplications.Web/DfE.ExternalApplications.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="DfE.CoreLibs.Caching" Version="1.0.10" />
12+
<PackageReference Include="DfE.CoreLibs.Contracts" Version="1.0.36" />
1213
<PackageReference Include="GovUK.Dfe.ExternalApplications.Api.Client" Version="0.1.13" />
1314
<PackageReference Include="GovUk.Frontend.AspNetCore" Version="3.2.2" />
1415
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

src/DfE.ExternalApplications.Web/Pages/Applications/Dashboard.cshtml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@using DfE.CoreLibs.Contracts.ExternalApplications.Models.Response
44
@using GovUk.Frontend.AspNetCore.TagHelpers
55
@using Microsoft.AspNetCore.Authorization
6+
@using System.ComponentModel;
67
@addTagHelper *, DfE.CoreLibs.Security
78
@model DfE.ExternalApplications.Web.Pages.Applications.DashboardModel
89
@inject IAuthorizationService AuthService
@@ -61,6 +62,10 @@
6162
var statusClass = app.CalculatedStatus == ApplicationStatus.Submitted ? "govuk-tag--green" :
6263
app.CalculatedStatus == ApplicationStatus.InProgress ? "govuk-tag--blue" : "govuk-tag--grey";
6364

65+
var appStatusInfo = @app.CalculatedStatus.GetType().GetField(@app.CalculatedStatus.ToString());
66+
var descriptionAttributes = (DescriptionAttribute[])appStatusInfo!.GetCustomAttributes(typeof(DescriptionAttribute), false);
67+
var appStatusDescription = descriptionAttributes.Length > 0 ? descriptionAttributes[0].Description : @app.CalculatedStatus.ToString();
68+
6469
<tr class="govuk-table__row">
6570
<td class="govuk-table__cell">@app.ApplicationReference</td>
6671
<td class="govuk-table__cell">@app.DateCreated.ToString("d MMMM yyyy")</td>
@@ -69,7 +74,7 @@
6974
</td>
7075
<td class="govuk-table__cell">
7176
<strong class="govuk-tag @statusClass">
72-
@app.CalculatedStatus
77+
@appStatusDescription
7378
</strong>
7479
</td>
7580
<td class="govuk-table__cell">

src/DfE.ExternalApplications.Web/Pages/Shared/BaseFormPageModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ public string GetTaskStatusDisplayText(Domain.Models.TaskStatus status)
180180
return status switch
181181
{
182182
Domain.Models.TaskStatus.Completed => "Completed",
183-
Domain.Models.TaskStatus.InProgress => "In Progress",
184-
Domain.Models.TaskStatus.NotStarted => "Not Started",
185-
Domain.Models.TaskStatus.CannotStartYet => "Cannot Start Yet",
186-
_ => "Not Started"
183+
Domain.Models.TaskStatus.InProgress => "In progress",
184+
Domain.Models.TaskStatus.NotStarted => "Not started",
185+
Domain.Models.TaskStatus.CannotStartYet => "Cannot start yet",
186+
_ => "Not started"
187187
};
188188
}
189189

0 commit comments

Comments
 (0)