-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1000 from DFE-Digital/feature/157115-no-trust-spo…
…nsored Feature/157115 no trust sponsored
- Loading branch information
Showing
15 changed files
with
223 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...repareConversions/Dfe.PrepareConversions.Data/Models/SponsoredProject/CreateNewProject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/PreferredTrust.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@page "/start-new-project/preferred-trust" | ||
@using Dfe.PrepareConversions.Pages.Shared | ||
@model Dfe.PrepareConversions.Pages.SponsoredProject.PreferredTrustModel | ||
|
||
@{ | ||
Layout = "_Layout"; | ||
ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Preferred trust"; | ||
var routeParams = new Dictionary<string, string> | ||
{ | ||
{ "urn", Request.Query["urn"] }, | ||
{ "ukprn", Request.Query["ukprn"] }, | ||
{ "hasSchoolApplied", Request.Query["hasSchoolApplied"] } | ||
}; | ||
} | ||
|
||
@section BeforeMain | ||
{ | ||
<partial name="_BackLink" model="@(new BackLink(Links.NewProject.SchoolApply.Page, routeParams))" /> | ||
<partial name="_ErrorSummary" /> | ||
} | ||
|
||
|
||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<form method="post"> | ||
|
||
<input hidden="" type="text" name="returnToSummary" value="no"> | ||
<input type="hidden" asp-for="Urn" /> | ||
<input type="hidden" asp-for="HasSchoolApplied" /> | ||
<h1 class="govuk-heading-l" data-cy="select-heading">Is there a preferred trust for this school?</h1> | ||
|
||
<div class="govuk-form-group" @ModelState.GetErrorStyleClass()> | ||
<div class="govuk-radios"> | ||
<div class="govuk-radios__item"> | ||
<input asp-for="HasPreferredTrust" class="govuk-radios__input" type="radio" value="Yes" id="DoneYes" data-cy="select-legal-input-yes"> | ||
<label class="govuk-label govuk-radios__label" for="DoneYes"> | ||
Yes | ||
</label> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<input asp-for="HasPreferredTrust" class="govuk-radios__input" type="radio" value="No" id="DoneNo" data-cy="select-legal-input-no"> | ||
<label class="govuk-label govuk-radios__label" for="DoneNo"> | ||
No | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<button class="govuk-button pt-3" data-module="govuk-button" data-cy="select-common-submitbutton"> | ||
Continue | ||
</button> | ||
</form> | ||
|
||
</div> |
58 changes: 58 additions & 0 deletions
58
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/NewProject/PreferredTrust.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Dfe.PrepareConversions.Data.Services; | ||
using Dfe.PrepareConversions.Models; | ||
using Dfe.PrepareConversions.Models.ProjectList; | ||
using Dfe.PrepareConversions.Services; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
using Microsoft.IdentityModel.Tokens; | ||
using System.Threading.Tasks; | ||
using EstablishmentDto = Dfe.Academies.Contracts.V4.Establishments.EstablishmentDto; | ||
|
||
namespace Dfe.PrepareConversions.Pages.SponsoredProject; | ||
|
||
public class PreferredTrustModel : PageModel | ||
{ | ||
private readonly ErrorService _errorService; | ||
private readonly IGetEstablishment _getEstablishment; | ||
|
||
public PreferredTrustModel(IGetEstablishment getEstablishment, ErrorService errorService) | ||
{ | ||
_getEstablishment = getEstablishment; | ||
_errorService = errorService; | ||
} | ||
[BindProperty] | ||
public string HasPreferredTrust { get; set; } | ||
|
||
[BindProperty] | ||
public string HasSchoolApplied { get; set; } | ||
|
||
public string Urn { get; set; } | ||
|
||
public async Task<IActionResult> OnGet(string urn, string hasSchoolApplied, string isPreferredTrust) | ||
{ | ||
ProjectListFilters.ClearFiltersFrom(TempData); | ||
HasSchoolApplied = hasSchoolApplied; | ||
HasPreferredTrust = isPreferredTrust ?? "yes"; // Default to Yes if not used backlink to access | ||
|
||
EstablishmentDto establishment = await _getEstablishment.GetEstablishmentByUrn(urn); | ||
Urn = establishment.Urn; | ||
|
||
return Page(); | ||
} | ||
|
||
public async Task<IActionResult> OnPost(string urn, string redirect) | ||
{ | ||
|
||
if (HasPreferredTrust.IsNullOrEmpty()) | ||
{ | ||
_errorService.AddError("IsPreferredTrust", "Select yes if there is a preferred trust"); | ||
return Page(); | ||
} | ||
|
||
var nextPage = HasPreferredTrust.ToLower().Equals("yes") ? Links.NewProject.SearchTrusts.Page : Links.NewProject.Summary.Page; | ||
|
||
redirect = string.IsNullOrEmpty(redirect) ? nextPage : redirect; | ||
|
||
return RedirectToPage(redirect, new { urn, HasSchoolApplied, HasPreferredTrust }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.