Skip to content

Commit

Permalink
Merge branch 'main' into feature/158735-Associate-FAM
Browse files Browse the repository at this point in the history
  • Loading branch information
elielijah321 committed Apr 15, 2024
2 parents e211b21 + 45188c6 commit 82879c0
Show file tree
Hide file tree
Showing 25 changed files with 158 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="FluentAssertions" Version="6.9.0" />
<PackageReference Include="MELT" Version="0.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="MELT" Version="0.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<CodeAnalysisRuleSet>..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

Expand All @@ -10,16 +10,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.8.2" />
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="Dfe.Academisation.CorrelationIdMiddleware" Version="2.0.2" />
<PackageReference Include="Dfe.Academisation.ExtensionMethods" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageReference Include="Microsoft.FeatureManagement" Version="2.5.1" />
<PackageReference Include="Microsoft.Graph" Version="4.53.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.FeatureManagement" Version="3.2.0" />
<PackageReference Include="Microsoft.Graph" Version="4.54.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using Dfe.PrepareConversions.Data.Models;
using Dfe.PrepareConversions.Data.Models.NewProject;
using Dfe.PrepareConversions.Data.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace Dfe.PrepareConversions.Data.Services;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": []
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<CodeAnalysisRuleSet>..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>87c23a87-e8b1-440f-b0a6-109d9521d781</UserSecretsId>
Expand All @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -13,19 +13,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.0.1" />
<PackageReference Include="AngleSharp" Version="1.1.2" />
<PackageReference Include="AngleSharp.Io" Version="1.0.0" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.17.0" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.17.0" />
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
<PackageReference Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="FluentAssertions" Version="6.9.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.11" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="WireMock.Net" Version="1.5.16" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="WireMock.Net" Version="1.5.51" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>eae6d8bd-2a58-4ed4-99e2-a82f32b0ce47</UserSecretsId>
<CodeAnalysisRuleSet>..\.sonarlint\dfe-digital_a2b-internalcsharp.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
Expand Down Expand Up @@ -34,18 +34,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="1.0.1" />
<PackageReference Include="AngleSharp" Version="1.1.2" />
<PackageReference Include="Dfe.Academies.Contracts" Version="1.0.10" />
<PackageReference Include="Dfe.Academisation.CorrelationIdMiddleware" Version="2.0.2" />
<PackageReference Include="Dfe.Academisation.ExtensionMethods" Version="2.0.0" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="2.5.1" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.26.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.26.0" />
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.18.0" />
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="0.18.0" />
<PackageReference Include="Scrutor" Version="4.2.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="3.2.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.17.4" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.17.4" />
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.21.0" />
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders.TagHelpers" Version="0.21.0" />
<PackageReference Include="Scrutor" Version="4.2.2" />
<PackageReference Include="Sentry.AspNetCore" Version="3.28.0" />
<PackageReference Include="Sentry.Serilog" Version="3.28.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
@if (Model.Project.ApplciationReference != null || Model.Project.ApplciationReference != string.Empty)
<span class="govuk-caption-xl">Form a MAT ref: @Model.Project.ReferenceNumber</span>
@if (!string.IsNullOrEmpty(Model.Project.ApplciationReference))
{
<span class="govuk-caption-xl">Application ref: @Model.Project.ApplciationReference</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public async Task<IActionResult> OnGet(string urn, string isFormAMat, string has

public async Task<IActionResult> OnGetSearch(string searchQuery)
{
string[] searchSplit = SplitOnBrackets(searchQuery);
string[] searchSplit = SplitOnBrackets(searchQuery);

IEnumerable<FormAMatProject> projects = (await _repository.SearchFormAMatProjects(searchQuery)).Body;

return new JsonResult(projects.Select(s => new { suggestion = HighlightSearchMatch($"{s.ProposedTrustName} ({DeduceReferenceNumber(s)})", searchSplit[0].Trim(), s), value = $"{DeduceReferenceNumber(s)}" }));
return new JsonResult(projects.Select(s => new { suggestion = HighlightSearchMatch($"{s.ProposedTrustName} ({s.ReferenceNumber}){IncludeA2BReferenceNumberIfAvailable(s)}", searchSplit[0].Trim(), s), value = $"{s.ProposedTrustName} ({s.ReferenceNumber}){IncludeA2BReferenceNumberIfAvailable(s)}" }));
}

public async Task<IActionResult> OnPost(string ukprn, string urn, string redirect)
Expand All @@ -77,14 +77,15 @@ public async Task<IActionResult> OnPost(string ukprn, string urn, string redirec
_errorService.AddError("Application Reference", "Please enter a application reference with more than three characters");
return Page();
}

var applicationReference = SearchQuery;
string[] splitSearch = SplitOnBrackets(SearchQuery);
// Fam reference should always be second in array
var FamReference = splitSearch[1];

var nextPage = Links.NewProject.Summary.Page;

redirect = string.IsNullOrEmpty(redirect) ? nextPage : redirect;

return RedirectToPage(redirect, new { ukprn, urn, HasSchoolApplied, IsFormAMat, IsProjectInPrepare, applicationReference });
return RedirectToPage(redirect, new { ukprn, urn, HasSchoolApplied, IsFormAMat, IsProjectInPrepare, FamReference });
}

private static string HighlightSearchMatch(string input, string toReplace, FormAMatProject project)
Expand All @@ -105,8 +106,8 @@ private static string[] SplitOnBrackets(string input)
return input.Split(new[] { '(', ')' }, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
}

private static string DeduceReferenceNumber(FormAMatProject project)
private static string IncludeA2BReferenceNumberIfAvailable(FormAMatProject project)
{
return !string.IsNullOrEmpty(project.ReferenceNumber) ? project.ReferenceNumber : project.ApplicationReference;
return !string.IsNullOrEmpty(project.ApplicationReference) ? $"({project.ApplicationReference})" : string.Empty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
</div>
}

@if (Model.ApplicationReference != null)
@if (Model.IsFormAMat != null)
{
<div class="govuk-grid-column-two-thirds">

Expand All @@ -283,9 +283,27 @@
</dd>
<dd class="govuk-summary-list__value"></dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
@if (Model.FamReference != null)
{
<div class="govuk-summary-list__row" isv>
<dt class="govuk-summary-list__key">
FAM Reference
</dt>
<dd class="govuk-summary-list__value" data-cy="a2b-reference">
@Model.FamReference
</dd>
<dd class="govuk-summary-list__actions">
<a asp-page="@Links.NewProject.LinkFormAMatProject.Page" class="govuk-link" data-cy="change-fam-reference"
asp-all-route-data="@backLinkRouteParams">
Change<span class="govuk-visually-hidden">FAM reference</span>
</a>
</dd>
</div>
}
@if (Model.ApplicationReference != null)
{
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
A2B Reference
</dt>
<dd class="govuk-summary-list__value" data-cy="a2b-reference">
Expand All @@ -298,6 +316,7 @@
</a>
</dd>
</div>
}

</dl>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public SummaryModel(IGetEstablishment getEstablishment,
public string IsProjectInPrepare { get; set; }
public string IsProjectAlreadyInPrepare { get; set; }
public string ApplicationReference { get; set; }
public string FamReference { get; set; }


public async Task<IActionResult> OnGetAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string isProjectInPrepare, string applicationReference)
public async Task<IActionResult> OnGetAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string isProjectInPrepare, string famReference)
{
Establishment = await _getEstablishment.GetEstablishmentByUrn(urn);
if (!string.IsNullOrEmpty(ukprn))
Expand All @@ -51,18 +52,22 @@ public async Task<IActionResult> OnGetAsync(string urn, string ukprn, string has
IsFormAMat = isFormAMat ?? "no";
IsProjectInPrepare = isProjectInPrepare ?? "no";
ProposedTrustName = proposedTrustName ?? null;
ApplicationReference = applicationReference ?? null;
FamReference = famReference ?? null;
ApplicationReference = null;

if (ApplicationReference != null)
if (FamReference != null)
{
var results = await _academyConversionProjectRepository.SearchFormAMatProjects(ApplicationReference);
ProposedTrustName = results.Body.First().ProposedTrustName;
var results = await _academyConversionProjectRepository.SearchFormAMatProjects(FamReference);
var famProject = results.Body.First();

ProposedTrustName = famProject.ProposedTrustName;
ApplicationReference = string.IsNullOrEmpty(famProject.ApplicationReference) ? null : famProject.ApplicationReference;
}

return Page();
}

public async Task<IActionResult> OnPostAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string applicationReference)
public async Task<IActionResult> OnPostAsync(string urn, string ukprn, string hasSchoolApplied, string hasPreferredTrust, string proposedTrustName, string isFormAMat, string famReference)
{
Academies.Contracts.V4.Establishments.EstablishmentDto establishment = await _getEstablishment.GetEstablishmentByUrn(urn);

Expand All @@ -83,7 +88,7 @@ public async Task<IActionResult> OnPostAsync(string urn, string ukprn, string ha
if (_isFormAMAT && proposedTrustName == null)
{
var createdProject = await _academyConversionProjectRepository.CreateProject(CreateProjectMapper.MapToDto(establishment, trust, hasSchoolApplied, hasPreferredTrust, true));
var formAMatProject = await _academyConversionProjectRepository.SearchFormAMatProjects(applicationReference);
var formAMatProject = await _academyConversionProjectRepository.SearchFormAMatProjects(famReference);

int projectId = createdProject.Body.Id;
var formAMatProjectID = formAMatProject.Body.First().Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@using Dfe.PrepareConversions.Data.Models.AcademyConversion
@model Dfe.PrepareConversions.Pages.TaskList.LegalRequirements.LegalGoverningBodyModel
@{
ViewData["Title"] = "Management commitee resolution";
ViewData["Title"] = "Management committee resolution";
}

@section BeforeMain
Expand All @@ -15,7 +15,7 @@
<form method="post">
<input hidden="" type="text" name="returnToSummary" value="no">
<span class="govuk-caption-l" data-cy="select-schoolname">@Model.SchoolName</span>
<h1 class="govuk-heading-l" data-cy="select-heading">Has the school provided a management commitee resolution?</h1>
<h1 class="govuk-heading-l" data-cy="select-heading">Has the school provided a management committee resolution?</h1>

<div class="govuk-form-group">
<div class="govuk-radios">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dl class="govuk-summary-list">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Management commitee resolution
Management committee resolution
</dt>
<dd class="govuk-summary-list__value">
@if (Model.Requirements.GoverningBodyApproved.HasValue)
Expand All @@ -32,7 +32,7 @@
</dd>
<dd class="govuk-summary-list__actions">
<a asp-page="@Links.LegalRequirements.GoverningBodyResolution.Page" asp-route-id="@Model.Id" class="govuk-link" data-cy="select-legal-summary-governingbody-change">
Change<span class="govuk-visually-hidden"> management commitee resolution</span>
Change<span class="govuk-visually-hidden"> management committee resolution</span>
</a>
</dd>
</div>
Expand Down
Loading

0 comments on commit 82879c0

Please sign in to comment.