Skip to content

Commit f62bde6

Browse files
TD-5563 seperating the features checkbox from the confirm checkbox
1 parent 8d38416 commit f62bde6

File tree

2 files changed

+88
-26
lines changed

2 files changed

+88
-26
lines changed

DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/ConfirmMakePrimaryFrameworkViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using DigitalLearningSolutions.Data.Models.CompetencyAssessments;
22
using DigitalLearningSolutions.Data.Models.Frameworks;
3-
using DigitalLearningSolutions.Web.Attributes;
3+
using System.ComponentModel.DataAnnotations;
44

55
namespace DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments
66
{
@@ -22,8 +22,8 @@ public ConfirmMakePrimaryFrameworkViewModel(CompetencyAssessmentBase competencyA
2222
public string? FrameworkName { get; set; }
2323
public int FrameworkId { get; set; }
2424
public string? Vocabulary { get; set; }
25-
[BooleanMustBeTrue(ErrorMessage = "You need to confirm that you want to make this the primary framework")]
26-
public bool Confirm { get; set; }
25+
[Required(ErrorMessage = "You need to confirm that you want to make this the primary framework")]
26+
public bool? Confirm { get; set; }
2727
public bool DescriptionStatus { get; set; }
2828
public bool ProviderandCategoryStatus { get; set; }
2929
public bool VocabularyStatus { get; set; }

DigitalLearningSolutions.Web/Views/CompetencyAssessments/ConfirmMakePrimaryFramework.cshtml

Lines changed: 85 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,117 @@
11
@using DigitalLearningSolutions.Web.Helpers
22
@using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments
33
@model ConfirmMakePrimaryFrameworkViewModel;
4+
45
@{
5-
var errorHasOccurred = !ViewData.ModelState.IsValid;
6-
ViewData["Title"] = "Competency Assessments - Change primary framework";
6+
var errorHasOccurred = !ViewData.ModelState.IsValid && ViewData.ModelState.ContainsKey(nameof(Model.Confirm));
7+
ViewData["Title"] = "Competency Assessments - make primary framework";
78
}
9+
810
<div class="nhsuk-grid-row">
911
<div class="nhsuk-grid-column-full">
1012
@if (errorHasOccurred)
1113
{
1214
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.Confirm) })" />
1315
}
14-
1516
<h1 class="nhsuk-heading-xl">Make @Model.FrameworkName primary framework</h1>
16-
<h2>Which features of the framework do you want to copy into this @Model.FrameworkName framework?</h2>
1717
</div>
1818
</div>
19+
1920
<div class="nhsuk-grid-row">
2021
<div class="nhsuk-grid-column-full">
2122
<form class="nhsuk-u-margin-bottom-3" method="post" asp-action="ConfirmMakePrimaryFramework">
23+
24+
<fieldset class="nhsuk-fieldset">
25+
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
26+
Which features of the framework do you want to copy into this @Model.FrameworkName framework?
27+
</legend>
28+
<div class="nhsuk-checkboxes">
29+
<div class="nhsuk-checkboxes__item ">
30+
<input class="nhsuk-checkboxes__input" id="DescriptionStatus" name="DescriptionStatus" type="checkbox" aria-describedby="DescriptionStatus-hint" value="true">
31+
<label class="nhsuk-label nhsuk-checkboxes__label" for="DescriptionStatus">
32+
Description
33+
</label>
34+
<div class="nhsuk-hint nhsuk-checkboxes__hint" id="DescriptionStatus-item-hint">
35+
The framework description will be copied into the competency assessment description.
36+
</div>
37+
</div>
38+
</div>
39+
<div class="nhsuk-checkboxes">
40+
<div class="nhsuk-checkboxes__item ">
41+
<input class="nhsuk-checkboxes__input" id="ProviderandCategoryStatus" name="ProviderandCategoryStatus" type="checkbox" aria-describedby="ProviderandCategoryStatus-hint" value="true">
42+
<label class="nhsuk-label nhsuk-checkboxes__label" for="ProviderandCategoryStatus">
43+
Provider and category
44+
</label>
45+
<div class="nhsuk-hint nhsuk-checkboxes__hint" id="ProviderandCategoryStatus-item-hint">
46+
The framework branding (provider and category) will be copied.
47+
</div>
48+
</div>
49+
</div>
50+
<div class="nhsuk-checkboxes">
51+
<div class="nhsuk-checkboxes__item ">
52+
<input class="nhsuk-checkboxes__input" id="VocabularyStatus" name="VocabularyStatus" type="checkbox" aria-describedby="VocabularyStatus-hint" value="true">
53+
<label class="nhsuk-label nhsuk-checkboxes__label" for="DescriptionStatus">
54+
Vocabulary
55+
</label>
56+
<div class="nhsuk-hint nhsuk-checkboxes__hint" id="VocabularyStatus-item-hint">
57+
The framework vocabulary (such as proficiency, competency, or capability) will be copied.
58+
</div>
59+
</div>
60+
</div>
61+
62+
<div class="nhsuk-checkboxes">
63+
<div class="nhsuk-checkboxes__item ">
64+
<input class="nhsuk-checkboxes__input" id="WorkingGroupStatus" name="WorkingGroupStatus" type="checkbox" aria-describedby="WorkingGroupStatus-hint" value="true">
65+
<label class="nhsuk-label nhsuk-checkboxes__label" for="WorkingGroupStatus">
66+
Working group
67+
</label>
68+
<div class="nhsuk-hint nhsuk-checkboxes__hint" id="WorkingGroupStatus-item-hint">
69+
Contributors and reviewers from the framework will be copied.
70+
</div>
71+
</div>
72+
</div>
73+
74+
<div class="nhsuk-checkboxes">
75+
<div class="nhsuk-checkboxes__item ">
76+
<input class="nhsuk-checkboxes__input" id="AllframeworkCompetenciesStatus" name="AllframeworkCompetenciesStatus" type="checkbox" aria-describedby="AllframeworkCompetenciesStatus-hint" value="true">
77+
<label class="nhsuk-label nhsuk-checkboxes__label" for="AllframeworkCompetenciesStatus">
78+
All framework competencies
79+
</label>
80+
<div class="nhsuk-hint nhsuk-checkboxes__hint" id="AllframeworkCompetenciesStatus-item-hint">
81+
All competencies in the framework will be copied.
82+
</div>
83+
</div>
84+
</div>
85+
</fieldset>
86+
<hr class="nhsuk-section-break nhsuk-section-break--l nhsuk-section-break--visible" />
87+
2288
<nhs-form-group>
23-
<vc:single-checkbox asp-for="@nameof(Model.DescriptionStatus)" label="Description" hint-text="The framework description will be copied into the competency assessment description."></vc:single-checkbox>
24-
</nhs-form-group>
25-
<nhs-form-group>
26-
<vc:single-checkbox asp-for="@nameof(Model.ProviderandCategoryStatus)" label="Provider and category" hint-text="The framework branding (provider and category) will be copied."></vc:single-checkbox>
27-
</nhs-form-group>
28-
<nhs-form-group>
29-
<vc:single-checkbox asp-for="@nameof(Model.VocabularyStatus)" label="Vocabulary" hint-text="The framework vocabulary (such as proficiency, competency, or capability) will be copied."></vc:single-checkbox>
30-
</nhs-form-group>
31-
<nhs-form-group>
32-
<vc:single-checkbox asp-for="@nameof(Model.WorkingGroupStatus)" label="Working group" hint-text="Contributors and reviewers from the framework will be copied."></vc:single-checkbox>
33-
</nhs-form-group>
34-
<nhs-form-group>
35-
<vc:single-checkbox asp-for="@nameof(Model.AllframeworkCompetenciesStatus)" label="All framework competencies" hint-text="All competencies in the framework will be copied."></vc:single-checkbox>
89+
<div class="nhsuk-checkboxes__item">
90+
91+
<input class="nhsuk-checkboxes__input" id="Confirm" name="Confirm" type="checkbox" aria-describedby="Confirm-hint" value="true">
92+
<label class="nhsuk-label nhsuk-checkboxes__label" for="@Model.Confirm">
93+
I am sure that I wish to make @Model.FrameworkName the primary framework
94+
</label>
95+
</div>
3696
</nhs-form-group>
97+
@* Hidden fields *@
3798
<input type="hidden" asp-for="CompetencyAssessmentId" />
3899
<input type="hidden" asp-for="FrameworkId" />
39100
<input type="hidden" asp-for="FrameworkName" />
40101
<input type="hidden" asp-for="AssessmentName" />
41102
<input type="hidden" asp-for="UserRole" />
42103
<input type="hidden" asp-for="Vocabulary" />
43-
44-
<vc:single-checkbox asp-for="@nameof(Model.Confirm)"
45-
label="I am sure that I wish to make @Model.FrameworkName the primary framework"
46-
hint-text="" />
47104

48105
<button class="nhsuk-button" type="submit">Make primary framework</button>
106+
107+
49108
</form>
109+
50110
<div class="nhsuk-back-link">
51-
<a class="nhsuk-back-link__link" asp-action="SelectFrameworkSources" asp-route-actionName="Summary" asp-route-competencyAssessmentId="@ViewContext.RouteData.Values["competencyAssessmentId"]">
52-
<svg class="nhsuk-icon nhsuk-icon__chevron-left" focusable='false' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
111+
<a class="nhsuk-back-link__link" asp-action="SelectFrameworkSources"
112+
asp-route-actionName="Summary"
113+
asp-route-competencyAssessmentId="@ViewContext.RouteData.Values["competencyAssessmentId"]">
114+
<svg class="nhsuk-icon nhsuk-icon__chevron-left" focusable='false' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true">
53115
<path d="M13.41 12l5.3-5.29a1 1 0 1 0-1.42-1.42L12 10.59l-5.29-5.3a1 1 0 0 0-1.42 1.42l5.3 5.29-5.3 5.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l5.29-5.3 5.29 5.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"></path>
54116
</svg>
55117
Cancel

0 commit comments

Comments
 (0)