diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/Sites/GetProjectSitesResponse.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/Sites/GetProjectSitesResponse.cs index e4906f69b..2e220a9e6 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/Sites/GetProjectSitesResponse.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Contracts/Project/Sites/GetProjectSitesResponse.cs @@ -11,5 +11,6 @@ public class GetProjectSitesResponse public ProjectSite PermanentSite { get; set; } = new(); public ProjectSite TemporarySite { get; set; } = new(); public string SchoolName { get; set; } + public string ProjectType { get; set; } } } diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Integration/ProjectSiteApiTests.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Integration/ProjectSiteApiTests.cs index b8ee5c6a0..749454520 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Integration/ProjectSiteApiTests.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API.Tests/Integration/ProjectSiteApiTests.cs @@ -1,4 +1,5 @@ -using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Sites; +using Dfe.ManageFreeSchoolProjects.API.Contracts.Project; +using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Sites; using Dfe.ManageFreeSchoolProjects.API.Contracts.ResponseModels; using Dfe.ManageFreeSchoolProjects.API.Tests.Fixtures; using Dfe.ManageFreeSchoolProjects.API.Tests.Helpers; @@ -22,6 +23,8 @@ public async Task When_SitesDoNotExist_Returns_200() var project = DatabaseModelBuilder.BuildProject(); var projectId = project.ProjectStatusProjectId; + project.ProjectStatusFreeSchoolApplicationWave = DatabaseModelBuilder.CreateProjectWave(ProjectType.PresumptionRoute); + using var context = _testFixture.GetContext(); context.Kpi.Add(project); await context.SaveChangesAsync(); @@ -46,6 +49,7 @@ public async Task When_SitesDoNotExist_Returns_200() AssertionHelper.AssertProjectSite(actualTemporarySite, updateTemporarySiteRequest); content.Data.SchoolName.Should().Be(project.ProjectStatusCurrentFreeSchoolName); + content.Data.ProjectType.Should().Be("Presumption"); } [Fact] @@ -54,6 +58,8 @@ public async Task When_SitesExist_Returns_200() var project = DatabaseModelBuilder.BuildProject(); var projectId = project.ProjectStatusProjectId; + project.ProjectStatusFreeSchoolApplicationWave = DatabaseModelBuilder.CreateProjectWave(ProjectType.PresumptionRoute); + using var context = _testFixture.GetContext(); context.Kpi.Add(project); await context.SaveChangesAsync(); @@ -78,6 +84,8 @@ public async Task When_SitesExist_Returns_200() AssertionHelper.AssertProjectSite(actualPermanentSite, updatePermanentSiteRequest); AssertionHelper.AssertProjectSite(actualTemporarySite, updateTemporarySiteRequest); + + content.Data.ProjectType.Should().Be("Presumption"); } [Fact] @@ -86,6 +94,8 @@ public async Task When_SiteNotConfigured_Returns_200() var project = DatabaseModelBuilder.BuildProject(); var projectId = project.ProjectStatusProjectId; + project.ProjectStatusFreeSchoolApplicationWave = DatabaseModelBuilder.CreateProjectWave(ProjectType.PresumptionRoute); + using var context = _testFixture.GetContext(); context.Kpi.Add(project); await context.SaveChangesAsync(); @@ -97,6 +107,8 @@ public async Task When_SiteNotConfigured_Returns_200() AssertBlankSite(content.Data.PermanentSite); AssertBlankSite(content.Data.TemporarySite); + + content.Data.ProjectType.Should().Be("Presumption"); } [Fact] diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/Sites/GetProjectSitesService.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/Sites/GetProjectSitesService.cs index 9fc041530..3a5310d38 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/Sites/GetProjectSitesService.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.API/UseCases/Project/Sites/GetProjectSitesService.cs @@ -1,4 +1,5 @@ -using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Sites; +using Dfe.ManageFreeSchoolProjects.API.Contracts.Project; +using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Sites; using Dfe.ManageFreeSchoolProjects.API.Exceptions; using Dfe.ManageFreeSchoolProjects.Data; using Dfe.ManageFreeSchoolProjects.Data.Entities.Existing; @@ -41,11 +42,17 @@ public async Task Execute(Kpi project) var permanentSite = sites.FirstOrDefault(p => p.IsPermanentSite()); var temporarySite = sites.FirstOrDefault(p => p.IsTemporarySite()); + var projectType = + project.ProjectStatusFreeSchoolApplicationWave == "FS - Presumption" + ? "Presumption" + : "Central Route"; + var result = new GetProjectSitesResponse() { PermanentSite = MapToSite(permanentSite), TemporarySite = MapToSite(temporarySite), SchoolName = project.ProjectStatusCurrentFreeSchoolName, + ProjectType = projectType, }; return result; diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/project-sites.cy.ts b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/project-sites.cy.ts index 9e479f2ff..d1b92359d 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/project-sites.cy.ts +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/project-sites.cy.ts @@ -7,7 +7,7 @@ import editSiteInformationPage from "cypress/pages/siteInformation/editSiteInfor import viewSiteInformationPage from "cypress/pages/siteInformation/viewSiteInformationPage"; import validationComponent from "cypress/pages/validationComponent"; -describe("Testing the setting up of project sites", () => { +describe("Testing the setting up of project sites - presumption route", () => { let project: ProjectDetailsRequest; beforeEach(() => { @@ -150,4 +150,51 @@ describe("Testing the setting up of project sites", () => { .hasTemporarySiteAddress("Alternative temporary site", "Alternative temporary street", "Alternative temporary town") .hasTemporarySitePostcode("TE1 3RD"); }); + +}); + +describe("Testing the setting up of project sites - central route", () => { + let project: ProjectDetailsRequest; + beforeEach(() => { + cy.login(); + + project = RequestBuilder.createProjectDetailsCentralRoute(); + + projectApi + .post({ + projects: [project], + }) + .then(() => { + cy.visit(`/projects/${project.projectId}/overview`); + }); + }); + + it("Should be not allow user to able to edit the project sites for a central route project", () => { + Logger.log("When there are no project sites should display empty"); + projectOverviewPage + .hasTemporarySiteAddress("Empty", "", "") + .hasTemporarySitePostcode("Empty") + .hasPermanentSiteAddress("Empty", "", "") + .hasPermanentSitePostcode("Empty"); + + projectOverviewPage.changeSiteInformation(); + + viewSiteInformationPage + .hasSchoolName(project.schoolName) + .checkInsetTextExists() + .hasTemporarySiteAddress("Empty", "", "") + .hasTemporarySitePostcode("Empty") + .hasTemporarySiteDatePlanningPermissionObtained("Empty") + .hasTemporarySiteStartDateOfOccupation("Empty") + .changeTemporarySiteShouldNotExist() + .hasPermanentSiteAddress("Empty", "", "") + .hasPermanentSitePostcode("Empty") + .hasPermanentSiteDatePlanningPermissionObtained("Empty") + .hasPermanentSiteStartDateOfOccupation("Empty") + .changePermanentSiteShouldNotExist(); + + cy.executeAccessibilityTests(); + + }); + }); \ No newline at end of file diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/siteInformation/viewSiteInformationPage.ts b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/siteInformation/viewSiteInformationPage.ts index a23215f52..f770fc1f1 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/siteInformation/viewSiteInformationPage.ts +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/siteInformation/viewSiteInformationPage.ts @@ -66,6 +66,24 @@ export class ViewSiteInformationPage { return this; } + public checkInsetTextExists() { + cy.getByTestId("central-route-hint").should("exist"); + + return this; + } + + public changeTemporarySiteShouldNotExist(): this { + cy.getById("change-temporary-site").should("not.exist"); + + return this; + } + + public changePermanentSiteShouldNotExist(): this { + cy.getById("change-permanent-site").should("not.exist"); + + return this; + } + public backToProject(): this { cy.get(".govuk-back-link").click(); diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/EditSiteInformation.cshtml.cs b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/EditSiteInformation.cshtml.cs index 9ea5782f5..68c34944a 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/EditSiteInformation.cshtml.cs +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/EditSiteInformation.cshtml.cs @@ -69,8 +69,14 @@ public EditSiteInformationModel( public async Task OnGet() { + var sites = await _getProjectSitesService.Execute(ProjectId); + if(sites.ProjectType == "Central Route") + { + return new NotFoundResult(); + } + var site = GetProjectSite(sites); AddressLine1 = site.Address.AddressLine1; diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/ViewSiteInformation.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/ViewSiteInformation.cshtml index 428128864..58490fe18 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/ViewSiteInformation.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/ViewSiteInformation.cshtml @@ -4,14 +4,15 @@ @model Dfe.ManageFreeSchoolProjects.Pages.Project.SiteInformation.ViewSiteInformationModel @{ var backLink = string.Format(RouteConstants.ProjectOverview, Model.ProjectId); - var editPermanentSite = string.Format(RouteConstants.EditPermanentSiteInformation, Model.ProjectId); - var editTemporarySite = string.Format(RouteConstants.EditTemporarySiteInformation, Model.ProjectId); + var projectType = Model.SiteInformation.ProjectType; + var editPermanentSite = projectType == "Central Route" ? "" : string.Format(RouteConstants.EditPermanentSiteInformation, Model.ProjectId); + var editTemporarySite = projectType == "Central Route" ? "" : string.Format(RouteConstants.EditTemporarySiteInformation, Model.ProjectId); ViewData["Title"] = $"Site information - {Model.SiteInformation.SchoolName}"; } @section BeforeMain { } @@ -20,5 +21,14 @@ Site information - - \ No newline at end of file +@{ + if (projectType == "Central Route") + { +
+ Site information is in the Construct system for central route projects. Contact Education Estates to access it. +
+ } +} + + + \ No newline at end of file diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/_SiteDetails.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/_SiteDetails.cshtml index 7c47cab10..a32430a1c 100644 --- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/_SiteDetails.cshtml +++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/SiteInformation/_SiteDetails.cshtml @@ -3,11 +3,14 @@