diff --git a/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Request/InternalProjectToUpdateMapper.cs b/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Request/InternalProjectToUpdateMapper.cs index 73f4ff3ec..7b554fb30 100644 --- a/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Request/InternalProjectToUpdateMapper.cs +++ b/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Request/InternalProjectToUpdateMapper.cs @@ -136,7 +136,13 @@ public static TransferringAcademyGeneralInformationUpdate TransferringAcademyGen { TransferringAcademyUkprn = input.OutgoingAcademyUkprn, PFIScheme = input.PFIScheme ?? string.Empty, - PFISchemeDetails = input.PFISchemeDetails ?? string.Empty + PFISchemeDetails = input.PFISchemeDetails ?? string.Empty, + DistanceFromAcademyToTrustHq = input.DistanceFromAcademyToTrustHq?.ToString() ?? string.Empty, + DistanceFromAcademyToTrustHqDetails = input.DistanceFromAcademyToTrustHqDetails ?? string.Empty, + ViabilityIssues = input.ViabilityIssues ?? string.Empty, + FinancialDeficit = input.FinancialDeficit ?? string.Empty, + MPNameAndParty = input.MPNameAndParty ?? string.Empty, + PublishedAdmissionNumber = input.PublishedAdmissionNumber ?? string.Empty }; } public static AcademyTransferProjectBenefits Benefits(Project input) diff --git a/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Response/AcademisationProjectMapper.cs b/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Response/AcademisationProjectMapper.cs index 69450c5a3..833c0783f 100644 --- a/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Response/AcademisationProjectMapper.cs +++ b/Dfe.PrepareTransfers.Data.TRAMS/Mappers/Response/AcademisationProjectMapper.cs @@ -59,7 +59,13 @@ private static List TransferringAcademies(AcademisationProj KeyStage4PerformanceAdditionalInformation = transfer.KeyStage4PerformanceAdditionalInformation, KeyStage5PerformanceAdditionalInformation = transfer.KeyStage5PerformanceAdditionalInformation, PFIScheme = transfer.PFIScheme, - PFISchemeDetails = transfer.PFISchemeDetails + PFISchemeDetails = transfer.PFISchemeDetails, + DistanceFromAcademyToTrustHq = transfer.DistanceFromAcademyToTrustHq, + DistanceFromAcademyToTrustHqDetails = transfer.DistanceFromAcademyToTrustHqDetails, + ViabilityIssues = transfer.ViabilityIssues, + FinancialDeficit = transfer.FinancialDeficit, + MPNameAndParty = transfer.MPNameAndParty, + PublishedAdmissionNumber = transfer.PublishedAdmissionNumber } ) .ToList(); diff --git a/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademy.cs b/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademy.cs index 6fdddc690..a29384a5c 100644 --- a/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademy.cs +++ b/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademy.cs @@ -16,6 +16,12 @@ public class TransferringAcademy public string KeyStage5PerformanceAdditionalInformation { get; set; } public string PFIScheme { get; set; } public string PFISchemeDetails { get; set; } + public string ViabilityIssues { get; set; } + public string FinancialDeficit { get; set; } + public string MPNameAndParty { get; set; } + public string DistanceFromAcademyToTrustHq { get; set; } + public string DistanceFromAcademyToTrustHqDetails { get; set; } + public string PublishedAdmissionNumber { get; set; } } } \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademyGeneralInformationUpdate.cs b/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademyGeneralInformationUpdate.cs index 02cb776e8..c1656437c 100644 --- a/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademyGeneralInformationUpdate.cs +++ b/Dfe.PrepareTransfers.Data.TRAMS/Models/AcademyTransferProject/TransferringAcademyGeneralInformationUpdate.cs @@ -5,6 +5,12 @@ public class TransferringAcademyGeneralInformationUpdate public string TransferringAcademyUkprn { get; set; } public string PFIScheme { get; set; } public string PFISchemeDetails { get; set; } + public string DistanceFromAcademyToTrustHq { get; set; } + public string DistanceFromAcademyToTrustHqDetails { get; set; } + public string ViabilityIssues { get; set; } + public string FinancialDeficit { get; set; } + public string MPNameAndParty { get; set; } + public string PublishedAdmissionNumber { get; set; } } } \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Data/Models/Academy.cs b/Dfe.PrepareTransfers.Data/Models/Academy.cs index c19b39914..79a0e560e 100644 --- a/Dfe.PrepareTransfers.Data/Models/Academy.cs +++ b/Dfe.PrepareTransfers.Data/Models/Academy.cs @@ -25,6 +25,12 @@ public Academy() public string FaithSchool { get; set; } public string PFIScheme { get; set; } public string PFISchemeDetails { get; set; } + public string ViabilityIssues { get; set; } + public string FinancialDeficit { get; set; } + public string MPNameAndParty { get; set; } + public string DistanceFromAcademyToTrustHq { get; set; } + public string DistanceFromAcademyToTrustHqDetails { get; set; } + public string PublishedAdmissionNumber { get; set; } public GeneralInformation GeneralInformation { get; set; } public PupilNumbers PupilNumbers { get; set; } public LatestOfstedJudgement LatestOfstedJudgement { get; set; } diff --git a/Dfe.PrepareTransfers.Data/Models/Projects/TransferringAcademy.cs b/Dfe.PrepareTransfers.Data/Models/Projects/TransferringAcademy.cs index 623534999..2ad61b616 100644 --- a/Dfe.PrepareTransfers.Data/Models/Projects/TransferringAcademy.cs +++ b/Dfe.PrepareTransfers.Data/Models/Projects/TransferringAcademy.cs @@ -15,6 +15,12 @@ public class TransferringAcademy public string OutgoingAcademyUrn { get; set; } public string? PFIScheme { get; set; } public string? PFISchemeDetails { get; set; } + public string? DistanceFromAcademyToTrustHq { get; set; } + public string? DistanceFromAcademyToTrustHqDetails{ get; set; } + public string? ViabilityIssues { get; set; } + public string? FinancialDeficit { get; set; } + public string? MPNameAndParty { get; set; } + public string? PublishedAdmissionNumber { get; set; } public string PupilNumbersAdditionalInformation { get; set; } public string LatestOfstedReportAdditionalInformation { get; set; } diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml new file mode 100644 index 000000000..02c7a7650 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml @@ -0,0 +1,69 @@ +@page "/project/{urn}/general-information/{academyUkprn}/distance-from-trust"; + +@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation.DistanceFromTrustModel + +@{ + ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "How far is the converting school from the trust"; + Layout = "_Layout"; + + var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error"; +} + +@section BeforeMain +{ + + Back + + +} + +
+ + +
+
+ +
+
+ +

+ + @Model.AcademyName + + How far is the transferring academies from the trust or other academies in the trust? +

+

Use the academy and trust's postcodes to measure the distance on Bing or Google maps.

+
+ For example, 20 +
+ +
+
+
+ + +
+
+ + +
+ This information will go into your project template under the academy overview section. +
+ + +
+ + +
+
+ +
diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml.cs new file mode 100644 index 000000000..f31d2efc9 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/DistanceFromTrust.cshtml.cs @@ -0,0 +1,84 @@ +using Dfe.PrepareTransfers.Data; +using Dfe.PrepareTransfers.Web.Models; +using Dfe.PrepareTransfers.Web.Models.Forms; +using Dfe.PrepareTransfers.Web.Services.Interfaces; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using System.Threading.Tasks; + +namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation +{ + public class DistanceFromTrustModel : CommonPageModel + { + public string AcademyName { get; set; } + + [BindProperty] public string DistanceToTrust { get; set; } + [BindProperty] public string DistanceFromAcademyToTrustHqDetails { get; set; } + + public bool IsPreview { get; set; } + + [BindProperty(SupportsGet = true)] public string AcademyUkprn { get; set; } + + private readonly IGetInformationForProject _getInformationForProject; + private readonly IProjects _projectsRepository; + + public DistanceFromTrustModel(IGetInformationForProject getInformationForProject, IProjects projectsRepository) + { + _getInformationForProject = getInformationForProject; + _projectsRepository = projectsRepository; + } + + public async Task OnGetAsync() + { + var projectInformation = await _getInformationForProject.Execute(Urn); + var academy = projectInformation.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + + OutgoingAcademyUrn = academy.Urn; + AcademyName = academy.Name; + DistanceToTrust = academy.DistanceFromAcademyToTrustHq; + DistanceFromAcademyToTrustHqDetails = academy.DistanceFromAcademyToTrustHqDetails; + + return Page(); + } + + public async Task OnPostAsync() + { + + if (string.IsNullOrEmpty(DistanceToTrust)) + { + ModelState.AddModelError(nameof(DistanceToTrust), "Please provide distance to trust."); + } + else if (!decimal.TryParse(DistanceToTrust, out var distanceToTrust)) + { + ModelState.AddModelError(nameof(DistanceToTrust), "Please provide a valid distance to trust."); + } + else + { + DistanceToTrust = distanceToTrust.ToString(); + } + + if (!ModelState.IsValid) + { + // Return the current page with validation errors + return Page(); + } + + var model = await _projectsRepository.GetByUrn(Urn); + + var academy = model.Result.TransferringAcademies.First(a => a.OutgoingAcademyUkprn == AcademyUkprn); + + academy.DistanceFromAcademyToTrustHq = DistanceToTrust; + academy.DistanceFromAcademyToTrustHqDetails = DistanceFromAcademyToTrustHqDetails; + + await _projectsRepository.UpdateAcademyGeneralInformation(model.Result.Urn, academy); + + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } + + return Redirect($"/project/{Urn}/general-information/{AcademyUkprn}"); + } + + } +} \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml new file mode 100644 index 000000000..b2bce92b8 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml @@ -0,0 +1,65 @@ +@page "/project/{urn}/general-information/{academyUkprn}/financial-deficit"; + +@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation.FinancialDeficitModel + +@{ + ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Financial Deficit"; + Layout = "_Layout"; + + var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error"; +} + +@section BeforeMain +{ + + Back + + +} + +
+ + +
+
+ +
+
+ +

+ + @Model.AcademyName + + Is there a financial deficit at the academy in its current financial year? +

+
+
+
+
+ + +
+ +
+ + +
+
+ +
+
+
+
+ +
diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml.cs new file mode 100644 index 000000000..0caa67a83 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/FinancialDeficit.cshtml.cs @@ -0,0 +1,73 @@ +using Dfe.PrepareTransfers.Data; +using Dfe.PrepareTransfers.Web.Models; +using Dfe.PrepareTransfers.Web.Models.Forms; +using Dfe.PrepareTransfers.Web.Services.Interfaces; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using System.Threading.Tasks; + +namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation +{ + public class FinancialDeficitModel : CommonPageModel + { + public string AcademyName { get; set; } + + public bool IsPreview { get; set; } + + [BindProperty] + public bool? YesChecked { get; set; } + + [BindProperty(SupportsGet = true)] public string AcademyUkprn { get; set; } + + private readonly IGetInformationForProject _getInformationForProject; + private readonly IProjects _projectsRepository; + + public FinancialDeficitModel(IGetInformationForProject getInformationForProject, IProjects projectsRepository) + { + _getInformationForProject = getInformationForProject; + _projectsRepository = projectsRepository; + } + + public async Task OnGetAsync() + { + var projectInformation = await _getInformationForProject.Execute(Urn); + var academy = projectInformation.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + var pupilNumbers = academy.PupilNumbers; + YesChecked = academy.FinancialDeficit?.ToLower().Contains("yes") ?? false; + + OutgoingAcademyUrn = academy.Urn; + AcademyName = academy.Name; + return Page(); + } + + public async Task OnPostAsync() + { + if (!YesChecked.HasValue) + { + ModelState.AddModelError("Financial Deficit", "Please select an option."); + } + + if (!ModelState.IsValid) + { + // Return the current page with validation errors + return Page(); + } + + var model = await _projectsRepository.GetByUrn(Urn); + + var academy = model.Result.TransferringAcademies.First(a => a.OutgoingAcademyUkprn == AcademyUkprn); + + academy.FinancialDeficit = YesChecked == true ? "Yes " : "No"; + + await _projectsRepository.UpdateAcademyGeneralInformation(model.Result.Urn, academy); + + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } + + return Redirect($"/project/{Urn}/general-information/{AcademyUkprn}"); + } + + } +} \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/Index.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/Index.cshtml.cs index 968d67ec1..8fba7de1c 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/Index.cshtml.cs +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/Index.cshtml.cs @@ -50,14 +50,14 @@ public async Task OnGetAsync(string urn) Capacity = generalInformation.Capacity; NumberOnRoll = $"{generalInformation.NumberOnRoll} ({generalInformation.PercentageFull})"; FreeSchoolMeals = generalInformation.PercentageFsm; - PublishedAdmissionNumber = generalInformation.Pan; + PublishedAdmissionNumber = academy.PublishedAdmissionNumber; PrivateFinanceInitiative = $"{academy.PFIScheme} {academy.PFISchemeDetails}"; - ViabilityIssues = generalInformation.ViabilityIssue; - FinancialDeficit = generalInformation.Deficit; + ViabilityIssues = academy.ViabilityIssues; + FinancialDeficit = academy.FinancialDeficit; SchoolType = generalInformation.SchoolType; DiocesePercent = generalInformation.DiocesesPercent; - DistanceFromAcademyToTrustHq = generalInformation.DistanceToSponsorHq; - MP = generalInformation.MpAndParty; + DistanceFromAcademyToTrustHq = $"{academy.DistanceFromAcademyToTrustHq?.ToString()} {academy.DistanceFromAcademyToTrustHqDetails}"; + MP = academy.MPNameAndParty; Urn = urn; GIASLastChangedDate = "N/A"; if (academy.LastChangedDate.IsNullOrEmpty() is false) diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml new file mode 100644 index 000000000..960e25c02 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml @@ -0,0 +1,59 @@ +@page "/project/{urn}/general-information/{academyUkprn}/enter-MP-name-and-political-party"; + +@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation.MPNameAndPartyModel + +@{ + ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Enter the name of the MP and their political party"; + Layout = "_Layout"; + + var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error"; +} + +@section BeforeMain +{ + + Back + + +} + +
+ + +
+
+ +
+
+ +

+ + @Model.AcademyName + + Enter the name of the MP and their political party +

+

Use the school and trust's postcodes to measure the distance on Bing or Google maps. They Work For You (opens in a new tab)

+ +

Academy postcode

+

@Model.AcademyPostCode

+ +
+
+ + +
+ +
+
+
+ +
diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml.cs new file mode 100644 index 000000000..68248091f --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/MPNameAndParty.cshtml.cs @@ -0,0 +1,73 @@ +using Dfe.PrepareTransfers.Data; +using Dfe.PrepareTransfers.Web.Models; +using Dfe.PrepareTransfers.Web.Services.Interfaces; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using System.Threading.Tasks; + +namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation +{ + public class MPNameAndPartyModel : CommonPageModel + { + public string AcademyName { get; set; } + + [BindProperty] public string MPNameAndParty { get; set; } + + public bool IsPreview { get; set; } + + [BindProperty(SupportsGet = true)] public string AcademyUkprn { get; set; } + [BindProperty(SupportsGet = true)] public string AcademyPostCode { get; set; } + + private readonly IGetInformationForProject _getInformationForProject; + private readonly IProjects _projectsRepository; + + public MPNameAndPartyModel(IGetInformationForProject getInformationForProject, IProjects projectsRepository) + { + _getInformationForProject = getInformationForProject; + _projectsRepository = projectsRepository; + } + + public async Task OnGetAsync() + { + var projectInformation = await _getInformationForProject.Execute(Urn); + var academy = projectInformation.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + + OutgoingAcademyUrn = academy.Urn; + AcademyName = academy.Name; + AcademyPostCode = academy.Address.Last() ?? ""; + MPNameAndParty = academy.MPNameAndParty; + + return Page(); + } + + public async Task OnPostAsync() + { + if (string.IsNullOrEmpty(MPNameAndParty)) + { + ModelState.AddModelError("MP (Party)", "Please provide MP (Party)."); + } + + if (!ModelState.IsValid) + { + // Return the current page with validation errors + return Page(); + } + + var model = await _projectsRepository.GetByUrn(Urn); + + var academy = model.Result.TransferringAcademies.First(a => a.OutgoingAcademyUkprn == AcademyUkprn); + + academy.MPNameAndParty = MPNameAndParty; + + await _projectsRepository.UpdateAcademyGeneralInformation(model.Result.Urn, academy); + + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } + + return Redirect($"/project/{Urn}/general-information/{AcademyUkprn}"); + } + + } +} \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PFIScheme.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PFIScheme.cshtml index e652e9ff8..a38aab805 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PFIScheme.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PFIScheme.cshtml @@ -35,7 +35,7 @@ @Model.AcademyName - Is your school part of a PFI (Private Finance Initiative) scheme? + Is your academy part of a PFI (Private Finance Initiative) scheme?
@@ -71,4 +71,5 @@
+ diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml new file mode 100644 index 000000000..850bc3efe --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml @@ -0,0 +1,60 @@ +@page "/project/{urn}/general-information/{academyUkprn}/published-admission-number"; + +@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation.PublishedAdmissionNumberModel + +@{ + ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Update the academy's published admission number (PAN) if it's not correct"; + Layout = "_Layout"; + + var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error"; +} + +@section BeforeMain +{ + + Back + + +} + +
+ + +
+
+ +
+
+ +

+ + @Model.AcademyName + + Update the academy's published admission number (PAN) if it's not correct +

+
+ For example, 20 +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+ +
diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml.cs new file mode 100644 index 000000000..0d0d88e8f --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/PublishedAdmissionNumber.cshtml.cs @@ -0,0 +1,80 @@ +using Dfe.PrepareTransfers.Data; +using Dfe.PrepareTransfers.Web.Models; +using Dfe.PrepareTransfers.Web.Models.Forms; +using Dfe.PrepareTransfers.Web.Services.Interfaces; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using System.Threading.Tasks; + +namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation +{ + public class PublishedAdmissionNumberModel : CommonPageModel + { + public string AcademyName { get; set; } + + [BindProperty] public string PublishedAdmissionNumber { get; set; } + + public bool IsPreview { get; set; } + + [BindProperty(SupportsGet = true)] public string AcademyUkprn { get; set; } + + private readonly IGetInformationForProject _getInformationForProject; + private readonly IProjects _projectsRepository; + + public PublishedAdmissionNumberModel(IGetInformationForProject getInformationForProject, IProjects projectsRepository) + { + _getInformationForProject = getInformationForProject; + _projectsRepository = projectsRepository; + } + + public async Task OnGetAsync() + { + var projectInformation = await _getInformationForProject.Execute(Urn); + var academy = projectInformation.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + + OutgoingAcademyUrn = academy.Urn; + AcademyName = academy.Name; + PublishedAdmissionNumber = academy.PublishedAdmissionNumber; + + return Page(); + } + + public async Task OnPostAsync() + { + if (string.IsNullOrEmpty(PublishedAdmissionNumber)) + { + ModelState.AddModelError("Published Admission Number", "Please provide a published admission number"); + } + else if (!int.TryParse(PublishedAdmissionNumber, out var publishedAdmissionNumber)) + { + ModelState.AddModelError("Published Admission Number", "Please provide a valid published admission number."); + } + else + { + PublishedAdmissionNumber = publishedAdmissionNumber.ToString(); + } + + if (!ModelState.IsValid) + { + // Return the current page with validation errors + return Page(); + } + + var model = await _projectsRepository.GetByUrn(Urn); + + var academy = model.Result.TransferringAcademies.First(a => a.OutgoingAcademyUkprn == AcademyUkprn); + + academy.PublishedAdmissionNumber = PublishedAdmissionNumber; + + await _projectsRepository.UpdateAcademyGeneralInformation(model.Result.Urn, academy); + + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } + + return Redirect($"/project/{Urn}/general-information/{AcademyUkprn}"); + } + + } +} \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml new file mode 100644 index 000000000..cbb085b61 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml @@ -0,0 +1,65 @@ +@page "/project/{urn}/general-information/{academyUkprn}/viability-issues"; + +@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation.ViabilityIssuesModel + +@{ + ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Viability Issues"; + Layout = "_Layout"; + + var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error"; +} + +@section BeforeMain +{ + + Back + + +} + +
+ + +
+
+ +
+
+ +

+ + @Model.AcademyName + + Are there viability issues at the academy? +

+
+
+
+
+ + +
+ +
+ + +
+
+ +
+
+
+
+ +
diff --git a/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml.cs b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml.cs new file mode 100644 index 000000000..5e409b646 --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Projects/GeneralInformation/ViabilityIssues.cshtml.cs @@ -0,0 +1,73 @@ +using Dfe.PrepareTransfers.Data; +using Dfe.PrepareTransfers.Web.Models; +using Dfe.PrepareTransfers.Web.Models.Forms; +using Dfe.PrepareTransfers.Web.Services.Interfaces; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using System.Threading.Tasks; + +namespace Dfe.PrepareTransfers.Web.Pages.Projects.GeneralInformation +{ + public class ViabilityIssuesModel : CommonPageModel + { + public string AcademyName { get; set; } + + public bool IsPreview { get; set; } + + [BindProperty] + public bool? YesChecked { get; set; } + + [BindProperty(SupportsGet = true)] public string AcademyUkprn { get; set; } + + private readonly IGetInformationForProject _getInformationForProject; + private readonly IProjects _projectsRepository; + + public ViabilityIssuesModel(IGetInformationForProject getInformationForProject, IProjects projectsRepository) + { + _getInformationForProject = getInformationForProject; + _projectsRepository = projectsRepository; + } + + public async Task OnGetAsync() + { + var projectInformation = await _getInformationForProject.Execute(Urn); + var academy = projectInformation.OutgoingAcademies.First(a => a.Ukprn == AcademyUkprn); + var pupilNumbers = academy.PupilNumbers; + YesChecked = academy.ViabilityIssues?.ToLower().Contains("yes") ?? false; + + OutgoingAcademyUrn = academy.Urn; + AcademyName = academy.Name; + return Page(); + } + + public async Task OnPostAsync() + { + if (!YesChecked.HasValue) + { + ModelState.AddModelError("Viability Issues", "Please select an option."); + } + + if (!ModelState.IsValid) + { + // Return the current page with validation errors + return Page(); + } + + var model = await _projectsRepository.GetByUrn(Urn); + + var academy = model.Result.TransferringAcademies.First(a => a.OutgoingAcademyUkprn == AcademyUkprn); + + academy.ViabilityIssues = YesChecked == true ? "Yes" : "No"; + + await _projectsRepository.UpdateAcademyGeneralInformation(model.Result.Urn, academy); + + if (ReturnToPreview) + { + return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new { Urn }); + } + + return Redirect($"/project/{Urn}/general-information/{AcademyUkprn}"); + } + + } +} \ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Shared/_GeneralInformation.cshtml b/Dfe.PrepareTransfers.Web/Pages/Shared/_GeneralInformation.cshtml index 976f18804..a77735e28 100644 --- a/Dfe.PrepareTransfers.Web/Pages/Shared/_GeneralInformation.cshtml +++ b/Dfe.PrepareTransfers.Web/Pages/Shared/_GeneralInformation.cshtml @@ -14,12 +14,12 @@
- + - - + + - - + +
\ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Pages/Shared/_UsefulInformation.cshtml b/Dfe.PrepareTransfers.Web/Pages/Shared/_UsefulInformation.cshtml new file mode 100644 index 000000000..7f2c6acbc --- /dev/null +++ b/Dfe.PrepareTransfers.Web/Pages/Shared/_UsefulInformation.cshtml @@ -0,0 +1,19 @@ +@{ + var showScheduleOfAdvisoryBoardMeetingsLink = (bool)(ViewData["ShowScheduleOfAdvisoryBoardMeetingsLink"] ?? false); +} +
+ +
\ No newline at end of file diff --git a/Dfe.PrepareTransfers.Web/Services/GetInformationForProject.cs b/Dfe.PrepareTransfers.Web/Services/GetInformationForProject.cs index b3b153d99..1fd5aff18 100644 --- a/Dfe.PrepareTransfers.Web/Services/GetInformationForProject.cs +++ b/Dfe.PrepareTransfers.Web/Services/GetInformationForProject.cs @@ -75,6 +75,12 @@ private static void SetGeneralInformation(Academy academyDomain, TransferringAca { academyDomain.PFIScheme = academy.PFIScheme; academyDomain.PFISchemeDetails = academy.PFISchemeDetails; + academyDomain.DistanceFromAcademyToTrustHq = academy.DistanceFromAcademyToTrustHq; + academyDomain.DistanceFromAcademyToTrustHqDetails = academy.DistanceFromAcademyToTrustHqDetails; + academyDomain.ViabilityIssues = academy.ViabilityIssues; + academyDomain.FinancialDeficit = academy.FinancialDeficit; + academyDomain.MPNameAndParty = academy.MPNameAndParty; + academyDomain.PublishedAdmissionNumber = academy.PublishedAdmissionNumber; } } } \ No newline at end of file