Skip to content

Commit 186f74f

Browse files
authored
Change teacher pensions CYA content page (#2831)
https://trello.com/c/DPypyG60/1925-content-design-updates-updates-to-the-check-details-pages-across-support-tasks **Update TeachersPensions CYA Page** - Add ‘Comments' label/row underneath ‘Evidence’ - Remove Summary control and put change links next to each row. (Only display ‘Change’ links for answers the user can edit) ### Checklist - [x] Attach to Trello card - [x] Rebased master - [x] Cleaned commit history - [x] Tested by running locally
1 parent 4c572a1 commit 186f74f

File tree

3 files changed

+97
-38
lines changed

3 files changed

+97
-38
lines changed

TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/SupportTasks/TeacherPensions/Resolve/CheckAnswers.cshtml

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,68 @@
2020

2121
<div class="govuk-grid-row">
2222
<div class="govuk-grid-column-two-thirds-from-desktop">
23-
<govuk-summary-card data-testid="request">
24-
<govuk-summary-card-title>
25-
Details of the merged record
26-
</govuk-summary-card-title>
27-
<govuk-summary-card-actions>
28-
<govuk-summary-card-action href="@changeLink" data-testid="change-link">Change</govuk-summary-card-action>
29-
</govuk-summary-card-actions>
30-
<govuk-summary-list>
31-
<govuk-summary-list-row>
32-
<govuk-summary-list-row-key>First name</govuk-summary-list-row-key>
33-
<govuk-summary-list-row-value use-empty-fallback>@Model.FirstName</govuk-summary-list-row-value>
34-
</govuk-summary-list-row>
35-
<govuk-summary-list-row>
36-
<govuk-summary-list-row-key>Last name</govuk-summary-list-row-key>
37-
<govuk-summary-list-row-value use-empty-fallback>@Model.LastName</govuk-summary-list-row-value>
38-
</govuk-summary-list-row>
39-
<govuk-summary-list-row>
40-
<govuk-summary-list-row-key>TRN</govuk-summary-list-row-key>
41-
<govuk-summary-list-row-value>@Model.Trn</govuk-summary-list-row-value>
42-
</govuk-summary-list-row>
43-
<govuk-summary-list-row>
44-
<govuk-summary-list-row-key>Date of birth</govuk-summary-list-row-key>
45-
<govuk-summary-list-row-value use-empty-fallback>@Model.DateOfBirth?.ToString(UiDefaults.DateOnlyDisplayFormat)</govuk-summary-list-row-value>
46-
</govuk-summary-list-row>
47-
<govuk-summary-list-row>
48-
<govuk-summary-list-row-key>NI number</govuk-summary-list-row-key>
49-
<govuk-summary-list-row-value use-empty-fallback>@Model.NationalInsuranceNumber</govuk-summary-list-row-value>
50-
</govuk-summary-list-row>
51-
<govuk-summary-list-row>
52-
<govuk-summary-list-row-key>Evidence</govuk-summary-list-row-key>
53-
<govuk-summary-list-row-value use-empty-fallback>
54-
<vc:evidence-file-link evidence-file="@Model.EvidenceFile" />
55-
</govuk-summary-list-row-value>
56-
</govuk-summary-list-row>
57-
</govuk-summary-list>
58-
</govuk-summary-card>
23+
<govuk-summary-list>
24+
<govuk-summary-list-row>
25+
<govuk-summary-list-row-key>First name</govuk-summary-list-row-key>
26+
<govuk-summary-list-row-value use-empty-fallback>@Model.FirstName</govuk-summary-list-row-value>
27+
@if (Model.IsFirstNameChangeable)
28+
{
29+
<govuk-summary-list-row-actions>
30+
<govuk-summary-list-row-action href="@changeLink" data-testid="firstname-change-link" visually-hidden-text="first name">Change</govuk-summary-list-row-action>
31+
</govuk-summary-list-row-actions>
32+
}
33+
</govuk-summary-list-row>
34+
<govuk-summary-list-row>
35+
<govuk-summary-list-row-key>Last name</govuk-summary-list-row-key>
36+
<govuk-summary-list-row-value use-empty-fallback>@Model.LastName</govuk-summary-list-row-value>
37+
@if (Model.IsLastNameChangeable)
38+
{
39+
<govuk-summary-list-row-actions>
40+
<govuk-summary-list-row-action href="@changeLink" data-testid="lastname-change-link" visually-hidden-text="last name">Change</govuk-summary-list-row-action>
41+
</govuk-summary-list-row-actions>
42+
}
43+
</govuk-summary-list-row>
44+
<govuk-summary-list-row>
45+
<govuk-summary-list-row-key>TRN</govuk-summary-list-row-key>
46+
<govuk-summary-list-row-value>@Model.Trn</govuk-summary-list-row-value>
47+
</govuk-summary-list-row>
48+
<govuk-summary-list-row>
49+
<govuk-summary-list-row-key>Date of birth</govuk-summary-list-row-key>
50+
<govuk-summary-list-row-value use-empty-fallback>@Model.DateOfBirth?.ToString(UiDefaults.DateOnlyDisplayFormat)</govuk-summary-list-row-value>
51+
@if (Model.IsDateOfBirthChangeable)
52+
{
53+
<govuk-summary-list-row-actions>
54+
<govuk-summary-list-row-action href="@changeLink" data-testid="dob-change-link" visually-hidden-text="date of birth">Change</govuk-summary-list-row-action>
55+
</govuk-summary-list-row-actions>
56+
}
57+
</govuk-summary-list-row>
58+
<govuk-summary-list-row>
59+
<govuk-summary-list-row-key>NI number</govuk-summary-list-row-key>
60+
<govuk-summary-list-row-value use-empty-fallback>@Model.NationalInsuranceNumber</govuk-summary-list-row-value>
61+
@if (Model.IsNationalInsuranceNumberChangeable)
62+
{
63+
<govuk-summary-list-row-actions>
64+
<govuk-summary-list-row-action href="@changeLink" data-testid="ni-change-link" visually-hidden-text="national insurance number">Change</govuk-summary-list-row-action>
65+
</govuk-summary-list-row-actions>
66+
}
67+
</govuk-summary-list-row>
68+
<govuk-summary-list-row>
69+
<govuk-summary-list-row-key>Evidence</govuk-summary-list-row-key>
70+
<govuk-summary-list-row-value use-empty-fallback>
71+
<vc:evidence-file-link evidence-file="@Model.EvidenceFile" />
72+
</govuk-summary-list-row-value>
73+
<govuk-summary-list-row-actions>
74+
<govuk-summary-list-row-action href="@changeLink" data-testid="evidence-change-link" visually-hidden-text="evidence">Change</govuk-summary-list-row-action>
75+
</govuk-summary-list-row-actions>
76+
</govuk-summary-list-row>
77+
<govuk-summary-list-row>
78+
<govuk-summary-list-row-key>Comments</govuk-summary-list-row-key>
79+
<govuk-summary-list-row-value use-empty-fallback>@Model.MergeComments</govuk-summary-list-row-value>
80+
<govuk-summary-list-row-actions>
81+
<govuk-summary-list-row-action href="@changeLink" data-testid="comments-change-link" visually-hidden-text="comments">Change</govuk-summary-list-row-action>
82+
</govuk-summary-list-row-actions>
83+
</govuk-summary-list-row>
84+
</govuk-summary-list>
5985
<div class="govuk-button-group">
6086
<govuk-button type="submit" data-testid="submit">@confirmButtonLabel</govuk-button>
6187
<govuk-button type="submit" formaction="@LinkGenerator.SupportTasks.TeacherPensions.Resolve.CheckAnswersCancel(Model.SupportTaskReference, Model.JourneyInstance!.InstanceId, false)" class="govuk-button--secondary">Cancel</govuk-button>

TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/SupportTasks/TeacherPensions/Resolve/CheckAnswers.cshtml.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ public class CheckAnswersModel(
1818
SupportUiLinkGenerator linkGenerator,
1919
TrnRequestService trnRequestService,
2020
EvidenceUploadManager evidenceController,
21-
IClock clock) : ResolveTeacherPensionsPotentialDuplicatePageModel(dbContext)
21+
IClock clock,
22+
PersonChangeableAttributesService changedService) : ResolveTeacherPensionsPotentialDuplicatePageModel(dbContext)
2223
{
2324
public string? SourceApplicationUserName { get; set; }
2425

@@ -46,6 +47,21 @@ public class CheckAnswersModel(
4647

4748
public UploadedEvidenceFile? EvidenceFile { get; set; }
4849

50+
public IEnumerable<ResolvedAttribute>? ResolvableAttributes { get; private set; }
51+
52+
public bool IsGenderChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.Gender) == true;
53+
54+
public bool IsFirstNameChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.FirstName) == true;
55+
56+
public bool IsMiddleNameChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.MiddleName) == true;
57+
58+
public bool IsLastNameChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.LastName) == true;
59+
60+
public bool IsDateOfBirthChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.DateOfBirth) == true;
61+
62+
public bool IsNationalInsuranceNumberChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.NationalInsuranceNumber) == true;
63+
64+
4965
public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next)
5066
{
5167
var supportTask = GetSupportTask();
@@ -91,6 +107,18 @@ public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingConte
91107
MergeComments = state.MergeComments;
92108
PotentialDuplicate = requestData.PotentialDuplicate;
93109
EvidenceFile = JourneyInstance.State.Evidence.UploadedEvidenceFile;
110+
111+
ResolvableAttributes = changedService.GetResolvableAttributes(
112+
new List<ResolvedAttribute>
113+
{
114+
new ResolvedAttribute(PersonMatchedAttribute.Gender, state.GenderSource),
115+
new ResolvedAttribute(PersonMatchedAttribute.FirstName, state.FirstNameSource),
116+
new ResolvedAttribute(PersonMatchedAttribute.MiddleName, state.MiddleNameSource),
117+
new ResolvedAttribute(PersonMatchedAttribute.LastName, state.LastNameSource),
118+
new ResolvedAttribute(PersonMatchedAttribute.DateOfBirth, state.DateOfBirthSource),
119+
new ResolvedAttribute(PersonMatchedAttribute.NationalInsuranceNumber, state.NationalInsuranceNumberSource),
120+
});
121+
94122
await base.OnPageHandlerExecutionAsync(context, next);
95123
}
96124

TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/SupportTasks/TeacherPensions/Resolve/CheckAnswersTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public async Task Get_MergeDetails_ReturnsCorrectContent()
2727
{
2828
// Arrange
2929
var evidenceFileName = "SomeFileName.png";
30+
var mergeComments = "THIS IS A MERGE RECORD";
3031
var fileName = "test.txt";
3132
long integrationTransactionId = 1;
3233
var person = await TestData.CreatePersonAsync(x => x.WithNationalInsuranceNumber().WithGender(Gender.Male));
@@ -70,7 +71,8 @@ public async Task Get_MergeDetails_ReturnsCorrectContent()
7071
FileName = evidenceFileName,
7172
FileSizeDescription = "5MB"
7273
}
73-
}
74+
},
75+
MergeComments = mergeComments
7476
};
7577

7678
var journeyInstance = await CreateJourneyInstance(supportTask.SupportTaskReference, state);
@@ -85,6 +87,7 @@ public async Task Get_MergeDetails_ReturnsCorrectContent()
8587
var dob = doc.GetSummaryListValueElementByKey("Date of birth");
8688
var trn = doc.GetSummaryListValueElementByKey("TRN");
8789
var evidenceFile = doc.GetSummaryListValueElementByKey("Evidence");
90+
var merge = doc.GetSummaryListValueElementByKey("Comments");
8891

8992
// Assert
9093
Assert.NotNull(firstName);
@@ -93,12 +96,14 @@ public async Task Get_MergeDetails_ReturnsCorrectContent()
9396
Assert.NotNull(niNumber);
9497
Assert.NotNull(trn);
9598
Assert.NotNull(evidenceFile);
99+
Assert.NotNull(merge);
96100
Assert.Contains(person.FirstName, firstName.TextContent);
97101
Assert.Contains(duplicatePerson1.LastName, lastName.TextContent);
98102
Assert.Contains(duplicatePerson1.DateOfBirth.ToString(UiDefaults.DateOnlyDisplayFormat), dob.TextContent);
99103
Assert.Contains(person.NationalInsuranceNumber!, niNumber.TextContent);
100104
Assert.Contains(duplicatePerson1!.Trn!, trn.TextContent);
101105
Assert.Contains(evidenceFileName, evidenceFile.TextContent);
106+
Assert.Contains(mergeComments, merge.TextContent);
102107
}
103108

104109
[Fact]

0 commit comments

Comments
 (0)