Skip to content

Commit

Permalink
benfefits and risk
Browse files Browse the repository at this point in the history
  • Loading branch information
danielryannimble committed Sep 4, 2024
1 parent b2de831 commit c4f8c9d
Show file tree
Hide file tree
Showing 27 changed files with 1,619 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page "/project/{urn}/benefits/land"
@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks.ComplexLandAndBuilding

@{
Layout = "_Layout";
ViewBag.Title = "Complex land and building issues";
}

@section BeforeMain
{
<backtopreview urn="@Model.Urn" return-to-preview="@Model.ReturnToPreview">
<a class="govuk-back-link" asp-page="@Model.PreviousPage" asp-route-urn="@Model.Urn">Back</a>
</backtopreview>
}

<div asp-gds-validation-summary></div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form method="post" novalidate="">
<input type="hidden" asp-for="@Model.Urn"/>
<input type="hidden" asp-for="@Model.ReturnToPreview"/>
<input type="hidden" asp-for="@Model.IncomingTrustName"/>
<div class="govuk-form-group">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" asp-for="Answer">
<span class="govuk-caption-l">
@Model.IncomingTrustName
</span>
What complex land and building issues are there? (optional)
</label>
</h1>
<textarea asp-for="Answer" class="govuk-textarea" rows="5" data-test="high-profile-transfer"></textarea>
</div>
<button class="govuk-button" data-module="govuk-button" type="submit">
Save and continue
</button>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Dfe.PrepareTransfers.Data;
using Dfe.PrepareTransfers.Data.Models.Projects;
using Dfe.PrepareTransfers.Web.Models;
using Microsoft.AspNetCore.Mvc;

namespace Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks
{
public class ComplexLandAndBuilding : CommonPageModel
{
private readonly IProjects _projectsRepository;
public string PreviousPage { get; set; }
[BindProperty] public string Answer { get; set; }

public ComplexLandAndBuilding(IProjects projectsRepository)
{
_projectsRepository = projectsRepository;
}

public async Task<IActionResult> OnGetAsync()
{
var project = await _projectsRepository.GetByUrn(Urn);
var projectResult = project.Result;
Answer = projectResult.Benefits.OtherFactors[TransferBenefits.OtherFactor.ComplexLandAndBuildingIssues];
IncomingTrustName = projectResult.IncomingTrustName;
PreviousPage =
OtherFactors.GetPage(
new List<TransferBenefits.OtherFactor> {TransferBenefits.OtherFactor.HighProfile},
projectResult.Benefits.OtherFactors, true);
return Page();
}

public async Task<IActionResult> OnPostAsync()
{
var project = await _projectsRepository.GetByUrn(Urn);

var projectResult = project.Result;
projectResult.Benefits.OtherFactors[TransferBenefits.OtherFactor.ComplexLandAndBuildingIssues] = Answer ?? string.Empty;

await _projectsRepository.UpdateBenefits(projectResult);

if (ReturnToPreview)
{
return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new {Urn});
}

var available = new List<TransferBenefits.OtherFactor>
{
TransferBenefits.OtherFactor.FinanceAndDebtConcerns,
TransferBenefits.OtherFactor.OtherRisks
};

return RedirectToPage(OtherFactors.GetPage(available, projectResult.Benefits.OtherFactors), new {Urn});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@page "/project/{urn}/benefits/equalities-impact-assessment"
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers
@model Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks.EqualitiesImpactAssessment

@{
ViewBag.Title = (!ViewData.ModelState.IsValid ? "Error: " : "") + "Has an Equalities Impact Assessment been considered?";
Layout = "_Layout";

var formClasses = ViewData.ModelState.IsValid ? string.Empty : "govuk-form-group--error";
}

@section BeforeMain
{
<backtopreview urn="@Model.Urn" return-to-preview="@Model.ReturnToPreview">
<a class="govuk-back-link" asp-page="/Projects/BenefitsAndRisks/Index" asp-route-urn="@Model.Urn">Back</a>
</backtopreview>
}

<div asp-gds-validation-summary></div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form method="post" novalidate="">
<input type="hidden" asp-for="@Model.Urn"/>
<input type="hidden" asp-for="@Model.ReturnToPreview"/>
<input type="hidden" asp-for="@Model.IncomingTrustName"/>
<div class="govuk-form-group @formClasses">
<fieldset class="govuk-fieldset" aria-describedby="equalities-impact-assessment-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading" data-test="header">
<span class="govuk-caption-l">
@Model.IncomingTrustName
</span>
Has an Equalities Impact Assessment been considered?
</h1>
</legend>

<p asp-gds-validation-for="EqualitiesImpactAssessmentViewModel.EqualitiesImpactAssessmentConsidered"></p>
<partial for="RadioButtonsYesNo" name="Shared/_InlineRadioButtons"/>

</fieldset>
</div>
<button class="govuk-button" data-module="govuk-button" type="submit" data-test="submit-btn">
Save and continue
</button>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Dfe.PrepareTransfers.Data;
using Dfe.PrepareTransfers.Web.Models;
using Dfe.PrepareTransfers.Web.Models.Benefits;
using Dfe.PrepareTransfers.Web.Models.Forms;
using Microsoft.AspNetCore.Mvc;

namespace Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks
{
public class EqualitiesImpactAssessment : CommonPageModel
{
private readonly IProjects _projects;

public EqualitiesImpactAssessment(IProjects projects)
{
_projects = projects;
}

[BindProperty] public EqualitiesImpactAssessmentViewModel EqualitiesImpactAssessmentViewModel { get; set; } = new EqualitiesImpactAssessmentViewModel();

public IList<RadioButtonViewModel> RadioButtonsYesNo { get; set; }


public async Task<IActionResult> OnGetAsync()
{
var project = await _projects.GetByUrn(Urn);
IncomingTrustName = project.Result.IncomingTrustName;

RadioButtonsYesNo = GetRadioButtons(project.Result.Benefits.EqualitiesImpactAssessmentConsidered);
return Page();
}

public async Task<IActionResult> OnPostAsync()
{
var project = await _projects.GetByUrn(Urn);

if (!ModelState.IsValid)
{
RadioButtonsYesNo = GetRadioButtons(project.Result.Benefits.EqualitiesImpactAssessmentConsidered);
return Page();
}

project.Result.Benefits.EqualitiesImpactAssessmentConsidered = EqualitiesImpactAssessmentViewModel.EqualitiesImpactAssessmentConsidered;
await _projects.UpdateBenefits(project.Result);

return RedirectToPage("/Projects/BenefitsAndRisks/Index", new {Urn});
}

private IList<RadioButtonViewModel> GetRadioButtons(bool? valueSelected)
{
var list = new List<RadioButtonViewModel>
{
new RadioButtonViewModel
{
DisplayName = "Yes",
Name = $"{nameof(EqualitiesImpactAssessmentViewModel.EqualitiesImpactAssessmentConsidered)}",
Value = "true",
Checked = valueSelected is true
},
new RadioButtonViewModel
{
DisplayName = "No",
Name = $"{nameof(EqualitiesImpactAssessmentViewModel.EqualitiesImpactAssessmentConsidered)}",
Value = "false",
Checked = valueSelected is false
}
};

var selectedRadio =
list.FirstOrDefault(c => c.Value == EqualitiesImpactAssessmentViewModel.EqualitiesImpactAssessmentConsidered.ToString());
if (selectedRadio != null)
{
selectedRadio.Checked = true;
}

return list;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page "/project/{urn}/benefits/finance"
@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks.FinanceAndDebt

@{
Layout = "_Layout";
ViewBag.Title = "Finance and debt concerns";
}

@section BeforeMain
{
<backtopreview urn="@Model.Urn" return-to-preview="@Model.ReturnToPreview">
<a class="govuk-back-link" asp-page="@Model.PreviousPage" asp-route-urn="@Model.Urn">Back</a>
</backtopreview>
}

<div asp-gds-validation-summary></div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form method="post" novalidate="">
<input type="hidden" asp-for="@Model.Urn"/>
<input type="hidden" asp-for="@Model.ReturnToPreview"/>
<input type="hidden" asp-for="@Model.IncomingTrustName"/>
<div class="govuk-form-group">
<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" asp-for="Answer">
<span class="govuk-caption-l">
@Model.IncomingTrustName
</span>
What are the finance and debt concerns? (optional)
</label>
</h1>
<textarea asp-for="Answer" class="govuk-textarea" rows="5" data-test="high-profile-transfer"></textarea>
</div>
<button class="govuk-button" data-module="govuk-button" type="submit">
Save and continue
</button>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Dfe.PrepareTransfers.Data;
using Dfe.PrepareTransfers.Data.Models.Projects;
using Dfe.PrepareTransfers.Web.Models;
using Microsoft.AspNetCore.Mvc;

namespace Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks
{
public class FinanceAndDebt : CommonPageModel
{
private readonly IProjects _projectsRepository;

[BindProperty] public string Answer { get; set; }
public string PreviousPage { get; set; }

public FinanceAndDebt(IProjects projectsRepository)
{
_projectsRepository = projectsRepository;
}

public async Task<IActionResult> OnGetAsync()
{
var project = await _projectsRepository.GetByUrn(Urn);

var projectResult = project.Result;
Answer = projectResult.Benefits.OtherFactors[TransferBenefits.OtherFactor.FinanceAndDebtConcerns];
IncomingTrustName = projectResult.IncomingTrustName;
PreviousPage =
OtherFactors.GetPage(
new List<TransferBenefits.OtherFactor>
{
TransferBenefits.OtherFactor.ComplexLandAndBuildingIssues,
TransferBenefits.OtherFactor.HighProfile,
},
projectResult.Benefits.OtherFactors, true);
return Page();
}


public async Task<IActionResult> OnPostAsync()
{
var project = await _projectsRepository.GetByUrn(Urn);
var projectResult = project.Result;
projectResult.Benefits.OtherFactors[TransferBenefits.OtherFactor.FinanceAndDebtConcerns] = Answer ?? string.Empty;
await _projectsRepository.UpdateBenefits(projectResult);

if (ReturnToPreview)
{
return RedirectToPage(Links.HeadteacherBoard.Preview.PageName, new {Urn});
}

var available = new List<TransferBenefits.OtherFactor>
{
TransferBenefits.OtherFactor.OtherRisks
};
return RedirectToPage(OtherFactors.GetPage(available, projectResult.Benefits.OtherFactors), new {Urn});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@page "/project/{urn}/benefits/high-profile-transfer"
@using Dfe.PrepareTransfers.Web.Dfe.PrepareTransfers.Helpers.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model Dfe.PrepareTransfers.Web.Pages.Projects.BenefitsAndRisks.HighProfileTransfer

@{
Layout = "_Layout";
ViewBag.Title = "High profile transfer";
}

@section BeforeMain
{
<backtopreview urn="@Model.Urn" return-to-preview="@Model.ReturnToPreview">
<a class="govuk-back-link" asp-page="/Projects/BenefitsAndRisks/Risks" asp-route-urn="@Model.Urn">Back</a>
</backtopreview>
}

<div asp-gds-validation-summary></div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form method="post" novalidate="">
<input type="hidden" asp-for="@Model.Urn"/>
<input type="hidden" asp-for="@Model.ReturnToPreview"/>
<input type="hidden" asp-for="@Model.IncomingTrustName"/>
<div class="govuk-form-group">

<h1 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--l" asp-for="Answer">
<span class="govuk-caption-l">
@Model.IncomingTrustName
</span>
Why is this a high profile transfer? (optional)
</label>
</h1>
<div id="hp-hint" class="govuk-hint">
For example, ministers and media could be involved.
</div>
<textarea asp-for="Answer" class="govuk-textarea" rows="5" data-test="high-profile-transfer"></textarea>
</div>
<button class="govuk-button" data-module="govuk-button" type="submit">
Save and continue
</button>
</form>
</div>
</div>
Loading

0 comments on commit c4f8c9d

Please sign in to comment.