diff --git a/DigitalLearningSolutions.Data/Services/FrameworkService.cs b/DigitalLearningSolutions.Data/Services/FrameworkService.cs index d37e0fc34e..06370ac3f1 100644 --- a/DigitalLearningSolutions.Data/Services/FrameworkService.cs +++ b/DigitalLearningSolutions.Data/Services/FrameworkService.cs @@ -1519,8 +1519,17 @@ OUTPUT INSERTED.Id VALUES (@question, @assessmentQuestionInputTypeId, @maxValueDescription, @minValueDescription, @scoringInstructions, @minValue, @maxValue, @includeComments, @adminId, @commentsPrompt, @commentsHint)", new { - question, assessmentQuestionInputTypeId, maxValueDescription, minValueDescription, - scoringInstructions, minValue, maxValue, includeComments, adminId, commentsPrompt, commentsHint, + question, + assessmentQuestionInputTypeId, + maxValueDescription, + minValueDescription, + scoringInstructions, + minValue, + maxValue, + includeComments, + adminId, + commentsPrompt, + commentsHint, } ); if (id < 1) @@ -1607,8 +1616,18 @@ public void UpdateAssessmentQuestion( WHERE ID = @id", new { - id, question, assessmentQuestionInputTypeId, maxValueDescription, minValueDescription, - scoringInstructions, minValue, maxValue, includeComments, adminId, commentsPrompt, commentsHint, + id, + question, + assessmentQuestionInputTypeId, + maxValueDescription, + minValueDescription, + scoringInstructions, + minValue, + maxValue, + includeComments, + adminId, + commentsPrompt, + commentsHint, } ); if (numberOfAffectedRows < 1) @@ -1811,14 +1830,14 @@ FROM Frameworks fc.AdminID, fc.CanModify, fc.UserEmail, - fc.Active AS UserActive, + COALESCE(au.Active, 1) AS UserActive, CASE WHEN fc.CanModify = 1 THEN 'Contributor' ELSE 'Reviewer' END AS FrameworkRole, f.FrameworkName, (SELECT Forename + ' ' + Surname + (CASE WHEN Active = 1 THEN '' ELSE ' (Inactive)' END) AS Expr1 FROM AdminUsers AS au1 WHERE (AdminID = @invitedByAdminId)) AS InvitedByName, (SELECT Email FROM AdminUsers AS au2 WHERE (AdminID = @invitedByAdminId)) AS InvitedByEmail FROM FrameworkCollaborators AS fc INNER JOIN Frameworks AS f ON fc.FrameworkID = f.ID - INNER JOIN AdminUsers AS au ON fc.AdminID = au.AdminID + LEFT OUTER JOIN AdminUsers AS au ON fc.AdminID = au.AdminID WHERE (fc.ID = @id)", new { invitedByAdminId, id } ).FirstOrDefault(); diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 32839de610..1697f5315f 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -485,7 +485,7 @@ public IActionResult FrameworkSummary() return View("Developer/Summary", sessionNewFramework.DetailFramework); } [Route("/Frameworks/Collaborators/{actionname}/{frameworkId}/")] - public IActionResult AddCollaborators(string actionname, int frameworkId) + public IActionResult AddCollaborators(string actionname, int frameworkId, bool error = false) { var adminId = GetAdminId(); var collaborators = frameworkService.GetCollaboratorsForFrameworkId(frameworkId); @@ -497,6 +497,7 @@ public IActionResult AddCollaborators(string actionname, int frameworkId) { BaseFramework = framework, Collaborators = collaborators, + Error = error, }; return View("Developer/Collaborators", model); } @@ -507,8 +508,15 @@ public IActionResult AddCollaborator(string actionname, string userEmail, bool c { 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 + { + return RedirectToAction("AddCollaborators", "Frameworks", new { frameworkId, actionname, error = true }); + } + } public IActionResult RemoveCollaborator(int frameworkId, string actionname, int id) diff --git a/DigitalLearningSolutions.Web/ViewModels/Frameworks/CollaboratorsViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Frameworks/CollaboratorsViewModel.cs index c16d3f7741..4b2aa6ad87 100644 --- a/DigitalLearningSolutions.Web/ViewModels/Frameworks/CollaboratorsViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/Frameworks/CollaboratorsViewModel.cs @@ -9,5 +9,6 @@ public class CollaboratorsViewModel public BaseFramework BaseFramework { get; set; } public IEnumerable? Collaborators { get; set; } public int AdminID { get; set; } + public bool Error { get; set; } } } diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml index 01a99428c6..75b6ceb185 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml @@ -115,15 +115,22 @@ else -
+
-
- Provide a user email address to add as a Contributor (to help create your framework) or Reviewer (to sign off your framework). Working group members can be added and removed later. + +
+ Provide the email address of a user with a registered DLS admin account to add as a Contributor (to help create your framework) or Reviewer (to sign off your framework). Working group members can be added and removed later.
- + @if(Model.Error) + { + + Error: The email address must match a registered DLS admin account. + + } +