From d09d2d6f5981f32d940b8a660c790b8a62f219ad Mon Sep 17 00:00:00 2001 From: plockwood Date: Wed, 31 Jan 2024 10:55:19 +0000 Subject: [PATCH 01/19] Form a mat changes for showing schools in mat --- .../FormAMat/OtherSchoolsInMat.cshtml.cs | 2 +- .../Pages/NewProject/SearchSchool.cshtml.cs | 11 ++++-- .../Shared/FormAMatProjectListRow.cshtml | 39 +++++++++++++++++++ .../Shared/FormAMatProjectListRow.cshtml.cs | 12 ++++++ .../Pages/Shared/_FormAMatSubMenu.cshtml | 17 ++++---- .../Pages/Shared/_ProjectListRows.cshtml | 1 + 6 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml create mode 100644 Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml.cs diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/OtherSchoolsInMat.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/OtherSchoolsInMat.cshtml.cs index 1ac84bce1..7e92338fe 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/OtherSchoolsInMat.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/FormAMat/OtherSchoolsInMat.cshtml.cs @@ -49,7 +49,7 @@ await _repository.GetAllProjects(CurrentPage, 50, Filters.Title, Filters.Selecte Paging = response.Body?.Paging; Projects = response.Body?.Data.Select(ProjectListHelper.Build).ToList(); var currentSchool = Project.SchoolURN; - Projects = Projects!.Where(x => x.SchoolURN != currentSchool); + //Projects = Projects!.Where(x => x.SchoolURN != currentSchool); TotalProjects = response.Body?.Paging?.RecordCount ?? 0; return Page(); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/SearchSchool.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/SearchSchool.cshtml.cs index 06a60b4b3..e1968cdab 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/SearchSchool.cshtml.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/SearchSchool.cshtml.cs @@ -75,9 +75,9 @@ public async Task OnPost(string ukprn, string redirect) return Page(); } - string expectedUkprn = splitSearch[1]; + string expectedUrn = splitSearch[splitSearch.Length - 1]; ; - var expectedEstablishment = await _getEstablishment.GetEstablishmentByUrn(expectedUkprn); + var expectedEstablishment = await _getEstablishment.GetEstablishmentByUrn(expectedUrn); if (expectedEstablishment.Name == null) { @@ -88,7 +88,7 @@ public async Task OnPost(string ukprn, string redirect) redirect = string.IsNullOrEmpty(redirect) ? Links.NewProject.SchoolApply.Page : redirect; - return RedirectToPage(redirect, new { urn = splitSearch[1], ukprn }); + return RedirectToPage(redirect, new { urn = expectedUrn, ukprn }); } private static string HighlightSearchMatch(string input, string toReplace, EstablishmentSearchResponse school) @@ -103,6 +103,9 @@ private static string HighlightSearchMatch(string input, string toReplace, Estab private static string[] SplitOnBrackets(string input) { - return input.Split(new[] { '(', ')' }, 3, StringSplitOptions.None); + // return array containing one empty string if input string is null or empty + if (string.IsNullOrWhiteSpace(input)) return new string[1] { string.Empty }; + + return input.Split(new[] { '(', ')' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); } } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml new file mode 100644 index 000000000..93fc7a65b --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml @@ -0,0 +1,39 @@ +@using Dfe.Academisation.ExtensionMethods +@using Dfe.PrepareConversions.TagHelpers +@model ProjectListRowViewModel + + + +

+ + @Model.Item.SchoolName + + URN: @Model.Item.SchoolURN +

+

+

Route: @Model.Item.TypeAndRoute.RouteDescription()
+
Application to join a trust: @Model.Item.NameOfTrust
+ @if (@Model.Item.LocalAuthority.IsEmpty() is false) + { +
Local authority: @Model.Item.LocalAuthority
+ } +

+ + +

+ @Model.Item.Status.Value +

+

+ + Project created date: @Model.Item.CreatedOn.ToDateString()
+
+ + @("Advisory board date: " + Model.Item.HeadTeacherBoardDate)
+
+ + Opening date: + @Model.Item.ProposedAcademyOpeningDate + +

+ + \ No newline at end of file diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml.cs new file mode 100644 index 000000000..45be45349 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/FormAMatProjectListRow.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Dfe.PrepareConversions.Pages.Shared +{ + public class FormAMatProjectListRowModel : PageModel + { + public void OnGet() + { + } + } +} diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_FormAMatSubMenu.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_FormAMatSubMenu.cshtml index 9d3096fbc..ff3ccc1af 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_FormAMatSubMenu.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_FormAMatSubMenu.cshtml @@ -5,20 +5,21 @@