diff --git a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs index c07c7f4e43..3c2cc31532 100644 --- a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Data; using System.Linq; - public interface ICompetencyAssessmentDataService { //GET DATA @@ -34,6 +33,8 @@ public interface ICompetencyAssessmentDataService IEnumerable GetCompetenciesForCompetencyAssessment(int competencyAssessmentId); IEnumerable GetLinkedFrameworksForCompetencyAssessment(int competencyAssessmentId); int[] GetLinkedFrameworkCompetencyIds(int competencyAssessmentId, int frameworkId); + CompetencyAssessmentFeatures? GetCompetencyAssessmentFeaturesTaskStatus(int competencyAssessmentId); + int? GetSelfAssessmentStructure(int competencyAssessmentId); //UPDATE DATA bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName); @@ -64,12 +65,15 @@ void MoveCompetencyGroupInSelfAssessment(int competencyAssessmentId, int groupId, string direction ); + public bool UpdateCompetencyAssessmentFeaturesTaskStatus(int id, bool descriptionStatus, bool providerandCategoryStatus, bool vocabularyStatus, + bool workingGroupStatus, bool AllframeworkCompetenciesStatus); + void UpdateSelfAssessmentFromFramework(int selfAssessmentId, int? frameworkId); //INSERT DATA int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName); bool InsertSelfAssessmentFramework(int adminId, int selfAssessmentId, int frameworkId); bool InsertCompetenciesIntoAssessmentFromFramework(int[] selectedCompetencyIds, int frameworkId, int competencyAssessmentId); - + bool InsertSelfAssessmentStructure(int selfAssessmentId, int? frameworkId); //DELETE DATA bool RemoveFrameworkCompetenciesFromAssessment(int competencyAssessmentId, int frameworkId); bool RemoveCompetencyFromAssessment(int competencyAssessmentId, int competencyId); @@ -754,5 +758,112 @@ public void MoveCompetencyGroupInSelfAssessment(int competencyAssessmentId, int commandType: CommandType.StoredProcedure ); } + + public bool UpdateCompetencyAssessmentFeaturesTaskStatus(int id, bool descriptionStatus, bool providerandCategoryStatus, bool vocabularyStatus, + bool workingGroupStatus, bool AllframeworkCompetenciesStatus) + { + var numberOfAffectedRows = connection.Execute( + @"IF EXISTS (SELECT 1 FROM SelfAssessmentTaskStatus WHERE SelfAssessmentId = @id) + BEGIN + UPDATE SelfAssessmentTaskStatus + SET IntroductoryTextTaskStatus = CASE WHEN @descriptionStatus = 1 THEN 1 ELSE NULL END, + BrandingTaskStatus = CASE WHEN @providerandCategoryStatus = 1 THEN 1 ELSE NULL END, + VocabularyTaskStatus = CASE WHEN @vocabularyStatus = 1 THEN 1 ELSE NULL END, + WorkingGroupTaskStatus = CASE WHEN @workingGroupStatus = 1 THEN 1 ELSE NULL END, + FrameworkLinksTaskStatus = CASE WHEN @AllframeworkCompetenciesStatus = 1 THEN 1 ELSE NULL END + WHERE SelfAssessmentId = @id; + END + ELSE + BEGIN + INSERT INTO SelfAssessmentTaskStatus + (SelfAssessmentId, IntroductoryTextTaskStatus, BrandingTaskStatus, VocabularyTaskStatus, WorkingGroupTaskStatus, FrameworkLinksTaskStatus) + VALUES + ( + @id, + CASE WHEN @descriptionStatus = 1 THEN 1 ELSE NULL END, + CASE WHEN @providerandCategoryStatus = 1 THEN 1 ELSE NULL END, + CASE WHEN @vocabularyStatus = 1 THEN 1 ELSE NULL END, + CASE WHEN @workingGroupStatus = 1 THEN 1 ELSE NULL END, + CASE WHEN @AllframeworkCompetenciesStatus = 1 THEN 1 ELSE NULL END + ); + END", + new { id, descriptionStatus, providerandCategoryStatus, vocabularyStatus, workingGroupStatus, AllframeworkCompetenciesStatus } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not updating SelfAssessmentTaskStatus as db update failed. " + + $"SelfAssessmentId: {id}, IntroductoryTextTaskStatus: {descriptionStatus}, BrandingTaskStatus: {providerandCategoryStatus}, " + + $"VocabularyTaskStatus: {vocabularyStatus}, WorkingGroupTaskStatus: {workingGroupStatus}, FrameworkLinksTaskStatus: {AllframeworkCompetenciesStatus}" + ); + return false; + } + return true; + } + + public CompetencyAssessmentFeatures? GetCompetencyAssessmentFeaturesTaskStatus(int competencyAssessmentId) + { + return connection.QueryFirstOrDefault( + @"SELECT s.ID, s.Name AS CompetencyAssessmentName, sts.IntroductoryTextTaskStatus AS DescriptionStatus, sts.BrandingTaskStatus AS ProviderandCategoryStatus, + sts.VocabularyTaskStatus AS VocabularyStatus, sts.WorkingGroupTaskStatus AS WorkingGroupStatus, sts.FrameworkLinksTaskStatus AS AllframeworkCompetenciesStatus + FROM SelfAssessments s INNER JOIN + SelfAssessmentTaskStatus sts ON s.ID = sts.SelfAssessmentId + WHERE s.ID = @competencyAssessmentId", + new { competencyAssessmentId } + ); + + } + + public void UpdateSelfAssessmentFromFramework( int selfAssessmentId, int? frameworkId) + { + + var numberOfAffectedRows = connection.Execute( + @"UPDATE s + SET + [Description] = COALESCE(F.[Description], 'No description provided'), + BrandID = F.BrandID, + CategoryID = F.CategoryID, + CreatedByCentreID = AU.CentreID, + CreatedByAdminID = F.OwnerAdminID + FROM SelfAssessments s + INNER JOIN Frameworks F ON F.ID = @frameworkId + INNER JOIN AdminUsers AU ON F.OwnerAdminID = AU.AdminID + WHERE s.id = @selfAssessmentId;" + , + new {selfAssessmentId, frameworkId } + ); + } + public bool InsertSelfAssessmentStructure(int selfAssessmentId, int? frameworkId) + { + + var numberOfAffectedRows = connection.Execute( + @"INSERT INTO SelfAssessmentStructure (SelfAssessmentID, CompetencyID, Ordering, CompetencyGroupID) + SELECT s.ID, FC.CompetencyID, ROW_NUMBER() OVER( ORDER BY FCG.Ordering, FC.Ordering ), FCG.CompetencyGroupID + FROM FrameworkCompetencies AS FC + INNER JOIN FrameworkCompetencyGroups AS FCG ON FC.FrameworkCompetencyGroupID = FCG.ID INNER JOIN + SelfAssessments s ON s.id = @selfAssessmentId + WHERE FC.FrameworkID = @frameworkId" + , + new { selfAssessmentId, frameworkId } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not inserting SelfAssessmentStructure record as db insert failed. " + + $"selfAssessmentId: {selfAssessmentId}, frameworkId: {frameworkId}" + ); + return false; + } + + return true; + } + public int? GetSelfAssessmentStructure(int competencyAssessmentId) + { + return connection.QueryFirstOrDefault( + @"SELECT 1 from dbo.SelfAssessmentStructure where selfassessmentid = @competencyAssessmentId", + new { competencyAssessmentId } + ); + + } } } diff --git a/DigitalLearningSolutions.Data/Models/CompetencyAssessments/CompetencyAssessmentFeatures.cs b/DigitalLearningSolutions.Data/Models/CompetencyAssessments/CompetencyAssessmentFeatures.cs new file mode 100644 index 0000000000..f68bfe7a67 --- /dev/null +++ b/DigitalLearningSolutions.Data/Models/CompetencyAssessments/CompetencyAssessmentFeatures.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DigitalLearningSolutions.Data.Models.CompetencyAssessments +{ + public class CompetencyAssessmentFeatures + { + public int ID { get; set; } + public string CompetencyAssessmentName { get; set; } = string.Empty; + public int UserRole { get; set; } + public bool DescriptionStatus { get; set; } + public bool ProviderandCategoryStatus { get; set; } + public bool VocabularyStatus { get; set; } + public bool WorkingGroupStatus { get; set; } + public bool AllframeworkCompetenciesStatus { get; set; } + } +} diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs index b0fb7fa9de..4464dee99c 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs @@ -8,6 +8,7 @@ using DigitalLearningSolutions.Web.Helpers; using DigitalLearningSolutions.Web.Models.Enums; using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments; + using GDS.MultiPageFormData.Enums; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.Extensions.Logging; @@ -82,7 +83,6 @@ public IActionResult ViewCompetencyAssessments(string tabname, string? searchStr isWorkforceManager ); } - var currentTab = tabname == "All" ? CompetencyAssessmentsTab.AllCompetencyAssessments : CompetencyAssessmentsTab.MyCompetencyAssessments; CompetencyAssessmentsViewModel? model = new CompetencyAssessmentsViewModel( isWorkforceManager, @@ -96,12 +96,18 @@ public IActionResult ViewCompetencyAssessments(string tabname, string? searchStr [Route("/CompetencyAssessments/{actionName}/Name/{competencyAssessmentId}")] [Route("/CompetencyAssessments/Framework/{frameworkId}/{actionName}/Name")] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/{actionName}/Name")] [Route("/CompetencyAssessments/{actionName}/Name")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] public IActionResult CompetencyAssessmentName(string actionName, int competencyAssessmentId = 0, int? frameworkId = null) { var adminId = GetAdminID(); var competencyAssessmentBase = new CompetencyAssessmentBase(); + if ((frameworkId.HasValue && frameworkId.Value != 0 && actionName == "New")) + { + var data = new CompetencyAssessmentFeaturesViewModel(); + SetcompetencyAssessmentFeaturesData(data); + } if (competencyAssessmentId > 0) { competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId); @@ -129,6 +135,7 @@ public IActionResult CompetencyAssessmentName(string actionName, int competencyA [HttpPost] [Route("/CompetencyAssessments/{actionName}/Name/{competencyAssessmentId}")] [Route("/CompetencyAssessments/Framework/{frameworkId}/{actionName}/Name")] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/{actionName}/Name")] [Route("/CompetencyAssessments/{actionName}/Name")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] public IActionResult SaveProfileName(CompetencyAssessmentBase competencyAssessmentBase, string actionName, int competencyAssessmentId = 0, int? frameworkId = null) @@ -153,6 +160,7 @@ public IActionResult SaveProfileName(CompetencyAssessmentBase competencyAssessme return View("Name", competencyAssessmentBase); } competencyAssessmentId = competencyAssessmentService.InsertCompetencyAssessment(adminId, userCentreId, competencyAssessmentBase.CompetencyAssessmentName, frameworkId); + if(frameworkId.HasValue && frameworkId.Value != 0) return RedirectToAction("CompetencyAssessmentFeatures", new { competencyAssessmentId, frameworkId }); } else { @@ -163,6 +171,9 @@ public IActionResult SaveProfileName(CompetencyAssessmentBase competencyAssessme ModelState.AddModelError(nameof(CompetencyAssessmentBase.CompetencyAssessmentName), "Another competency assessment exists with that name. Please choose a different name."); return View("Name", competencyAssessmentBase); } + if (frameworkId.HasValue && frameworkId.Value != 0 + && competencyAssessmentId != 0 + && actionName == "Edit") return RedirectToAction("CompetencyAssessmentFeatures", new { competencyAssessmentId, frameworkId }); } return RedirectToAction("ManageCompetencyAssessment", new { competencyAssessmentId, frameworkId }); } @@ -640,5 +651,80 @@ public IActionResult ViewSelectedCompetencies(ViewSelectedCompetenciesFormData m competencyAssessmentService.UpdateSelectCompetenciesTaskStatus(model.ID, model.TaskStatus.Value, null); return RedirectToAction("ManageCompetencyAssessment", new { competencyAssessmentId = model.ID }); } + + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/Features")] + public IActionResult CompetencyAssessmentFeatures(int competencyAssessmentId, int? frameworkId = null) + { + + var adminId = GetAdminID(); + var data = GetcompetencyAssessmentFeaturesData(); + if (!string.IsNullOrEmpty(data.CompetencyAssessmentName)) return View(data); + var competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId); + if (competencyAssessmentBase == null) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 500 }); + if (competencyAssessmentBase.UserRole < 2) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); + var baseModel = new CompetencyAssessmentFeaturesViewModel(competencyAssessmentBase.ID, + competencyAssessmentBase.CompetencyAssessmentName, + competencyAssessmentBase.UserRole, + frameworkId); + return View(baseModel); + } + [HttpPost] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/Features")] + public IActionResult CompetencyAssessmentFeatures(CompetencyAssessmentFeaturesViewModel featuresViewModel) + { + if (featuresViewModel == null) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 500 }); + SetcompetencyAssessmentFeaturesData(featuresViewModel); + return RedirectToAction("CompetencyAssessmentSummary", new { competencyAssessmentId = featuresViewModel.ID,featuresViewModel.FrameworkId }); + } + + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/Summary")] + public IActionResult CompetencyAssessmentSummary(int competencyAssessmentId, int? frameworkId = null) + { + if (competencyAssessmentService.GetSelfAssessmentStructure(competencyAssessmentId) != 0) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 410 }); + if (competencyAssessmentId == 0) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); + var data = GetcompetencyAssessmentFeaturesData(); + if (data == null) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 500 }); + SetcompetencyAssessmentFeaturesData(data); + return View(data); + } + [HttpPost] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{competencyAssessmentId}/Summary")] + public IActionResult CompetencyAssessmentSummary(CompetencyAssessmentFeaturesViewModel competency) + { + var data = GetcompetencyAssessmentFeaturesData(); + if (data.ID == 0) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 403 }); + if (competencyAssessmentService.GetSelfAssessmentStructure(data.ID) != 0) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 410 }); + var features = competencyAssessmentService.UpdateCompetencyAssessmentFeaturesTaskStatus(data.ID, + data.DescriptionStatus, + data.ProviderandCategoryStatus, + data.VocabularyStatus, + data.WorkingGroupStatus, + data.AllframeworkCompetenciesStatus); + if (!features) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 500 }); + competencyAssessmentService.UpdateSelfAssessmentFromFramework(data.ID , data.FrameworkId ); + var insertSelfAssessment = competencyAssessmentService.InsertSelfAssessmentStructure(data.ID, data.FrameworkId); + if (!insertSelfAssessment) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 500 }); + multiPageFormService.ClearMultiPageFormData(MultiPageFormDataFeature.AddCustomWebForm("AssessmentFeaturesDataCWF"), TempData); + TempData.Clear(); + return RedirectToAction("ManageCompetencyAssessment", new { competencyAssessmentId = competency.ID, competency.FrameworkId }); + } + + private void SetcompetencyAssessmentFeaturesData(CompetencyAssessmentFeaturesViewModel data) + { + multiPageFormService.SetMultiPageFormData( + data, + MultiPageFormDataFeature.AddCustomWebForm("AssessmentFeaturesDataCWF"), + TempData + ); + } + + private CompetencyAssessmentFeaturesViewModel GetcompetencyAssessmentFeaturesData() + { + var data = multiPageFormService.GetMultiPageFormData( + MultiPageFormDataFeature.AddCustomWebForm("AssessmentFeaturesDataCWF"), + TempData + ).GetAwaiter().GetResult(); + return data; + } } } diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs index c057b43776..a07a957ee0 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs @@ -2,6 +2,7 @@ { using DigitalLearningSolutions.Web.Helpers; using DigitalLearningSolutions.Web.Services; + using GDS.MultiPageFormData; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; @@ -16,13 +17,15 @@ public partial class CompetencyAssessmentsController : Controller private readonly IFrameworkNotificationService frameworkNotificationService; private readonly ILogger logger; private readonly IConfiguration config; + private readonly IMultiPageFormService multiPageFormService; public CompetencyAssessmentsController( ICompetencyAssessmentService competencyAssessmentService, IFrameworkService frameworkService, ICommonService commonService, IFrameworkNotificationService frameworkNotificationService, ILogger logger, - IConfiguration config) + IConfiguration config, + IMultiPageFormService multiPageFormService) { this.competencyAssessmentService = competencyAssessmentService; this.frameworkService = frameworkService; @@ -30,6 +33,7 @@ public CompetencyAssessmentsController( this.frameworkNotificationService = frameworkNotificationService; this.logger = logger; this.config = config; + this.multiPageFormService = multiPageFormService; } public IActionResult Index() { diff --git a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs index 6d13912a3b..33d55b7fed 100644 --- a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs +++ b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs @@ -30,7 +30,8 @@ public interface ICompetencyAssessmentService bool RemoveSelfAssessmentFramework(int assessmentId, int frameworkId, int adminId); int[] GetLinkedFrameworkCompetencyIds(int competencyAssessmentId, int frameworkId); - + CompetencyAssessmentFeatures? GetCompetencyAssessmentFeaturesTaskStatus(int competencyAssessmentId); + int? GetSelfAssessmentStructure(int competencyAssessmentId); //UPDATE DATA bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName); bool UpdateCompetencyRoleProfileLinks(int competencyAssessmentId, int adminId, int? professionalGroupId, int? subGroupId, int? roleId); @@ -53,13 +54,16 @@ void MoveCompetencyGroupInSelfAssessment(int competencyAssessmentId, int groupId, string direction ); + bool UpdateCompetencyAssessmentFeaturesTaskStatus(int id, bool descriptionStatus, bool providerandCategoryStatus, bool vocabularyStatus, + bool workingGroupStatus, bool AllframeworkCompetenciesStatus); + void UpdateSelfAssessmentFromFramework(int selfAssessmentId, int? frameworkId); //INSERT DATA int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName, int? frameworkId); bool InsertSelfAssessmentFramework(int adminId, int assessmentId, int frameworkId); int GetCompetencyCountByFrameworkId(int competencyAssessmentId, int frameworkId); bool InsertCompetenciesIntoAssessmentFromFramework(int[] selectedCompetencyIds, int frameworkId, int competencyAssessmentId); - + bool InsertSelfAssessmentStructure(int selfAssessmentId, int? frameworkId); //DELETE DATA bool RemoveFrameworkCompetenciesFromAssessment(int competencyAssessmentId, int frameworkId); bool RemoveCompetencyFromAssessment(int competencyAssessmentId, int competencyId); @@ -264,5 +268,27 @@ public void MoveCompetencyGroupInSelfAssessment(int competencyAssessmentId, int { competencyAssessmentDataService.MoveCompetencyGroupInSelfAssessment(competencyAssessmentId, groupId, direction); } - } + public bool UpdateCompetencyAssessmentFeaturesTaskStatus(int id, bool descriptionStatus, bool providerandCategoryStatus, bool vocabularyStatus, + bool workingGroupStatus, bool AllframeworkCompetenciesStatus) + { + return competencyAssessmentDataService.UpdateCompetencyAssessmentFeaturesTaskStatus(id, descriptionStatus, providerandCategoryStatus, vocabularyStatus, + workingGroupStatus, AllframeworkCompetenciesStatus); + } + public CompetencyAssessmentFeatures? GetCompetencyAssessmentFeaturesTaskStatus(int competencyAssessmentId) + { + return competencyAssessmentDataService.GetCompetencyAssessmentFeaturesTaskStatus(competencyAssessmentId); + } + public bool InsertSelfAssessmentStructure(int selfAssessmentId, int? frameworkId) + { + return competencyAssessmentDataService.InsertSelfAssessmentStructure(selfAssessmentId, frameworkId); + } + public void UpdateSelfAssessmentFromFramework(int selfAssessmentId, int? frameworkId) + { + competencyAssessmentDataService.UpdateSelfAssessmentFromFramework(selfAssessmentId, frameworkId); + } + public int? GetSelfAssessmentStructure(int competencyAssessmentId) + { + return competencyAssessmentDataService.GetSelfAssessmentStructure(competencyAssessmentId); + } + } } diff --git a/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/CompetencyAssessmentFeaturesViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/CompetencyAssessmentFeaturesViewModel.cs new file mode 100644 index 0000000000..b4279f5c27 --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/CompetencyAssessments/CompetencyAssessmentFeaturesViewModel.cs @@ -0,0 +1,52 @@ +using DigitalLearningSolutions.Data.Models.CompetencyAssessments; +using System.Collections.Generic; + +namespace DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments +{ + public class CompetencyAssessmentFeaturesViewModel + { + public CompetencyAssessmentFeaturesViewModel() + { } + public CompetencyAssessmentFeaturesViewModel(int id, string competencyAssessmentName, int userRole, int? frameworkId) + { + ID = id; + CompetencyAssessmentName = competencyAssessmentName; + UserRole = userRole; + FrameworkId = frameworkId; + } + + public CompetencyAssessmentFeaturesViewModel(CompetencyAssessmentFeaturesViewModel features) + { + ID = features.ID; + CompetencyAssessmentName = features.CompetencyAssessmentName; + DescriptionStatus = features.DescriptionStatus; + ProviderandCategoryStatus = features.ProviderandCategoryStatus; + VocabularyStatus = features.VocabularyStatus; + WorkingGroupStatus = features.WorkingGroupStatus; + AllframeworkCompetenciesStatus = features.AllframeworkCompetenciesStatus; + FrameworkId = features.FrameworkId.Value; + } + public int ID { get; set; } + public string CompetencyAssessmentName { get; set; } = string.Empty; + public int UserRole { get; set; } + public bool DescriptionStatus { get; set; } + public bool ProviderandCategoryStatus { get; set; } + public bool VocabularyStatus { get; set; } + public bool WorkingGroupStatus { get; set; } + public bool AllframeworkCompetenciesStatus { get; set; } + public int? FrameworkId { get; set; } + public IEnumerable SelectedFeatures + { + get + { + var features = new List(); + if (DescriptionStatus) features.Add("Description"); + if (ProviderandCategoryStatus) features.Add("Provider and category"); + if (VocabularyStatus) features.Add("Vocabulary"); + if (WorkingGroupStatus) features.Add("Working group"); + if (AllframeworkCompetenciesStatus) features.Add("All framework competencies"); + return features; + } + } + } +} diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentFeatures.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentFeatures.cshtml new file mode 100644 index 0000000000..1e5ef6a629 --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentFeatures.cshtml @@ -0,0 +1,64 @@ +@using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments +@model CompetencyAssessmentFeaturesViewModel +@{ + ViewData["Title"] = "Competency assessment features "; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; +} + +@section NavMenuItems { + +} + @section NavBreadcrumbs { + +} + +

Create a new competency assessment

+

Which features of the framework do you want to copy into the competency assessment?

+

The framework itself will be used as the source for this self-assessment.

+

Select any additional features you want to copy into the competency assessment. You can edit all features later if needed.

+
+ @if (!ViewData.ModelState.IsValid) + { + + } + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentSummary.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentSummary.cshtml new file mode 100644 index 0000000000..be9f1d0e0d --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/CompetencyAssessmentSummary.cshtml @@ -0,0 +1,81 @@ +@using DigitalLearningSolutions.Web.ViewModels.CompetencyAssessments +@model CompetencyAssessmentFeaturesViewModel +@{ + ViewData["Title"] = "Competency assessment features summary"; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; +} + +@section NavMenuItems { + +} +@section NavBreadcrumbs { + +} + + +

Check your answer before creating competency assessment

+
+ @if (!ViewData.ModelState.IsValid) + { + + } +
+
+ +
+
+ Assessment name +
+
+ @Model.CompetencyAssessmentName +
+
+ + Change assessment name + +
+
+
+
+ Features to copy from framework +
+
+ @if (Model.SelectedFeatures.Any()) + { +
    + @foreach (var feature in Model.SelectedFeatures) + { +
  • @feature
  • + } +
+ } + else + { + No features selected + } +
+
+ + Change features + +
+
+
+ + + + +
+ +