-
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 #1057 from DFE-Digital/feature/165916-scheme-of-de…
…legation Feature/165916 scheme of delegation
- Loading branch information
Showing
16 changed files
with
162 additions
and
11 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
31 changes: 31 additions & 0 deletions
31
Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionMaker.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,31 @@ | ||
@page "/task-list/{id:int}/decision/decision-maker" | ||
@using Dfe.PrepareConversions.Extensions | ||
@using Dfe.PrepareConversions.TagHelpers | ||
@model Dfe.PrepareConversions.Pages.TaskList.Decision.DecisionMaker | ||
@{ | ||
ViewData["Title"] = $"Decision maker's name"; | ||
Layout = "_Layout"; | ||
} | ||
|
||
@section BeforeMain | ||
{ | ||
<partial name="_BackLink" model="@Model.BackLinkModel"/> | ||
<partial name="_ErrorSummary"/> | ||
} | ||
|
||
<span id="selection-span" class="govuk-caption-l">Record the decision</span> | ||
<h1 class="govuk-heading-l">Decision maker's name</h1> | ||
|
||
<form method="post"> | ||
<div class="govuk-form-group @ModelState.GetErrorStyleClass()"> | ||
<label class="govuk-hint" for="decision-maker-name"> | ||
Enter the name of the person who made the decision | ||
</label> | ||
<input class="govuk-input govuk-!-width-two-thirds" id="decision-maker-name" name="decision-maker-name" type="text" value="@Model.DecisionMakerName"> | ||
</div> | ||
|
||
|
||
<button class="govuk-button" data-module="govuk-button" id="submit-btn"> | ||
Continue | ||
</button> | ||
</form> |
67 changes: 67 additions & 0 deletions
67
...PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/Decision/DecisionMaker.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,67 @@ | ||
using Dfe.Academisation.ExtensionMethods; | ||
using Dfe.PrepareConversions.Data.Models.AdvisoryBoardDecision; | ||
using Dfe.PrepareConversions.Data.Services; | ||
using Dfe.PrepareConversions.Extensions; | ||
using Dfe.PrepareConversions.Models; | ||
using Dfe.PrepareConversions.Pages.TaskList.Decision.Models; | ||
using Dfe.PrepareConversions.Services; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
|
||
namespace Dfe.PrepareConversions.Pages.TaskList.Decision; | ||
|
||
public class DecisionMaker : DecisionBaseModel | ||
{ | ||
private readonly ErrorService _errorService; | ||
|
||
public DecisionMaker(ErrorService errorService, IAcademyConversionProjectRepository repository, ISession session) | ||
: base(repository, session) | ||
{ | ||
_errorService = errorService; | ||
} | ||
|
||
[BindProperty(Name = "decision-maker-name")] | ||
[Required] | ||
public string DecisionMakerName { get; set; } | ||
|
||
|
||
public AdvisoryBoardDecision Decision { get; set; } | ||
|
||
public IActionResult OnGet(int id) | ||
{ | ||
|
||
Decision = GetDecisionFromSession(id); | ||
DecisionMakerName = Decision.DecisionMakerName; | ||
|
||
SetBackLinkModel(Links.Decision.WhoDecided, id); | ||
|
||
return Page(); | ||
} | ||
|
||
public IActionResult OnPost(int id) | ||
{ | ||
if (!ModelState.IsValid) | ||
{ | ||
_errorService.AddError("decision-maker-name", "Enter the decision maker's name"); | ||
return OnGet(id); | ||
} | ||
|
||
AdvisoryBoardDecision decision = GetDecisionFromSession(id); | ||
decision.DecisionMakerName = DecisionMakerName; | ||
|
||
SetDecisionInSession(id, decision); | ||
|
||
return decision.Decision switch | ||
{ | ||
AdvisoryBoardDecisions.Approved => RedirectToPage(Links.Decision.AnyConditions.Page, LinkParameters), | ||
AdvisoryBoardDecisions.Declined => RedirectToPage(Links.Decision.DeclineReason.Page, LinkParameters), | ||
AdvisoryBoardDecisions.Deferred => RedirectToPage(Links.Decision.WhyDeferred.Page, LinkParameters), | ||
AdvisoryBoardDecisions.Withdrawn => RedirectToPage(Links.Decision.WhyWithdrawn.Page, LinkParameters), | ||
_ => RedirectToPage(Links.Decision.AnyConditions.Page, LinkParameters) | ||
}; | ||
} | ||
} |
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