Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions DigitalLearningSolutions.Data/Services/FrameworkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -497,6 +497,7 @@ public IActionResult AddCollaborators(string actionname, int frameworkId)
{
BaseFramework = framework,
Collaborators = collaborators,
Error = error,
};
return View("Developer/Collaborators", model);
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public class CollaboratorsViewModel
public BaseFramework BaseFramework { get; set; }
public IEnumerable<CollaboratorDetail>? Collaborators { get; set; }
public int AdminID { get; set; }
public bool Error { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,22 @@ else
<label class="nhsuk-label nhsuk-u-margin-top-6" for="add-user-hint">
<h2>Add a user to the working group</h2>
</label>
<div class="nhsuk-form-group">
<div class="@(Model.Error? "nhsuk-form-group nhsuk-form-group--error" : "nhsuk-form-group")">
<div class=" sort-select-container">
<label class="nhsuk-label" for="example">
User email address
</label>
<div class="nhsuk-hint" id="add-user-hint">
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.

<div class="nhsuk-hint" id="add-user-hint">
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.
</div>
<input class="nhsuk-input" id="userEmail" aria-describedby="add-user-hint" type="email" name="userEmail" />
@if(Model.Error)
{
<span class="nhsuk-error-message" id="no-admin-error">
<span class="nhsuk-u-visually-hidden">Error:</span> The email address must match a registered DLS admin account.
</span>
}
<input class="@(Model.Error? "nhsuk-input nhsuk-input--error" : "nhsuk-input")" id="userEmail" aria-describedby="add-user-hint" type="email" name="userEmail" />
</div>
</div>
<button class="nhsuk-button nhsuk-button--secondary button-small" asp-route-canModify="True" asp-route-frameworkId="@Model.BaseFramework.ID">
Expand Down