From 3946f73fd4e5952123d300943a25d80a754e6b90 Mon Sep 17 00:00:00 2001 From: plockwood Date: Fri, 4 Oct 2024 14:34:26 +0100 Subject: [PATCH 01/19] approved decision page --- .../Models/AcademyConversionProject.cs | 2 + .../Decision/DecisionApprovedInfo.cshtml | 26 ++++++++ .../Decision/DecisionApprovedInfo.cshtml.cs | 64 +++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs index cc981eac0..254704078 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/AcademyConversionProject.cs @@ -142,4 +142,6 @@ public class AcademyConversionProject public bool ProjectDatesSectionComplete { get; set; } + public bool IsReadOnly { get; set; } + } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml new file mode 100644 index 000000000..c24d4847c --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml @@ -0,0 +1,26 @@ +@page "/task-list/{id:int}/decision/approved-info" +@using Dfe.PrepareConversions.Extensions +@using Dfe.PrepareConversions.TagHelpers +@model Dfe.PrepareConversions.Pages.TaskList.Decision.DecisionMaker +@{ + ViewData["Title"] = "Approved decision information"; + Layout = "_Layout"; +} + +@section BeforeMain +{ + + +} + +Record the decision +

@ViewData["Title"]

+ +
+

+ Decision recorded +

+
+ Your reference number
+
+
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs new file mode 100644 index 000000000..742715c88 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs @@ -0,0 +1,64 @@ +using Dfe.PrepareConversions.Data.Models.AdvisoryBoardDecision; +using Dfe.PrepareConversions.Data.Services; +using Dfe.PrepareConversions.Models; +using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; +using Dfe.PrepareConversions.Services; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System; +using System.ComponentModel.DataAnnotations; +using System.Security.AccessControl; + +namespace Dfe.PrepareConversions.Pages.TaskList.Decision +{ + public class DecisionApprovedInfo : PageModel + { + private readonly ErrorService _errorService; + + public DecisionApprovedInfo(ErrorService errorService, IAcademyConversionProjectRepository repository, ISession session) + : base(repository, session) + { + _errorService = errorService; + } + + public AdvisoryBoardDecision Decision { get; set; } + + public async onget + public async IActionResult OnGetAsync(int id) + { + Decision = await _advisoryBoardDecisionRepository.Get(id); + + SetBackLinkModel(GetPageForBackLink(id), id); + + return Page(); + } + public LinkItem GetPageForBackLink(int id) + { + return Decision switch + { + { Decision: AdvisoryBoardDecisions.Approved } => Links.Decision.AnyConditions, + { Decision: AdvisoryBoardDecisions.Declined } => Links.Decision.DeclineReason, + { Decision: AdvisoryBoardDecisions.Deferred } => Links.Decision.WhyDeferred, + { Decision: AdvisoryBoardDecisions.Withdrawn } => Links.Decision.WhyWithdrawn, + { Decision: AdvisoryBoardDecisions.DAORevoked } => Links.Decision.WhyDAORevoked, + _ => throw new Exception("Unexpected decision state") + }; + } + public IActionResult OnPost(int id) + { + if (!ModelState.IsValid) + { + _errorService.AddError("decision-maker-name", "Enter the decision maker's name"); + return OnGet(id); + } + + AdvisoryBoardDecision decision = GetDecisionFromSession(id); + decision.DecisionMakerName = DecisionMakerName; + + SetDecisionInSession(id, decision); + + return RedirectToPage(Links.Decision.DecisionDate.Page, LinkParameters); + } + } +} \ No newline at end of file From b888455afa6344b47ff4c5c7ef7b50ea9f113546 Mon Sep 17 00:00:00 2001 From: plockwood Date: Fri, 4 Oct 2024 14:51:53 +0100 Subject: [PATCH 02/19] fixed errors --- .../Decision/DecisionApprovedInfo.cshtml.cs | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs index 742715c88..bd33274cb 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs @@ -1,38 +1,43 @@ +using Dfe.PrepareConversions.Data; using Dfe.PrepareConversions.Data.Models.AdvisoryBoardDecision; using Dfe.PrepareConversions.Data.Services; +using Dfe.PrepareConversions.Data.Services.Interfaces; using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; using Dfe.PrepareConversions.Services; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; using System; -using System.ComponentModel.DataAnnotations; -using System.Security.AccessControl; +using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.Decision { - public class DecisionApprovedInfo : PageModel + public class DecisionApprovedInfo : DecisionBaseModel { private readonly ErrorService _errorService; - - public DecisionApprovedInfo(ErrorService errorService, IAcademyConversionProjectRepository repository, ISession session) - : base(repository, session) + private readonly IAcademyConversionAdvisoryBoardDecisionRepository _advisoryBoardDecisionRepository; + public DecisionApprovedInfo(ErrorService errorService, + IAcademyConversionProjectRepository repository, + IAcademyConversionAdvisoryBoardDecisionRepository advisoryBoardDecisionRepository, + ISession session) : base(repository, session) { _errorService = errorService; + _advisoryBoardDecisionRepository = advisoryBoardDecisionRepository; } public AdvisoryBoardDecision Decision { get; set; } - public async onget - public async IActionResult OnGetAsync(int id) - { - Decision = await _advisoryBoardDecisionRepository.Get(id); + public async Task OnGetAsync(int id) { + ApiResponse savedDecision = await _advisoryBoardDecisionRepository.Get(id); + + if(savedDecision.Success) + Decision = savedDecision.Body; SetBackLinkModel(GetPageForBackLink(id), id); return Page(); } + public LinkItem GetPageForBackLink(int id) { return Decision switch @@ -45,20 +50,5 @@ public LinkItem GetPageForBackLink(int id) _ => throw new Exception("Unexpected decision state") }; } - public IActionResult OnPost(int id) - { - if (!ModelState.IsValid) - { - _errorService.AddError("decision-maker-name", "Enter the decision maker's name"); - return OnGet(id); - } - - AdvisoryBoardDecision decision = GetDecisionFromSession(id); - decision.DecisionMakerName = DecisionMakerName; - - SetDecisionInSession(id, decision); - - return RedirectToPage(Links.Decision.DecisionDate.Page, LinkParameters); - } } } \ No newline at end of file From 3c53d14f6b73d2547c174c93bf4a8eec54d40aee Mon Sep 17 00:00:00 2001 From: plockwood Date: Mon, 7 Oct 2024 12:06:21 +0100 Subject: [PATCH 03/19] #182434 Updating link in the trust template task --- Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json index 1578ff1f8..aa1cfc8fd 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json @@ -37,7 +37,7 @@ "TransfersUrl": "https://dev.prepare-transfers.education.gov.uk" }, "ApplicationLinks": { - "SharePointTemplateUrl": "https://educationgovuk.sharepoint.com/sites/lvedfe00116/SitePages/Headteacher-Board-Operational-Processes.aspx?xsdata=...", + "SharePointTemplateUrl": "https://educationgovuk.sharepoint.com/sites/lvewp00030/SitePages/7-Monitoring%20&%20Decision%20Making/1-Advisory%20Board/Advisory%20Board.aspx", "RevocationGuidanceLink": "https://educationgovuk.sharepoint.com/:w:/r/sites/lvedfe00116/_layouts/15/Doc.aspx?action=default&file=Revocation_Guidance_Mar24.docx&mobileredirect=true&sourcedoc=%7B563CD875-E0A4-46F0-AEC2-8C19453E24D5%7D" }, "ApplicationInsights": { From 5d9a9672cfd1f418fa7b529a1db82a0824ef3658 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Mon, 7 Oct 2024 13:40:23 +0100 Subject: [PATCH 04/19] Hide change button if the project is readonly --- .../AcademyConversionProjectExtensions.cs | 1 + .../RationaleForTrustIntegrationTests.cs | 6 +- .../GeneralInformation/Index.cshtml.cs | 107 ++++++++---------- .../TransferDates/AdvisoryBoard.cshtml.cs | 103 ++++++++--------- .../BaseAcademyConversionProjectPageModel.cs | 2 +- .../RecordDecisionPreview/default.cshtml | 12 +- .../SchoolAndTrustInformation/default.cshtml | 14 +-- .../Components/SchoolOverview/default.cshtml | 12 +- .../ExternalApplicationForm/Index.cshtml | 22 ++-- .../Pages/ProjectNotes/Index.cshtml | 9 +- .../Pages/Shared/_SummaryListRow.cshtml | 63 ++++++----- .../TaskList/Decision/RecordADecision.cshtml | 2 +- .../Pages/TaskList/Decision/Summary.cshtml.cs | 26 ++--- .../Pages/TaskList/Index.cshtml | 7 +- .../LegalDiocesanConsent.cshtml.cs | 7 +- .../LegalGoverningBody.cshtml.cs | 7 +- .../LegalRequirements/LegalModelBase.cs | 18 +-- .../LegalRequirements/LegalSummary.cshtml | 82 ++++++++------ .../LegalRequirements/LegalSummary.cshtml.cs | 9 +- ...alAuthorityInformationTemplateDates.cshtml | 23 ++-- .../TaskList/PreviewProjectTemplate.cshtml | 30 ++--- .../ProjectDates/ConfirmProjectDates.cshtml | 25 ++-- .../ConfirmProjectDates.cshtml.cs | 12 +- .../ConfirmProjectAndTrustRationale.cshtml | 19 ++-- .../ConfirmRisksAndIssues.cshtml | 17 +-- .../ConversionDetails.cshtml | 15 ++- .../SchoolBudgetInformation/Budget.cshtml | 32 +++--- .../SchoolOverview/SchoolOverview.cshtml | 22 ++-- .../PupilForecasts.cshtml | 11 +- ...UpdateAcademyConversionProjectPageModel.cs | 22 ++-- .../TagHelpers/SummaryListRowTagHelper.cs | 10 +- .../SchoolAndTrustInformationViewComponent.cs | 3 +- .../SchoolOverviewViewComponent.cs | 16 +-- .../ViewModels/ProjectViewModel.cs | 2 + .../RecordDecisionPreviewViewModel.cs | 16 +-- .../SchoolAndTrustInformationViewModel.cs | 1 + .../ViewModels/SchoolOverviewViewModel.cs | 1 + .../ViewModels/SummaryListRowViewModel.cs | 1 + .../Models/Project.cs | 68 +++++------ .../TestFixtures/GetInformationForProject.cs | 6 +- 40 files changed, 424 insertions(+), 437 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Extensions/AcademyConversionProjectExtensions.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Extensions/AcademyConversionProjectExtensions.cs index 01ca3d7a1..301340aea 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Extensions/AcademyConversionProjectExtensions.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Extensions/AcademyConversionProjectExtensions.cs @@ -14,6 +14,7 @@ public static UpdateAcademyConversionProject CreateUpdateAcademyConversionProjec FoundationConsent = project.FoundationConsent.ToString(), GoverningBodyResolution = project.GoverningBodyApproved.ToString(), LegalRequirementsSectionComplete = project.IsComplete + }; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/RationaleForTrustIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/RationaleForTrustIntegrationTests.cs index 56523d52e..9878218e2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/RationaleForTrustIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/RationaleForTrustIntegrationTests.cs @@ -9,10 +9,8 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.Rationale; -public class RationaleForTrustIntegrationTests : BaseIntegrationTests +public class RationaleForTrustIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public RationaleForTrustIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_navigate_to_and_update_rationale_for_trust() { @@ -53,7 +51,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_back_to_rationale_from_rationale_for_trust() { - AcademyConversionProject project = AddGetProject(x => x.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary); + var project = AddGetProject(x => x.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-project-trust-rationale/trust-rationale"); await NavigateAsync("Back"); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/GeneralInformation/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/GeneralInformation/Index.cshtml.cs index 8fba7de1c..8d357cf1b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/GeneralInformation/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/GeneralInformation/Index.cshtml.cs @@ -9,65 +9,58 @@ namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation { - public class Index : CommonPageModel - { - private readonly IGetInformationForProject _getInformationForProject; + public class Index(IGetInformationForProject getInformationForProject) : CommonPageModel + { + public string SchoolPhase { get; set; } + public string AgeRange { get; set; } + public string Capacity { get; set; } + public string NumberOnRoll { get; set; } + public string FreeSchoolMeals { get; set; } + public string PublishedAdmissionNumber { get; set; } + public string PrivateFinanceInitiative { get; set; } + public string ViabilityIssues { get; set; } + public string FinancialDeficit { get; set; } + public string SchoolType { get; set; } + public string DiocesePercent { get; set; } + public string DistanceFromAcademyToTrustHq { get; set; } + public string GIASLastChangedDate { get; set; } + public string MP { get; set; } - public string SchoolPhase { get; set; } - public string AgeRange { get; set; } - public string Capacity { get; set; } - public string NumberOnRoll { get; set; } - public string FreeSchoolMeals { get; set; } - public string PublishedAdmissionNumber { get; set; } - public string PrivateFinanceInitiative { get; set; } - public string ViabilityIssues { get; set; } - public string FinancialDeficit { get; set; } - public string SchoolType { get; set; } - public string DiocesePercent { get; set; } - public string DistanceFromAcademyToTrustHq { get; set; } - public string GIASLastChangedDate { get; set; } - public string MP { get; set; } + [BindProperty(SupportsGet = true)] + public string AcademyUkprn { get; set; } - [BindProperty(SupportsGet = true)] - public string AcademyUkprn { get; set; } + public string AcademyName { get; set; } + public string Urn { get; set; } - public string AcademyName { get; set; } - public string Urn { get; set; } + public async Task OnGetAsync(string urn) + { + var getInformationForProjectResponse = await getInformationForProject.Execute(urn); + var academy = getInformationForProjectResponse.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + var generalInformation = getInformationForProjectResponse.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn).GeneralInformation; + AcademyName = academy.Name; + SchoolPhase = generalInformation.SchoolPhase; + AgeRange = generalInformation.AgeRange; + Capacity = generalInformation.Capacity; + NumberOnRoll = $"{generalInformation.NumberOnRoll} ({generalInformation.PercentageFull})"; + FreeSchoolMeals = generalInformation.PercentageFsm; + PublishedAdmissionNumber = academy.PublishedAdmissionNumber; + PrivateFinanceInitiative = $"{academy.PFIScheme} {academy.PFISchemeDetails}"; + ViabilityIssues = academy.ViabilityIssues; + FinancialDeficit = academy.FinancialDeficit; + SchoolType = generalInformation.SchoolType; + DiocesePercent = generalInformation.DiocesesPercent; + DistanceFromAcademyToTrustHq = $"{academy.DistanceFromAcademyToTrustHq?.ToString()} {academy.DistanceFromAcademyToTrustHqDetails}"; + MP = academy.MPNameAndParty; + Urn = urn; + GIASLastChangedDate = "N/A"; + if (academy.LastChangedDate.IsNullOrEmpty() is false) + { + GIASLastChangedDate = DateTime.Parse(academy.LastChangedDate, CultureInfo.GetCultureInfo("en-GB")).ToString("MMMM yyyy"); + } - public Index(IGetInformationForProject getInformationForProject) - { - _getInformationForProject = getInformationForProject; - } - - public async Task OnGetAsync(string urn) - { - var getInformationForProjectResponse = await _getInformationForProject.Execute(urn); - var academy = getInformationForProjectResponse.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); - var generalInformation = getInformationForProjectResponse.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn).GeneralInformation; - AcademyName = academy.Name; - SchoolPhase = generalInformation.SchoolPhase; - AgeRange = generalInformation.AgeRange; - Capacity = generalInformation.Capacity; - NumberOnRoll = $"{generalInformation.NumberOnRoll} ({generalInformation.PercentageFull})"; - FreeSchoolMeals = generalInformation.PercentageFsm; - PublishedAdmissionNumber = academy.PublishedAdmissionNumber; - PrivateFinanceInitiative = $"{academy.PFIScheme} {academy.PFISchemeDetails}"; - ViabilityIssues = academy.ViabilityIssues; - FinancialDeficit = academy.FinancialDeficit; - SchoolType = generalInformation.SchoolType; - DiocesePercent = generalInformation.DiocesesPercent; - DistanceFromAcademyToTrustHq = $"{academy.DistanceFromAcademyToTrustHq?.ToString()} {academy.DistanceFromAcademyToTrustHqDetails}"; - MP = academy.MPNameAndParty; - Urn = urn; - GIASLastChangedDate = "N/A"; - if (academy.LastChangedDate.IsNullOrEmpty() is false) - { - GIASLastChangedDate = DateTime.Parse(academy.LastChangedDate, CultureInfo.GetCultureInfo("en-GB")).ToString("MMMM yyyy"); - } - - Urn = getInformationForProjectResponse.Project.Urn; - OutgoingAcademyUrn = getInformationForProjectResponse.Project.OutgoingAcademyUrn; - return Page(); - } - } + Urn = getInformationForProjectResponse.Project.Urn; + OutgoingAcademyUrn = getInformationForProjectResponse.Project.OutgoingAcademyUrn; + return Page(); + } + } } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/TransferDates/AdvisoryBoard.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/TransferDates/AdvisoryBoard.cshtml.cs index 9ac37a4c4..89525a566 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/TransferDates/AdvisoryBoard.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Areas/Transfers/Pages/Projects/TransferDates/AdvisoryBoard.cshtml.cs @@ -9,74 +9,67 @@ namespace Dfe.PrepareTransfers.Web.Pages.Projects.TransferDates { - public class AdvisoryBoard : CommonPageModel - { - private readonly IProjects _projectsRepository; + public class AdvisoryBoard(IProjects projectsRepository) : CommonPageModel + { + [BindProperty] public AdvisoryBoardViewModel AdvisoryBoardViewModel { get; set; } + public string TrustName { get; set; } - [BindProperty] public AdvisoryBoardViewModel AdvisoryBoardViewModel { get; set; } - public string TrustName { get; set; } + public async Task OnGetAsync() + { + var project = await projectsRepository.GetByUrn(Urn); - public AdvisoryBoard(IProjects projectsRepository) - { - _projectsRepository = projectsRepository; - } - - public async Task OnGetAsync() - { - var project = await _projectsRepository.GetByUrn(Urn); - - var projectResult = project.Result; - TrustName = projectResult.OutgoingTrustName; - AdvisoryBoardViewModel = new AdvisoryBoardViewModel + var projectResult = project.Result; + TrustName = projectResult.OutgoingTrustName; + AdvisoryBoardViewModel = new AdvisoryBoardViewModel + { + AdvisoryBoardDate = new DateViewModel { - AdvisoryBoardDate = new DateViewModel - { - Date = DateViewModel.SplitDateIntoDayMonthYear(projectResult.Dates.Htb), - UnknownDate = projectResult.Dates.HasHtbDate is false - } - }; - IncomingTrustName = projectResult.IncomingTrustName; - return Page(); - } + Date = DateViewModel.SplitDateIntoDayMonthYear(projectResult.Dates.Htb), + UnknownDate = projectResult.Dates.HasHtbDate is false + } + }; + IncomingTrustName = projectResult.IncomingTrustName; + return Page(); + } - public async Task OnPostAsync() - { - var project = await _projectsRepository.GetByUrn(Urn); + public async Task OnPostAsync() + { + var project = await projectsRepository.GetByUrn(Urn); - if (!ModelState.IsValid) - { - return Page(); - } + if (!ModelState.IsValid) + { + return Page(); + } - var projectResult = project.Result; + var projectResult = project.Result; - var validationContext = new ValidationContext(AdvisoryBoardViewModel) - { - RootContextData = + var validationContext = new ValidationContext(AdvisoryBoardViewModel) + { + RootContextData = { ["TargetDate"] = projectResult.Dates.Target } - }; - var validator = new AdvisoryBoardDateValidator(); - var validationResult = await validator.ValidateAsync(validationContext); + }; + var validator = new AdvisoryBoardDateValidator(); + var validationResult = await validator.ValidateAsync(validationContext); - if (!validationResult.IsValid) - { - validationResult.AddToModelState(ModelState, nameof(AdvisoryBoardViewModel)); - return Page(); - } + if (!validationResult.IsValid) + { + validationResult.AddToModelState(ModelState, nameof(AdvisoryBoardViewModel)); + return Page(); + } - projectResult.Dates.Htb = AdvisoryBoardViewModel.AdvisoryBoardDate.DateInputAsString(); - projectResult.Dates.HasHtbDate = !AdvisoryBoardViewModel.AdvisoryBoardDate.UnknownDate; + projectResult.Dates.Htb = AdvisoryBoardViewModel.AdvisoryBoardDate.DateInputAsString(); + projectResult.Dates.HasHtbDate = !AdvisoryBoardViewModel.AdvisoryBoardDate.UnknownDate; - await _projectsRepository.UpdateDates(projectResult); + await projectsRepository.UpdateDates(projectResult); - if (ReturnToPreview) - { - return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); - } + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } - return RedirectToPage("/Projects/TransferDates/Index", new { Urn }); - } - } + return RedirectToPage("/Projects/TransferDates/Index", new { Urn }); + } + } } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs index 55122aa0b..8c3e578d6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs @@ -34,7 +34,7 @@ public virtual async Task OnPostAsync(int id) protected async Task SetProject(int id) { - ApiResponse project = await _repository.GetProjectById(id); + var project = await _repository.GetProjectById(id); if (!project.Success) { // 404 logic diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index 7bc26926c..d3b1bdef2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -205,20 +205,27 @@ }
+ @if (Model.IsReadOnly) + { Change Date academy order (AO) sent + }
} + @if (Model.IsReadOnly) + {

- You can click the button to change the recorded decision. -

+ You can click the button to change the recorded decision. +

+ Change your decision + } } else { @@ -227,7 +234,6 @@ else

You have not recorded the decision for this project. You can record the decision once it has been made.

- Record a decision diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml index 1fbe08926..eeaf0d25c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml @@ -14,13 +14,13 @@ - + @* Voluntary grant *@ - + @* Sponsored grant *@ @@ -31,13 +31,13 @@ @if (Model.IsPreview) { - - - + + + } - - + + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolOverview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolOverview/default.cshtml index b5a3e1944..0d87a54dd 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolOverview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolOverview/default.cshtml @@ -16,21 +16,21 @@ - + - - - + + + - + - + @{ diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.cshtml index 21a166647..6eed50fc0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.cshtml @@ -26,9 +26,12 @@ No
- - ChangeExternal application form saved for the school - + @if(!Model.Project.IsReadOnly) + { + + ChangeExternal application form saved for the school + + }
@@ -39,11 +42,14 @@
@Model.ApplicationFormLink
-
- - Changeschool application form url - -
+ @if(!Model.Project.IsReadOnly) + { +
+ + Changeschool application form url + +
+ } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml index 1b8f3cf90..f78c59391 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectNotes/Index.cshtml @@ -32,9 +32,12 @@

Project notes

- - Add note - + @if (!Model.Project.IsReadOnly) + { + + Add note + + }
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SummaryListRow.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SummaryListRow.cshtml index 7ae732cc8..d30eec6ae 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SummaryListRow.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_SummaryListRow.cshtml @@ -30,35 +30,38 @@ Empty } -
- @if (!string.IsNullOrEmpty(Model.Page) && !string.IsNullOrEmpty(Model.RouteId)) - { - if (ViewData["IncludeFragment"] is bool includeFragment && includeFragment) - { - - Change@Model.HiddenText - - } - else if (!string.IsNullOrEmpty(Model.Fragment)) - { - - Change@Model.HiddenText - - } - else - { - - Change@Model.HiddenText - - } + @if (!Model.IsReadOnly) + { +
+ @if (!string.IsNullOrEmpty(Model.Page) && !string.IsNullOrEmpty(Model.RouteId)) + { + if (ViewData["IncludeFragment"] is bool includeFragment && includeFragment) + { + + Change@Model.HiddenText + + } + else if (!string.IsNullOrEmpty(Model.Fragment)) + { + + Change@Model.HiddenText + + } + else + { + + Change@Model.HiddenText + + } + } +
} -
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml index ffc0d165d..96eeb8ef9 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml @@ -13,5 +13,5 @@
- @await Component.InvokeAsync("RecordDecisionPreview", new { id = int.Parse(Model?.Project.Id ?? string.Empty), AcademyTypeAndRoute = Model.Project.AcademyTypeAndRoute }) + @await Component.InvokeAsync("RecordDecisionPreview", new { id = int.Parse(Model?.Project.Id ?? string.Empty), AcademyTypeAndRoute = Model.Project.AcademyTypeAndRoute, isReadOnly= Model.Project.IsReadOnly })
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs index 53241e274..535a3a6e6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs @@ -14,21 +14,11 @@ namespace Dfe.PrepareConversions.Pages.TaskList.Decision; -public class SummaryModel : DecisionBaseModel +public class SummaryModel(IAcademyConversionProjectRepository repository, + ISession session, + IAcademyConversionAdvisoryBoardDecisionRepository advisoryBoardDecisionRepository, + IAcademyConversionProjectRepository academyConversionProjectRepository) : DecisionBaseModel(repository, session) { - private readonly IAcademyConversionProjectRepository _academyConversionProjectRepository; - private readonly IAcademyConversionAdvisoryBoardDecisionRepository _advisoryBoardDecisionRepository; - - public SummaryModel(IAcademyConversionProjectRepository repository, - ISession session, - IAcademyConversionAdvisoryBoardDecisionRepository advisoryBoardDecisionRepository, - IAcademyConversionProjectRepository academyConversionProjectRepository) - : base(repository, session) - { - _advisoryBoardDecisionRepository = advisoryBoardDecisionRepository; - _academyConversionProjectRepository = academyConversionProjectRepository; - } - public AdvisoryBoardDecision Decision { get; set; } public string DecisionText => Decision.Decision == AdvisoryBoardDecisions.DAORevoked @@ -70,17 +60,17 @@ public async Task OnPostAsync(int id) private async Task CreateOrUpdateDecision(int id, AdvisoryBoardDecision decision) { - ApiResponse savedDecision = await _advisoryBoardDecisionRepository.Get(id); + ApiResponse savedDecision = await advisoryBoardDecisionRepository.Get(id); if (savedDecision.StatusCode == HttpStatusCode.NotFound) { - await _advisoryBoardDecisionRepository.Create(decision); + await advisoryBoardDecisionRepository.Create(decision); } else { - await _advisoryBoardDecisionRepository.Update(decision); + await advisoryBoardDecisionRepository.Update(decision); } - await _academyConversionProjectRepository.UpdateProject(id, new UpdateAcademyConversionProject { ProjectStatus = decision.GetDecisionAsFriendlyName() }); + await academyConversionProjectRepository.UpdateProject(id, new UpdateAcademyConversionProject { ProjectStatus = decision.GetDecisionAsFriendlyName() }); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml index 9907ef7f7..1113e4d99 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml @@ -98,9 +98,10 @@ } - - - + @if(!Model.Project.IsReadOnly) + { + + }

Give a case for academisation

    diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalDiocesanConsent.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalDiocesanConsent.cshtml.cs index 8527e39ab..a69a7f6c2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalDiocesanConsent.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalDiocesanConsent.cshtml.cs @@ -6,13 +6,8 @@ namespace Dfe.PrepareConversions.Pages.TaskList.LegalRequirements; -public class LegalDiocesanConsentModel : LegalModelBase +public class LegalDiocesanConsentModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : LegalModelBase(academyConversionProjectRepository) { - public LegalDiocesanConsentModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : - base(academyConversionProjectRepository) - { - } - [BindProperty] public string Approved { get; set; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml.cs index 19aca2d95..39739c4e3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalGoverningBody.cshtml.cs @@ -6,13 +6,8 @@ namespace Dfe.PrepareConversions.Pages.TaskList.LegalRequirements; -public class LegalGoverningBodyModel : LegalModelBase +public class LegalGoverningBodyModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : LegalModelBase(academyConversionProjectRepository) { - public LegalGoverningBodyModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : - base(academyConversionProjectRepository) - { - } - [BindProperty] public string Approved { get; set; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs index 3fd6979a8..a4b6e8126 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs @@ -1,5 +1,3 @@ -using Dfe.PrepareConversions.Data; -using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.AcademyConversion; using Dfe.PrepareConversions.Data.Services; using Dfe.PrepareConversions.Models; @@ -11,18 +9,14 @@ namespace Dfe.PrepareConversions.Pages.TaskList.LegalRequirements; -public class LegalModelBase : PageModel +public class LegalModelBase(IAcademyConversionProjectRepository academyConversionProjectRepository) : PageModel { - protected readonly IAcademyConversionProjectRepository AcademyConversionProjectRepository; - - public LegalModelBase(IAcademyConversionProjectRepository _academyConversionProjectRepository) - { - AcademyConversionProjectRepository = _academyConversionProjectRepository; - } + protected readonly IAcademyConversionProjectRepository AcademyConversionProjectRepository = academyConversionProjectRepository; public int Id { get; private set; } public string SchoolName { get; private set; } public Data.Models.AcademyConversion.LegalRequirements Requirements { get; private set; } + public bool IsReadOnly { get; set; } public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) { @@ -30,7 +24,7 @@ public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingConte { Id = (int)context.HandlerArguments[nameof(Id)]; - ApiResponse projectResponse = await AcademyConversionProjectRepository.GetProjectById(Id); + var projectResponse = await AcademyConversionProjectRepository.GetProjectById(Id); if (projectResponse.Success) { SchoolName = projectResponse.Body.SchoolName; @@ -40,11 +34,11 @@ public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingConte context.Result = NotFound(); } - ApiResponse project = - await AcademyConversionProjectRepository.GetProjectById(Id); + var project = await AcademyConversionProjectRepository.GetProjectById(Id); if (project.Success) { Requirements = Data.Models.AcademyConversion.LegalRequirements.From(project.Body); + IsReadOnly = project.Body.IsReadOnly; } else { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml index 2932e8327..6fffbfa37 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml @@ -30,11 +30,14 @@ Empty } -
    - - Change management committee resolution - -
    + @if (!Model.IsReadOnly) + { +
    + + Change management committee resolution + +
    + }
@@ -50,11 +53,14 @@ Empty } -
- - Change consultation - -
+ @if (!Model.IsReadOnly) + { +
+ + Change consultation + +
+ }
@@ -70,11 +76,14 @@ Empty } -
- - Change diocesan consent - -
+ @if (!Model.IsReadOnly) + { +
+ + Change diocesan consent + +
+ }
@@ -90,29 +99,34 @@ Empty } -
- - Change foundation consent - -
+ @if (!Model.IsReadOnly) + { +
+ + Change foundation consent + +
+ }
- -
-
-
-
- - + @if (!Model.IsReadOnly) + { + +
+
+
+ + +
-
- - + + + }
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs index cc6e9da4b..cc37a0ed8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs @@ -6,13 +6,8 @@ namespace Dfe.PrepareConversions.Pages.TaskList.LegalRequirements; -public class LegalSummaryModel : LegalModelBase +public class LegalSummaryModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : LegalModelBase(academyConversionProjectRepository) { - public LegalSummaryModel(IAcademyConversionProjectRepository academyConversionProjectRepository) : - base(academyConversionProjectRepository) - { - } - [BindProperty] public bool IsComplete { get; set; } @@ -24,7 +19,7 @@ public void OnGet(int id) public async Task OnPostAsync(int id) { Requirements.IsComplete = IsComplete; - await AcademyConversionProjectRepository.UpdateProject(id, Requirements.CreateUpdateAcademyConversionProject()); + await academyConversionProjectRepository.UpdateProject(id, Requirements.CreateUpdateAcademyConversionProject()); return RedirectToPage(Links.TaskList.Index.Page, new { id }); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml index db74da5a3..007ef445f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml @@ -26,19 +26,22 @@
- - - - + + + +
-
- + @if(!Model.Project.IsReadOnly) + { + + - - + + + }
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml index 27d1138cf..03e913396 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml @@ -52,13 +52,13 @@
- - - - - - - + + + + + + +
@@ -73,7 +73,7 @@
- +
@@ -101,10 +101,10 @@
- - - - + + + +
@@ -121,9 +121,9 @@
@if (!Model.Project.IsSponsored) { - + } - +
@@ -137,7 +137,7 @@
- +
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml index c5e27284e..bfa7e059b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml @@ -20,18 +20,21 @@
- - - + + +
-
-
- + @if (!Model.Project.IsReadOnly) + { +
+ + - - -
+ + +
+ } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml.cs index 7eeaa75b9..347a04b62 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml.cs @@ -3,22 +3,12 @@ using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.Services; using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.ProjectDates; -public class ConfirmProjectDatesModel : BaseAcademyConversionProjectPageModel +public class ConfirmProjectDatesModel(IAcademyConversionProjectRepository repository) : BaseAcademyConversionProjectPageModel(repository) { - private readonly ErrorService _errorService; - - public ConfirmProjectDatesModel(IAcademyConversionProjectRepository repository, ErrorService errorService): base(repository) - { - _errorService = errorService; - } - [BindProperty(Name = "project-dates-complete", BinderType = typeof(CheckboxInputModelBinder))] public bool ProjectDatesSectionComplete { get; set; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml index d8ea75f01..a0af27f93 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml @@ -40,16 +40,19 @@
@if (@Model.Project.AcademyTypeAndRoute != AcademyTypeAndRoutes.Sponsored) { - + } - +
-
- + @if(!Model.Project.IsReadOnly) + { + + - - + + + } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml index 3f5537ab7..544a3a720 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml @@ -25,14 +25,17 @@
- +
-
- + @if(!Model.Project.IsReadOnly) + { + + - - + + + }
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml index d9934d2ce..07559e227 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml @@ -37,12 +37,15 @@
@await Component.InvokeAsync("SchoolAndTrustInformation") -
- + @if (!Model.Project.IsReadOnly) + { + + - - + + + }
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml index b4041ccd1..d7076d961 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml @@ -28,12 +28,12 @@
- - - - - - + + + + + +
@@ -42,14 +42,16 @@
- +
-
- - - - -
+ @if (!Model.Project.IsReadOnly) + { +
+ + + + } + \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml index b6da657e3..f90bd7142 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml @@ -40,14 +40,18 @@ } -
- @await Component.InvokeAsync("SchoolOverview") -
- + +
+ @await Component.InvokeAsync("SchoolOverview") + @if (!Model.Project.IsReadOnly) + { + + - - -
+ + + } +
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml index 097d1c21c..44fb1b1c8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml @@ -47,10 +47,13 @@
- +
-
- -
+ @if (!Model.Project.IsReadOnly) + { +
+ +
+ }
\ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs index 40dc02a4f..0401f5940 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/UpdateAcademyConversionProjectPageModel.cs @@ -10,20 +10,12 @@ namespace Dfe.PrepareConversions.Pages; -public class UpdateAcademyConversionProjectPageModel : BaseAcademyConversionProjectPageModel +public class UpdateAcademyConversionProjectPageModel(IAcademyConversionProjectRepository repository, ErrorService errorService) : BaseAcademyConversionProjectPageModel(repository) { - private readonly ErrorService _errorService; - - public UpdateAcademyConversionProjectPageModel(IAcademyConversionProjectRepository repository, ErrorService errorService) : base(repository) - { - _errorService = errorService; - } - - [BindProperty] public AcademyConversionProjectPostModel AcademyConversionProject { get; set; } - public bool ShowError => _errorService.HasErrors(); + public bool ShowError => errorService.HasErrors(); public string SuccessPage { @@ -42,7 +34,7 @@ public override async Task OnPostAsync(int id) AcademyConversionProject.LocalAuthorityInformationTemplateReturnedDate.HasValue && AcademyConversionProject.LocalAuthorityInformationTemplateSentDate > AcademyConversionProject.LocalAuthorityInformationTemplateReturnedDate) { - _errorService.AddError("returnedDateBeforeSentDateError", "The returned template date be must on or after sent date"); + errorService.AddError("returnedDateBeforeSentDateError", "The returned template date be must on or after sent date"); } if (AcademyConversionProject.EndOfCurrentFinancialYear.HasValue && @@ -51,13 +43,13 @@ public override async Task OnPostAsync(int id) AcademyConversionProject.EndOfNextFinancialYear != DateTime.MinValue && AcademyConversionProject.EndOfCurrentFinancialYear.Value.AddYears(1).AddDays(-1) > AcademyConversionProject.EndOfNextFinancialYear) { - _errorService.AddError( + errorService.AddError( $"/task-list/{id}/confirm-school-budget-information/update-school-budget-information?return=%2FTaskList%2FSchoolBudgetInformation/ConfirmSchoolBudgetInformation&fragment=financial-year", "The next financial year cannot be before or within a year of the current financial year"); } - _errorService.AddErrors(Request.Form.Keys, ModelState); - if (_errorService.HasErrors()) + errorService.AddErrors(Request.Form.Keys, ModelState); + if (errorService.HasErrors()) { RePopDatePickerModelsAfterValidationFail(); return Page(); @@ -67,7 +59,7 @@ public override async Task OnPostAsync(int id) if (!response.Success) { - _errorService.AddApiError(); + errorService.AddApiError(); return Page(); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/SummaryListRowTagHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/SummaryListRowTagHelper.cs index b80986dd5..91b127768 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/SummaryListRowTagHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/SummaryListRowTagHelper.cs @@ -9,10 +9,8 @@ namespace Dfe.PrepareConversions.TagHelpers; [HtmlTargetElement("govuk-summary-list-row", TagStructure = TagStructure.WithoutEndTag)] -public class SummaryListRowTagHelper : InputTagHelperBase +public class SummaryListRowTagHelper(IHtmlHelper htmlHelper) : InputTagHelperBase(htmlHelper) { - public SummaryListRowTagHelper(IHtmlHelper htmlHelper) : base(htmlHelper) { } - [HtmlAttributeName("value")] public string Value { get; set; } @@ -43,6 +41,9 @@ public SummaryListRowTagHelper(IHtmlHelper htmlHelper) : base(htmlHelper) { } [HtmlAttributeName("highlight-negative-value")] public bool HighlightNegativeValue { get; set; } + [HtmlAttributeName("asp-read-only")] + public bool IsReadOnly { get; set; } + protected override async Task RenderContentAsync() { string value1 = For == null ? Value : For.Model?.ToString(); @@ -62,7 +63,8 @@ protected override async Task RenderContentAsync() KeyWidth = KeyWidth, ValueWidth = ValueWidth, Name = Name, - HighlightNegativeValue = HighlightNegativeValue + HighlightNegativeValue = HighlightNegativeValue, + IsReadOnly = IsReadOnly }; return await _htmlHelper.PartialAsync("_SummaryListRow", model); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs index c9013816a..bb0344c13 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolAndTrustInformationViewComponent.cs @@ -60,7 +60,8 @@ public async Task InvokeAsync() ConversionSupportGrantType = project.ConversionSupportGrantType, ConversionSupportGrantEnvironmentalImprovementGrant = project.ConversionSupportGrantEnvironmentalImprovementGrant, ConversionSupportNumberOfSites = project?.ConversionSupportGrantNumberOfSites, - DaoPackSentDate = project.DaoPackSentDate.ToDateString() + DaoPackSentDate = project.DaoPackSentDate.ToDateString(), + IsReadOnly = project.IsReadOnly }; return View(viewModel); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs index 44e64e210..654831119 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/SchoolOverviewViewComponent.cs @@ -11,29 +11,20 @@ namespace Dfe.PrepareConversions.ViewComponents; -public class SchoolOverviewViewComponent : ViewComponent +public class SchoolOverviewViewComponent(SchoolOverviewService schoolOverviewService, IAcademyConversionProjectRepository repository) : ViewComponent { - private readonly SchoolOverviewService _schoolOverviewService; - private readonly IAcademyConversionProjectRepository _repository; - - public SchoolOverviewViewComponent(SchoolOverviewService schoolOverviewService, IAcademyConversionProjectRepository repository) - { - _schoolOverviewService = schoolOverviewService; - _repository = repository; - } - public async Task InvokeAsync() { int id = int.Parse(ViewContext.RouteData.Values["id"]?.ToString() ?? string.Empty); - ApiResponse response = await _repository.GetProjectById(id); + ApiResponse response = await repository.GetProjectById(id); if (!response.Success) { throw new InvalidOperationException(); } AcademyConversionProject project = response.Body; - SchoolOverview schoolOverview = await _schoolOverviewService.GetSchoolOverviewByUrn(project.Urn.ToString()); + SchoolOverview schoolOverview = await schoolOverviewService.GetSchoolOverviewByUrn(project.Urn.ToString()); SchoolOverviewViewModel viewModel = new() { @@ -68,6 +59,7 @@ public async Task InvokeAsync() NumberOfMedicalPlaces = project.NumberOfMedicalPlaces, NumberOfSENUnitPlaces = project.NumberOfSENUnitPlaces, NumberOfPost16Places = project.NumberOfPost16Places, + IsReadOnly = project.IsReadOnly }; return View(viewModel); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs index b92338262..5c42c7a98 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs @@ -130,6 +130,7 @@ public ProjectViewModel(AcademyConversionProject project) ProposedConversionDate = project.ProposedConversionDate; ProjectDatesSectionComplete = project.ProjectDatesSectionComplete; + IsReadOnly = project.IsReadOnly; } public string Id { get; } @@ -267,5 +268,6 @@ public ProjectViewModel(AcademyConversionProject project) public override bool IsExternalSchoolApplication => string.IsNullOrEmpty(this.ApplicationReferenceNumber); public bool HasPermission { get; set; } + public bool IsReadOnly { get; set; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs index 293a966ae..c83ec7c51 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs @@ -2,16 +2,10 @@ namespace Dfe.PrepareConversions.ViewModels; -public class RecordDecisionPreviewViewModel +public class RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute) { - public RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute) - { - Id = id; - Decision = decision; - AcademyTypeAndRoute = academyTypeAndRoute; - } - - public int Id { get; set; } - public string AcademyTypeAndRoute { get; set; } - public AdvisoryBoardDecision Decision { get; set; } + public int Id { get; set; } = id; + public string AcademyTypeAndRoute { get; set; } = academyTypeAndRoute; + public AdvisoryBoardDecision Decision { get; set; } = decision; + public bool IsReadOnly { get; set; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs index f868653e3..9bac22824 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolAndTrustInformationViewModel.cs @@ -34,4 +34,5 @@ public class SchoolAndTrustInformationViewModel public bool WasForm7Received { get; set; } public bool IsPreview { get; set; } + public bool IsReadOnly { get; set; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolOverviewViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolOverviewViewModel.cs index 6383794b3..dbb20bb35 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolOverviewViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SchoolOverviewViewModel.cs @@ -32,4 +32,5 @@ public class SchoolOverviewViewModel public int? NumberOfMedicalPlaces { get; set; } public int? NumberOfPost16Places { get; set; } public int? NumberOfSENUnitPlaces { get; set; } + public bool IsReadOnly { get; set; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SummaryListRowViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SummaryListRowViewModel.cs index 1de2bafb0..c7c231494 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SummaryListRowViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/SummaryListRowViewModel.cs @@ -21,6 +21,7 @@ public class SummaryListRowViewModel public string ValueWidth { get; set; } public string Name { get; set; } public bool HighlightNegativeValue { get; set; } + public bool IsReadOnly { get; set; } public string NegativeStyleClass { diff --git a/Dfe.PrepareConversions/Dfe.PrepareTransfers.Data/Models/Project.cs b/Dfe.PrepareConversions/Dfe.PrepareTransfers.Data/Models/Project.cs index f084a442f..b6c7b6346 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareTransfers.Data/Models/Project.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareTransfers.Data/Models/Project.cs @@ -3,40 +3,40 @@ namespace Dfe.PrepareTransfers.Data.Models { - public class Project - { - public Project() - { - TransferringAcademies = new List(); - Features = new TransferFeatures(); - Dates = new TransferDates(); - Benefits = new TransferBenefits(); - LegalRequirements = new TransferLegalRequirements(); - Rationale = new TransferRationale(); - AcademyAndTrustInformation = new TransferAcademyAndTrustInformation(); - } + public class Project + { + public Project() + { + TransferringAcademies = new List(); + Features = new TransferFeatures(); + Dates = new TransferDates(); + Benefits = new TransferBenefits(); + LegalRequirements = new TransferLegalRequirements(); + Rationale = new TransferRationale(); + AcademyAndTrustInformation = new TransferAcademyAndTrustInformation(); + } - public int Id { get; set; } - public string Urn { get; set; } - public string Reference { get; set; } - public string OutgoingTrustUkprn { get; set; } - public string OutgoingTrustName { get; set; } - public string State { get; set; } - public string Status { get; set; } - public List TransferringAcademies { get; set; } - public TransferFeatures Features { get; set; } - public TransferDates Dates { get; set; } - public TransferBenefits Benefits { get; set; } - public TransferLegalRequirements LegalRequirements { get; set; } - public TransferRationale Rationale { get; set; } - public TransferAcademyAndTrustInformation AcademyAndTrustInformation { get; set; } - public string GeneralInformationAdditionalInformation { get; set; } + public int Id { get; set; } + public string Urn { get; set; } + public string Reference { get; set; } + public string OutgoingTrustUkprn { get; set; } + public string OutgoingTrustName { get; set; } + public string State { get; set; } + public string Status { get; set; } + public List TransferringAcademies { get; set; } + public TransferFeatures Features { get; set; } + public TransferDates Dates { get; set; } + public TransferBenefits Benefits { get; set; } + public TransferLegalRequirements LegalRequirements { get; set; } + public TransferRationale Rationale { get; set; } + public TransferAcademyAndTrustInformation AcademyAndTrustInformation { get; set; } + public string GeneralInformationAdditionalInformation { get; set; } - public string OutgoingAcademyName => TransferringAcademies[0].OutgoingAcademyName; - public string OutgoingAcademyUrn => TransferringAcademies[0].OutgoingAcademyUrn; - public string IncomingTrustUkprn => TransferringAcademies[0].IncomingTrustUkprn; - public string IncomingTrustName => TransferringAcademies[0].IncomingTrustNameInTitleCase; - public PrepareConversions.Data.Models.User AssignedUser { get; set; } - public bool? IsFormAMat { get; set; } - } + public string OutgoingAcademyName => TransferringAcademies[0].OutgoingAcademyName; + public string OutgoingAcademyUrn => TransferringAcademies[0].OutgoingAcademyUrn; + public string IncomingTrustUkprn => TransferringAcademies[0].IncomingTrustUkprn; + public string IncomingTrustName => TransferringAcademies[0].IncomingTrustNameInTitleCase; + public PrepareConversions.Data.Models.User AssignedUser { get; set; } + public bool? IsFormAMat { get; set; } + } } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareTransfers.Web.Tests/TestFixtures/GetInformationForProject.cs b/Dfe.PrepareConversions/Dfe.PrepareTransfers.Web.Tests/TestFixtures/GetInformationForProject.cs index 6bfce1e92..42fa866da 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareTransfers.Web.Tests/TestFixtures/GetInformationForProject.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareTransfers.Web.Tests/TestFixtures/GetInformationForProject.cs @@ -53,8 +53,8 @@ public static GetInformationForProjectResponse GetTestInformationForProject(stri OutgoingTrustConsent = ThreeOptions.NotApplicable, }, - TransferringAcademies = new List - { + TransferringAcademies = + [ new TransferringAcademy { IncomingTrustName = "incoming trust name", @@ -64,7 +64,7 @@ public static GetInformationForProjectResponse GetTestInformationForProject(stri KeyStage5PerformanceAdditionalInformation = "ks5 additional info", LatestOfstedReportAdditionalInformation = "ofsted additional info" } - } + ] }; var foundAcademy = new Academy From 17e65ba6eb018a9879595f6cdd9756a0a7688be3 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Mon, 7 Oct 2024 14:08:49 +0100 Subject: [PATCH 05/19] Fixed decision section --- .../RecordDecisionPreview/default.cshtml | 4 ++-- .../RecordDecisionPreviewViewComponent.cs | 17 +++++------------ .../RecordDecisionPreviewViewModel.cs | 4 ++-- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index d3b1bdef2..99aa60da2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -205,7 +205,7 @@ }
- @if (Model.IsReadOnly) + @if (!Model.IsReadOnly) { Change Date academy order (AO) sent @@ -216,7 +216,7 @@ } - @if (Model.IsReadOnly) + @if (!Model.IsReadOnly) {

You can click the button to change the recorded decision. diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs index 5d8615d09..c28aa8d3b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs @@ -8,23 +8,16 @@ namespace Dfe.PrepareConversions.ViewComponents; -public class RecordDecisionPreviewViewComponent : ViewComponent +public class RecordDecisionPreviewViewComponent(IAcademyConversionAdvisoryBoardDecisionRepository decisionRepository, ISession session) : ViewComponent { public const string DECISION_SESSION_KEY = "Decision"; - protected readonly ISession _session; - private readonly IAcademyConversionAdvisoryBoardDecisionRepository _decisionRepository; + protected readonly ISession _session = session; - public RecordDecisionPreviewViewComponent(IAcademyConversionAdvisoryBoardDecisionRepository decisionRepository, ISession session) + public async Task InvokeAsync(int id, string AcademyTypeAndRoute, bool isReadOnly) { - _decisionRepository = decisionRepository; - _session = session; - } - - public async Task InvokeAsync(int id, string AcademyTypeAndRoute) - { - AdvisoryBoardDecision decision = (await _decisionRepository.Get(id)).Body; + var decision = (await decisionRepository.Get(id)).Body; SetDecisionInSession(id, decision); - RecordDecisionPreviewViewModel viewModel = new(id, decision, AcademyTypeAndRoute); + RecordDecisionPreviewViewModel viewModel = new(id, decision, AcademyTypeAndRoute, isReadOnly); return View(viewModel); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs index c83ec7c51..f6463b58f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs @@ -2,10 +2,10 @@ namespace Dfe.PrepareConversions.ViewModels; -public class RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute) +public class RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute, bool isReadOnly) { public int Id { get; set; } = id; public string AcademyTypeAndRoute { get; set; } = academyTypeAndRoute; public AdvisoryBoardDecision Decision { get; set; } = decision; - public bool IsReadOnly { get; set; } + public bool IsReadOnly { get; set; } = isReadOnly; } From a6abb8a0508033dbde8a7712f358421356e2147f Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Tue, 8 Oct 2024 13:57:32 +0100 Subject: [PATCH 06/19] added tests and notification message --- .../Pages/BaseIntegrationTests.MockData.cs | 43 ++++++++------- .../Pages/BaseIntegrationTests.cs | 6 ++ .../ProjectListIntegrationTests.cs | 38 ++++++++----- ...nformationTemplateDatesIntegrationTests.cs | 28 ++++++++-- ...rojectAndTrustRationaleIntegrationTests.cs | 32 ++++++++--- .../ConfirmRisksAndIssuesIntegrationTests.cs | 30 +++++++--- .../RisksAndIssuesIntegrationTests.cs | 4 +- .../AcademyTypeAndRouteIntegrationTests.cs | 8 +-- ...hoolAndTrustInformationIntegrationTests.cs | 55 ++++++++++++++----- .../AdditionalInformationIntegrationTests.cs | 13 ++--- ...SchoolBudgetInformationIntegrationTests.cs | 26 ++++++++- .../ConfirmSchoolOverviewIntegrationTests.cs | 29 ++++++++-- ...irmSchoolPupilForecastsIntegrationTests.cs | 17 ++++++ .../SchoolAndTrustInformation/default.cshtml | 24 ++++---- .../Pages/Shared/_ProjectHeader.cshtml | 35 ++++++++++-- .../Pages/TaskList/Index.cshtml | 28 +++++----- .../EducationalAttendance.cshtml | 21 +++++++ .../KeyStage2PerformanceTables.cshtml | 21 +++++++ .../KeyStage4PerformanceTables.cshtml | 21 +++++++ .../KeyStage5PerformanceTables.cshtml | 21 +++++++ .../LegalRequirements/LegalSummary.cshtml | 26 ++++++++- .../LegalRequirements/LegalSummary.cshtml.cs | 2 +- ...alAuthorityInformationTemplateDates.cshtml | 21 +++++++ .../TaskList/PreviewProjectTemplate.cshtml | 25 +++++---- .../ProjectDates/ConfirmProjectDates.cshtml | 21 +++++++ .../ConfirmProjectAndTrustRationale.cshtml | 21 +++++++ .../ConfirmRisksAndIssues.cshtml | 21 +++++++ .../ConversionDetails.cshtml | 21 +++++++ .../SchoolBudgetInformation/Budget.cshtml | 23 +++++++- .../SchoolOverview/SchoolOverview.cshtml | 21 +++++++ .../ConfirmSchoolPerformance.cshtml | 21 +++++++ .../PupilForecasts.cshtml | 21 +++++++ .../TagHelpers/BackLinkTagHelper.cs | 4 +- 33 files changed, 608 insertions(+), 140 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs index 094d3794a..cbeeb8cb3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs @@ -19,15 +19,17 @@ namespace Dfe.PrepareConversions.Tests.Pages; public abstract partial class BaseIntegrationTests { - private readonly string[] _routes = { AcademyTypeAndRoutes.Voluntary, AcademyTypeAndRoutes.Sponsored }; + private readonly string[] _routes = [AcademyTypeAndRoutes.Voluntary, AcademyTypeAndRoutes.Sponsored]; protected IEnumerable AddGetProjects(Action postSetup = null, int? recordCount = null, - AcademyConversionSearchModelV2 searchModel = null) + AcademyConversionSearchModelV2 searchModel = null, + bool isReadOnly = false) { - List projects = _fixture + var projects = _fixture .Build() .With(x => x.AcademyTypeAndRoute, _routes[Random.Shared.Next(0, _routes.Length)]) + .With(x => x.IsReadOnly, isReadOnly) .CreateMany() .Select(x => { @@ -47,11 +49,11 @@ protected IEnumerable AddGetProjects(Action(), - DeliveryOfficerQueryString = Array.Empty(), - RegionQueryString = Array.Empty(), - LocalAuthoritiesQueryString = Array.Empty(), - AdvisoryBoardDatesQueryString = Array.Empty() + StatusQueryString = [], + DeliveryOfficerQueryString = [], + RegionQueryString = [], + LocalAuthoritiesQueryString = [], + AdvisoryBoardDatesQueryString = [] }; _factory.AddPostWithJsonRequest(PathFor.GetAllProjectsV2, searchModel, response); @@ -62,8 +64,8 @@ protected ProjectFilterParameters AddGetStatuses() { ProjectFilterParameters filterParameters = new() { - Statuses = new List { "Accepted", "Accepted with Conditions", "Deferred", "Declined" }, - AssignedUsers = new List { "Bob" } + Statuses = ["Accepted", "Accepted with Conditions", "Deferred", "Declined"], + AssignedUsers = ["Bob"] }; @@ -72,11 +74,12 @@ protected ProjectFilterParameters AddGetStatuses() return filterParameters; } - public AcademyConversionProject AddGetProject(Action postSetup = null) + public AcademyConversionProject AddGetProject(Action postSetup = null, bool isReadOnly = false) { - AcademyConversionProject project = _fixture + var project = _fixture .Build() .With(x => x.AcademyTypeAndRoute, AcademyTypeAndRoutes.Voluntary) + .With(x => x.IsReadOnly, isReadOnly) .Create(); postSetup?.Invoke(project); @@ -88,7 +91,7 @@ public AcademyConversionProject AddGetProject(Action p public KeyStagePerformanceResponse AddGetKeyStagePerformance(int urn, Action postSetup = null) { - KeyStagePerformanceResponse keyStagePerformance = _fixture.Create(); + var keyStagePerformance = _fixture.Create(); postSetup?.Invoke(keyStagePerformance); _factory.AddGetWithJsonResponse($"/educationPerformance/{urn}", keyStagePerformance); @@ -97,7 +100,7 @@ public KeyStagePerformanceResponse AddGetKeyStagePerformance(int urn, Action AddGetProjectNotes(int academyConversionProjectId, Action> postSetup = null) { - IEnumerable projectNotes = _fixture.CreateMany().ToList(); + var projectNotes = _fixture.CreateMany().ToList(); postSetup?.Invoke(projectNotes); _factory.AddGetWithJsonResponse($"/project-notes/{academyConversionProjectId}", projectNotes); @@ -109,7 +112,7 @@ public UpdateAcademyConversionProject AddPatchProject(AcademyConversi Expression> propertyThatWillChange, TProperty expectedNewValue) { - UpdateAcademyConversionProject request = _fixture + var request = _fixture .Build() .OmitAutoProperties() .With(propertyThatWillChange, expectedNewValue) @@ -133,7 +136,7 @@ public void GetRoleCapabilities(List roles) public UpdateAcademyConversionProject AddPatchConfiguredProject(AcademyConversionProject project, Action configure = null) { - UpdateAcademyConversionProject request = _fixture + var request = _fixture .Build() .OmitAutoProperties() .Create(); @@ -163,7 +166,7 @@ public ProjectNote AddPostProjectNote(int id, AddProjectNote request) public SetPerformanceDataModel AddPutPerformanceData(AcademyConversionProject project) { - SetPerformanceDataModel request = _fixture + var request = _fixture .Build() .OmitAutoProperties() .With(x => x.Id, project.Id) @@ -214,11 +217,11 @@ public UpdateAcademyConversionProject AddPatchProjectMany(AcademyConversionProje Func, IPostprocessComposer> postProcess) { - IPostprocessComposer composer = _fixture + var composer = _fixture .Build() .OmitAutoProperties(); - UpdateAcademyConversionProject request = postProcess(composer) + var request = postProcess(composer) .Create(); _factory.AddPatchWithJsonRequest(string.Format(PathFor.UpdateProject, project.Id), request, project); @@ -258,7 +261,7 @@ public AcademisationApplication AddGetApplication(Action(a => a.With(s => s.Schools, () => new List { _fixture.Create() })); - AcademisationApplication application = _fixture.Create(); + var application = _fixture.Create(); postSetup?.Invoke(application); _factory.AddGetWithJsonResponse(string.Format(_pathFor.GetApplicationByReference, application.ApplicationReference), application); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.cs index dcf93bd66..43e2aefcc 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.cs @@ -61,6 +61,12 @@ protected async Task OpenAndConfirmPathAsync(string path, string expe return resultDocument; } + protected void VerifyElementDoesNotExist(string dataTest) + { + var anchors = Document.QuerySelectorAll($"[data-test='{dataTest}']").FirstOrDefault(); + Assert.Null(anchors); + } + protected void VerifyNullElement(string linkText) { var anchors = Document.QuerySelectorAll("a"); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListIntegrationTests.cs index 6f7558f73..d091820a6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListIntegrationTests.cs @@ -2,7 +2,6 @@ using AngleSharp.Html.Dom; using Dfe.Academisation.ExtensionMethods; using Dfe.PrepareConversions.Data.Models; -using Dfe.PrepareConversions.Extensions; using Dfe.PrepareConversions.Tests.Extensions; using FluentAssertions; using System.Collections.Generic; @@ -12,20 +11,16 @@ namespace Dfe.PrepareConversions.Tests.Pages.ProjectList; -public class ProjectListIntegrationTests : BaseIntegrationTests +public class ProjectListIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public ProjectListIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) - { - } - [Fact] public async Task Should_display_list_of_projects_and_navigate_to_and_from_task_list() { - List projects = AddGetProjects(x => x.AcademyTypeAndRoute = "Converter").ToList(); + var projects = AddGetProjects(x => x.AcademyTypeAndRoute = "Converter").ToList(); AddGetStatuses(); await OpenAndConfirmPathAsync("/project-list"); - AcademyConversionProject firstProject = AddGetProject(p => p.Id = projects.First().Id); + var firstProject = AddGetProject(p => p.Id = projects.First().Id); await NavigateAsync(projects.First().SchoolName); Document.Url.Should().BeUrl($"/task-list/{firstProject.Id}?returnToFormAMatMenu=False"); @@ -35,7 +30,7 @@ public async Task Should_display_list_of_projects_and_navigate_to_and_from_task_ for (int i = 0; i < 2; i++) { - AcademyConversionProject project = projects.ElementAt(i); + var project = projects.ElementAt(i); Document.QuerySelector($"#school-name-{i}")?.TextContent.Should().Contain(project.SchoolName); Document.QuerySelector($"#urn-{i}")?.TextContent.Should().Contain(project.Urn.ToString()); @@ -54,7 +49,7 @@ public async Task Should_display_list_of_projects_and_navigate_to_and_from_task_ public async Task Should_display_approved_after_recording_decision() { AddGetStatuses(); - IEnumerable projects = AddGetProjects(p => p.ProjectStatus = "Approved"); + var projects = AddGetProjects(p => p.ProjectStatus = "Approved"); await OpenAndConfirmPathAsync("/project-list"); @@ -66,7 +61,7 @@ public async Task Should_display_approved_after_recording_decision() public async Task Should_display_pre_advisory_board_by_default() { AddGetStatuses(); - List projects = AddGetProjects().ToList(); + var projects = AddGetProjects().ToList(); await OpenAndConfirmPathAsync("/project-list"); @@ -78,15 +73,32 @@ public async Task Should_display_pre_advisory_board_by_default() public async Task Should_display_application_received_date_when_no_htb_date_set() { AddGetStatuses(); - IEnumerable projects = AddGetProjects(p => p.HeadTeacherBoardDate = null); + var projects = AddGetProjects(p => p.HeadTeacherBoardDate = null); await OpenAndConfirmPathAsync("/project-list"); - AcademyConversionProject project = projects.First(); + var project = projects.First(); Document.QuerySelector("#application-to-join-trust-0")?.TextContent.Should().Contain(project.NameOfTrust); Document.QuerySelector("#local-authority-0")?.TextContent.Should().Contain(project.LocalAuthority); Document.QuerySelector("#application-received-date-0")?.TextContent.Should().Contain(project.CreatedOn.ToDateString()); ResetServer(); } + + [Fact] + public async Task Should_not_have_create_project_document_buttons_if_project_read_only() + { + AddGetStatuses(); + var projects = AddGetProjects(p => p.ProjectStatus = "Approved", isReadOnly: true); + + await OpenAndConfirmPathAsync("/project-list"); + + var project = projects.First(); + + await NavigateAsync(project.SchoolName); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}?returnToFormAMatMenu=False"); + Document.QuerySelector("#preview-project-template-button").Should().BeNull(); + Document.QuerySelector("#generate-project-template-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDatesIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDatesIntegrationTests.cs index e151b58a9..b19d627ae 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDatesIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDatesIntegrationTests.cs @@ -21,7 +21,7 @@ public ConfirmLocalAuthorityInformationTemplateDatesIntegrationTests(Integration [Fact] public async Task Should_be_in_progress_and_display_la_info_template_when_populated() { - AcademyConversionProject project = AddGetProject(p => p.LocalAuthorityInformationTemplateSectionComplete = false); + var project = AddGetProject(p => p.LocalAuthorityInformationTemplateSectionComplete = false); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); @@ -41,7 +41,7 @@ public async Task Should_be_in_progress_and_display_la_info_template_when_popula [Fact] public async Task Should_be_completed_and_checked_when_la_info_template_section_complete() { - AcademyConversionProject project = AddGetProject(project => project.LocalAuthorityInformationTemplateSectionComplete = true); + var project = AddGetProject(project => project.LocalAuthorityInformationTemplateSectionComplete = true); AddPatchConfiguredProject(project, x => { x.LocalAuthorityInformationTemplateSectionComplete = true; @@ -65,7 +65,7 @@ public async Task Should_be_completed_and_checked_when_la_info_template_section_ [Fact] public async Task Should_show_error_summary_when_there_is_an_API_error() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddPatchError(project.Id); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-local-authority-information-template-dates"); @@ -78,7 +78,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_between_task_list_and_confirm_la_info_template_when_navigated_from_task_list() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("LA information template sent date", 0); @@ -89,4 +89,24 @@ public async Task Should_navigate_between_task_list_and_confirm_la_info_template Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + [Theory] + [InlineData("change-la-info-template-sent-date", + "change-la-info-template-returned-date", + "change-la-info-template-comments", + "change-la-info-template-sharepoint-link")] + public async Task Should_not_have_change_link_if_project_read_only(params string[] elements) + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("LA information template sent date", 0); + + Document.Url.Should().Contain($"/task-list/{project.Id}/confirm-local-authority-information-template-dates"); + foreach (var element in elements) + { + VerifyElementDoesNotExist(element); + } + Document.QuerySelector("#la-info-template-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationaleIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationaleIntegrationTests.cs index 4a49da3f4..508f6528f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationaleIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationaleIntegrationTests.cs @@ -8,14 +8,12 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.Rationale; -public class ConfirmProjectAndTrustRationaleIntegrationTests : BaseIntegrationTests +public class ConfirmProjectAndTrustRationaleIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public ConfirmProjectAndTrustRationaleIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_remove_rationale_for_project_if_sponsored() { - AcademyConversionProject project = AddGetProject(p => p.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored); + var project = AddGetProject(p => p.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Rationale"); @@ -26,7 +24,7 @@ public async Task Should_remove_rationale_for_project_if_sponsored() [Fact] public async Task Should_be_in_progress_and_display_rationale_when_rationale_populated() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.RationaleSectionComplete = false; project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary; @@ -47,7 +45,7 @@ public async Task Should_be_in_progress_and_display_rationale_when_rationale_pop [Fact] public async Task Should_be_completed_and_checked_when_rationale_mark_as_complete_true() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.RationaleSectionComplete = true; }); @@ -73,7 +71,7 @@ public async Task Should_be_completed_and_checked_when_rationale_mark_as_complet [Fact] public async Task Should_be_not_started_and_display_empty_when_rationale_not_prepopulated() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.RationaleForProject = null; project.RationaleForTrust = null; @@ -106,7 +104,7 @@ public async Task Should_be_not_started_and_display_empty_when_rationale_not_pre [Fact] public async Task Should_show_error_summary_when_there_is_an_API_error() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddPatchError(project.Id); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-project-trust-rationale"); @@ -119,7 +117,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_between_task_list_and_rationale_summary() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Rationale"); @@ -130,4 +128,20 @@ public async Task Should_navigate_between_task_list_and_rationale_summary() Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + + [Fact] + public async Task Should_not_have_change_link_if_project_read_only() + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("Rationale"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/confirm-project-trust-rationale"); + + VerifyElementDoesNotExist("change-rationale-for-trust"); + + Document.QuerySelector("#rationale-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssuesIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssuesIntegrationTests.cs index cd5551283..7b583f05e 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssuesIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssuesIntegrationTests.cs @@ -8,14 +8,12 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.RisksAndIssues; -public class ConfirmRisksAndIssuesIntegrationTests : BaseIntegrationTests +public class ConfirmRisksAndIssuesIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public ConfirmRisksAndIssuesIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_be_in_progress_and_display_risks_and_issues() { - AcademyConversionProject project = AddGetProject(p => p.RisksAndIssuesSectionComplete = false); + var project = AddGetProject(p => p.RisksAndIssuesSectionComplete = false); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); @@ -30,7 +28,7 @@ public async Task Should_be_in_progress_and_display_risks_and_issues() [Fact] public async Task Should_be_completed_and_checked_when_risks_and_issues_mark_as_complete_true() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.RisksAndIssuesSectionComplete = true; }); @@ -56,7 +54,7 @@ public async Task Should_be_completed_and_checked_when_risks_and_issues_mark_as_ [Fact] public async Task Should_be_not_started_and_display_empty_when_risks_and_issues_not_prepopulated() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.RisksAndIssues = null; project.RisksAndIssuesSectionComplete = false; @@ -85,7 +83,7 @@ public async Task Should_be_not_started_and_display_empty_when_risks_and_issues_ [Fact] public async Task Should_show_error_summary_when_there_is_an_API_error() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddPatchError(project.Id); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-risks-issues"); @@ -98,7 +96,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_between_task_list_and_confirm_risks_and_issues() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Risks and issues"); @@ -109,4 +107,20 @@ public async Task Should_navigate_between_task_list_and_confirm_risks_and_issues Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + + [Fact] + public async Task Should_not_have_change_link_if_project_read_only() + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("Risks and issues"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/confirm-risks-issues"); + + VerifyElementDoesNotExist("change-risks-and-issues"); + + Document.QuerySelector("#risks-and-issues-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/RisksAndIssuesIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/RisksAndIssuesIntegrationTests.cs index 776b4acb0..62f8c80ad 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/RisksAndIssuesIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/RisksAndIssues/RisksAndIssuesIntegrationTests.cs @@ -9,10 +9,8 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.RisksAndIssues; -public class RisksAndIssuesIntegrationTests : BaseIntegrationTests +public class RisksAndIssuesIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public RisksAndIssuesIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_navigate_to_and_update_risks_and_issues() { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/AcademyTypeAndRouteIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/AcademyTypeAndRouteIntegrationTests.cs index e311965c1..1ee261721 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/AcademyTypeAndRouteIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/AcademyTypeAndRouteIntegrationTests.cs @@ -10,15 +10,13 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.SchoolAndTrustInformation; -public class AcademyTypeAndRouteIntegrationTests : BaseIntegrationTests +public class AcademyTypeAndRouteIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public AcademyTypeAndRouteIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_navigate_to_and_update_conversion_support_grant_amount() { - AcademyConversionProject project = AddGetProject(x => x.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary); - UpdateAcademyConversionProject request = AddPatchProjectMany(project, composer => + var project = AddGetProject(x => x.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary); + var request = AddPatchProjectMany(project, composer => composer .With(r => r.ConversionSupportGrantAmount) .With(r => r.ConversionSupportGrantChangeReason) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/ConfirmSchoolAndTrustInformationIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/ConfirmSchoolAndTrustInformationIntegrationTests.cs index 2fab6750e..5bed4060d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/ConfirmSchoolAndTrustInformationIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolAndTrustInformation/ConfirmSchoolAndTrustInformationIntegrationTests.cs @@ -11,14 +11,12 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.SchoolAndTrustInformation; -public class ConfirmSchoolAndTrustInformationIntegrationTests : BaseIntegrationTests +public class ConfirmSchoolAndTrustInformationIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public ConfirmSchoolAndTrustInformationIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_be_in_progress_and_display_school_and_trust_information() { - AcademyConversionProject project = AddGetProject(p => + var project = AddGetProject(p => { p.SchoolAndTrustInformationSectionComplete = false; p.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary; @@ -49,7 +47,7 @@ public async Task Should_be_in_progress_and_display_school_and_trust_information [Fact] public async Task Should_display_an_error_when_school_and_trust_information_is_marked_as_complete_without_advisory_board_date_set() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.SchoolAndTrustInformationSectionComplete = false; project.HeadTeacherBoardDate = null; @@ -72,7 +70,7 @@ public async Task Should_display_an_error_when_school_and_trust_information_is_m [Fact] public async Task Should_be_completed_and_checked_when_school_and_trust_information_complete() { - AcademyConversionProject project = AddGetProject(project => project.SchoolAndTrustInformationSectionComplete = true); + var project = AddGetProject(project => project.SchoolAndTrustInformationSectionComplete = true); AddPatchConfiguredProject(project, x => { x.SchoolAndTrustInformationSectionComplete = true; @@ -95,7 +93,7 @@ public async Task Should_be_completed_and_checked_when_school_and_trust_informat [Fact] public async Task Should_be_not_started_and_display_empty_when_school_and_trust_information_not_prepopulated() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Voluntary; project.RecommendationForProject = null; @@ -146,7 +144,7 @@ public async Task Should_be_not_started_and_display_empty_when_school_and_trust_ [Fact] public async Task Should_show_error_summary_when_there_is_an_API_error() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddPatchError(project.Id); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/conversion-details"); @@ -159,7 +157,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_show_error_summary_when_grant_amount_less_than_full_amount_and_no_reason_entered() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.ConversionSupportGrantAmount = 2000m; project.ConversionSupportGrantChangeReason = null; @@ -185,7 +183,7 @@ public async Task Should_show_error_summary_when_grant_amount_less_than_full_amo [Fact] public async Task Should_navigate_between_task_list_and_school_and_trust_information() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Conversion details"); @@ -200,7 +198,7 @@ public async Task Should_navigate_between_task_list_and_school_and_trust_informa [Fact] public async Task Should_display_the_dao_pack_sent_date_row_if_the_project_is_a_directed_academy_order() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.ApplicationReceivedDate = null; project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored; @@ -216,7 +214,7 @@ public async Task Should_display_the_dao_pack_sent_date_row_if_the_project_is_a_ [Fact] public async Task Should_display_empty_for_the_dao_date_if_it_has_not_been_provided() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.ApplicationReceivedDate = null; project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored; @@ -234,7 +232,7 @@ public async Task Should_display_the_dao_pack_sent_date_if_it_has_been_provided( { DateTime yesterday = DateTime.Today.Subtract(TimeSpan.FromDays(1)); - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.ApplicationReceivedDate = null; project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored; @@ -250,7 +248,7 @@ public async Task Should_display_the_dao_pack_sent_date_if_it_has_been_provided( [Fact] public async Task Should_not_display_the_dao_pack_sent_date_row_if_the_project_is_not_a_directed_academy_order() { - AcademyConversionProject project = AddGetProject(project => project.ApplicationReceivedDate = DateTime.Today); + var project = AddGetProject(project => project.ApplicationReceivedDate = DateTime.Today); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Conversion details"); @@ -262,7 +260,7 @@ public async Task Should_not_display_the_dao_pack_sent_date_row_if_the_project_i [Fact] public async Task Should_navigate_to_dao_pack_sent_date_edit_screen_when_the_change_link_is_clicked() { - AcademyConversionProject project = AddGetProject(project => + var project = AddGetProject(project => { project.ApplicationReceivedDate = null; project.AcademyTypeAndRoute = AcademyTypeAndRoutes.Sponsored; @@ -279,4 +277,31 @@ await Document.QuerySelectorAll("a[data-test^=\"change-dao-p Document.Url.Should().EndWith("/dao-pack-sent-date"); } + + [Theory] + [InlineData("change-name-of-trust", + "change-form-7-received", + "change-dao-pack-sent-date", + "change-grant-funding-type", + "change-finance-year-following", + "change-grant-funding-amount", + "change-grant-funding-reason", + "change-grant-funding-environmental-improvement-grant", + "change-author", + "change-cleared-by")] + public async Task Should_not_have_change_link_if_project_read_only(params string[] elements) + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("Conversion details"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/conversion-details"); + foreach (var element in elements) + { + VerifyElementDoesNotExist(element); + } + Document.QuerySelector("#school-and-trust-information-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/AdditionalInformationIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/AdditionalInformationIntegrationTests.cs index d75ff877b..d827db62a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/AdditionalInformationIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/AdditionalInformationIntegrationTests.cs @@ -1,7 +1,6 @@ using AngleSharp.Dom; using AngleSharp.Html.Dom; using AutoFixture; -using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Tests.Extensions; using FluentAssertions; using System.Threading.Tasks; @@ -9,15 +8,13 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.SchoolBudgetInformation; -public class AdditionalInformationIntegrationTests : BaseIntegrationTests +public class AdditionalInformationIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public AdditionalInformationIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_navigate_to_and_update_additional_information() { - AcademyConversionProject project = AddGetProject(); - UpdateAcademyConversionProject request = AddPatchConfiguredProject(project, x => + var project = AddGetProject(); + var request = AddPatchConfiguredProject(project, x => { x.SchoolBudgetInformationAdditionalInformation = _fixture.Create(); x.Urn = project.Urn; @@ -39,7 +36,7 @@ public async Task Should_navigate_to_and_update_additional_information() [Fact] public async Task Should_show_error_summary_when_there_is_an_API_error() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddPatchError(project.Id); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-school-pupil-forecasts/additional-information"); @@ -52,7 +49,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_back_to_confirm_school_pupil_forecasts() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}/confirm-school-budget-information/additional-information"); await NavigateAsync("Back"); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/ConfirmSchoolBudgetInformationIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/ConfirmSchoolBudgetInformationIntegrationTests.cs index 10094bf66..75c277f91 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/ConfirmSchoolBudgetInformationIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolBudgetInformation/ConfirmSchoolBudgetInformationIntegrationTests.cs @@ -197,7 +197,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Should_navigate_between_task_list_and_confirm_school_budget_information() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); await NavigateAsync("Budget"); @@ -208,4 +208,28 @@ public async Task Should_navigate_between_task_list_and_confirm_school_budget_in Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + + [Theory] + [InlineData("change-financial-year", + "change-finance-year-current", + "change-finance-current-capital", + "change-next-financial-year", + "change-finance-year-following", + "change-finance-projected-capital", + "change-school-budget-information-additional-information")] + public async Task Should_not_have_change_link_if_project_read_only(params string[] elements) + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("Budget"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/budget"); + foreach (var element in elements) + { + VerifyElementDoesNotExist(element); + } + Document.QuerySelector("#school-budget-information-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolOverview/ConfirmSchoolOverviewIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolOverview/ConfirmSchoolOverviewIntegrationTests.cs index e06f04d00..cd0c8de19 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolOverview/ConfirmSchoolOverviewIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolOverview/ConfirmSchoolOverviewIntegrationTests.cs @@ -10,10 +10,8 @@ namespace Dfe.PrepareConversions.Tests.Pages.TaskList.SchoolOverview; -public class ConfirmSchoolOverviewIntegrationTests : BaseIntegrationTests +public class ConfirmSchoolOverviewIntegrationTests(IntegrationTestingWebApplicationFactory factory) : BaseIntegrationTests(factory) { - public ConfirmSchoolOverviewIntegrationTests(IntegrationTestingWebApplicationFactory factory) : base(factory) { } - [Fact] public async Task Should_be_in_progress_and_display_school_overview() { @@ -178,7 +176,7 @@ public async Task Should_show_error_summary_when_there_is_an_API_error() [Fact] public async Task Back_link_should_navigate_from_school_overview_to_task_list() { - AcademyConversionProject project = AddGetProject(); + var project = AddGetProject(); AddGetEstablishmentDto(project.Urn.ToString()); await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); @@ -191,6 +189,29 @@ public async Task Back_link_should_navigate_from_school_overview_to_task_list() Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + [Theory] + [InlineData("change-published-admission-number", + "change-viability-issues", + "change-financial-deficit", + "change-part-of-pfi", + "change-distance-to-trust-headquarters", + "change-member-of-parliament-name-and-party")] + public async Task Should_not_have_change_link_if_project_read_only(params string[] elements) + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("School overview"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/school-overview"); + foreach (var element in elements) + { + VerifyElementDoesNotExist(element); + } + Document.QuerySelector("#school-overview-complete").Should().BeNull(); + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } + private static string AsPercentageOf(string numberOfPupils, string schoolCapacity) { int? a = int.Parse(numberOfPupils); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolPupilForecasts/ConfirmSchoolPupilForecastsIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolPupilForecasts/ConfirmSchoolPupilForecastsIntegrationTests.cs index 09b245a43..3e40bd7d1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolPupilForecasts/ConfirmSchoolPupilForecastsIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/SchoolPupilForecasts/ConfirmSchoolPupilForecastsIntegrationTests.cs @@ -122,4 +122,21 @@ public async Task Back_link_should_navigate_from_confirm_school_pupil_forecasts_ Document.Url.Should().BeUrl($"/task-list/{project.Id}"); } + + [Theory] + [InlineData("change-school-pupil-forecasts-additional-information")] + public async Task Should_not_have_change_link_if_project_read_only(params string[] elements) + { + var project = AddGetProject(isReadOnly: true); + + await OpenAndConfirmPathAsync($"/task-list/{project.Id}"); + await NavigateAsync("Pupil forecasts"); + + Document.Url.Should().BeUrl($"/task-list/{project.Id}/pupil-forecasts"); + foreach (var element in elements) + { + VerifyElementDoesNotExist(element); + } + Document.QuerySelector("#confirm-and-continue-button").Should().BeNull(); + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml index eeaf0d25c..39ca85284 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml @@ -11,24 +11,24 @@ - - + + - - - - + + + + @* Voluntary grant *@ - + @* Sponsored grant *@ - - - - - + + + + + @if (Model.IsPreview) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index d51222873..3c011a379 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -5,9 +5,30 @@

@Model.SchoolName

-

- Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat) -

+ @if (Model.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ } +

+ Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat) +

Project owner: @@ -19,13 +40,15 @@ { @Model.AssignedUser.FullName } - - Change + @if (!Model.IsReadOnly) + { + Change + }

@Model.ProjectStatus

- @if (Model.HasPermission) + @if (Model.HasPermission && !Model.IsReadOnly) { Delete project diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml index 1113e4d99..771ec1abd 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml @@ -8,11 +8,8 @@ } @section BeforeMain - { - @Links.ProjectList.Index.BackText - @* @Links.ProjectList.Index.BackText *@ - - +{ + @Links.ProjectList.Index.BackText } @if (Model.ShowGenerateHtbTemplateError) @@ -197,14 +194,17 @@ - -

- Create your project document -

-

Project documents are in Microsoft Word format. You can make changes to documents after you create them.

- + @if (!Model.Project.IsReadOnly) + { +

+ Create your project document +

+ +

Project documents are in Microsoft Word format. You can make changes to documents after you create them.

+ + } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml index 25f1e046e..e17b47cd6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml @@ -14,6 +14,27 @@
@Model.Project.SchoolName

Educational Attendance

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }

These performance tables will automatically go into your project template.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml index 10bd7c862..39da8848a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml @@ -14,6 +14,27 @@
@Model.Project.SchoolName

Key stage 2 performance tables

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }

This information comes from Find and compare schools in England. It is for reference only. It will not appear in the project document.

Source of data: Find and compare school performance (opens in new tab) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml index 3679c159e..5faef955a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml @@ -14,6 +14,27 @@

@Model.Project.SchoolName

Key stage 4 performance tables

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }

This information comes from Find and compare schools in England. It is for reference only. It will not appear in the project document.

Source of data: Find and compare school performance (opens in new tab) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml index 8f28129d6..cab586a6c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml @@ -14,6 +14,27 @@

@Model.Project.SchoolName

Key stage 5 performance tables

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }

This information comes from Find and compare schools in England. It is for reference only. It will not appear in the project document.

Source of data: Find and compare school performance (opens in new tab) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml index 6fffbfa37..c8c81f2c5 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml @@ -11,10 +11,32 @@ }

-
+
@Model.SchoolName

Legal requirements

- + @if (Model.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ } +
+
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs index cc37a0ed8..9f073ca1a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml.cs @@ -19,7 +19,7 @@ public void OnGet(int id) public async Task OnPostAsync(int id) { Requirements.IsComplete = IsComplete; - await academyConversionProjectRepository.UpdateProject(id, Requirements.CreateUpdateAcademyConversionProject()); + await AcademyConversionProjectRepository.UpdateProject(id, Requirements.CreateUpdateAcademyConversionProject()); return RedirectToPage(Links.TaskList.Index.Page, new { id }); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml index 007ef445f..77a37a0f9 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml @@ -23,6 +23,27 @@

Record dates for the local authority information template

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml index 03e913396..bbedc5607 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/PreviewProjectTemplate.cshtml @@ -156,16 +156,19 @@
} -
-
-

- Create your project document -

-

Project documents are in Microsoft Word format. You can make changes to documents after you create them.

+@if (!Model.Project.IsReadOnly) +{ +
+
+

+ Create your project document +

+

Project documents are in Microsoft Word format. You can make changes to documents after you create them.

-
- -
-
-
\ No newline at end of file +
+ +
+
+
+} diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml index bfa7e059b..4687411e0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml @@ -17,6 +17,27 @@

Confirm project dates

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml index a0af27f93..6fe91a0a0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml @@ -26,6 +26,27 @@

Confirm project and trust rationale

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
@if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Voluntary)) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml index 544a3a720..e3ad3a67a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml @@ -22,6 +22,27 @@

Confirm risks and issues

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml index 07559e227..eeb1c4417 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml @@ -25,6 +25,27 @@

Conversion details

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
@if (ViewData["AcademyTypeAndRoute"].Equals(AcademyTypeAndRoutes.Sponsored)) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml index d7076d961..9276d1b7d 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml @@ -22,7 +22,28 @@
@Model.Project.SchoolName

Budget

-

This table will go into your project document.

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ } +

This table will go into your project document.

You can add additional information if you need to, this will also go into your project document.


diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml index f90bd7142..aea574958 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml @@ -24,6 +24,27 @@

School overview

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ } @if (ViewData["AcademyTypeAndRoute"] is AcademyTypeAndRoutes.Sponsored) {
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml index f5a5729bd..2e747bd37 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml @@ -14,6 +14,27 @@
@Model.Project.SchoolName

School performance (Ofsted information)

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }

This information comes from TRAMS. It is for reference only. It will not appear in the project document.


diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml index 44fb1b1c8..adb7cafc8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml @@ -18,6 +18,27 @@

Pupil forecasts

+ @if (Model.Project.IsReadOnly) + { +
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate. +

+

+ You cannot make changes to this project in Prepare. +

+
+
+ }
@if (ViewData["AcademyTypeAndRoute"]!.Equals(AcademyTypeAndRoutes.Sponsored)) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/BackLinkTagHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/BackLinkTagHelper.cs index 7fde088a1..07c5e87ad 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/BackLinkTagHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/BackLinkTagHelper.cs @@ -6,10 +6,8 @@ namespace Dfe.PrepareConversions.TagHelpers; [HtmlTargetElement("govuk-back-link", TagStructure = TagStructure.WithoutEndTag)] -public class BackLinkTagHelper : AnchorTagHelper +public class BackLinkTagHelper(IHtmlGenerator generator) : AnchorTagHelper(generator) { - public BackLinkTagHelper(IHtmlGenerator generator) : base(generator) { } - [HtmlAttributeName("link-item")] public LinkItem LinkItem { get; set; } From 64bb8c5cd7a83a60c394cad2447eaa9b37aace2d Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 9 Oct 2024 15:56:56 +0100 Subject: [PATCH 07/19] Enabled AO sent date and updated text --- .../RecordDecisionPreview/default.cshtml | 23 ++-- .../Pages/Shared/_ProjectHeader.cshtml | 115 ++++++++++-------- .../Decision/AcademyOrderDate.cshtml.cs | 36 +++--- .../TaskList/Decision/DecisionDate.cshtml.cs | 24 ++-- .../Decision/Models/DecisionBaseModel.cs | 24 ++-- .../Pages/TaskList/Decision/Summary.cshtml | 98 +++++++++------ .../Pages/TaskList/Decision/Summary.cshtml.cs | 15 ++- .../Pages/TaskList/Index.cshtml.cs | 4 +- 8 files changed, 183 insertions(+), 156 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index 99aa60da2..f7c7ca92c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -205,27 +205,22 @@ }
- @if (!Model.IsReadOnly) - { - - Change Date academy order (AO) sent - - } + + Change Date academy order (AO) sent +
} - @if (!Model.IsReadOnly) {

- You can click the button to change the recorded decision. -

- - - Change your decision - - } + You can click the button to change the recorded decision. +

+ } + + @(Model.IsReadOnly ? "Confirm date AO sent" : "Change your decision") + } else { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index 3c011a379..f72281acf 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -5,57 +5,72 @@

@Model.SchoolName

- @if (Model.IsReadOnly) - { -
-
-

- Important -

-
-
-

- Project approved -

-

- This project was approved and moved to Complete conversions transfers and changes on @Model.ApplicationReceivedDate. -

-

- You cannot make changes to this project in Prepare. -

-
-
- } -

- Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat) -

-

- Project owner: - @if (Model.AssignedUser == null || string.IsNullOrWhiteSpace(Model?.AssignedUser.FullName)) - { - Empty - } - else - { - @Model.AssignedUser.FullName - } - @if (!Model.IsReadOnly) - { - Change - } -

-

- @Model.ProjectStatus -

- @if (Model.HasPermission && !Model.IsReadOnly) - { - - Delete project - - } - - + + @if (Model.IsReadOnly) + { +
+
+
+

+ Important +

+
+
+

+ Project approved +

+

+ This project was approved and moved to Complete conversions transfers and changes on @Model.ApplicationReceivedDate. +

+ @if (Model.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } +
+
+
+ } +
+

+ Route: @Model.AcademyTypeAndRoute.RouteDescription(@Model.IsFormAMat) +

+

+ Project owner: + + @if (Model.AssignedUser == null || string.IsNullOrWhiteSpace(Model?.AssignedUser.FullName)) + { + Empty + } + else + { + @Model.AssignedUser.FullName + } + @if (!Model.IsReadOnly) + { + Change + } +

+

+ @Model.ProjectStatus +

+ @if (Model.HasPermission && !Model.IsReadOnly) + { + + Delete project + + } +
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs index 432cf52a6..3ede87e23 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs @@ -1,6 +1,7 @@ using Dfe.Academisation.ExtensionMethods; using Dfe.PrepareConversions.Data.Models.AdvisoryBoardDecision; using Dfe.PrepareConversions.Data.Services; +using Dfe.PrepareConversions.Data.Services.Interfaces; using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; using Dfe.PrepareConversions.Services; @@ -9,21 +10,15 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.Decision; -public class AcademyOrderDateModel : DecisionBaseModel, IDateValidationMessageProvider +public class AcademyOrderDateModel(IAcademyConversionProjectRepository repository, + ISession session, + ErrorService errorService, + IAcademyConversionAdvisoryBoardDecisionRepository decisionRepository) : DecisionBaseModel(repository, session), IDateValidationMessageProvider { - private readonly ErrorService _errorService; - - public AcademyOrderDateModel(IAcademyConversionProjectRepository repository, - ISession session, - ErrorService errorService) - : base(repository, session) - { - _errorService = errorService; - } - [BindProperty(Name = "academy-order-date", BinderType = typeof(DateInputModelBinder))] [DateValidation(DateRangeValidationService.DateRange.PastOrToday)] [Display(Name = "academy-order-date")] @@ -47,10 +42,15 @@ string IDateValidationMessageProvider.AllMissing(string displayName) } - public IActionResult OnGet(int id) + public async Task OnGetAsync(int id) { - AdvisoryBoardDecision decision = GetDecisionFromSession(id); - if (decision.Decision == null) return RedirectToPage(Links.TaskList.Index.Page, new { id }); + var decision = GetDecisionFromSession(id); + if (decision.Decision == null) + { + decision = (await decisionRepository.Get(id)).Body; + SetDecisionInSession(id, decision); + if (decision.Decision == null) return RedirectToPage(Links.TaskList.Index.Page, new { id }); + } Decision = decision; DecisionText = decision.Decision.ToString()?.ToLowerInvariant(); @@ -61,15 +61,15 @@ public IActionResult OnGet(int id) return Page(); } - public IActionResult OnPost(int id) + public async Task OnPost(int id) { - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); decision.AcademyOrderDate = AcademyOrderDate; if (!ModelState.IsValid) { - _errorService.AddErrors(Request.Form.Keys, ModelState); - return OnGet(id); + errorService.AddErrors(Request.Form.Keys, ModelState); + return await OnGetAsync(id); } SetDecisionInSession(id, decision); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionDate.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionDate.cshtml.cs index 60788b1c9..b7c930526 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionDate.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionDate.cshtml.cs @@ -12,18 +12,10 @@ namespace Dfe.PrepareConversions.Pages.TaskList.Decision; -public class DecisionDate : DecisionBaseModel, IDateValidationMessageProvider +public class DecisionDate(IAcademyConversionProjectRepository repository, + ISession session, + ErrorService errorService) : DecisionBaseModel(repository, session), IDateValidationMessageProvider { - private readonly ErrorService _errorService; - - public DecisionDate(IAcademyConversionProjectRepository repository, - ISession session, - ErrorService errorService) - : base(repository, session) - { - _errorService = errorService; - } - [BindProperty(Name = "decision-date", BinderType = typeof(DateInputModelBinder))] [DateValidation(DateRangeValidationService.DateRange.PastOrToday)] [Display(Name = "decision")] @@ -43,14 +35,14 @@ string IDateValidationMessageProvider.AllMissing(string displayName) { string idRaw = Request.RouteValues["id"] as string; int id = int.Parse(idRaw ?? string.Empty); - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); return decision.Decision == AdvisoryBoardDecisions.DAORevoked ? "Enter the date the DAO was revoked" : $"Enter the date when the conversion was {decision.Decision.ToDescription().ToLowerInvariant()}"; } public IActionResult OnGet(int id) { - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); if (decision.Decision == null) return RedirectToPage(Links.TaskList.Index.Page, new { id }); Decision = GetDecisionFromSession(id); @@ -64,12 +56,12 @@ public IActionResult OnGet(int id) public IActionResult OnPost(int id) { - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); decision.AdvisoryBoardDecisionDate = DateOfDecision; if (!ModelState.IsValid) { - _errorService.AddErrors(Request.Form.Keys, ModelState); + errorService.AddErrors(Request.Form.Keys, ModelState); return OnGet(id); } @@ -79,6 +71,6 @@ public IActionResult OnPost(int id) return RedirectToPage(Links.Decision.AcademyOrderDate.Page, new { id }); } - return RedirectToPage(Links.Decision.Summary.Page, new { id }); + return RedirectToPage(Links.Decision.Summary.Page, new { id}); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Models/DecisionBaseModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Models/DecisionBaseModel.cs index 9d76f8152..a3dab46d8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Models/DecisionBaseModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Models/DecisionBaseModel.cs @@ -1,5 +1,4 @@ -using Dfe.PrepareConversions.Data; -using Dfe.PrepareConversions.Data.Models; +using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.AdvisoryBoardDecision; using Dfe.PrepareConversions.Data.Services; using Dfe.PrepareConversions.Extensions; @@ -11,11 +10,12 @@ namespace Dfe.PrepareConversions.Pages.TaskList.Decision.Models; -public abstract class DecisionBaseModel : PageModel +public abstract class DecisionBaseModel(IAcademyConversionProjectRepository repository, ISession session) : PageModel { public const string DECISION_SESSION_KEY = "Decision"; - protected readonly IAcademyConversionProjectRepository _repository; - protected readonly ISession _session; + public const string PROJECT_READONLY_SESSION_KEY = "Project_iro"; + protected readonly IAcademyConversionProjectRepository _repository = repository; + protected readonly ISession _session = session; protected AcademyConversionProject _project; /// @@ -23,12 +23,6 @@ public abstract class DecisionBaseModel : PageModel /// protected bool PropagateBackLinkOverride = true; - protected DecisionBaseModel(IAcademyConversionProjectRepository repository, ISession session) - { - _repository = repository; - _session = session; - } - public BackLinkModel BackLinkModel { get; set; } public string SchoolName { get; set; } public string AcademyTypeAndRoute { get; set; } @@ -42,7 +36,7 @@ protected DecisionBaseModel(IAcademyConversionProjectRepository repository, ISes private async Task SetDefaults(int id) { Id = id; - ApiResponse project = await _repository.GetProjectById(id); + var project = await _repository.GetProjectById(id); SchoolName = project.Body.SchoolName; AcademyTypeAndRoute = project.Body.AcademyTypeAndRoute; } @@ -77,6 +71,12 @@ protected AdvisoryBoardDecision GetDecisionFromSession(int id) return _session.Get($"{DECISION_SESSION_KEY}_{id}") ?? new AdvisoryBoardDecision(); } + protected bool GetIsProjectReadOnly(int id) + { + _ = bool.TryParse(_session.GetString($"{PROJECT_READONLY_SESSION_KEY}_{id}"), out bool isReadOnly); + return isReadOnly; + } + /// /// Stores the provided in the current session. /// diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml index db8d9e64f..41a7622cc 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml @@ -13,7 +13,7 @@ } Record the decision -

Check your answers before recording this decision

+

@(Model.IsReadOnly ? "Check your answers": "Check your answers before recording this decision")

@@ -46,9 +46,12 @@
- - Changedecision - + @if (!Model.IsReadOnly) + { + + Changedecision + + }
@@ -98,29 +101,32 @@
- @if (Model.Decision.Decision == AdvisoryBoardDecisions.Declined) - { - - Changedeclined-reason - - } - else if (Model.Decision.Decision == AdvisoryBoardDecisions.Deferred) - { - - Changedeferred-reason - - } - else if (Model.Decision.Decision == AdvisoryBoardDecisions.Withdrawn) - { - - Changewithdrawn-reason - - } - else if (Model.Decision.Decision == AdvisoryBoardDecisions.DAORevoked) - { - - Changedaorevoked-reason - + @if(!Model.IsReadOnly) + { + if (Model.Decision.Decision == AdvisoryBoardDecisions.Declined) + { + + Changedeclined-reason + + } + else if (Model.Decision.Decision == AdvisoryBoardDecisions.Deferred) + { + + Changedeferred-reason + + } + else if (Model.Decision.Decision == AdvisoryBoardDecisions.Withdrawn) + { + + Changewithdrawn-reason + + } + else if (Model.Decision.Decision == AdvisoryBoardDecisions.DAORevoked) + { + + Changedaorevoked-reason + + } }
@@ -142,11 +148,14 @@ }
- @if (Model.Decision.Decision != AdvisoryBoardDecisions.DAORevoked) + @if (!Model.IsReadOnly) { - - Changewho made this decision - + @if (Model.Decision.Decision != AdvisoryBoardDecisions.DAORevoked) + { + + Changewho made this decision + + } }
@@ -175,9 +184,12 @@ }
- - Changedecision maker's name - + @if(!Model.IsReadOnly) + { + + Changedecision maker's name + + }
@@ -201,9 +213,12 @@ }
- - Changecondition answer - + @if (!Model.IsReadOnly) + { + + Changecondition answer + + }
} @@ -225,9 +240,12 @@
- + @if(!Model.IsReadOnly) + { + Changedate of decision - + + }
@* AO Date *@ @@ -260,6 +278,6 @@
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs index 535a3a6e6..d511792c9 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs @@ -6,7 +6,7 @@ using Dfe.PrepareConversions.Data.Services.Interfaces; using Dfe.PrepareConversions.Extensions; using Dfe.PrepareConversions.Models; -using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; +using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Net; @@ -20,6 +20,7 @@ public class SummaryModel(IAcademyConversionProjectRepository repository, IAcademyConversionProjectRepository academyConversionProjectRepository) : DecisionBaseModel(repository, session) { public AdvisoryBoardDecision Decision { get; set; } + public bool IsReadOnly { get; set; } public string DecisionText => Decision.Decision == AdvisoryBoardDecisions.DAORevoked ? "DAO revoked" @@ -29,6 +30,8 @@ public class SummaryModel(IAcademyConversionProjectRepository repository, public IActionResult OnGet(int id) { Decision = GetDecisionFromSession(id); + IsReadOnly = GetIsProjectReadOnly(id); + if (AcademyTypeAndRoute == AcademyTypeAndRoutes.Voluntary) { SetBackLinkModel(Links.Decision.AcademyOrderDate, id); @@ -46,21 +49,23 @@ public async Task OnPostAsync(int id) { if (!ModelState.IsValid) return OnGet(id); - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); decision.ConversionProjectId = id; await CreateOrUpdateDecision(id, decision); - SetDecisionInSession(id, null); + SetDecisionInSession(id, null); - TempData.SetNotification(NotificationType.Success, "Done", "Decision recorded"); + TempData.SetNotification(NotificationType.Success, "Done", GetIsProjectReadOnly(id) + ? "Date academy order sent confirmed" + : "Decision recorded"); return RedirectToPage(Links.TaskList.Index.Page, new { id }); } private async Task CreateOrUpdateDecision(int id, AdvisoryBoardDecision decision) { - ApiResponse savedDecision = await advisoryBoardDecisionRepository.Get(id); + var savedDecision = await advisoryBoardDecisionRepository.Get(id); if (savedDecision.StatusCode == HttpStatusCode.NotFound) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs index 6ce6436e2..5b19c6234 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Index.cshtml.cs @@ -17,7 +17,8 @@ public class IndexModel(KeyStagePerformanceService keyStagePerformanceService, IAcademyConversionProjectRepository repository, ErrorService errorService, ISession session) : BaseAcademyConversionProjectPageModel(repository) { - public const string SESSION_KEY = "RoleCapabilities"; + public const string SESSION_KEY = "RoleCapabilities"; + public const string PROJECT_READONLY_SESSION_KEY = "Project_iro"; protected readonly ISession _session = session; public bool ShowGenerateHtbTemplateError { get; set; } @@ -86,6 +87,7 @@ public override async Task OnGetAsync(int id) TaskList.HasAbsenceData = keyStagePerformance.HasSchoolAbsenceData; } Project.HasPermission = _session.HasPermission($"{SESSION_KEY}_{HttpContext.User.Identity.Name}", RoleCapability.DeleteConversionProject); + _session.SetString($"{PROJECT_READONLY_SESSION_KEY}_{id}", Project.IsReadOnly.ToString()); return Page(); } } From f3479a822d6c36204ffeebf30ebf7a2568461cac Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 9 Oct 2024 16:21:43 +0100 Subject: [PATCH 08/19] Fixed prepare letting user to change decision for locked project issue --- .../RecordDecisionPreview/default.cshtml | 15 +++++++++++---- .../TaskList/Decision/RecordDecision.cshtml.cs | 8 ++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index f7c7ca92c..0ed36bdfa 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -217,10 +217,17 @@

You can click the button to change the recorded decision.

- } - - @(Model.IsReadOnly ? "Confirm date AO sent" : "Change your decision") - + + Change your decision + + } + else + { + + @(Model.IsReadOnly ? "Confirm date AO sent" : "Change your decision") + + } + } else { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordDecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordDecision.cshtml.cs index e3a06f17f..197d3e954 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordDecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordDecision.cshtml.cs @@ -34,11 +34,11 @@ public RecordDecisionModel(IAcademyConversionProjectRepository repository, public async Task OnGet(int id) { - AdvisoryBoardDecision sessionDecision = GetDecisionFromSession(id); + var sessionDecision = GetDecisionFromSession(id); if (sessionDecision.Decision == null) { - ApiResponse savedDecision = await _decisionRepository.Get(id); + var savedDecision = await _decisionRepository.Get(id); SetDecisionInSession(id, savedDecision?.Body); AdvisoryBoardDecision = savedDecision?.Body?.Decision; } @@ -53,11 +53,11 @@ public async Task OnPost(int id) { if (!ModelState.IsValid) { - _errorService.AddErrors(new[] { "AdvisoryBoardDecision" }, ModelState); + _errorService.AddErrors(["AdvisoryBoardDecision"], ModelState); return await OnGet(id); } - AdvisoryBoardDecision decision = GetDecisionFromSession(id) ?? new AdvisoryBoardDecision(); + var decision = GetDecisionFromSession(id) ?? new AdvisoryBoardDecision(); decision.Decision = AdvisoryBoardDecision.Value; SetDecisionInSession(id, decision); From c250c6689b55138ebb7c547e9a0432554d63fae6 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 9 Oct 2024 17:25:12 +0100 Subject: [PATCH 09/19] Display content based on isvoluntary flag --- .../Pages/Shared/_ProjectHeader.cshtml | 2 +- .../TaskList/Decision/AcademyOrderDate.cshtml | 9 ++++++++- .../Decision/AcademyOrderDate.cshtml.cs | 9 +++++++-- .../EducationalAttendance.cshtml | 17 ++++++++++++++--- .../KeyStage2PerformanceTables.cshtml | 17 ++++++++++++++--- .../KeyStage4PerformanceTables.cshtml | 17 ++++++++++++++--- .../KeyStage5PerformanceTables.cshtml | 17 ++++++++++++++--- .../LegalRequirements/LegalModelBase.cs | 7 ++++++- .../LegalRequirements/LegalSummary.cshtml | 17 ++++++++++++++--- ...ocalAuthorityInformationTemplateDates.cshtml | 17 ++++++++++++++--- .../ProjectDates/ConfirmProjectDates.cshtml | 17 ++++++++++++++--- .../ConfirmProjectAndTrustRationale.cshtml | 17 ++++++++++++++--- .../RisksAndIssues/ConfirmRisksAndIssues.cshtml | 17 ++++++++++++++--- .../ConversionDetails.cshtml | 17 ++++++++++++++--- .../SchoolBudgetInformation/Budget.cshtml | 17 ++++++++++++++--- .../SchoolOverview/SchoolOverview.cshtml | 17 ++++++++++++++--- .../ConfirmSchoolPerformance.cshtml | 17 ++++++++++++++--- .../SchoolPupilForecasts/PupilForecasts.cshtml | 17 ++++++++++++++--- 18 files changed, 218 insertions(+), 47 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index f72281acf..3776405b5 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -26,7 +26,7 @@ @if (Model.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml index fe22bc910..dbcf318e6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml @@ -7,7 +7,14 @@ @section BeforeMain { - + @if (Model.IsReadOnly) + { + + } + else + { + + } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs index 3ede87e23..409be6a42 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs @@ -5,6 +5,7 @@ using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; using Dfe.PrepareConversions.Services; +using DocumentFormat.OpenXml.Vml.Spreadsheet; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; @@ -28,6 +29,9 @@ public class AcademyOrderDateModel(IAcademyConversionProjectRepository repositor public AdvisoryBoardDecision Decision { get; set; } + public bool IsReadOnly { get; set; } + public LinkItem BackLink { get;set; } + string IDateValidationMessageProvider.SomeMissing(string displayName, IEnumerable missingParts) { return $"Date must include a {string.Join(" and ", missingParts)}"; @@ -37,7 +41,7 @@ string IDateValidationMessageProvider.AllMissing(string displayName) { string idRaw = Request.RouteValues["id"] as string; int id = int.Parse(idRaw ?? string.Empty); - AdvisoryBoardDecision decision = GetDecisionFromSession(id); + var decision = GetDecisionFromSession(id); return $"Enter the date when the conversion was {decision.Decision.ToDescription().ToLowerInvariant()}"; } @@ -55,7 +59,8 @@ public async Task OnGetAsync(int id) Decision = decision; DecisionText = decision.Decision.ToString()?.ToLowerInvariant(); AcademyOrderDate = Decision.AcademyOrderDate; - + IsReadOnly = GetIsProjectReadOnly(id); + BackLink = new() { Page = Request.Headers["Referer"], BackText = "backText" }; SetBackLinkModel(Links.Decision.DecisionDate, id); return Page(); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml index e17b47cd6..011024450 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml index 39da8848a..a654882f3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml index 5faef955a..28404b526 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml index cab586a6c..d9383e024 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs index a4b6e8126..5b4ae725c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalModelBase.cs @@ -1,3 +1,4 @@ +using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Models.AcademyConversion; using Dfe.PrepareConversions.Data.Services; using Dfe.PrepareConversions.Models; @@ -5,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Primitives; +using System; using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.LegalRequirements; @@ -17,6 +19,7 @@ public class LegalModelBase(IAcademyConversionProjectRepository academyConversio public string SchoolName { get; private set; } public Data.Models.AcademyConversion.LegalRequirements Requirements { get; private set; } public bool IsReadOnly { get; set; } + public bool IsVoluntary { get; set; } public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context, PageHandlerExecutionDelegate next) { @@ -37,8 +40,10 @@ public override async Task OnPageHandlerExecutionAsync(PageHandlerExecutingConte var project = await AcademyConversionProjectRepository.GetProjectById(Id); if (project.Success) { - Requirements = Data.Models.AcademyConversion.LegalRequirements.From(project.Body); + Requirements = Data.Models.AcademyConversion.LegalRequirements.From(project.Body); IsReadOnly = project.Body.IsReadOnly; + IsVoluntary = string.IsNullOrWhiteSpace(project.Body.AcademyTypeAndRoute) is false && + project.Body.AcademyTypeAndRoute.Equals(AcademyTypeAndRoutes.Voluntary, StringComparison.InvariantCultureIgnoreCase); } else { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml index c8c81f2c5..e13ccb99a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml index 77a37a0f9..70629d474 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml @@ -38,9 +38,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml index 4687411e0..bca498e66 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml @@ -32,9 +32,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml index 6fe91a0a0..680924d62 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml @@ -41,9 +41,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml index e3ad3a67a..0ca393eb6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml @@ -37,9 +37,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml index eeb1c4417..80255d3ed 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml @@ -40,9 +40,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml index 9276d1b7d..e01976e7a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml @@ -37,9 +37,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml index aea574958..6a0791b41 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml @@ -39,9 +39,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml index 2e747bd37..5466cc229 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml @@ -29,9 +29,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml index adb7cafc8..d52cdd349 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml @@ -33,9 +33,20 @@

This project was approved and moved to Complete conversions transfers and changes on @Model.Project.ApplicationReceivedDate.

-

- You cannot make changes to this project in Prepare. -

+ @if (Model.Project.IsVoluntary) + { +

+ You can only + enter or change the date the academy order was sent + to this school. All other information is locked. +

+ } + else + { +

+ You cannot make changes to this project in Prepare. +

+ } } From 834b1f087241e5b134f5dc5daeeba3183cb95ffa Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Fri, 11 Oct 2024 14:10:22 +0100 Subject: [PATCH 10/19] Return to previous page --- .../Dfe.PrepareConversions.Data/Models/User.cs | 15 ++++----------- .../Dfe.PrepareConversions/Models/Links.cs | 4 ++-- .../Pages/Shared/_ProjectHeader.cshtml | 2 +- .../TaskList/Decision/AcademyOrderDate.cshtml | 11 ++--------- .../TaskList/Decision/AcademyOrderDate.cshtml.cs | 12 ++++++------ .../EducationalAttendance.cshtml | 2 +- .../KeyStage2PerformanceTables.cshtml | 2 +- .../KeyStage4PerformanceTables.cshtml | 2 +- .../KeyStage5PerformanceTables.cshtml | 2 +- .../LegalRequirements/LegalSummary.cshtml | 2 +- ...mLocalAuthorityInformationTemplateDates.cshtml | 2 +- .../ProjectDates/ConfirmProjectDates.cshtml | 2 +- .../ConfirmProjectAndTrustRationale.cshtml | 2 +- .../RisksAndIssues/ConfirmRisksAndIssues.cshtml | 2 +- .../ConversionDetails.cshtml | 2 +- .../SchoolBudgetInformation/Budget.cshtml | 2 +- .../TaskList/SchoolOverview/SchoolOverview.cshtml | 2 +- .../ConfirmSchoolPerformance.cshtml | 2 +- .../SchoolPupilForecasts/PupilForecasts.cshtml | 2 +- 19 files changed, 29 insertions(+), 43 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/User.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/User.cs index 63944cf0d..6856b0381 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/User.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Models/User.cs @@ -1,15 +1,8 @@ namespace Dfe.PrepareConversions.Data.Models; -public class User +public class User(string id, string emailAddress, string fullName) { - public User(string id, string emailAddress, string fullName) - { - Id = id; - EmailAddress = emailAddress; - FullName = fullName; - } - - public string Id { get; set; } - public string EmailAddress { get; } - public string FullName { get; } + public string Id { get; set; } = id; + public string EmailAddress { get; } = emailAddress; + public string FullName { get; } = fullName; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs index 4d1a2be83..a4efbe907 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs @@ -6,14 +6,14 @@ namespace Dfe.PrepareConversions.Models; public static class Links { - private static readonly List _links = new(); + private static readonly List _links = []; private static string _transfersUrl; public static string TransfersUrl => _transfersUrl; private static bool _isApplicationDocumentsEnabled; public static bool IsApplicationDocumentsEnabled => _isApplicationDocumentsEnabled; - private static LinkItem AddLinkItem(string page, string backText = "Back") + public static LinkItem AddLinkItem(string page, string backText = "Back") { LinkItem item = new() { Page = page, BackText = backText }; _links.Add(item); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml index 3776405b5..2c054e82f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectHeader.cshtml @@ -26,7 +26,7 @@ @if (Model.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml index dbcf318e6..6fee54b2c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml @@ -7,21 +7,14 @@ @section BeforeMain { - @if (Model.IsReadOnly) - { - - } - else - { - - } + } - Record the decision

Date the academy order (AO) was sent

+
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs index 409be6a42..6f95f7736 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs @@ -30,7 +30,7 @@ public class AcademyOrderDateModel(IAcademyConversionProjectRepository repositor public AdvisoryBoardDecision Decision { get; set; } public bool IsReadOnly { get; set; } - public LinkItem BackLink { get;set; } + public string? ReturnUrl { get; set; } string IDateValidationMessageProvider.SomeMissing(string displayName, IEnumerable missingParts) { @@ -46,7 +46,7 @@ string IDateValidationMessageProvider.AllMissing(string displayName) } - public async Task OnGetAsync(int id) + public async Task OnGetAsync(int id, string? returnUrl = null) { var decision = GetDecisionFromSession(id); if (decision.Decision == null) @@ -60,13 +60,13 @@ public async Task OnGetAsync(int id) DecisionText = decision.Decision.ToString()?.ToLowerInvariant(); AcademyOrderDate = Decision.AcademyOrderDate; IsReadOnly = GetIsProjectReadOnly(id); - BackLink = new() { Page = Request.Headers["Referer"], BackText = "backText" }; - SetBackLinkModel(Links.Decision.DecisionDate, id); + ReturnUrl = returnUrl; + SetBackLinkModel(IsReadOnly ? Links.AddLinkItem(returnUrl) : Links.Decision.DecisionDate, id); return Page(); } - public async Task OnPost(int id) + public async Task OnPost(int id, string? returnUrl = null) { var decision = GetDecisionFromSession(id); decision.AcademyOrderDate = AcademyOrderDate; @@ -74,7 +74,7 @@ public async Task OnPost(int id) if (!ModelState.IsValid) { errorService.AddErrors(Request.Form.Keys, ModelState); - return await OnGetAsync(id); + return await OnGetAsync(id, returnUrl); } SetDecisionInSession(id, decision); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml index 011024450..e2d0081c2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/EducationalAttendance.cshtml @@ -32,7 +32,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml index a654882f3..86986347f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage2PerformanceTables.cshtml @@ -32,7 +32,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml index 28404b526..3227661c4 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage4PerformanceTables.cshtml @@ -32,7 +32,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml index d9383e024..59f9c9f95 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/KeyStagePerformance/KeyStage5PerformanceTables.cshtml @@ -32,7 +32,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml index e13ccb99a..1dd751b82 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LegalRequirements/LegalSummary.cshtml @@ -32,7 +32,7 @@ @if (Model.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml index 70629d474..af62cbf36 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/LocalAuthorityInformationTemplate/ConfirmLocalAuthorityInformationTemplateDates.cshtml @@ -41,7 +41,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml index bca498e66..031d95f28 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/ConfirmProjectDates.cshtml @@ -35,7 +35,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml index 680924d62..123323b6b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Rationale/ConfirmProjectAndTrustRationale.cshtml @@ -44,7 +44,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml index 0ca393eb6..c2f2fe3ef 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/RisksAndIssues/ConfirmRisksAndIssues.cshtml @@ -40,7 +40,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml index 80255d3ed..b0be2d34a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/ConversionDetails.cshtml @@ -43,7 +43,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml index e01976e7a..8bc1d17fb 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolBudgetInformation/Budget.cshtml @@ -40,7 +40,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml index 6a0791b41..31c4f8ae6 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolOverview/SchoolOverview.cshtml @@ -42,7 +42,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml index 5466cc229..34ab1a32e 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPerformance/ConfirmSchoolPerformance.cshtml @@ -32,7 +32,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml index d52cdd349..b4f6f0617 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolPupilForecasts/PupilForecasts.cshtml @@ -36,7 +36,7 @@ @if (Model.Project.IsVoluntary) {

- You can only + You can only enter or change the date the academy order was sent to this school. All other information is locked.

From 033792fb133572c9028ba9c56d3fb5529260f451 Mon Sep 17 00:00:00 2001 From: plockwood Date: Fri, 11 Oct 2024 16:29:21 +0100 Subject: [PATCH 11/19] Changes for approved decision info page --- .../Dfe.PrepareConversions/Models/Links.cs | 1 + .../Decision/DecisionApprovedInfo.cshtml | 23 +++++++++++++++---- .../Decision/DecisionApprovedInfo.cshtml.cs | 15 +----------- .../Pages/TaskList/Decision/Summary.cshtml.cs | 23 ++++++++++++------- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs index 4d1a2be83..3ab1fac92 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs @@ -239,6 +239,7 @@ public static class Decision public static readonly LinkItem Summary = AddLinkItem(backText: "Back", page: "/TaskList/Decision/Summary"); public static readonly LinkItem SubMenuRecordADecision = AddLinkItem(backText: "Back", page: "/TaskList/Decision/RecordADecision"); public static readonly LinkItem AcademyOrderDate = AddLinkItem(backText: "Back", page: "/TaskList/Decision/AcademyOrderDate"); + public static readonly LinkItem ApprovedInfo = AddLinkItem(backText: "Back", page: "/TaskList/Decision/DecisionApprovedInfo"); } public static class DeleteProject diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml index c24d4847c..1c29356e0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml @@ -1,7 +1,7 @@ @page "/task-list/{id:int}/decision/approved-info" @using Dfe.PrepareConversions.Extensions @using Dfe.PrepareConversions.TagHelpers -@model Dfe.PrepareConversions.Pages.TaskList.Decision.DecisionMaker +@model Dfe.PrepareConversions.Pages.TaskList.Decision.DecisionApprovedInfo @{ ViewData["Title"] = "Approved decision information"; Layout = "_Layout"; @@ -13,14 +13,27 @@ } -Record the decision -

@ViewData["Title"]

-

Decision recorded

- Your reference number
+ @Model.SchoolName
Approved @(Model.Decision.ApprovedConditionsSet.HasValue && Model.Decision.ApprovedConditionsSet.Value ? "with conditions" : string.Empty)
+

This project is now locked and you can cannot make changes to it.

+

What happens next

+

This project has been created in Complete conversions, transfers and changes.

+

Add handover details

+

You must add handover details to the project in complete before the project can continue.

+

You need to add:

+
    +
  • which team will manage the project next
  • +
  • any handover comments
  • +
  • links to SharePoint folders
  • +
  • external contact details
  • +
+ + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs index bd33274cb..447013adc 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs @@ -33,22 +33,9 @@ public async Task OnGetAsync(int id) { if(savedDecision.Success) Decision = savedDecision.Body; - SetBackLinkModel(GetPageForBackLink(id), id); + SetBackLinkModel(Links.TaskList.Index, id); return Page(); } - - public LinkItem GetPageForBackLink(int id) - { - return Decision switch - { - { Decision: AdvisoryBoardDecisions.Approved } => Links.Decision.AnyConditions, - { Decision: AdvisoryBoardDecisions.Declined } => Links.Decision.DeclineReason, - { Decision: AdvisoryBoardDecisions.Deferred } => Links.Decision.WhyDeferred, - { Decision: AdvisoryBoardDecisions.Withdrawn } => Links.Decision.WhyWithdrawn, - { Decision: AdvisoryBoardDecisions.DAORevoked } => Links.Decision.WhyDAORevoked, - _ => throw new Exception("Unexpected decision state") - }; - } } } \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs index d511792c9..b30e1309c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/Summary.cshtml.cs @@ -52,10 +52,19 @@ public async Task OnPostAsync(int id) var decision = GetDecisionFromSession(id); decision.ConversionProjectId = id; - await CreateOrUpdateDecision(id, decision); + var savedDecisionResponse = await advisoryBoardDecisionRepository.Get(id); + AdvisoryBoardDecision existingDecision = null; + + if (savedDecisionResponse.Success) { existingDecision = savedDecisionResponse.Body; } + + await CreateOrUpdateDecision(id, existingDecision, decision); SetDecisionInSession(id, null); + if (decision.Decision == AdvisoryBoardDecisions.Approved && (existingDecision is null || existingDecision.Decision != AdvisoryBoardDecisions.Approved)) { + return RedirectToPage(Links.Decision.ApprovedInfo.Page, new { id }); + } + TempData.SetNotification(NotificationType.Success, "Done", GetIsProjectReadOnly(id) ? "Date academy order sent confirmed" : "Decision recorded"); @@ -63,19 +72,17 @@ public async Task OnPostAsync(int id) return RedirectToPage(Links.TaskList.Index.Page, new { id }); } - private async Task CreateOrUpdateDecision(int id, AdvisoryBoardDecision decision) + private async Task CreateOrUpdateDecision(int id, AdvisoryBoardDecision existingDecision, AdvisoryBoardDecision newDecision) { - var savedDecision = await advisoryBoardDecisionRepository.Get(id); - - if (savedDecision.StatusCode == HttpStatusCode.NotFound) + if (existingDecision is null) { - await advisoryBoardDecisionRepository.Create(decision); + await advisoryBoardDecisionRepository.Create(newDecision); } else { - await advisoryBoardDecisionRepository.Update(decision); + await advisoryBoardDecisionRepository.Update(newDecision); } - await academyConversionProjectRepository.UpdateProject(id, new UpdateAcademyConversionProject { ProjectStatus = decision.GetDecisionAsFriendlyName() }); + await academyConversionProjectRepository.UpdateProject(id, new UpdateAcademyConversionProject { ProjectStatus = newDecision.GetDecisionAsFriendlyName() }); } } From a933b146c72ff797d1ddbe3614b2de63386a72db Mon Sep 17 00:00:00 2001 From: plockwood Date: Mon, 14 Oct 2024 12:00:16 +0100 Subject: [PATCH 12/19] new app setting --- Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json index aa1cfc8fd..fb7556841 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json @@ -39,6 +39,7 @@ "ApplicationLinks": { "SharePointTemplateUrl": "https://educationgovuk.sharepoint.com/sites/lvewp00030/SitePages/7-Monitoring%20&%20Decision%20Making/1-Advisory%20Board/Advisory%20Board.aspx", "RevocationGuidanceLink": "https://educationgovuk.sharepoint.com/:w:/r/sites/lvedfe00116/_layouts/15/Doc.aspx?action=default&file=Revocation_Guidance_Mar24.docx&mobileredirect=true&sourcedoc=%7B563CD875-E0A4-46F0-AEC2-8C19453E24D5%7D" + "CompleteHandoverProjectList": "" }, "ApplicationInsights": { "EnableBrowserAnalytics": "No", From 2f0636b94f6cee502fd360b21baf695cbf0a9d53 Mon Sep 17 00:00:00 2001 From: plockwood Date: Mon, 14 Oct 2024 17:23:20 +0100 Subject: [PATCH 13/19] approved decision page changes --- .../Decision/DecisionApprovedInfo.cshtml | 21 ++++++++++++++++--- .../Dfe.PrepareConversions/appsettings.json | 4 ++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml index 1c29356e0..990b817e5 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml @@ -1,7 +1,9 @@ @page "/task-list/{id:int}/decision/approved-info" @using Dfe.PrepareConversions.Extensions @using Dfe.PrepareConversions.TagHelpers +@using Microsoft.Extensions.Configuration @model Dfe.PrepareConversions.Pages.TaskList.Decision.DecisionApprovedInfo +@inject IConfiguration Configuration @{ ViewData["Title"] = "Approved decision information"; Layout = "_Layout"; @@ -22,10 +24,19 @@

This project is now locked and you can cannot make changes to it.

+@if (Model.IsVoluntaryAcademyType(Model.AcademyTypeAndRoute)) +{ +

+ You can only + + enter or change the date the academy order was sent enter or change the date the academy order was sent + to the school. +

+}

What happens next

This project has been created in Complete conversions, transfers and changes.

Add handover details

-

You must add handover details to the project in complete before the project can continue.

+

You must add handover details to the project in complete before the project can continue.

You need to add:

  • which team will manage the project next
  • @@ -33,7 +44,11 @@
  • links to SharePoint folders
  • external contact details
- + + + diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json index fb7556841..0bf39a824 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json @@ -38,8 +38,8 @@ }, "ApplicationLinks": { "SharePointTemplateUrl": "https://educationgovuk.sharepoint.com/sites/lvewp00030/SitePages/7-Monitoring%20&%20Decision%20Making/1-Advisory%20Board/Advisory%20Board.aspx", - "RevocationGuidanceLink": "https://educationgovuk.sharepoint.com/:w:/r/sites/lvedfe00116/_layouts/15/Doc.aspx?action=default&file=Revocation_Guidance_Mar24.docx&mobileredirect=true&sourcedoc=%7B563CD875-E0A4-46F0-AEC2-8C19453E24D5%7D" - "CompleteHandoverProjectList": "" + "RevocationGuidanceLink": "https://educationgovuk.sharepoint.com/:w:/r/sites/lvedfe00116/_layouts/15/Doc.aspx?action=default&file=Revocation_Guidance_Mar24.docx&mobileredirect=true&sourcedoc=%7B563CD875-E0A4-46F0-AEC2-8C19453E24D5%7D", + "CompleteHandoverProjectListLink": "https://dev.complete.education.gov.uk/projects/all/handover" }, "ApplicationInsights": { "EnableBrowserAnalytics": "No", From f7a10ae01514f4585e6e1245d1aaf0a96dc97e45 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 16 Oct 2024 11:10:57 +0100 Subject: [PATCH 14/19] Display validation errors if project owner or AB date is not set --- CODEOWNERS | 2 +- .../Dfe.PrepareConversions.sln | 2 +- .../BaseAcademyConversionProjectPageModel.cs | 2 - .../RecordDecisionPreview/default.cshtml | 48 +++++++++++++++---- .../Pages/ProjectAssignment/Index.cshtml.cs | 23 +++------ .../Pages/Shared/_DateInput.cshtml | 17 +++++-- .../Pages/Shared/_ErrorSummary.cshtml | 4 ++ .../TaskList/Decision/AcademyOrderDate.cshtml | 1 - .../Decision/AcademyOrderDate.cshtml.cs | 10 ++-- .../TaskList/Decision/RecordADecision.cshtml | 14 +++--- .../Decision/RecordADecision.cshtml.cs | 27 +++++++++-- .../ProjectDates/AdvisoryBoardDate.cshtml | 5 +- .../AdvisoryBoardDate.cshtml | 2 +- .../Services/ErrorService.cs | 6 +-- .../TagHelpers/DateInputTagHelper.cs | 15 ++---- .../TagHelpers/InputTagHelperBase.cs | 5 ++ .../RecordDecisionPreviewViewComponent.cs | 4 +- .../ViewModels/DateInputViewModel.cs | 2 + .../ViewModels/ProjectViewModel.cs | 3 +- .../RecordDecisionPreviewViewModel.cs | 4 +- 20 files changed, 123 insertions(+), 73 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index d60c3200f..0a502a107 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,3 +1,3 @@ * @dneed-nimble @paullocknimble @danielryannimble @dangood84 @nwarms @elielijah321 @FahadDarw @mshakirdfe /terraform/ @DrizzlyOwl @stretch96 -Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests @cshnimble +Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests @FahadDarw diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.sln b/Dfe.PrepareConversions/Dfe.PrepareConversions.sln index 5ec32ea4c..01c88e471 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.sln +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.sln @@ -26,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.PrepareTransfers.Helper EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.PrepareTransfers.Data.TRAMS", "Dfe.PrepareTransfers.Data.TRAMS\Dfe.PrepareTransfers.Data.TRAMS.csproj", "{77D748AF-A6C5-4B3E-B2AB-5C9C68CBF91D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dfe.PrepareTransfers.Web.Tests", "Dfe.PrepareTransfers.Web.Tests\Dfe.PrepareTransfers.Web.Tests.csproj", "{9A3DEDB7-AA5E-4A4E-AA77-33DBDADD0DD0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.PrepareTransfers.Web.Tests", "Dfe.PrepareTransfers.Web.Tests\Dfe.PrepareTransfers.Web.Tests.csproj", "{9A3DEDB7-AA5E-4A4E-AA77-33DBDADD0DD0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs index 8c3e578d6..54f4e5842 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/BaseAcademyConversionProjectPageModel.cs @@ -1,6 +1,4 @@  -using Dfe.PrepareConversions.Data; -using Dfe.PrepareConversions.Data.Models; using Dfe.PrepareConversions.Data.Services; using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.ViewModels; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index 0ed36bdfa..055ecdba1 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -227,17 +227,45 @@ @(Model.IsReadOnly ? "Confirm date AO sent" : "Change your decision") } - + } else { -
-

Record a decision

-

- You have not recorded the decision for this project. You can record the decision once it has been made. -

- - Record a decision - -
+
+ @if (!(Model.HasAdvisoryBoardDate && Model.HasAssignedOwner)) + { + + } +

+ You have not recorded a decision for this project. +

+

+ You can record the decision only when the: +

    +
  • project has been assigned to somebody
  • +
  • advisory board date has been entered
  • +
  • decision has been made
  • +
+

+ @if ((Model.HasAdvisoryBoardDate && Model.HasAssignedOwner)) + { + + Record a decision + + } + else + { + + + } +
} \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectAssignment/Index.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectAssignment/Index.cshtml.cs index 6d8a16a6c..e9ae58514 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectAssignment/Index.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ProjectAssignment/Index.cshtml.cs @@ -13,17 +13,8 @@ namespace Dfe.PrepareConversions.Pages.ProjectAssignment; -public class IndexModel : PageModel +public class IndexModel(IUserRepository userRepository, IAcademyConversionProjectRepository academyConversionProjectRepository) : PageModel { - private readonly IAcademyConversionProjectRepository _academyConversionProjectRepository; - private readonly IUserRepository _userRepository; - - public IndexModel(IUserRepository userRepository, IAcademyConversionProjectRepository academyConversionProjectRepository) - { - _academyConversionProjectRepository = academyConversionProjectRepository; - _userRepository = userRepository; - } - public string SchoolName { get; private set; } public int Id { get; set; } public IEnumerable DeliveryOfficers { get; set; } @@ -31,19 +22,19 @@ public IndexModel(IUserRepository userRepository, IAcademyConversionProjectRepos public async Task OnGet(int id) { - var projectResponse = await _academyConversionProjectRepository.GetProjectById(id); + var projectResponse = await academyConversionProjectRepository.GetProjectById(id); Id = id; SchoolName = projectResponse.Body?.SchoolName; SelectedDeliveryOfficer = projectResponse.Body?.AssignedUser?.FullName; - DeliveryOfficers = await _userRepository.GetAllUsers(); + DeliveryOfficers = await userRepository.GetAllUsers(); return Page(); } public async Task OnPost(int id, string selectedName, bool unassignDeliveryOfficer, string deliveryOfficerInput) { - ApiResponse projectResponse = await _academyConversionProjectRepository.GetProjectById(id); + ApiResponse projectResponse = await academyConversionProjectRepository.GetProjectById(id); if (string.IsNullOrWhiteSpace(deliveryOfficerInput)) { selectedName = string.Empty; @@ -51,16 +42,16 @@ public async Task OnPost(int id, string selectedName, bool unassi if (unassignDeliveryOfficer) { - await _academyConversionProjectRepository.SetAssignedUser(id, new SetAssignedUserModel(id, Guid.Empty, string.Empty, string.Empty)); + await academyConversionProjectRepository.SetAssignedUser(id, new SetAssignedUserModel(id, Guid.Empty, string.Empty, string.Empty)); TempData.SetNotification(NotificationType.Success, "Done", "Project is unassigned"); } else if (!string.IsNullOrEmpty(selectedName)) { - IEnumerable deliveryOfficers = await _userRepository.GetAllUsers(); + IEnumerable deliveryOfficers = await userRepository.GetAllUsers(); var assignedUser = deliveryOfficers.SingleOrDefault(u => u.FullName == selectedName); - await _academyConversionProjectRepository.SetAssignedUser(id, new SetAssignedUserModel(id, new Guid(assignedUser.Id), assignedUser.FullName, assignedUser.EmailAddress)); + await academyConversionProjectRepository.SetAssignedUser(id, new SetAssignedUserModel(id, new Guid(assignedUser.Id), assignedUser.FullName, assignedUser.EmailAddress)); TempData.SetNotification(NotificationType.Success, "Done", "Project is assigned"); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_DateInput.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_DateInput.cshtml index a5dc69c44..e8731d22c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_DateInput.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_DateInput.cshtml @@ -45,13 +45,24 @@ @Model.AdditionalInformation

- } - - + }
@Model.Hint
+ @if (string.IsNullOrWhiteSpace(Model.DetailsHeading) is false) + { +
+ + + @Model.DetailsHeading + + +
+ @Model.DetailsBody +
+
+ } @if (showError) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ErrorSummary.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ErrorSummary.cshtml index 401ab1d93..34cd25d27 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ErrorSummary.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ErrorSummary.cshtml @@ -19,6 +19,10 @@ { @error.Message } + else @if (error.Key?.Contains("/project-assignment") ?? false) + { + @error.Message + } else if (!string.IsNullOrWhiteSpace(error.Key)) { @error.Message diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml index 6fee54b2c..aafd4a3c2 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml @@ -14,7 +14,6 @@

Date the academy order (AO) was sent

-
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs index 6f95f7736..10cbfdaf9 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AcademyOrderDate.cshtml.cs @@ -30,7 +30,6 @@ public class AcademyOrderDateModel(IAcademyConversionProjectRepository repositor public AdvisoryBoardDecision Decision { get; set; } public bool IsReadOnly { get; set; } - public string? ReturnUrl { get; set; } string IDateValidationMessageProvider.SomeMissing(string displayName, IEnumerable missingParts) { @@ -46,7 +45,7 @@ string IDateValidationMessageProvider.AllMissing(string displayName) } - public async Task OnGetAsync(int id, string? returnUrl = null) + public async Task OnGetAsync(int id) { var decision = GetDecisionFromSession(id); if (decision.Decision == null) @@ -60,13 +59,12 @@ public async Task OnGetAsync(int id, string? returnUrl = null) DecisionText = decision.Decision.ToString()?.ToLowerInvariant(); AcademyOrderDate = Decision.AcademyOrderDate; IsReadOnly = GetIsProjectReadOnly(id); - ReturnUrl = returnUrl; - SetBackLinkModel(IsReadOnly ? Links.AddLinkItem(returnUrl) : Links.Decision.DecisionDate, id); + SetBackLinkModel(IsReadOnly ? Links.TaskList.Index : Links.Decision.DecisionDate, id); return Page(); } - public async Task OnPost(int id, string? returnUrl = null) + public async Task OnPost(int id) { var decision = GetDecisionFromSession(id); decision.AcademyOrderDate = AcademyOrderDate; @@ -74,7 +72,7 @@ public async Task OnPost(int id, string? returnUrl = null) if (!ModelState.IsValid) { errorService.AddErrors(Request.Form.Keys, ModelState); - return await OnGetAsync(id, returnUrl); + return await OnGetAsync(id); } SetDecisionInSession(id, decision); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml index 96eeb8ef9..686e8578b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml @@ -1,4 +1,5 @@ @page "/task-list/{id:int}/record-a-decision" +@using Microsoft.IdentityModel.Tokens @model Dfe.PrepareConversions.Pages.TaskList.Decision.IndexModel @{ @@ -6,12 +7,11 @@ } @section BeforeMain - { - @Links.ProjectList.Index.BackText +{ +@Links.ProjectList.Index.BackText } + - - -
- @await Component.InvokeAsync("RecordDecisionPreview", new { id = int.Parse(Model?.Project.Id ?? string.Empty), AcademyTypeAndRoute = Model.Project.AcademyTypeAndRoute, isReadOnly= Model.Project.IsReadOnly }) -
+
+ @await Component.InvokeAsync("RecordDecisionPreview", new { id = int.Parse(Model?.Project.Id ?? string.Empty), AcademyTypeAndRoute = Model.Project.AcademyTypeAndRoute, isReadOnly = Model.Project.IsReadOnly, hasAssignedOwner = (Model.Project.AssignedUser != null && Model.Project.AssignedUser.EmailAddress.Length > 0), hasAdvisoryBoardDate = Model.Project.HeadTeacherBoardDate.HasValue }) +
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs index 8f14c4e2b..8fee2ccea 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs @@ -1,15 +1,14 @@ using Dfe.PrepareConversions.Data.Services; using Dfe.PrepareConversions.Models; +using Dfe.PrepareConversions.Services; using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.Decision { - public class IndexModel : BaseAcademyConversionProjectPageModel + public class IndexModel(IAcademyConversionProjectRepository repository, ErrorService errorService) : BaseAcademyConversionProjectPageModel(repository) { - public IndexModel(IAcademyConversionProjectRepository repository) : base(repository) - { - } public string ReturnPage { get; set; } public string ReturnId { get; set; } @@ -27,8 +26,28 @@ public async override Task OnGetAsync(int id) TempData["returnToFormAMatMenu"] = true; } + ValidateProject(id); + return Page(); } + + private void ValidateProject(int id) + { + if (!Project.HeadTeacherBoardDate.HasValue || Project.AssignedUser == null || Project.AssignedUser.EmailAddress.Length < 1) + { + ReturnPage = @Links.TaskList.Index.Page; + if (!Project.HeadTeacherBoardDate.HasValue) + { + errorService.AddError($"/task-list/{id}/confirm-school-trust-information-project-dates/advisory-board-date?return={ReturnPage}", + "You must enter an advisory board date before you can record a decision."); + } + if (Project.AssignedUser == null || Project.AssignedUser.EmailAddress.Length < 1) + { + errorService.AddError($"/project-assignment/{id}", + "You must enter the name of the person who worked on this project before you can reford a decison."); + } + } + } } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml index 5b83bffe7..40303f1ae 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml @@ -18,9 +18,8 @@ @if (!Model.Project.HeadTeacherBoardDate.HasValue) { - + }else{ - - + } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml index e6008e20a..a256fd93b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml @@ -16,4 +16,4 @@ } - \ No newline at end of file + \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/ErrorService.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/ErrorService.cs index be077cb02..40dc02036 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/ErrorService.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Services/ErrorService.cs @@ -1,5 +1,4 @@ using Dfe.Academisation.ExtensionMethods; -using Dfe.PrepareConversions.Extensions; using Dfe.PrepareConversions.Models; using Microsoft.AspNetCore.Mvc.ModelBinding; using System; @@ -13,7 +12,8 @@ public class ErrorService private const string API_ERROR = "There is a system problem and we could not save your changes. Contact regionalservices.rg@education.gov.uk if this continues."; - private readonly List _errors = new(); + private readonly List _errors = []; + private static readonly string[] dayUnit = ["-day", "-month", "-year"]; public void AddError(string key, string message) { @@ -80,7 +80,7 @@ private static bool IsDateInputId(string id) private static string DateInputId(string id) { - string timeUnit = new[] { "-day", "-month", "-year" }.FirstOrDefault(id.EndsWith); + string timeUnit = dayUnit.FirstOrDefault(id.EndsWith); return timeUnit is null ? id diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/DateInputTagHelper.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/DateInputTagHelper.cs index b85d3eabb..23480ac7e 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/DateInputTagHelper.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/DateInputTagHelper.cs @@ -12,15 +12,8 @@ namespace Dfe.PrepareConversions.TagHelpers; [HtmlTargetElement("govuk-date-input", TagStructure = TagStructure.WithoutEndTag)] -public class DateInputTagHelper : InputTagHelperBase +public class DateInputTagHelper(IHtmlHelper htmlHelper, ErrorService errorService) : InputTagHelperBase(htmlHelper) { - private readonly ErrorService _errorService; - - public DateInputTagHelper(IHtmlHelper htmlHelper, ErrorService errorService) : base(htmlHelper) - { - _errorService = errorService; - } - public bool HeadingLabel { get; set; } protected override async Task RenderContentAsync() @@ -48,7 +41,9 @@ private DateInputViewModel ValidateRequest() Hint = Hint, PreviousInformation = PreviousInformation, AdditionalInformation = AdditionalInformation, - DateString = date.ToDateString() + DateString = date.ToDateString(), + DetailsHeading = DetailsHeading, + DetailsBody = DetailsBody }; if (date.HasValue) @@ -58,7 +53,7 @@ private DateInputViewModel ValidateRequest() model.Year = date.Value.Year.ToString(); } - Error error = _errorService.GetError(Name); + Error error = errorService.GetError(Name); if (error is not null) { model.ErrorMessage = error.Message; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/InputTagHelperBase.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/InputTagHelperBase.cs index 01ad9c608..a2a695c44 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/InputTagHelperBase.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/TagHelpers/InputTagHelperBase.cs @@ -42,6 +42,11 @@ protected InputTagHelperBase(IHtmlHelper htmlHelper) [HtmlAttributeName("hint")] public string Hint { get; set; } + [HtmlAttributeName("details-heading")] + public string DetailsHeading { get; set; } + [HtmlAttributeName("details-body")] + public string DetailsBody { get; set; } + [ViewContext] public ViewContext ViewContext { get; set; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs index c28aa8d3b..c672701d8 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewComponents/RecordDecisionPreviewViewComponent.cs @@ -13,11 +13,11 @@ public class RecordDecisionPreviewViewComponent(IAcademyConversionAdvisoryBoardD public const string DECISION_SESSION_KEY = "Decision"; protected readonly ISession _session = session; - public async Task InvokeAsync(int id, string AcademyTypeAndRoute, bool isReadOnly) + public async Task InvokeAsync(int id, string AcademyTypeAndRoute, bool isReadOnly, bool hasAssignedOwner, bool hasAdvisoryBoardDate) { var decision = (await decisionRepository.Get(id)).Body; SetDecisionInSession(id, decision); - RecordDecisionPreviewViewModel viewModel = new(id, decision, AcademyTypeAndRoute, isReadOnly); + RecordDecisionPreviewViewModel viewModel = new(id, decision, AcademyTypeAndRoute, isReadOnly, hasAssignedOwner, hasAdvisoryBoardDate); return View(viewModel); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/DateInputViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/DateInputViewModel.cs index 1dbb4b8b7..3ee61ede9 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/DateInputViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/DateInputViewModel.cs @@ -18,4 +18,6 @@ public class DateInputViewModel public string PreviousInformation { get; set; } public string AdditionalInformation { get; set; } public string DateString { get; set; } + public string DetailsHeading { get; set; } + public string DetailsBody { get; set; } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs index 5c42c7a98..e29868749 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/ProjectViewModel.cs @@ -265,9 +265,8 @@ public ProjectViewModel(AcademyConversionProject project) protected override string TypeAndRouteValue => AcademyTypeAndRoute; - public override bool IsExternalSchoolApplication => string.IsNullOrEmpty(this.ApplicationReferenceNumber); + public override bool IsExternalSchoolApplication => string.IsNullOrEmpty(ApplicationReferenceNumber); public bool HasPermission { get; set; } public bool IsReadOnly { get; set; } - } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs index f6463b58f..202aadd9a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/ViewModels/RecordDecisionPreviewViewModel.cs @@ -2,10 +2,12 @@ namespace Dfe.PrepareConversions.ViewModels; -public class RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute, bool isReadOnly) +public class RecordDecisionPreviewViewModel(int id, AdvisoryBoardDecision decision, string academyTypeAndRoute, bool isReadOnly, bool hasAssignedOwner, bool hasAdvisoryBoardDate) { public int Id { get; set; } = id; public string AcademyTypeAndRoute { get; set; } = academyTypeAndRoute; public AdvisoryBoardDecision Decision { get; set; } = decision; public bool IsReadOnly { get; set; } = isReadOnly; + public bool HasAssignedOwner { get; set; } = hasAssignedOwner; + public bool HasAdvisoryBoardDate { get; set; } = hasAdvisoryBoardDate; } From d0c47e95620ff479e3e1795ca4c67c09326d97b9 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 16 Oct 2024 11:40:40 +0100 Subject: [PATCH 15/19] Fixed styling and wording --- .../Pages/Components/RecordDecisionPreview/default.cshtml | 1 + .../Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml | 4 ++-- .../SchoolAndTrustInformation/AdvisoryBoardDate.cshtml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml index 055ecdba1..b7e5e9f58 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/RecordDecisionPreview/default.cshtml @@ -238,6 +238,7 @@ else } +

Record a decision

You have not recorded a decision for this project.

diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml index 40303f1ae..aacd914ee 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/ProjectDates/AdvisoryBoardDate.cshtml @@ -18,8 +18,8 @@ @if (!Model.Project.HeadTeacherBoardDate.HasValue) { - + }else{ - + } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml index a256fd93b..adfffc955 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/AdvisoryBoardDate.cshtml @@ -16,4 +16,4 @@ } - \ No newline at end of file + \ No newline at end of file From be31b0ce1e53c6f57ac0cfb2f9cc763dacd82873 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 16 Oct 2024 12:47:39 +0100 Subject: [PATCH 16/19] Fixed spelling mistake --- .../Pages/TaskList/Decision/RecordADecision.cshtml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs index 8fee2ccea..12004a196 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs @@ -44,7 +44,7 @@ private void ValidateProject(int id) if (Project.AssignedUser == null || Project.AssignedUser.EmailAddress.Length < 1) { errorService.AddError($"/project-assignment/{id}", - "You must enter the name of the person who worked on this project before you can reford a decison."); + "You must enter the name of the person who worked on this project before you can record a decison."); } } } From 67351e107d919f9d8b4489bf327eac26cca555b0 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Wed, 16 Oct 2024 13:01:15 +0100 Subject: [PATCH 17/19] fixed spelling mistake --- .../Pages/TaskList/Decision/RecordADecision.cshtml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs index 12004a196..308b7b978 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/RecordADecision.cshtml.cs @@ -44,7 +44,7 @@ private void ValidateProject(int id) if (Project.AssignedUser == null || Project.AssignedUser.EmailAddress.Length < 1) { errorService.AddError($"/project-assignment/{id}", - "You must enter the name of the person who worked on this project before you can record a decison."); + "You must enter the name of the person who worked on this project before you can record a decision."); } } } From 76320e4ed52fc742dd2fb99344e1cf3f9afd3147 Mon Sep 17 00:00:00 2001 From: plockwood Date: Wed, 16 Oct 2024 16:26:24 +0100 Subject: [PATCH 18/19] commiting help link to appsettings so release can go ahead --- Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json index 0bf39a824..e924ec62f 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/appsettings.json @@ -56,5 +56,6 @@ "Sharepoint": { "Enabled": false, "Url": "" - } + }, + "GetHelpLink": "https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-X7F89QcWu5CjlJXwF0TVktUMTFEUVRCVVg4WlMyS1AzUEJSUDAySlhQTCQlQCN0PWcu" } From 03164cb431a5529274f7fab4672ef1cfa7d425b3 Mon Sep 17 00:00:00 2001 From: "SHAKIR, Muhammad" Date: Fri, 18 Oct 2024 10:02:21 +0100 Subject: [PATCH 19/19] Fixed test --- ...IntegrationTestingWebApplicationFactory.cs | 1 - .../Pages/BaseIntegrationTests.MockData.cs | 2 ++ .../Decision/SummaryIntegrationTests.cs | 7 +++---- .../TaskList/Decision/AnyConditions.cshtml.cs | 16 ++++------------ .../Decision/DecisionApprovedInfo.cshtml.cs | 19 ++++--------------- .../TaskList/Decision/WhoDecided.cshtml.cs | 2 +- 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/IntegrationTestingWebApplicationFactory.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/IntegrationTestingWebApplicationFactory.cs index 367f267dd..82b7ab469 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/IntegrationTestingWebApplicationFactory.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/IntegrationTestingWebApplicationFactory.cs @@ -109,7 +109,6 @@ public void AddGetWithJsonResponse(string path, TResponseBody res .WithBody(JsonConvert.SerializeObject(responseBody))); } - public void AddPatchWithJsonRequest(string path, TRequestBody requestBody, TResponseBody responseBody) { _mockApiServer diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs index cbeeb8cb3..ad86a26d3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs @@ -80,6 +80,8 @@ public AcademyConversionProject AddGetProject(Action p .Build() .With(x => x.AcademyTypeAndRoute, AcademyTypeAndRoutes.Voluntary) .With(x => x.IsReadOnly, isReadOnly) + .With(x => x.HeadTeacherBoardDate, DateTime.Now.AddDays(-1)) + .With(x => x.AssignedUser, _fixture.Create()) .Create(); postSetup?.Invoke(project); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Decision/SummaryIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Decision/SummaryIntegrationTests.cs index dc4a3b9c0..3fd22fe93 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Decision/SummaryIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/TaskList/Decision/SummaryIntegrationTests.cs @@ -22,6 +22,7 @@ public class SummaryIntegrationTests(IntegrationTestingWebApplicationFactory fac private string PageSubHeading => Document.QuerySelector("[data-test='prepare-project-doc']")?.Text().Trim(); private string NotificationMessage => Document.QuerySelector("#notification-message")?.Text().Trim(); private string NotificationBannerTitle => Document.QuerySelector("#govuk-notification-banner-title")!.Text().Trim(); + [Fact] public async Task Should_redirect_to_task_list() @@ -63,15 +64,13 @@ public async Task Should_populate_summary_and_create_new_decision() ConversionProjectId = _project.Id }; - _factory.AddPostWithJsonRequest("/conversion-project/advisory-board-decision", request, new AdvisoryBoardDecision()); + _factory.AddPostWithJsonRequest("/conversion-project/advisory-board-decision", request, new AdvisoryBoardDecision()); await _wizard.StartFor(_project.Id); await _wizard.SubmitThroughTheWizard(request); await _wizard.ClickSubmitButton(); - Document.Url.Should().EndWith($"/task-list/{_project.Id}"); - NotificationMessage.Should().Be("Decision recorded"); - NotificationBannerTitle.Should().Be("Done"); + Document.Url.Should().EndWith($"/task-list/{_project.Id}/decision/approved-info"); } [Fact] diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AnyConditions.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AnyConditions.cshtml.cs index a9df8d93c..e63711337 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AnyConditions.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/AnyConditions.cshtml.cs @@ -9,18 +9,10 @@ namespace Dfe.PrepareConversions.Pages.TaskList.Decision; -public class AnyConditionsModel : DecisionBaseModel +public class AnyConditionsModel(IAcademyConversionProjectRepository repository, + ISession session, + ErrorService errorService) : DecisionBaseModel(repository, session) { - private readonly ErrorService _errorService; - - public AnyConditionsModel(IAcademyConversionProjectRepository repository, - ISession session, - ErrorService errorService) - : base(repository, session) - { - _errorService = errorService; - } - [BindProperty] [Required(ErrorMessage = "Select whether any conditions were set")] public bool? ApprovedConditionsSet { get; set; } @@ -58,7 +50,7 @@ public IActionResult OnPost(int id) return RedirectToPage(Links.Decision.DecisionMaker.Page, LinkParameters); } - _errorService.AddErrors(ModelState.Keys, ModelState); + errorService.AddErrors(ModelState.Keys, ModelState); return OnGet(id); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs index 447013adc..a0dc9007a 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionApprovedInfo.cshtml.cs @@ -4,31 +4,20 @@ using Dfe.PrepareConversions.Data.Services.Interfaces; using Dfe.PrepareConversions.Models; using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; -using Dfe.PrepareConversions.Services; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using System; using System.Threading.Tasks; namespace Dfe.PrepareConversions.Pages.TaskList.Decision { - public class DecisionApprovedInfo : DecisionBaseModel + public class DecisionApprovedInfo(IAcademyConversionProjectRepository repository, + IAcademyConversionAdvisoryBoardDecisionRepository advisoryBoardDecisionRepository, + ISession session) : DecisionBaseModel(repository, session) { - private readonly ErrorService _errorService; - private readonly IAcademyConversionAdvisoryBoardDecisionRepository _advisoryBoardDecisionRepository; - public DecisionApprovedInfo(ErrorService errorService, - IAcademyConversionProjectRepository repository, - IAcademyConversionAdvisoryBoardDecisionRepository advisoryBoardDecisionRepository, - ISession session) : base(repository, session) - { - _errorService = errorService; - _advisoryBoardDecisionRepository = advisoryBoardDecisionRepository; - } - public AdvisoryBoardDecision Decision { get; set; } public async Task OnGetAsync(int id) { - ApiResponse savedDecision = await _advisoryBoardDecisionRepository.Get(id); + ApiResponse savedDecision = await advisoryBoardDecisionRepository.Get(id); if(savedDecision.Success) Decision = savedDecision.Body; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/WhoDecided.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/WhoDecided.cshtml.cs index bf47b18e3..a2cd7e1a3 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/WhoDecided.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/WhoDecided.cshtml.cs @@ -47,7 +47,7 @@ public IActionResult OnPost(int id) { if (!ModelState.IsValid) { - _errorService.AddErrors(new[] { "DecisionMadeBy" }, ModelState); + _errorService.AddErrors(["DecisionMadeBy"], ModelState); return OnGet(id); }