Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/readonly transfer projects #1214

Merged
merged 10 commits into from
Oct 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,7 @@ public class AcademyConversionProject
public bool ProjectDatesSectionComplete { get; set; }

public bool IsReadOnly { get; set; }

public DateTime? ProjectSentToCompleteDate { get; set; }

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Dfe.PrepareTransfers.Data.Models.Projects;
using Dfe.PrepareTransfers.Web.Models.Forms;
using Dfe.PrepareTransfers.Helpers;
using System;

namespace Dfe.PrepareTransfers.Web.Models.Benefits
{
Expand All @@ -16,14 +17,19 @@ public class BenefitsSummaryViewModel : CommonViewModel
public readonly string OutgoingAcademyUrn;
public readonly bool? AnyRisks;
public readonly bool? EqualitiesImpactAssessmentConsidered;
public readonly bool? IsReadOnly;
public readonly DateTime? ProjectSentToCompleteDate;


public BenefitsSummaryViewModel(IList<TransferBenefits.IntendedBenefit> intendedBenefits,
string otherIntendedBenefit,
IList<OtherFactorsItemViewModel> otherFactorsItems,
string projectUrn,
string outgoingAcademyUrn,
bool? anyRisks = null,
bool? equalitiesImpactAssessmentConsidered = null)
bool? equalitiesImpactAssessmentConsidered = null,
bool? isReadOnly = null,
DateTime? projectSentToCompleteDate = null)
{
_intendedBenefits = intendedBenefits;
_otherIntendedBenefit = otherIntendedBenefit;
Expand All @@ -34,6 +40,8 @@ public BenefitsSummaryViewModel(IList<TransferBenefits.IntendedBenefit> intended
OutgoingAcademyUrn = outgoingAcademyUrn;
AnyRisks = anyRisks;
EqualitiesImpactAssessmentConsidered = equalitiesImpactAssessmentConsidered;
IsReadOnly = isReadOnly;
ProjectSentToCompleteDate = projectSentToCompleteDate;
}

public List<string> IntendedBenefitsSummary()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System;

namespace Dfe.PrepareTransfers.Web.Models
{
Expand All @@ -16,5 +17,14 @@ public abstract class CommonPageModel : PageModel
public string IncomingTrustName { get; set; }
[BindProperty]
public bool IsFormAMAT { get; set; }

[BindProperty]

public bool? IsReadOnly { get; set; }

[BindProperty(SupportsGet = true)]

public DateTime? ProjectSentToCompleteDate { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dfe.PrepareTransfers.Web.Models.Forms;
using Dfe.PrepareTransfers.Data.Models;
using Dfe.PrepareTransfers.Web.Models.Forms;
using System;

namespace Dfe.PrepareTransfers.Web.Models.LegalRequirements
{
Expand All @@ -9,16 +10,23 @@ public class LegalRequirementsViewModel : CommonViewModel
public readonly ThreeOptions? IncomingTrustAgreement;
public readonly ThreeOptions? DiocesanConsent;
public readonly ThreeOptions? OutgoingTrustConsent;
public readonly bool? InternalIsReadOnly;
public readonly DateTime? InternalProjectSentToCompleteDate;

public LegalRequirementsViewModel(ThreeOptions? incomingTrustAgreement,
ThreeOptions? diocesanConsent,
ThreeOptions? outgoingTrustConsent,
string projectUrn)
string projectUrn,
bool? IsReadOnly,
DateTime? ProjectSentToCompleteDate)
{
IncomingTrustAgreement = incomingTrustAgreement;
DiocesanConsent = diocesanConsent;
OutgoingTrustConsent = outgoingTrustConsent;
Urn = projectUrn;
InternalIsReadOnly = IsReadOnly;
InternalProjectSentToCompleteDate = ProjectSentToCompleteDate;

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static class Decision
public static readonly LinkItem WhyWithdrawn = Create("/TaskList/Decision/WhyWithdrawn");
public static readonly LinkItem Summary = Create("/TaskList/Decision/Summary");
public static readonly LinkItem SubMenuRecordADecision = Create("/TaskList/Decision/RecordADecision");

public static readonly LinkItem ApprovedInfo = Create("/TaskList/Decision/TransfersDecisionApprovedInfo");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@
<h1 class="govuk-heading-l">
Trust information
</h1>
<hr class="govuk-section-break govuk-section-break--l">
<hr class="govuk-section-break govuk-section-break--l">
@if (Model.IsReadOnly == true)
{
<partial name="Shared/_ProjectApproved" for="@Model"/>
}
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="govuk-grid-column-three-quarters">
<partial name="Shared/_AcademyAndTrustSummary" model="Model"></partial>
<form asp-page="/transfers/Projects/Index" asp-route-urn="@Model.Urn" method="get">
<button class="govuk-button govuk-!-margin-top-6" type="submit">
Confirm and continue
</button>
</form>
@if (Model.IsReadOnly != true)
{
<form asp-page="/transfers/Projects/Index" asp-route-urn="@Model.Urn" method="get">
<button class="govuk-button govuk-!-margin-top-6" type="submit">
Confirm and continue
</button>
</form>
}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Threading.Tasks;
using Dfe.PrepareTransfers.Data;
using System.Threading.Tasks;
using Dfe.PrepareTransfers.Web.Models;
using Dfe.PrepareTransfers.Web.Services.Interfaces;
using Dfe.PrepareTransfers.Data.Models.Projects;
using Microsoft.AspNetCore.Mvc;
using dataModels = Dfe.PrepareTransfers.Data.Models;

namespace Dfe.PrepareTransfers.Web.Pages.Projects.AcademyAndTrustInformation
{
Expand All @@ -14,16 +16,20 @@ public class Index : CommonPageModel
public string TargetDate { get; set; }

private readonly IGetInformationForProject _getInformationForProject;

private readonly IProjects _projectsRepository;

public Index(IGetInformationForProject getInformationForProject)
public Index(IGetInformationForProject getInformationForProject, IProjects projectsRepository)
{
_getInformationForProject = getInformationForProject;
_projectsRepository = projectsRepository;
}

public async Task<IActionResult> OnGetAsync(string urn)
{
var projectInformation = await _getInformationForProject.Execute(urn);

var project = await _projectsRepository.GetByUrn(Urn);
dataModels.Project projectResult = project.Result;
ProjectReference = projectInformation.Project.Reference;
Recommendation = projectInformation.Project.AcademyAndTrustInformation.Recommendation;
Author = projectInformation.Project.AcademyAndTrustInformation.Author;
Expand All @@ -32,6 +38,8 @@ public async Task<IActionResult> OnGetAsync(string urn)
TargetDate = projectInformation.Project.Dates?.Target;
OutgoingAcademyUrn = projectInformation.Project.OutgoingAcademyUrn;
Urn = projectInformation.Project.Urn;
IsReadOnly = projectResult.IsReadOnly;
ProjectSentToCompleteDate = projectResult.ProjectSentToCompleteDate;
IsFormAMAT = projectInformation.Project.IsFormAMat.HasValue && projectInformation.Project.IsFormAMat.Value == true;

return Page();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@
<h1 class="govuk-heading-l">
Benefits and risks
</h1>
<hr class="govuk-section-break govuk-section-break--l">
<hr class="govuk-section-break govuk-section-break--l">
@if (Model.IsReadOnly == true)
{
<partial name="Shared/_ProjectApproved" for="@Model"/>
}
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<partial for="@Model.BenefitsSummaryViewModel" name="_BenefitsSummary"/>
<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel"/>
</div>
<div class="govuk-grid-column-three-quarters">
<partial for="@Model.BenefitsSummaryViewModel" name="_BenefitsSummary"/>
@if (Model.IsReadOnly != true)
{
<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel"/>
}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ public async Task<IActionResult> OnGetAsync()

var projectResult = project.Result;
ProjectReference = projectResult.Reference;
IsReadOnly = projectResult.IsReadOnly;
ProjectSentToCompleteDate = projectResult.ProjectSentToCompleteDate;
BenefitsSummaryViewModel = new BenefitsSummaryViewModel(
projectResult.Benefits.IntendedBenefits.ToList(),
projectResult.Benefits.OtherIntendedBenefit,
BuildOtherFactorsItemViewModel(projectResult.Benefits.OtherFactors).Where(o => o.Checked).ToList(),
projectResult.Urn,
projectResult.OutgoingAcademyUrn,
projectResult.Benefits.AnyRisks,
projectResult.Benefits.EqualitiesImpactAssessmentConsidered
projectResult.Benefits.EqualitiesImpactAssessmentConsidered,
projectResult.IsReadOnly,
projectResult.ProjectSentToCompleteDate
);
MarkSectionCompletedViewModel = new MarkSectionCompletedViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,27 @@
}

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">
Project reference: @Model.ProjectReference
</span>
<h1 class="govuk-heading-l">
Features of the transfer
</h1>
<hr class="govuk-section-break govuk-section-break--l">
</div>
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">
Project reference: @Model.ProjectReference
</span>
<h1 class="govuk-heading-l">
Features of the transfer
</h1>
<hr class="govuk-section-break govuk-section-break--l">
@if (Model.IsReadOnly == true)
{
<partial name="Shared/_ProjectApproved" for="@Model"/>
}
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="govuk-grid-column-three-quarters">

<partial for="@Model" name="_FeaturesSummary"/>

<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel"/>
</div>
@if (Model.IsReadOnly != true)
{
<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel"/>
}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public async Task<IActionResult> OnGetAsync()
OutgoingAcademyUrn = projectResult.OutgoingAcademyUrn;
ReasonForTheTransfer = projectResult.Features.ReasonForTheTransfer;
SpecificReasonForTheTransfer = projectResult.Features.SpecificReasonsForTheTransfer;
IsReadOnly = projectResult.IsReadOnly;
ProjectSentToCompleteDate = projectResult.ProjectSentToCompleteDate;
MarkSectionCompletedViewModel = new MarkSectionCompletedViewModel
{
IsCompleted = projectResult.Features.IsCompleted ?? false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">Project reference: @Model.ProjectReference</span>

<h1 class="govuk-heading-xl govuk-!-margin-bottom-2">
@Model.IncomingTrustName
</h1>
<h1 class="govuk-heading-xl govuk-!-margin-bottom-2">
@Model.IncomingTrustName
</h1>

@if (Model.IsReadOnly == true)
{
<partial name="Shared/_ProjectApproved" for="@Model" />
}

<p class="govuk-body govuk-!-margin-bottom-1">
<p class="govuk-body govuk-!-margin-bottom-1">
Route: @if (Model.IsFormAMAT)
{
<span>Form a MAT</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Index(ITaskListService taskListService, PerformanceDataChannel perf
public string ProjectStatus { get; set; }
public User AssignedUser { get; set; }
public bool HasPermission { get; set; }


/// <summary>
/// Item1 Academy Ukprn, Item2 Academy Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,37 @@
@using Dfe.Academisation.ExtensionMethods
@model Dfe.PrepareTransfers.Web.Pages.Projects.LegalRequirements.Index
@{
ViewBag.Title = "Legal Requirements";
Layout = "_Layout";
ViewBag.Title = "Legal Requirements";
Layout = "_Layout";
}

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

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">
Project reference: @Model.ProjectReference
</span>
<h1 class="govuk-heading-l">
Legal requirements
</h1>
<hr class="govuk-section-break govuk-section-break--l">
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<span class="govuk-caption-l">
Project reference: @Model.ProjectReference
</span>
<h1 class="govuk-heading-l">
Legal requirements
</h1>
<hr class="govuk-section-break govuk-section-break--l">
@if (Model.IsReadOnly == true)
{
<partial name="Shared/_ProjectApproved" for="@Model"/>
}
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<partial for="@Model.LegalRequirementsViewModel" name="_LegalSummary" />
<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel" />
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<partial for="@Model.LegalRequirementsViewModel" name="_LegalSummary"/>
@if (Model.IsReadOnly != true)
{
<partial name="Shared/_MarkSectionCompleted" for="MarkSectionCompletedViewModel"/>
}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ public async Task<IActionResult> OnGetAsync()

var projectResult = project.Result;
ProjectReference = projectResult.Reference;
IsReadOnly = projectResult.IsReadOnly;
ProjectSentToCompleteDate = projectResult.ProjectSentToCompleteDate;
LegalRequirementsViewModel = new LegalRequirementsViewModel(
projectResult.LegalRequirements.IncomingTrustAgreement,
projectResult.LegalRequirements.DiocesanConsent,
projectResult.LegalRequirements.OutgoingTrustConsent,
projectResult.Urn
projectResult.Urn,
projectResult.IsReadOnly,
projectResult.ProjectSentToCompleteDate
);
MarkSectionCompletedViewModel = new MarkSectionCompletedViewModel
{
Expand Down
Loading
Loading