-
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 #951 from DFE-Digital/feature/sen-tasklist
Feature/external application form
- Loading branch information
Showing
23 changed files
with
241 additions
and
10 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
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
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
53 changes: 53 additions & 0 deletions
53
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Edit.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,53 @@ | ||
@page "/task-list/{id:int}/ExternalApplicationForm/edit" | ||
@using Dfe.PrepareConversions.TagHelpers | ||
@model Dfe.PrepareConversions.Pages.ExternalApplicationForm.EditModel | ||
@{ | ||
ViewData["Title"] = "Have you saved the School Application form"; | ||
} | ||
|
||
@section BeforeMain | ||
{ | ||
<a asp-page="@Links.ExternalApplicationForm.Index.Page" asp-route-id="@Model.Project.Id" class="govuk-back-link">@Links.ExternalApplicationForm.Index.BackText</a> | ||
<partial name="_ErrorSummary"/> | ||
} | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<form method="post"> | ||
<span class="govuk-caption-l">@Model.Project.SchoolName</span> | ||
<h1 class="govuk-heading-l">Have you saved the school's completed Application form in SharePoint?</h1> | ||
<div class="govuk-form-group"> | ||
<div class="govuk-radios" data-module="govuk-radios"> | ||
<div class="govuk-radios__item"> | ||
<input asp-for="@Model.YesChecked" class="govuk-radios__input" type="radio" value="true" aria-controls="conditional-applicationsaved" id="radio-yes" data-cy="select-radio-yes"> | ||
<label class="govuk-label govuk-radios__label" for="radio-yes"> | ||
Yes | ||
</label> | ||
</div> | ||
|
||
<div class="govuk-radios__conditional" id="conditional-applicationsaved" data-cy="select-sharepoint-section"> | ||
<div class="govuk-form-group @ModelState.GetErrorStyleClass()"> | ||
<label class="govuk-label" for="application-form-url"> | ||
What is the link for the Application form? | ||
</label> | ||
|
||
<inline-error for="@nameof(Model.ExternalApplicationFormUrl)"/> | ||
<textarea asp-for="@Model.ExternalApplicationFormUrl" class="govuk-textarea @ModelState.GetTextAreaErrorStyles(nameof(Model.ExternalApplicationFormUrl))" rows="5" aria-describedby="application-form-url-hint" data-cy="select-sharepoint-url" aria-label="text-area-for-application-form"></textarea> | ||
</div> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<input asp-for="@Model.YesChecked" class="govuk-radios__input" type="radio" value="false" id="radio-no" data-cy="select-radio-no"> | ||
<label class="govuk-label govuk-radios__label" for="radio-no"> | ||
No | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<button class="govuk-button" data-module="govuk-button" data-cy="select-save-and-continue"> | ||
Save and continue | ||
</button> | ||
</form> | ||
</div> | ||
</div> |
55 changes: 55 additions & 0 deletions
55
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Edit.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,55 @@ | ||
using Dfe.PrepareConversions.Data; | ||
using Dfe.PrepareConversions.Data.Models; | ||
using Dfe.PrepareConversions.Data.Services; | ||
using Dfe.PrepareConversions.Models; | ||
using Dfe.PrepareConversions.Services; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.Threading.Tasks; | ||
|
||
namespace Dfe.PrepareConversions.Pages.ExternalApplicationForm; | ||
|
||
public class EditModel : BaseAcademyConversionProjectPageModel | ||
{ | ||
private readonly ErrorService _errorService; | ||
|
||
public EditModel(IAcademyConversionProjectRepository repository, ErrorService errorService) : base(repository) | ||
{ | ||
_errorService = errorService; | ||
} | ||
|
||
[BindProperty] | ||
public bool? YesChecked { get; set; } | ||
|
||
[BindProperty] | ||
public string ExternalApplicationFormUrl { get; set; } | ||
|
||
public override async Task<IActionResult> OnGetAsync(int id) | ||
{ | ||
await base.OnGetAsync(id); | ||
|
||
YesChecked = Project.ExternalApplicationFormSaved; | ||
ExternalApplicationFormUrl = Project.ExternalApplicationFormUrl; | ||
|
||
return Page(); | ||
} | ||
|
||
public override async Task<IActionResult> OnPostAsync(int id) | ||
{ | ||
if (YesChecked is true && string.IsNullOrWhiteSpace(ExternalApplicationFormUrl)) | ||
{ | ||
ModelState.AddModelError(nameof(ExternalApplicationFormUrl), "You must enter valid link for the schools application form"); | ||
} | ||
|
||
if (ModelState.IsValid) | ||
{ | ||
|
||
await _repository.SetProjectExternalApplicationForm(id, YesChecked.Value, YesChecked is true ? ExternalApplicationFormUrl : default); | ||
|
||
|
||
return RedirectToPage(Links.ExternalApplicationForm.Index.Page, new { id }); | ||
} | ||
|
||
_errorService.AddErrors(ModelState.Keys, ModelState); | ||
return await base.OnGetAsync(id); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.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,50 @@ | ||
@page "/task-list/{id:int}/ExternalApplicationForm" | ||
@using Dfe.PrepareConversions.TagHelpers | ||
@model Dfe.PrepareConversions.Pages.ExternalApplicationForm.IndexModel | ||
@{ | ||
ViewData["Title"] = "School application form"; | ||
} | ||
|
||
@section BeforeMain | ||
{ | ||
<a asp-page="@Links.ProjectList.Index.Page" class="govuk-back-link">@Links.ProjectList.Index.BackText</a> | ||
} | ||
|
||
<partial name="_ProjectHeader" model="@Model.Project"/> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<dl class="govuk-summary-list"> | ||
|
||
<div class="govuk-summary-list__row" data-cy="select-annex-b-form-returned"> | ||
<dt class="govuk-summary-list__key govuk-!-width-one-third"> | ||
Have you saved the school's completed application form in SharePoint? | ||
</dt> | ||
<dd class="govuk-summary-list__value" data-cy="select-annex-b-form-returned-answer"> | ||
<span if="Model.AplicationFormSaved.HasValue is false" class="empty">Empty</span> | ||
<span if="Model.AplicationFormSaved is true" id="la-info-template-comments">Yes</span> | ||
<span if="Model.AplicationFormSaved is false" id="la-info-template-comments">No</span> | ||
</dd> | ||
<dd class="govuk-summary-list__actions" data-cy="select-annex-b-form-returned-change"> | ||
<a asp-page="@Links.ExternalApplicationForm.Edit.Page" asp-route-id="@Model.Project.Id" class="govuk-link"> | ||
Change<span class="govuk-visually-hidden">External application form saved for the school</span> | ||
</a> | ||
</dd> | ||
</div> | ||
|
||
<div if="Model.HasLink" class="govuk-summary-list__row" data-cy="select-annex-b-sharepoint-link"> | ||
<dt class="govuk-summary-list__key govuk-!-width-one-third"> | ||
SharePoint link | ||
</dt> | ||
<dd class="govuk-summary-list__value" data-cy="select-annex-b-sharepoint-url"> | ||
<a href="@Model.ApplicationFormLink" target="_blank" rel="noopener" aria-label="Application form (opens in a new tab)">@Model.ApplicationFormLink</a> | ||
</dd> | ||
<dd class="govuk-summary-list__actions" data-cy="select-annex-b-sharepoint-change"> | ||
<a asp-page="@Links.ExternalApplicationForm.Edit.Page" asp-route-id="@Model.Project.Id" class="govuk-link"> | ||
Change<span class="govuk-visually-hidden">school application form url</span> | ||
</a> | ||
</dd> | ||
</div> | ||
</dl> | ||
</div> | ||
</div> |
15 changes: 15 additions & 0 deletions
15
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/ExternalApplicationForm/Index.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,15 @@ | ||
using Dfe.PrepareConversions.Data.Services; | ||
|
||
namespace Dfe.PrepareConversions.Pages.ExternalApplicationForm; | ||
|
||
public class IndexModel : BaseAcademyConversionProjectPageModel | ||
{ | ||
public IndexModel(IAcademyConversionProjectRepository repository) : base(repository) | ||
{ | ||
} | ||
|
||
public bool HasLink => string.IsNullOrWhiteSpace(Project.ExternalApplicationFormUrl) is false; | ||
|
||
public bool? AplicationFormSaved => Project.ExternalApplicationFormSaved; | ||
public string ApplicationFormLink => Project.ExternalApplicationFormUrl; | ||
} |
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.