diff --git a/DigitalLearningSolutions.Data.Migrations/202501280929_CreateCompetencyAssessmentTables.cs b/DigitalLearningSolutions.Data.Migrations/202501280929_CreateCompetencyAssessmentTables.cs index a75c829262..3ad9669e2c 100644 --- a/DigitalLearningSolutions.Data.Migrations/202501280929_CreateCompetencyAssessmentTables.cs +++ b/DigitalLearningSolutions.Data.Migrations/202501280929_CreateCompetencyAssessmentTables.cs @@ -12,11 +12,11 @@ public override void Up() .WithColumn("SelfAssessmentId").AsInt32().NotNullable().ForeignKey("SelfAssessments", "ID") .WithColumn("FrameworkId").AsInt32().NotNullable().ForeignKey("Frameworks", "ID") .WithColumn("CreatedDate").AsDateTime().NotNullable().WithDefault(SystemMethods.CurrentDateTime) - .WithColumn("CreatedByUserId").AsInt32().NotNullable().ForeignKey("Users", "ID") + .WithColumn("CreatedByAdminId").AsInt32().NotNullable().ForeignKey("AdminAccounts", "ID") .WithColumn("RemovedDate").AsDateTime().Nullable() - .WithColumn("RemovedByUserId").AsInt32().Nullable().ForeignKey("Users", "ID") + .WithColumn("RemovedByAdminId").AsInt32().Nullable().ForeignKey("AdminAccounts", "ID") .WithColumn("AmendedDate").AsDateTime().Nullable() - .WithColumn("AmendedByUserId").AsInt32().Nullable().ForeignKey("Users", "ID"); + .WithColumn("AmendedByAdminId").AsInt32().Nullable().ForeignKey("AdminAccounts", "ID"); Create.Table("SelfAssessmentTaskStatus") .WithColumn("ID").AsInt32().NotNullable().PrimaryKey().Identity() .WithColumn("SelfAssessmentId").AsInt32().NotNullable().ForeignKey("SelfAssessments", "ID").Unique() @@ -32,13 +32,13 @@ public override void Up() .WithColumn("SupervisorRolesTaskStatus").AsBoolean().Nullable() .WithColumn("SelfAssessmentOptionsTaskStatus").AsBoolean().Nullable() .WithColumn("ReviewTaskStatus").AsBoolean().Nullable(); - Execute.Sql($@"INSERT INTO SelfAssessmentFrameworks (SelfAssessmentId, FrameworkId, CreatedByUserId) - SELECT sa.ID, fc.FrameworkID, aa.UserID + Alter.Table("SelfAssessments").AlterColumn("Description").AsString(int.MaxValue).Nullable(); + Execute.Sql($@"INSERT INTO SelfAssessmentFrameworks (SelfAssessmentId, FrameworkId, CreatedByAdminId) + SELECT sa.ID, fc.FrameworkID, sa.CreatedByAdminID FROM SelfAssessments AS sa INNER JOIN SelfAssessmentStructure AS sas ON sa.ID = sas.SelfAssessmentID INNER JOIN - FrameworkCompetencies AS fc ON sas.CompetencyID = fc.CompetencyID INNER JOIN - AdminAccounts AS aa ON sa.CreatedByAdminID = aa.ID - GROUP BY sa.ID, fc.FrameworkID, aa.UserID + FrameworkCompetencies AS fc ON sas.CompetencyID = fc.CompetencyID + GROUP BY sa.ID, fc.FrameworkID, sa.CreatedByAdminID "); Execute.Sql($@"INSERT INTO SelfAssessmentTaskStatus (SelfAssessmentId, IntroductoryTextTaskStatus, BrandingTaskStatus, VocabularyTaskStatus, WorkingGroupTaskStatus, NationalRoleProfileTaskStatus, FrameworkLinksTaskStatus, SelectCompetenciesTaskStatus, OptionalCompetenciesTaskStatus, RoleRequirementsTaskStatus, SupervisorRolesTaskStatus, SelfAssessmentOptionsTaskStatus) SELECT ID, 1,1,1,1,1,1,1,1,1,1,1 @@ -50,6 +50,7 @@ public override void Down() { Delete.Table("SelfAssessmentFrameworks"); Delete.Table("SelfAssessmentTaskStatus"); + Alter.Table("SelfAssessments").AlterColumn("Description").AsString(int.MaxValue).NotNullable(); } } diff --git a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs index a24ad4edc7..29c9e5e6c7 100644 --- a/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/CompetencyAssessmentDataService.cs @@ -1,10 +1,14 @@ namespace DigitalLearningSolutions.Data.DataServices { + using System; using System.Collections.Generic; using System.Data; using System.Linq; using Dapper; + using DigitalLearningSolutions.Data.Models.Common; using DigitalLearningSolutions.Data.Models.CompetencyAssessments; + using DigitalLearningSolutions.Data.Models.Frameworks; + using DocumentFormat.OpenXml.Wordprocessing; using Microsoft.Extensions.Logging; public interface ICompetencyAssessmentDataService @@ -24,8 +28,16 @@ public interface ICompetencyAssessmentDataService bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName); bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID); + bool UpdateCompetencyAssessmentBranding( + int competencyAssessmentId, + int brandId, + int categoryId, + int adminId + ); + bool UpdateCompetencyAssessmentDescription(int competencyAssessmentId, int adminId, string competencyAssessmentDescription); //INSERT DATA - + int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName); + bool InsertSelfAssessmentFramework(int adminId, int selfAssessmentId, int frameworkId); //DELETE DATA } @@ -121,6 +133,33 @@ FROM SelfAssessmentCollaborators ).FirstOrDefault(); } + public int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName) + { + if ((competencyAssessmentName.Length == 0) | (adminId < 1)) + { + logger.LogWarning( + $"Not inserting competency assessmente as it failed server side validation. AdminId: {adminId}, competencyAssessmentName: {competencyAssessmentName}" + ); + return -1; + } + var result = connection.ExecuteScalar( + @"SELECT COUNT(*) FROM SelfAssessments WHERE [Name] = @competencyAssessmentName", + new { competencyAssessmentName } + ); + int existingSelfAssessments = Convert.ToInt32(result); + if (existingSelfAssessments > 0) + { + return -1; + } + var assessmentId = connection.QuerySingle( + @"INSERT INTO SelfAssessments ([Name], CreatedByCentreID, CreatedByAdminID) + OUTPUT INSERTED.Id + VALUES (@competencyAssessmentName, @centreId, @adminId)" + , + new { competencyAssessmentName, centreId, adminId } + ); + return assessmentId; + } public bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName) { if ((competencyAssessmentName.Length == 0) | (adminId < 1) | (competencyAssessmentId < 1)) @@ -130,11 +169,11 @@ public bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int admin ); return false; } - - var existingSelfAssessments = (int)connection.ExecuteScalar( + var result = connection.ExecuteScalar( @"SELECT COUNT(*) FROM SelfAssessments WHERE [Name] = @competencyAssessmentName AND ID <> @competencyAssessmentId", new { competencyAssessmentName, competencyAssessmentId } ); + int existingSelfAssessments = Convert.ToInt32(result); if (existingSelfAssessments > 0) { return false; @@ -179,10 +218,11 @@ ORDER BY ProfessionalGroup" public bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID) { - var sameCount = (int)connection.ExecuteScalar( + var result = connection.ExecuteScalar( @"SELECT COUNT(*) FROM CompetencyAssessments WHERE ID = @competencyAssessmentId AND NRPProfessionalGroupID = @nrpProfessionalGroupID", new { competencyAssessmentId, nrpProfessionalGroupID } ); + int sameCount = Convert.ToInt32(result); if (sameCount > 0) { //same so don't update: @@ -202,5 +242,75 @@ public bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessment return false; } + public bool UpdateCompetencyAssessmentBranding( + int competencyAssessmentId, + int brandId, + int categoryId, + int adminId + ) + { + if ((competencyAssessmentId < 1) | (brandId < 1) | (categoryId < 1) | (adminId < 1)) + { + logger.LogWarning( + $"Not updating competency assessment as it failed server side validation. competencyAssessmentId: {competencyAssessmentId}, brandId: {brandId}, categoryId: {categoryId}, AdminId: {adminId}" + ); + return false; + } + + var numberOfAffectedRows = connection.Execute( + @"UPDATE SelfAssessments SET BrandID = @brandId, CategoryID = @categoryId, UpdatedByAdminID = @adminId + WHERE ID = @competencyAssessmentId", + new { brandId, categoryId, adminId, competencyAssessmentId } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not updating competency assessment as db update failed. " + + $"frameworkId: {competencyAssessmentId}, brandId: {brandId}, categoryId: {categoryId}, AdminId: {adminId}" + ); + return false; + } + + return true; + } + + public bool UpdateCompetencyAssessmentDescription(int competencyAssessmentId, int adminId, string competencyAssessmentDescription) + { + var numberOfAffectedRows = connection.Execute( + @"UPDATE SelfAssessments SET Description = @competencyAssessmentDescription, UpdatedByAdminID = @adminId + WHERE ID = @competencyAssessmentId", + new { adminId, competencyAssessmentId, competencyAssessmentDescription } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not updating competency assessment as db update failed. " + + $"frameworkId: {competencyAssessmentId}, competencyAssessmentDescription: {competencyAssessmentDescription}, AdminId: {adminId}" + ); + return false; + } + return true; + } + + public bool InsertSelfAssessmentFramework(int adminId, int selfAssessmentId, int frameworkId) + { + var numberOfAffectedRows = connection.Execute( + @"INSERT INTO SelfAssessmentFrameworks (SelfAssessmentId, FrameworkId, CreatedByAdminId) + SELECT @selfAssessmentId, @frameworkId, @adminId + WHERE NOT EXISTS (SELECT 1 FROM SelfAssessmentFrameworks WHERE SelfAssessmentId = @selfAssessmentId AND FrameworkId = @frameworkId)" + , + new { adminId, selfAssessmentId, frameworkId } + ); + if (numberOfAffectedRows < 1) + { + logger.LogWarning( + "Not inserting SelfAssessmentFrameworks record as db insert failed. " + + $"selfAssessmentId: {selfAssessmentId}, frameworkId: {frameworkId}, AdminId: {adminId}" + ); + return false; + } + + return true; + } } } diff --git a/DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs b/DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs index 4da0365aee..6bec58e4a0 100644 --- a/DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/FrameworkDataService.cs @@ -284,7 +284,7 @@ public class FrameworkDataService : IFrameworkDataService fwr.ID AS FrameworkReviewID"; private const string BrandedFrameworkFields = - @",(SELECT BrandName + @", FW.Description, (SELECT BrandName FROM Brands WHERE (BrandID = FW.BrandID)) AS Brand, (SELECT CategoryName diff --git a/DigitalLearningSolutions.Data/Models/Frameworks/BrandedFramework.cs b/DigitalLearningSolutions.Data/Models/Frameworks/BrandedFramework.cs index f49b526831..fdcc327484 100644 --- a/DigitalLearningSolutions.Data/Models/Frameworks/BrandedFramework.cs +++ b/DigitalLearningSolutions.Data/Models/Frameworks/BrandedFramework.cs @@ -2,6 +2,7 @@ { public class BrandedFramework : BaseFramework { + public string? Description { get; set; } public string? Brand { get => brand; diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs index cae052c92c..907bd33328 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessments.cs @@ -92,66 +92,15 @@ public IActionResult ViewCompetencyAssessments(string tabname, string? searchStr ); return View("Index", model); } - public IActionResult StartNewCompetencyAssessmentSession() - { - var adminId = GetAdminID(); - TempData.Clear(); - var sessionNewCompetencyAssessment = new SessionNewCompetencyAssessment(); - if (!Request.Cookies.ContainsKey(CookieName)) - { - var id = Guid.NewGuid(); - - Response.Cookies.Append( - CookieName, - id.ToString(), - new CookieOptions - { - Expires = DateTimeOffset.UtcNow.AddDays(30) - }); - sessionNewCompetencyAssessment.Id = id; - } - else - { - if (Request.Cookies.TryGetValue(CookieName, out string idString)) - { - sessionNewCompetencyAssessment.Id = Guid.Parse(idString); - } - else - { - var id = Guid.NewGuid(); - - Response.Cookies.Append( - CookieName, - id.ToString(), - new CookieOptions - { - Expires = DateTimeOffset.UtcNow.AddDays(30) - }); - sessionNewCompetencyAssessment.Id = id; - } - } - CompetencyAssessmentBase competencyAssessmentBase = new CompetencyAssessmentBase() - { - BrandID = 6, - OwnerAdminID = adminId, - National = true, - Public = true, - PublishStatusID = 1, - UserRole = 3 - }; - sessionNewCompetencyAssessment.CompetencyAssessmentBase = competencyAssessmentBase; - TempData.Set(sessionNewCompetencyAssessment); - return RedirectToAction("CompetencyAssessmentName", "CompetencyAssessments", new { actionname = "New" }); - } - - [Route("/CompetencyAssessments/Name/{actionname}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/Name/{actionname}")] + [Route("/CompetencyAssessments/{actionName}/Name/{competencyAssessmentId}")] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{actionName}/Name")] + [Route("/CompetencyAssessments/{actionName}/Name")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult CompetencyAssessmentName(string actionname, int competencyAssessmentId = 0) + public IActionResult CompetencyAssessmentName(string actionName, int competencyAssessmentId = 0, int? frameworkId = null) { var adminId = GetAdminID(); - CompetencyAssessmentBase? competencyAssessmentBase; + var competencyAssessmentBase = new CompetencyAssessmentBase(); if (competencyAssessmentId > 0) { competencyAssessmentBase = competencyAssessmentService.GetCompetencyAssessmentBaseById(competencyAssessmentId, adminId); @@ -165,69 +114,63 @@ public IActionResult CompetencyAssessmentName(string actionname, int competencyA return StatusCode(403); } } - else + else if( frameworkId != null ) { - SessionNewCompetencyAssessment sessionNewCompetencyAssessment = TempData.Peek(); - TempData.Set(sessionNewCompetencyAssessment); - competencyAssessmentBase = sessionNewCompetencyAssessment.CompetencyAssessmentBase; - TempData.Set(sessionNewCompetencyAssessment); + var framework = frameworkService.GetBaseFrameworkByFrameworkId((int)frameworkId, adminId); + if ( framework != null ) + { + competencyAssessmentBase.CompetencyAssessmentName = framework.FrameworkName; + } } return View("Name", competencyAssessmentBase); } [HttpPost] - [Route("/CompetencyAssessments/Name/{actionname}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/Name/{actionname}")] + [Route("/CompetencyAssessments/{actionName}/Name/{competencyAssessmentId}")] + [Route("/CompetencyAssessments/Framework/{frameworkId}/{actionName}/Name")] + [Route("/CompetencyAssessments/{actionName}/Name")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult SaveProfileName(CompetencyAssessmentBase competencyAssessmentBase, string actionname, int competencyAssessmentId = 0) + public IActionResult SaveProfileName(CompetencyAssessmentBase competencyAssessmentBase, string actionName, int competencyAssessmentId = 0, int? frameworkId = null) { if (!ModelState.IsValid) { ModelState.Remove(nameof(CompetencyAssessmentBase.CompetencyAssessmentName)); ModelState.AddModelError(nameof(CompetencyAssessmentBase.CompetencyAssessmentName), "Please enter a valid competency assessment name (between 3 and 255 characters)"); - // do something return View("Name", competencyAssessmentBase); } else { - if (actionname == "New") + var userCentreId = (int)GetCentreId(); + var adminId = GetAdminID(); + if (actionName == "New") { var sameItems = competencyAssessmentService.GetCompetencyAssessmentByName(competencyAssessmentBase.CompetencyAssessmentName, GetAdminID()); if (sameItems != null) { ModelState.Remove(nameof(CompetencyAssessmentBase.CompetencyAssessmentName)); ModelState.AddModelError(nameof(CompetencyAssessmentBase.CompetencyAssessmentName), "Another competency assessment exists with that name. Please choose a different name."); - // do something return View("Name", competencyAssessmentBase); } - SessionNewCompetencyAssessment sessionNewCompetencyAssessment = TempData.Peek(); - sessionNewCompetencyAssessment.CompetencyAssessmentBase = competencyAssessmentBase; - TempData.Set(sessionNewCompetencyAssessment); - return RedirectToAction("CompetencyAssessmentProfessionalGroup", "CompetencyAssessments", new { actionname }); + competencyAssessmentService.InsertCompetencyAssessment(adminId, userCentreId, competencyAssessmentBase.CompetencyAssessmentName, frameworkId); } else - { - var adminId = GetAdminID(); + { + var isUpdated = competencyAssessmentService.UpdateCompetencyAssessmentName(competencyAssessmentBase.ID, adminId, competencyAssessmentBase.CompetencyAssessmentName); - if (isUpdated) - { - return RedirectToAction("ViewCompetencyAssessment", new { tabname = "Details", competencyAssessmentId }); - } - else + if (!isUpdated) { ModelState.AddModelError(nameof(CompetencyAssessmentBase.CompetencyAssessmentName), "Another competency assessment exists with that name. Please choose a different name."); - // do something return View("Name", competencyAssessmentBase); } } - + return RedirectToAction("ManageCompetencyAssessment", new { competencyAssessmentId }); } } - [Route("/CompetencyAssessments/ProfessionalGroup/{actionname}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionname}")] + [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}/{competencyAssessmentId}")] + [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult CompetencyAssessmentProfessionalGroup(string actionname, int competencyAssessmentId = 0) + public IActionResult CompetencyAssessmentProfessionalGroup(string actionName, int competencyAssessmentId = 0) { var adminId = GetAdminID(); CompetencyAssessmentBase? competencyAssessmentBase; @@ -261,10 +204,10 @@ public IActionResult CompetencyAssessmentProfessionalGroup(string actionname, in } [HttpPost] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionname}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/ProfessionalGroup/{actionname}")] + [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}/{competencyAssessmentId}")] + [Route("/CompetencyAssessments/ProfessionalGroup/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult SaveProfessionalGroup(CompetencyAssessmentBase competencyAssessmentBase, string actionname, int competencyAssessmentId = 0) + public IActionResult SaveProfessionalGroup(CompetencyAssessmentBase competencyAssessmentBase, string actionName, int competencyAssessmentId = 0) { if (competencyAssessmentBase.NRPProfessionalGroupID == null) { @@ -273,12 +216,12 @@ public IActionResult SaveProfessionalGroup(CompetencyAssessmentBase competencyAs // do something return View("Name", competencyAssessmentBase); } - if (actionname == "New") + if (actionName == "New") { SessionNewCompetencyAssessment sessionNewCompetencyAssessment = TempData.Peek(); sessionNewCompetencyAssessment.CompetencyAssessmentBase = competencyAssessmentBase; TempData.Set(sessionNewCompetencyAssessment); - return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionname }); + return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionName }); } else { @@ -286,19 +229,19 @@ public IActionResult SaveProfessionalGroup(CompetencyAssessmentBase competencyAs var isUpdated = competencyAssessmentService.UpdateCompetencyAssessmentProfessionalGroup(competencyAssessmentBase.ID, adminId, competencyAssessmentBase.NRPProfessionalGroupID); if (isUpdated) { - return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionname, competencyAssessmentId }); + return RedirectToAction("CompetencyAssessmentSubGroup", "CompetencyAssessments", new { actionName, competencyAssessmentId }); } else { - return RedirectToAction("ViewCompetencyAssessment", new { tabname = "Details", competencyAssessmentId }); + return RedirectToAction("ManageCompetencyAssessment", new { tabname = "Details", competencyAssessmentId }); } } } - [Route("/CompetencyAssessments/SubGroup/{actionname}/{competencyAssessmentId}")] - [Route("/CompetencyAssessments/SubGroup/{actionname}")] + [Route("/CompetencyAssessments/SubGroup/{actionName}/{competencyAssessmentId}")] + [Route("/CompetencyAssessments/SubGroup/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.CompetencyAssessments))] - public IActionResult CompetencyAssessmentSubGroup(string actionname, int competencyAssessmentId = 0) + public IActionResult CompetencyAssessmentSubGroup(string actionName, int competencyAssessmentId = 0) { return View("SubGroup"); } diff --git a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs index 88016c1eeb..c057b43776 100644 --- a/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/CompetencyAssessmentsController/CompetencyAssessmentsController.cs @@ -11,18 +11,21 @@ public partial class CompetencyAssessmentsController : Controller { private readonly ICompetencyAssessmentService competencyAssessmentService; + private readonly IFrameworkService frameworkService; private readonly ICommonService commonService; private readonly IFrameworkNotificationService frameworkNotificationService; private readonly ILogger logger; private readonly IConfiguration config; public CompetencyAssessmentsController( ICompetencyAssessmentService competencyAssessmentService, + IFrameworkService frameworkService, ICommonService commonService, IFrameworkNotificationService frameworkNotificationService, ILogger logger, IConfiguration config) { this.competencyAssessmentService = competencyAssessmentService; + this.frameworkService = frameworkService; this.commonService = commonService; this.frameworkNotificationService = frameworkNotificationService; this.logger = logger; diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index ffb9460299..02cd192c36 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -136,18 +136,18 @@ public IActionResult StartNewFrameworkSession() MultiPageFormDataFeature.AddNewFramework, TempData ); - return RedirectToAction("CreateNewFramework", "Frameworks", new { actionname = "New" }); + return RedirectToAction("CreateNewFramework", "Frameworks", new { actionName = "New" }); } - [Route("/Frameworks/Name/{actionname}/{frameworkId}")] - [Route("/Frameworks/Name/{actionname}")] + [Route("/Frameworks/Name/{actionName}/{frameworkId}")] + [Route("/Frameworks/Name/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.Frameworks))] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult CreateNewFramework(string actionname, int frameworkId = 0) + public IActionResult CreateNewFramework(string actionName, int frameworkId = 0) { var adminId = GetAdminId(); DetailFramework? detailFramework; @@ -173,15 +173,15 @@ public IActionResult CreateNewFramework(string actionname, int frameworkId = 0) return View("Developer/Name", detailFramework); } [HttpPost] - [Route("/Frameworks/Name/{actionname}/{frameworkId}")] - [Route("/Frameworks/Name/{actionname}")] + [Route("/Frameworks/Name/{actionName}/{frameworkId}")] + [Route("/Frameworks/Name/{actionName}")] [SetSelectedTab(nameof(NavMenuTab.Frameworks))] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult CreateNewFramework(DetailFramework detailFramework, string actionname, int frameworkId = 0) + public IActionResult CreateNewFramework(DetailFramework detailFramework, string actionName, int frameworkId = 0) { if (!ModelState.IsValid) { @@ -189,7 +189,7 @@ public IActionResult CreateNewFramework(DetailFramework detailFramework, string ModelState.AddModelError(nameof(BaseFramework.FrameworkName), "Please enter a valid framework name (between 3 and 255 characters)"); return View("Developer/Name", detailFramework); } - if (actionname == "New") + if (actionName == "New") { SessionNewFramework sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); sessionNewFramework.DetailFramework = detailFramework; @@ -198,7 +198,7 @@ public IActionResult CreateNewFramework(DetailFramework detailFramework, string MultiPageFormDataFeature.AddNewFramework, TempData ); - return RedirectToAction("SetNewFrameworkName", new { frameworkname = detailFramework.FrameworkName, actionname }); + return RedirectToAction("SetNewFrameworkName", new { frameworkname = detailFramework.FrameworkName, actionName }); } var adminId = GetAdminId(); var isUpdated = frameworkService.UpdateFrameworkName(detailFramework.ID, adminId, detailFramework.FrameworkName); @@ -207,10 +207,10 @@ public IActionResult CreateNewFramework(DetailFramework detailFramework, string return View("Developer/Name", detailFramework); } - [Route("/Frameworks/Similar/{actionname}")] - public IActionResult SetNewFrameworkName(string frameworkname, string actionname) + [Route("/Frameworks/Similar/{actionName}")] + public IActionResult SetNewFrameworkName(string frameworkname, string actionName) { - if (actionname == "New") + if (actionName == "New") { var sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); multiPageFormService.SetMultiPageFormData( @@ -241,14 +241,14 @@ public IActionResult SetNewFrameworkName(string frameworkname, string actionname }; return View("Developer/Similar", model); } - return RedirectToAction("SaveNewFramework", "Frameworks", new { frameworkname, actionname }); + return RedirectToAction("SaveNewFramework", "Frameworks", new { frameworkname, actionName }); } - public IActionResult SaveNewFramework(string frameworkname, string actionname) + public IActionResult SaveNewFramework(string frameworkname, string actionName) { //var framework = frameworkService.CreateFramework(frameworkname, GetAdminID()); //need to create framework and move to next step. - if (actionname != "New") + if (actionName != "New") { return StatusCode(500); } @@ -258,23 +258,23 @@ public IActionResult SaveNewFramework(string frameworkname, string actionname) MultiPageFormDataFeature.AddNewFramework, TempData ); - return RedirectToAction("FrameworkDescription", "Frameworks", new { actionname }); + return RedirectToAction("FrameworkDescription", "Frameworks", new { actionName }); } - [Route("/Frameworks/Description/{actionname}/")] - [Route("/Frameworks/Description/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Description/{actionName}/")] + [Route("/Frameworks/Description/{actionName}/{frameworkId}/")] [SetSelectedTab(nameof(NavMenuTab.Frameworks))] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult FrameworkDescription(string actionname, int frameworkId = 0) + public IActionResult FrameworkDescription(string actionName, int frameworkId = 0) { var adminId = GetAdminId(); var centreId = GetCentreId(); DetailFramework? framework; - if (actionname == "New") + if (actionName == "New") { var sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); framework = sessionNewFramework.DetailFramework; @@ -298,16 +298,16 @@ public IActionResult FrameworkDescription(string actionname, int frameworkId = 0 } [HttpPost] - [Route("/Frameworks/Description/{actionname}/")] - [Route("/Frameworks/Description/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Description/{actionName}/")] + [Route("/Frameworks/Description/{actionName}/{frameworkId}/")] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult FrameworkDescription(DetailFramework detailFramework, string actionname, int frameworkId = 0) + public IActionResult FrameworkDescription(DetailFramework detailFramework, string actionName, int frameworkId = 0) { - if (actionname == "New") + if (actionName == "New") { var sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); sessionNewFramework.DetailFramework = detailFramework; @@ -316,7 +316,7 @@ public IActionResult FrameworkDescription(DetailFramework detailFramework, strin MultiPageFormDataFeature.AddNewFramework, TempData ); - return RedirectToAction("FrameworkType", "Frameworks", new { actionname }); + return RedirectToAction("FrameworkType", "Frameworks", new { actionName }); } detailFramework.Description = SanitizerHelper.SanitizeHtmlData(detailFramework.Description); frameworkService.UpdateFrameworkDescription(frameworkId, GetAdminId(), detailFramework.Description); @@ -324,20 +324,20 @@ public IActionResult FrameworkDescription(DetailFramework detailFramework, strin } - [Route("/Frameworks/Type/{actionname}/")] - [Route("/Frameworks/Type/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Type/{actionName}/")] + [Route("/Frameworks/Type/{actionName}/{frameworkId}/")] [SetSelectedTab(nameof(NavMenuTab.Frameworks))] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult FrameworkType(string actionname, int frameworkId = 0) + public IActionResult FrameworkType(string actionName, int frameworkId = 0) { var adminId = GetAdminId(); var centreId = GetCentreId(); DetailFramework? framework; - if (actionname == "New") + if (actionName == "New") { var sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); framework = sessionNewFramework.DetailFramework; @@ -361,16 +361,16 @@ public IActionResult FrameworkType(string actionname, int frameworkId = 0) } [HttpPost] - [Route("/Frameworks/Type/{actionname}/")] - [Route("/Frameworks/Type/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Type/{actionName}/")] + [Route("/Frameworks/Type/{actionName}/{frameworkId}/")] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult FrameworkType(DetailFramework detailFramework, string actionname, int frameworkId = 0) + public IActionResult FrameworkType(DetailFramework detailFramework, string actionName, int frameworkId = 0) { - if (actionname == "New") + if (actionName == "New") { var sessionNewFramework = multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddNewFramework, TempData).GetAwaiter().GetResult(); sessionNewFramework.DetailFramework = detailFramework; @@ -379,26 +379,26 @@ public IActionResult FrameworkType(DetailFramework detailFramework, string actio MultiPageFormDataFeature.AddNewFramework, TempData ); - return RedirectToAction("SetNewFrameworkBrand", "Frameworks", new { actionname }); + return RedirectToAction("SetNewFrameworkBrand", "Frameworks", new { actionName }); } frameworkService.UpdateFrameworkConfig(frameworkId, GetAdminId(), detailFramework.FrameworkConfig); return RedirectToAction("ViewFramework", new { tabname = "Details", frameworkId }); } - [Route("/Frameworks/Categorise/{actionname}/")] - [Route("/Frameworks/Categorise/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Categorise/{actionName}/")] + [Route("/Frameworks/Categorise/{actionName}/{frameworkId}/")] [SetSelectedTab(nameof(NavMenuTab.Frameworks))] [ResponseCache(CacheProfileName = "Never")] [TypeFilter( typeof(RedirectToErrorEmptySessionData), Arguments = new object[] { nameof(MultiPageFormDataFeature.AddNewFramework) } )] - public IActionResult SetNewFrameworkBrand(string actionname, int frameworkId = 0) + public IActionResult SetNewFrameworkBrand(string actionName, int frameworkId = 0) { var adminId = GetAdminId(); var centreId = GetCentreId(); DetailFramework? framework; - if (actionname == "New") + if (actionName == "New") { if (TempData[MultiPageFormDataFeature.AddNewFramework.TempDataKey] == null) { @@ -443,13 +443,13 @@ public IActionResult SetNewFrameworkBrand(string actionname, int frameworkId = 0 } [HttpPost] - [Route("/Frameworks/Categorise/{actionname}/")] - [Route("/Frameworks/Categorise/{actionname}/{frameworkId}/")] - public IActionResult SetNewFrameworkBrand(DetailFramework? detailFramework, string actionname, int frameworkId = 0) + [Route("/Frameworks/Categorise/{actionName}/")] + [Route("/Frameworks/Categorise/{actionName}/{frameworkId}/")] + public IActionResult SetNewFrameworkBrand(DetailFramework? detailFramework, string actionName, int frameworkId = 0) { var adminId = GetAdminId(); var centreId = GetCentreId(); - if (actionname != "New" && frameworkId > 0) + if (actionName != "New" && frameworkId > 0) { detailFramework = InsertBrandingCategoryTopicIfRequired(detailFramework); if (detailFramework == null) return RedirectToAction("SetNewFrameworkBrand", "Frameworks", new { frameworkId }); @@ -577,12 +577,12 @@ public IActionResult RemoveFrameworkFlag(RemoveCustomFlagConfirmationViewModel m } [HttpPost] - [Route("/Frameworks/Flags/{actionname}/{frameworkId}/{flagId}")] - public IActionResult EditFrameworkFlag(CustomFlagViewModel model, int frameworkId, string actionname, int flagId) + [Route("/Frameworks/Flags/{actionName}/{frameworkId}/{flagId}")] + public IActionResult EditFrameworkFlag(CustomFlagViewModel model, int frameworkId, string actionName, int flagId) { if (ModelState.IsValid) { - if (actionname == "Edit") + if (actionName == "Edit") { frameworkService.UpdateFrameworkCustomFlag(frameworkId, model.Id, model.FlagName, model.FlagGroup, model.FlagTagClass); } @@ -596,11 +596,11 @@ public IActionResult EditFrameworkFlag(CustomFlagViewModel model, int frameworkI } [HttpGet] - [Route("/Frameworks/Flags/{actionname:regex(Edit|New)}/{frameworkId}/{flagId}")] - public IActionResult EditFrameworkFlag(int frameworkId, string actionname, int flagId) + [Route("/Frameworks/Flags/{actionName:regex(Edit|New)}/{frameworkId}/{flagId}")] + public IActionResult EditFrameworkFlag(int frameworkId, string actionName, int flagId) { var model = new CustomFlagViewModel(); - if (actionname == "Edit") + if (actionName == "Edit") { var flag = frameworkService.GetCustomFlagsByFrameworkId(frameworkId, (int?)flagId).FirstOrDefault(); model = new CustomFlagViewModel() @@ -614,9 +614,9 @@ public IActionResult EditFrameworkFlag(int frameworkId, string actionname, int f return View("Developer/EditCustomFlag", model); } - [Route("/Frameworks/Collaborators/{actionname}/{frameworkId}/")] + [Route("/Frameworks/Collaborators/{actionName}/{frameworkId}/")] [ResponseCache(CacheProfileName = "Never")] - public IActionResult AddCollaborators(string actionname, int frameworkId, bool error = false) + public IActionResult AddCollaborators(string actionName, int frameworkId, bool error = false) { var adminId = GetAdminId(); var collaborators = frameworkService.GetCollaboratorsForFrameworkId(frameworkId); @@ -638,14 +638,14 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e } [HttpPost] - [Route("/Frameworks/Collaborators/{actionname}/{frameworkId}/")] - public IActionResult AddCollaborator(string actionname, string userEmail, bool canModify, int frameworkId) + [Route("/Frameworks/Collaborators/{actionName}/{frameworkId}/")] + public IActionResult AddCollaborator(string actionName, string userEmail, bool canModify, int frameworkId) { var collaboratorId = frameworkService.AddCollaboratorToFramework(frameworkId, userEmail, canModify); if (collaboratorId > 0) { frameworkNotificationService.SendFrameworkCollaboratorInvite(collaboratorId, GetAdminId()); - return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionname }); + return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionName }); } else { @@ -670,15 +670,15 @@ public IActionResult AddCollaborator(string actionname, string userEmail, bool c { TempData["FrameworkError"] = "User not added,Kindly try again;"; } - return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionname }); + return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionName }); } } - public IActionResult RemoveCollaborator(int frameworkId, string actionname, int id) + public IActionResult RemoveCollaborator(int frameworkId, string actionName, int id) { frameworkService.RemoveCollaboratorFromFramework(frameworkId, id); - return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionname }); + return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionName }); } [Route("/Framework/{frameworkId}/{tabname}/{frameworkCompetencyGroupId}/{frameworkCompetencyId}")] @@ -750,7 +750,7 @@ public IActionResult InsertFramework() detailFramework.Description = SanitizerHelper.SanitizeHtmlData(detailFramework.Description); var newFramework = frameworkService.CreateFramework(detailFramework, adminId); TempData.Clear(); - return RedirectToAction("AddCollaborators", "Frameworks", new { actionname = "New", frameworkId = newFramework.ID }); + return RedirectToAction("AddCollaborators", "Frameworks", new { actionName = "New", frameworkId = newFramework.ID }); } } } diff --git a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs index 1a50a20ae6..ef5a5e36a0 100644 --- a/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs +++ b/DigitalLearningSolutions.Web/ServiceFilter/RedirectToErrorEmptySessionData.cs @@ -34,7 +34,7 @@ public void OnActionExecuting(ActionExecutingContext context) return; } - if (context.ActionArguments.ContainsKey("actionname") && context.ActionArguments["actionname"].ToString() == "Edit") + if (context.ActionArguments.ContainsKey("actionName") && context.ActionArguments["actionName"].ToString() == "Edit") { return; } diff --git a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs index 27385103bd..e867731ba5 100644 --- a/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs +++ b/DigitalLearningSolutions.Web/Services/CompetencyAssessmentService.cs @@ -22,13 +22,18 @@ public interface ICompetencyAssessmentService bool UpdateCompetencyAssessmentProfessionalGroup(int competencyAssessmentId, int adminId, int? nrpProfessionalGroupID); + //INSERT DATA + int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName, int? frameworkId); + } public class CompetencyAssessmentService : ICompetencyAssessmentService { private readonly ICompetencyAssessmentDataService competencyAssessmentDataService; - public CompetencyAssessmentService(ICompetencyAssessmentDataService competencyAssessmentDataService) + private readonly IFrameworkDataService frameworkDataService; + public CompetencyAssessmentService(ICompetencyAssessmentDataService competencyAssessmentDataService, IFrameworkDataService frameworkDataService) { this.competencyAssessmentDataService = competencyAssessmentDataService; + this.frameworkDataService = frameworkDataService; } public IEnumerable GetAllCompetencyAssessments(int adminId) { @@ -54,6 +59,20 @@ public IEnumerable GetCompetencyAssessmentsForAdminId(int { return competencyAssessmentDataService.GetCompetencyAssessmentsForAdminId(adminId); } + public int InsertCompetencyAssessment(int adminId, int centreId, string competencyAssessmentName, int? frameworkId) + { + var assessmentId = competencyAssessmentDataService.InsertCompetencyAssessment(adminId, centreId, competencyAssessmentName); + if(assessmentId > 0 && frameworkId != null) + { + var framework = frameworkDataService.GetBrandedFrameworkByFrameworkId((int)frameworkId, adminId); + if (framework != null) { + competencyAssessmentDataService.InsertSelfAssessmentFramework(adminId, assessmentId, framework.ID); + competencyAssessmentDataService.UpdateCompetencyAssessmentDescription(adminId, assessmentId, framework.Description); + competencyAssessmentDataService.UpdateCompetencyAssessmentBranding(assessmentId, (int)framework.BrandID, (int)framework.CategoryID, adminId); + } + } + return assessmentId; + } public bool UpdateCompetencyAssessmentName(int competencyAssessmentId, int adminId, string competencyAssessmentName) { diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/Name.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/Name.cshtml index 493008c8a0..93fb40d442 100644 --- a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/Name.cshtml +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/Name.cshtml @@ -1,109 +1,109 @@ @using DigitalLearningSolutions.Data.Models.CompetencyAssessments; @model CompetencyAssessmentBase; @{ - ViewData["Title"] = "New Competency Assessments"; - ViewData["Application"] = "Framework Service"; + ViewData["Title"] = "New Competency Assessments"; + ViewData["Application"] = "Framework Service"; } @section NavMenuItems { - + } - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") +@if ((string)ViewContext.RouteData.Values["actionName"] == "New") { - @section NavBreadcrumbs { - - } + @section NavBreadcrumbs { + + } } else { - @section NavBreadcrumbs { - - } + @section NavBreadcrumbs { + + } } -@if ((string)ViewContext.RouteData.Values["actionname"] == "New") +@if ((string)ViewContext.RouteData.Values["actionName"] == "New") { -

Create a new competency assessment

+

Create a new competency assessment

} else { -

Edit competency assessment name

+

Edit competency assessment name

}
- @if (!ViewData.ModelState.IsValid) - { - - } - - -
- Choose a title that identifies the job role or roles that this profile applies to and the scope of capabilities covered. -
- - -
- - - - - - - - - - - - - - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") - { - - - } - else - { - @if (Model.PublishStatusID == 3) + @if (!ViewData.ModelState.IsValid) + { + + } + + +
+ Choose a title that identifies scope of capabilities covered and/or the roles or levels the assessment targets. +
+ + +
+ + + + + + + + + + + + + + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") + { + + + } + else { - + @if (Model.PublishStatusID == 3) + { + + } + + } - - - } diff --git a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ProfessionalGroup.cshtml b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ProfessionalGroup.cshtml index 3ce78d8b38..68c80cd634 100644 --- a/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ProfessionalGroup.cshtml +++ b/DigitalLearningSolutions.Web/Views/CompetencyAssessments/ProfessionalGroup.cshtml @@ -8,7 +8,7 @@ @section NavMenuItems { } - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { @section NavBreadcrumbs { } @@ -63,7 +63,7 @@ else
- @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { Skip professional group and job role linking. @@ -96,9 +96,9 @@ else - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { - + Back
- @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { - + Back
- @if ((string)ViewContext.RouteData.Values["actionname"] == "Review") + @if ((string)ViewContext.RouteData.Values["actionName"] == "Review") { Done diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/CustomFlags.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/CustomFlags.cshtml index fb49365122..279cd472da 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/CustomFlags.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/CustomFlags.cshtml @@ -66,7 +66,7 @@ Edit + asp-route-actionName="New"> Add custom flag diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/DefaultQuestions.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/DefaultQuestions.cshtml index f831bcabe0..29f69d03e9 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/DefaultQuestions.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/DefaultQuestions.cshtml @@ -66,13 +66,13 @@ Actions - + Remove @if (question.UserIsOwner) {   - + Edit } @@ -103,7 +103,7 @@ Add - + Add a new question
diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Description.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Description.cshtml index a9dd4fcd97..de7c3ef63d 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Description.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Description.cshtml @@ -9,7 +9,7 @@ @section NavMenuItems { } - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { @section NavBreadcrumbs { } } -@if ((string)ViewContext.RouteData.Values["actionname"] == "New") +@if ((string)ViewContext.RouteData.Values["actionName"] == "New") {

Framework description

} @@ -77,9 +77,9 @@ else - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { - + Back - } - else - { - Send for review - } - } - @if (Model.DetailFramework.FrameworkReviewID != null) - { - Submit my review - } -
+ @*Preview*@ + @if (Model.DetailFramework.UserRole > 1) + { + if (Model.DetailFramework.PublishStatusID == 2) + { + Publish + } + else if (Model.DetailFramework.PublishStatusID == 3) + { + + Create assessment + } + else + { + Send for review + } + } + @if (Model.DetailFramework.FrameworkReviewID != null) + { + Submit my review + } +
-
- @if ((string)ViewContext.RouteData.Values["tabname"] == "Structure") - { - - } - else if ((string)ViewContext.RouteData.Values["tabname"] == "Details") - { - - } - else if ((string)ViewContext.RouteData.Values["tabname"] == "Comments") - { - - } -
+
+ @if ((string)ViewContext.RouteData.Values["tabname"] == "Structure") + { + + } + else if ((string)ViewContext.RouteData.Values["tabname"] == "Details") + { + + } + else if ((string)ViewContext.RouteData.Values["tabname"] == "Comments") + { + + } +
diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Name.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Name.cshtml index a43cec595e..16f54436b1 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Name.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Name.cshtml @@ -9,7 +9,7 @@ @section NavMenuItems { } - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { @section NavBreadcrumbs { } } -@if ((string)ViewContext.RouteData.Values["actionname"] == "New") +@if ((string)ViewContext.RouteData.Values["actionName"] == "New") {

Create a new framework

} @@ -70,7 +70,7 @@ else - @if ((string)ViewContext.RouteData.Values["actionname"] == "New") + @if ((string)ViewContext.RouteData.Values["actionName"] == "New") { - Manage working group + Manage working group @@ -88,7 +88,7 @@ else

There are no members of the working group for this framework who haven't already got an open review request. Use the Manage working group button below to add some more.

} diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Similar.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Similar.cshtml index d853b735d8..51754820d4 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Similar.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Similar.cshtml @@ -71,10 +71,10 @@ else } distinct from @Model.FrameworkName, you can continue to create it.

- + Back - + Next