From 8bd3e2b022bd883a2033de6b95731ea20f7a4f90 Mon Sep 17 00:00:00 2001 From: Stu SHERWIN Date: Mon, 1 Sep 2025 11:56:09 +0100 Subject: [PATCH] Deactivate/reactivate person content changes --- .../Pages/Persons/PersonDetail/Index.cshtml | 4 ++-- .../SetStatus/CheckAnswers.cshtml | 14 ++++++------- .../SetStatus/CheckAnswers.cshtml.cs | 2 +- .../Pages/Shared/_PersonDetail.cshtml | 2 +- .../SetStatus/CheckAnswersTests.cs | 20 +++++++++---------- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Index.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Index.cshtml index 7b583ac2f6..c2b4348757 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Index.cshtml +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/Index.cshtml @@ -16,7 +16,7 @@

Alert on record. - View alerts. + View alerts

} @@ -56,7 +56,7 @@ } - Qualified Teacher Learning and Skills status (QTLS) + Qualified teacher learning and skills status (QTLS) @(Model.PersonProfessionalStatus.QtlsStatus == QtlsStatus.None ? "No" : Model.PersonProfessionalStatus.QtlsStatus.ToString()) @if (Model.PersonProfessionalStatus.InductionStatus != InductionStatus.None) diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml index fd83fc2b6b..a58ef4942b 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml @@ -3,8 +3,8 @@ @{ Layout = "_Layout"; ViewBag.Title = Model.TargetStatus == PersonStatus.Deactivated - ? "Check details and deactivate record" - : "Check details and reactivate record"; + ? "Check details before deactivating record" + : "Check details before reactivating record"; var caption = Model.TargetStatus == PersonStatus.Deactivated ? $"Deactivate record - {Model.PersonName}" : $"Reactivate record - {Model.PersonName}"; @@ -29,14 +29,14 @@ @if (Model.TargetStatus == PersonStatus.Deactivated) { - Reason for deactivating record + Reason @Model.DeactivateReason?.GetDisplayName() Change - Reason details + More details @if (Model.DeactivateReasonDetail is not null) { @@ -55,14 +55,14 @@ else { - Reason for reactivating record + Reason @Model.ReactivateReason?.GetDisplayName() Change - Reason details + More details @if (Model.ReactivateReasonDetail is not null) { @@ -79,7 +79,7 @@ } - Evidence uploaded + Evidence @if (Model.UploadedEvidenceFileUrl is not null) { diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml.cs b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml.cs index 12a024f6e6..9ae60b824d 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Persons/PersonDetail/SetStatus/CheckAnswers.cshtml.cs @@ -88,7 +88,7 @@ EvidenceFileId is Guid fileId await JourneyInstance!.CompleteAsync(); var action = TargetStatus == PersonStatus.Deactivated ? "deactivated" : "reactivated"; - TempData.SetFlashSuccess(messageText: $"{PersonName}\u2019s record has been {action}."); + TempData.SetFlashSuccess($"{PersonName}\u2019s record has been {action}."); return Redirect(LinkGenerator.PersonDetail(PersonId)); } diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Shared/_PersonDetail.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Shared/_PersonDetail.cshtml index fd750e2940..47f4b50c52 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Shared/_PersonDetail.cshtml +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Shared/_PersonDetail.cshtml @@ -53,7 +53,7 @@ @if (Model.Options.HasFlag(PersonDetailViewModelOptions.ShowEmail)) { - Email + Email address @Model.Email } diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Persons/PersonDetail/SetStatus/CheckAnswersTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Persons/PersonDetail/SetStatus/CheckAnswersTests.cs index 8efa40d43b..5e5ceaa6c3 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Persons/PersonDetail/SetStatus/CheckAnswersTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Persons/PersonDetail/SetStatus/CheckAnswersTests.cs @@ -49,12 +49,10 @@ public async Task Get_WhenFieldChanged_ShowsReasonAndEvidenceFile_AsExpected(Per // Assert var doc = await AssertEx.HtmlResponseAsync(response); - doc.AssertRow(targetStatus == PersonStatus.Deactivated - ? "Reason for deactivating record" - : "Reason for reactivating record", v => Assert.Equal("Another reason", v.TrimmedText())); - doc.AssertRow("Reason details", v => Assert.Equal(_changeReasonDetails, v.TrimmedText())); + doc.AssertRow("Reason", v => Assert.Equal("Another reason", v.TrimmedText())); + doc.AssertRow("More details", v => Assert.Equal(_changeReasonDetails, v.TrimmedText())); var expectedFileUrl = $"{TestScopedServices.FakeBlobStorageFileUrlBase}{evidenceFileId}"; - doc.AssertRow("Evidence uploaded", v => + doc.AssertRow("Evidence", v => { var link = Assert.IsAssignableFrom(v.QuerySelector("a")); Assert.Equal("evidence.pdf (opens in new tab)", link.TrimmedText()); @@ -96,14 +94,14 @@ public async Task Get_WhenFieldChanged_ShowsMissingAdditionalDetailAndEvidenceFi if (targetStatus == PersonStatus.Deactivated) { - doc.AssertRow("Reason for deactivating record", v => Assert.Equal("The record holder died", v.TrimmedText())); + doc.AssertRow("Reason", v => Assert.Equal("The record holder died", v.TrimmedText())); } else { - doc.AssertRow("Reason for reactivating record", v => Assert.Equal("The record was deactivated by mistake", v.TrimmedText())); + doc.AssertRow("Reason", v => Assert.Equal("The record was deactivated by mistake", v.TrimmedText())); } - doc.AssertRow("Reason details", v => Assert.Equal("Not provided", v.TrimmedText())); - doc.AssertRows("Evidence uploaded", v => Assert.Equal("Not provided", v.TrimmedText())); + doc.AssertRow("More details", v => Assert.Equal("Not provided", v.TrimmedText())); + doc.AssertRows("Evidence", v => Assert.Equal("Not provided", v.TrimmedText())); } [Theory] @@ -148,10 +146,10 @@ public async Task Post_Confirm_UpdatesPersonStatusCreatesEventCompletesJourneyAn var redirectResponse = await response.FollowRedirectAsync(HttpClient); var redirectDoc = await redirectResponse.GetDocumentAsync(); - var expectedMessage = targetStatus == PersonStatus.Deactivated + var expectedHeading = targetStatus == PersonStatus.Deactivated ? "Lily The Pink\u2019s record has been deactivated." : "Lily The Pink\u2019s record has been reactivated."; - AssertEx.HtmlDocumentHasFlashSuccess(redirectDoc, expectedMessage: expectedMessage); + AssertEx.HtmlDocumentHasFlashSuccess(redirectDoc, expectedHeading); await WithDbContext(async dbContext => {