Skip to content

Commit 864595f

Browse files
authored
Content changes for NPQ CYA page (#2832)
https://trello.com/c/DPypyG60/1925-content-design-updates-updates-to-the-check-details-pages-across-support-tasks **Content changes for NPQ CYA page.** - remove summary card. - add conditional change links. - rename email to email address. - add reason to cya page only when the action is a merge. ### Checklist - [x] Attach to Trello card - [x] Rebased master - [x] Cleaned commit history - [x] Tested by running locally
1 parent 186f74f commit 864595f

File tree

4 files changed

+111
-56
lines changed

4 files changed

+111
-56
lines changed

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

Lines changed: 71 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,55 +26,83 @@
2626

2727
<div class="govuk-grid-row">
2828
<div class="govuk-grid-column-two-thirds-from-desktop">
29-
<govuk-summary-card data-testid="request">
30-
<govuk-summary-card-title>
31-
Details of the record
32-
</govuk-summary-card-title>
33-
<govuk-summary-card-actions>
34-
<govuk-summary-card-action href="@changeLink" data-testid="change-link">Change</govuk-summary-card-action>
35-
</govuk-summary-card-actions>
36-
<govuk-summary-list>
37-
<govuk-summary-list-row>
38-
<govuk-summary-list-row-key>First name</govuk-summary-list-row-key>
39-
<govuk-summary-list-row-value use-empty-fallback>@Model.FirstName</govuk-summary-list-row-value>
40-
</govuk-summary-list-row>
41-
<govuk-summary-list-row>
42-
<govuk-summary-list-row-key>Middle name</govuk-summary-list-row-key>
43-
<govuk-summary-list-row-value use-empty-fallback>@Model.MiddleName</govuk-summary-list-row-value>
44-
</govuk-summary-list-row>
45-
<govuk-summary-list-row>
46-
<govuk-summary-list-row-key>Last name</govuk-summary-list-row-key>
47-
<govuk-summary-list-row-value use-empty-fallback>@Model.LastName</govuk-summary-list-row-value>
48-
</govuk-summary-list-row>
49-
<govuk-summary-list-row>
50-
<govuk-summary-list-row-key>Date of birth</govuk-summary-list-row-key>
51-
<govuk-summary-list-row-value use-empty-fallback>@Model.DateOfBirth?.ToString(UiDefaults.DateOnlyDisplayFormat)</govuk-summary-list-row-value>
52-
</govuk-summary-list-row>
53-
<govuk-summary-list-row>
54-
<govuk-summary-list-row-key>Email</govuk-summary-list-row-key>
55-
<govuk-summary-list-row-value use-empty-fallback>@Model.EmailAddress</govuk-summary-list-row-value>
56-
</govuk-summary-list-row>
57-
<govuk-summary-list-row>
58-
<govuk-summary-list-row-key>National Insurance number</govuk-summary-list-row-key>
59-
<govuk-summary-list-row-value use-empty-fallback>@Model.NationalInsuranceNumber</govuk-summary-list-row-value>
60-
</govuk-summary-list-row>
61-
<govuk-summary-list-row>
62-
<govuk-summary-list-row-key>Gender</govuk-summary-list-row-key>
63-
<govuk-summary-list-row-value use-empty-fallback>@Model.Gender?.GetDisplayName()</govuk-summary-list-row-value>
64-
</govuk-summary-list-row>
65-
@if (Model.Trn is not null)
29+
30+
31+
<govuk-summary-list>
32+
<govuk-summary-list-row>
33+
<govuk-summary-list-row-key>First name</govuk-summary-list-row-key>
34+
<govuk-summary-list-row-value use-empty-fallback>@Model.FirstName</govuk-summary-list-row-value>
35+
</govuk-summary-list-row>
36+
<govuk-summary-list-row>
37+
<govuk-summary-list-row-key>Middle name</govuk-summary-list-row-key>
38+
<govuk-summary-list-row-value use-empty-fallback>@Model.MiddleName</govuk-summary-list-row-value>
39+
</govuk-summary-list-row>
40+
<govuk-summary-list-row>
41+
<govuk-summary-list-row-key>Last name</govuk-summary-list-row-key>
42+
<govuk-summary-list-row-value use-empty-fallback>@Model.LastName</govuk-summary-list-row-value>
43+
</govuk-summary-list-row>
44+
<govuk-summary-list-row>
45+
<govuk-summary-list-row-key>Date of birth</govuk-summary-list-row-key>
46+
<govuk-summary-list-row-value use-empty-fallback>@Model.DateOfBirth?.ToString(UiDefaults.DateOnlyDisplayFormat)</govuk-summary-list-row-value>
47+
@if (Model.IsDateOfBirthChangeable)
48+
{
49+
<govuk-summary-list-row-actions>
50+
<govuk-summary-list-row-action href="@changeLink" data-testid="dob-change-link" visually-hidden-text="date of birth">Change</govuk-summary-list-row-action>
51+
</govuk-summary-list-row-actions>
52+
}
53+
</govuk-summary-list-row>
54+
<govuk-summary-list-row>
55+
<govuk-summary-list-row-key>Email address</govuk-summary-list-row-key>
56+
<govuk-summary-list-row-value use-empty-fallback>@Model.EmailAddress</govuk-summary-list-row-value>
57+
@if (Model.IsEmailAddressChangeable)
58+
{
59+
<govuk-summary-list-row-actions>
60+
<govuk-summary-list-row-action href="@changeLink" data-testid="email-change-link" visually-hidden-text="email address">Change</govuk-summary-list-row-action>
61+
</govuk-summary-list-row-actions>
62+
}
63+
</govuk-summary-list-row>
64+
<govuk-summary-list-row>
65+
<govuk-summary-list-row-key>National Insurance number</govuk-summary-list-row-key>
66+
<govuk-summary-list-row-value use-empty-fallback>@Model.NationalInsuranceNumber</govuk-summary-list-row-value>
67+
@if (Model.IsNationalInsuranceNumberChangeable)
68+
{
69+
<govuk-summary-list-row-actions>
70+
<govuk-summary-list-row-action href="@changeLink" data-testid="ni-change-link" visually-hidden-text="national insurance number">Change</govuk-summary-list-row-action>
71+
</govuk-summary-list-row-actions>
72+
}
73+
</govuk-summary-list-row>
74+
<govuk-summary-list-row>
75+
<govuk-summary-list-row-key>Gender</govuk-summary-list-row-key>
76+
<govuk-summary-list-row-value use-empty-fallback>@Model.Gender?.GetDisplayName()</govuk-summary-list-row-value>
77+
@if (Model.IsGenderChangeable)
6678
{
67-
<govuk-summary-list-row>
68-
<govuk-summary-list-row-key>TRN</govuk-summary-list-row-key>
69-
<govuk-summary-list-row-value>@Model.Trn</govuk-summary-list-row-value>
70-
</govuk-summary-list-row>
79+
<govuk-summary-list-row-actions>
80+
<govuk-summary-list-row-action href="@changeLink" data-testid="gender-change-link" visually-hidden-text="gender">Change</govuk-summary-list-row-action>
81+
</govuk-summary-list-row-actions>
7182
}
83+
</govuk-summary-list-row>
84+
@if (Model.Trn is not null)
85+
{
86+
<govuk-summary-list-row>
87+
<govuk-summary-list-row-key>TRN</govuk-summary-list-row-key>
88+
<govuk-summary-list-row-value>@Model.Trn</govuk-summary-list-row-value>
89+
<govuk-summary-list-row-actions>
90+
<govuk-summary-list-row-action href="@changeLink" data-testid="change-link" visually-hidden-text="trn">Change</govuk-summary-list-row-action>
91+
</govuk-summary-list-row-actions>
92+
</govuk-summary-list-row>
93+
}
94+
@if (!Model.CreatingNewRecord)
95+
{
7296
<govuk-summary-list-row>
7397
<govuk-summary-list-row-key>Comments</govuk-summary-list-row-key>
7498
<govuk-summary-list-row-value use-empty-fallback>@Model.Comments</govuk-summary-list-row-value>
99+
<govuk-summary-list-row-actions>
100+
<govuk-summary-list-row-action href="@changeLink" data-testid="comments-change-link" visually-hidden-text="comments">Change</govuk-summary-list-row-action>
101+
</govuk-summary-list-row-actions>
75102
</govuk-summary-list-row>
76-
</govuk-summary-list>
77-
</govuk-summary-card>
103+
}
104+
</govuk-summary-list>
105+
78106
<div class="govuk-button-group">
79107
<govuk-button type="submit" data-testid="submit">@confirmButtonLabel</govuk-button>
80108
<govuk-button type="submit" formaction="@LinkGenerator.SupportTasks.NpqTrnRequests.Resolve.CheckAnswersCancel(Model.SupportTaskReference, Model.JourneyInstance!.InstanceId)" class="govuk-button--secondary">Cancel</govuk-button>

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public class CheckAnswersModel(
1717
TrnRequestService trnRequestService,
1818
ITrnGenerator trnGenerator,
1919
SupportUiLinkGenerator linkGenerator,
20-
IClock clock) : ResolveNpqTrnRequestPageModel(dbContext)
20+
IClock clock,
21+
PersonChangeableAttributesService changedService) : ResolveNpqTrnRequestPageModel(dbContext)
22+
2123
{
2224
public string? SourceApplicationUserName { get; set; }
2325

@@ -43,6 +45,16 @@ public class CheckAnswersModel(
4345

4446
public string? Comments { get; set; }
4547

48+
public IEnumerable<ResolvedAttribute>? ResolvableAttributes { get; private set; }
49+
50+
public bool IsGenderChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.Gender) == true;
51+
52+
public bool IsDateOfBirthChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.DateOfBirth) == true;
53+
54+
public bool IsNationalInsuranceNumberChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.NationalInsuranceNumber) == true;
55+
56+
public bool IsEmailAddressChangeable => ResolvableAttributes?.Any(r => r.Attribute == PersonMatchedAttribute.EmailAddress) == true;
57+
4658
public void OnGet()
4759
{
4860
}
@@ -248,6 +260,15 @@ public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingConte
248260
Comments = state.Comments;
249261
SourceApplicationUserName = requestData.ApplicationUser!.Name;
250262
PotentialDuplicate = requestData.PotentialDuplicate;
263+
264+
ResolvableAttributes = changedService.GetResolvableAttributes(
265+
new List<ResolvedAttribute>
266+
{
267+
new ResolvedAttribute(PersonMatchedAttribute.Gender, state.GenderSource),
268+
new ResolvedAttribute(PersonMatchedAttribute.DateOfBirth, state.DateOfBirthSource),
269+
new ResolvedAttribute(PersonMatchedAttribute.NationalInsuranceNumber, state.NationalInsuranceNumberSource),
270+
new ResolvedAttribute(PersonMatchedAttribute.EmailAddress, state.EmailAddressSource)
271+
});
251272
await base.OnPageHandlerExecutionAsync(context, next);
252273
}
253274
}

TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/JourneyTests/SupportTasks/NpqTrnRequestTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,11 @@ await WithDbContextAsync(dbContext =>
3030
await page.ClickContinueButtonAsync();
3131

3232
await page.AssertOnMatchesCheckYourAnswersPageAsync(supportTaskReference);
33-
await page.ClickChangeLinkAsync();
34-
35-
await page.AssertOnMatchesPageAsync(supportTaskReference);
3633
await page.ClickBackLinkAsync();
37-
38-
await page.AssertOnMatchesCheckYourAnswersPageAsync(supportTaskReference);
39-
await page.ClickChangeLinkAsync();
40-
4134
await page.AssertOnMatchesPageAsync(supportTaskReference);
42-
await page.ClickContinueButtonAsync();
4335

36+
await page.ClickRadioByLabelAsync($"Create a new record");
37+
await page.ClickContinueButtonAsync();
4438
await page.AssertOnMatchesCheckYourAnswersPageAsync(supportTaskReference);
4539
await page.ClickButtonAsync("Confirm and create record");
4640
await page.AssertOnListPageAsync();

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ public async Task Get_UpdatingExistingRecord_HasBackAndChangeLinksToMergePage()
256256
{
257257
MatchedPersonIds = supportTask.TrnRequestMetadata!.Matches!.MatchedPersons.Select(p => p.PersonId).AsReadOnly(),
258258
PersonId = supportTask.TrnRequestMetadata!.Matches!.MatchedPersons.First().PersonId,
259-
PersonAttributeSourcesSet = true
259+
PersonAttributeSourcesSet = true,
260+
DateOfBirthSource = PersonAttributeSource.ExistingRecord,
261+
GenderSource = PersonAttributeSource.ExistingRecord,
262+
NationalInsuranceNumberSource = PersonAttributeSource.ExistingRecord,
263+
EmailAddressSource = PersonAttributeSource.ExistingRecord,
260264
});
261265

262266
var expectedBackLink = $"/support-tasks/npq-trn-requests/{supportTask.SupportTaskReference}/resolve/merge?{journeyInstance.GetUniqueIdQueryParameter()}";
@@ -272,11 +276,15 @@ public async Task Get_UpdatingExistingRecord_HasBackAndChangeLinksToMergePage()
272276
// Assert
273277
var doc = await AssertEx.HtmlResponseAsync(response);
274278
Assert.Equal(expectedBackLink, doc.GetElementsByClassName("govuk-back-link").Single().GetAttribute("href"));
275-
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("change-link")?.GetAttribute("href"));
279+
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("gender-change-link")?.GetAttribute("href"));
280+
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("dob-change-link")?.GetAttribute("href"));
281+
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("ni-change-link")?.GetAttribute("href"));
282+
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("email-change-link")?.GetAttribute("href"));
283+
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("comments-change-link")?.GetAttribute("href"));
276284
}
277285

278286
[Fact]
279-
public async Task Get_CreatingNewRecord_RequestHasMatches_HasBackLinkAndChangeLinkToMatchPage()
287+
public async Task Get_CreatingNewRecord_RequestHasMatches_HasBackLinkAndNoChangeLinks()
280288
{
281289
// Arrange
282290
var applicationUser = await TestData.CreateApplicationUserAsync();
@@ -305,7 +313,11 @@ public async Task Get_CreatingNewRecord_RequestHasMatches_HasBackLinkAndChangeLi
305313
// Assert
306314
var doc = await AssertEx.HtmlResponseAsync(response);
307315
Assert.Equal(expectedBackLink, doc.GetElementsByClassName("govuk-back-link").Single().GetAttribute("href"));
308-
Assert.Equal(expectedChangeLink, doc.GetElementByTestId("change-link")?.GetAttribute("href"));
316+
Assert.Null(doc.GetElementByTestId("gender-change-link"));
317+
Assert.Null(doc.GetElementByTestId("dob-change-link"));
318+
Assert.Null(doc.GetElementByTestId("ni-change-link"));
319+
Assert.Null(doc.GetElementByTestId("email-change-link"));
320+
Assert.Null(doc.GetElementByTestId("comments-change-link"));
309321
}
310322

311323
[Fact]

0 commit comments

Comments
 (0)