From b3153a0df20bfb24ce8401a19092893a8e83eaa2 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Tue, 13 Jul 2021 19:36:39 +0100 Subject: [PATCH 01/15] HEEDLS-554 Create ViewDelegate controller; configure manage button on delegate card Create ViewDelegate controller with delegateId parameter and required user policy; redirect to ViewDelegate index page from DelegateCard Manage Delegate button --- .../Delegates/ViewDelegateController.cs | 18 ++++++++++++++++++ .../_SearchableDelegateCard.cshtml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs new file mode 100644 index 0000000000..195d3a829f --- /dev/null +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs @@ -0,0 +1,18 @@ +namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Delegates +{ + using DigitalLearningSolutions.Web.Helpers; + using Microsoft.AspNetCore.Authorization; + using Microsoft.AspNetCore.Mvc; + using Microsoft.FeatureManagement.Mvc; + + [FeatureGate(FeatureFlags.RefactoredTrackingSystem)] + [Authorize(Policy = CustomPolicies.UserCentreAdmin)] + [Route("TrackingSystem/Delegates/View/{delegateId:int}")] + public class ViewDelegateController : Controller + { + public IActionResult Index(int delegateId) + { + return new ObjectResult(delegateId); + } + } +} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml index d0bacf2832..e0dc1a41cb 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml @@ -61,7 +61,7 @@ } - Manage delegate + Manage delegate Set password From a26fa01db8d6d79615e2b535e991beec3897778b Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Tue, 13 Jul 2021 19:44:15 +0100 Subject: [PATCH 02/15] HEEDLS-554 Create ViewDelegate blank page with navbar and breadcrumbs --- .../Delegates/ViewDelegateController.cs | 2 +- .../Delegates/ViewDelegate/Index.cshtml | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs index 195d3a829f..63e8c84cc3 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs @@ -12,7 +12,7 @@ public class ViewDelegateController : Controller { public IActionResult Index(int delegateId) { - return new ObjectResult(delegateId); + return View(); } } } diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml new file mode 100644 index 0000000000..dac8d07588 --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -0,0 +1,23 @@ +@using Microsoft.Extensions.Configuration +@inject IConfiguration Configuration + +@{ + ViewData["Title"] = "View delegate"; + ViewData["Application"] = "Tracking System"; + ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/TrackingSystem/Centre/Dashboard"; + ViewData["HeaderPathName"] = "Tracking System"; +} + +@section NavMenuItems { + +} + +@section NavBreadcrumbs { + +} + +
+
+

View delegate

+
+
From baab93311c6e8bf602a3eaae9178086c33cdd8e3 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 10:45:49 +0100 Subject: [PATCH 03/15] HEEDLS-554 Implement GetDelegateUserCardById method --- .../DataServices/UserDataServiceTests.cs | 32 +++++++++++++- .../DataServices/UserDataService.cs | 42 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs index 7324f917de..03b5e62081 100644 --- a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs +++ b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs @@ -6,7 +6,6 @@ using System.Transactions; using DigitalLearningSolutions.Data.DataServices; using DigitalLearningSolutions.Data.Mappers; - using DigitalLearningSolutions.Data.Models.User; using DigitalLearningSolutions.Data.Tests.TestHelpers; using FluentAssertions; using FluentAssertions.Execution; @@ -460,5 +459,36 @@ public void GetDelegateUserCardsByCentreId_populates_DelegateUserCard_admin_fiel userCard.AliasId.Should().Be(""); userCard.JobGroupId.Should().Be(6); } + + [Test] + public void GetDelegateUserCardById_populates_DelegateUser_fields_correctly() + { + // Given + var expected = UserTestHelper.GetDefaultDelegateUser( + dateRegistered: DateTime.Parse("2010-09-22 06:52:09.080"), + jobGroupName: "Nursing / midwifery" + ); + + // When + var userCard = userDataService.GetDelegateUserCardById(2); + + // Then + userCard.Should().BeEquivalentTo(expected); + } + + [Test] + public void GetDelegateUserCardById_populates_DelegateUserCard_fields_correctly() + { + // When + var userCard = userDataService.GetDelegateUserCardById(97055)!; + + // Then + userCard.Active.Should().BeTrue(); + userCard.SelfReg.Should().BeTrue(); + userCard.ExternalReg.Should().BeFalse(); + userCard.AdminId.Should().Be(74); + userCard.AliasId.Should().Be(""); + userCard.JobGroupId.Should().Be(6); + } } } diff --git a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs index 25819941a4..1c422726f0 100644 --- a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs @@ -11,6 +11,7 @@ public interface IUserDataService { public AdminUser? GetAdminUserById(int id); public DelegateUser? GetDelegateUserById(int id); + public DelegateUserCard? GetDelegateUserCardById(int id); public List GetAdminUsersByCentreId(int centreId); public List GetDelegateUserCardsByCentreId(int centreId); public AdminUser? GetAdminUserByUsername(string username); @@ -136,6 +137,47 @@ FROM Candidates AS cd return user; } + public DelegateUserCard? GetDelegateUserCardById(int id) + { + var user = connection.Query( + @"SELECT + cd.CandidateID AS Id, + cd.CandidateNumber, + ct.CentreName, + cd.CentreID, + cd.DateRegistered, + ct.Active AS CentreActive, + cd.EmailAddress, + cd.FirstName, + cd.LastName, + cd.Password, + cd.Approved, + cd.Answer1, + cd.Answer2, + cd.Answer3, + cd.Answer4, + cd.Answer5, + cd.Answer6, + cd.JobGroupId, + jg.JobGroupName, + cd.SelfReg, + cd.ExternalReg, + cd.Active, + (SELECT AdminID + FROM AdminUsers au + WHERE au.Email = cd.EmailAddress AND au.CentreID = cd.CentreID + ) AS AdminID, + cd.AliasID + FROM Candidates AS cd + INNER JOIN Centres AS ct ON ct.CentreID = cd.CentreID + INNER JOIN JobGroups AS jg ON jg.JobGroupID = cd.JobGroupID + WHERE cd.CandidateId = @id", + new { id } + ).SingleOrDefault(); + + return user; + } + public List GetAdminUsersByCentreId(int centreId) { var users = connection.Query( From e7714bdac248727ce2a5e954d4e35f42a908f4c5 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 11:03:35 +0100 Subject: [PATCH 04/15] HEEDLS-554 Extract delegate info into DelegateInfoViewModel --- .../Delegates/AllDelegatesController.cs | 3 +- .../Delegates/DelegateInfoViewModel.cs | 47 +++++++++++++++++ .../Delegates/SearchableDelegateViewModel.cs | 52 +++---------------- .../_SearchableDelegateCard.cshtml | 26 +++++----- 4 files changed, 70 insertions(+), 58 deletions(-) create mode 100644 DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/AllDelegatesController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/AllDelegatesController.cs index 3392a82222..cb13c25e12 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/AllDelegatesController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/AllDelegatesController.cs @@ -30,7 +30,8 @@ public IActionResult Index() delegateUser => { var customFields = customPromptHelper.GetCustomFieldViewModelsForCentre(centreId, delegateUser); - return new SearchableDelegateViewModel(delegateUser, customFields); + var delegateInfoViewModel = new DelegateInfoViewModel(delegateUser, customFields); + return new SearchableDelegateViewModel(delegateInfoViewModel); } ); var model = new AllDelegatesViewModel(centreId, searchableDelegateViewModels); diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs new file mode 100644 index 0000000000..bb17106e70 --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs @@ -0,0 +1,47 @@ +namespace DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates +{ + using System.Collections.Generic; + using DigitalLearningSolutions.Data.Models.User; + using DigitalLearningSolutions.Web.ViewModels.Common; + + public class DelegateInfoViewModel + { + public DelegateInfoViewModel(DelegateUserCard delegateUser, List customFields) + { + Id = delegateUser.Id; + Name = delegateUser.SearchableName; + CandidateNumber = delegateUser.CandidateNumber; + + IsSelfReg = delegateUser.SelfReg; + IsExternalReg = delegateUser.ExternalReg; + IsActive = delegateUser.Active; + IsAdmin = delegateUser.AdminId.HasValue; + IsPasswordSet = delegateUser.Password != null; + + Email = delegateUser.EmailAddress; + JobGroup = delegateUser.JobGroupName; + if (delegateUser.DateRegistered.HasValue) + { + RegistrationDate = delegateUser.DateRegistered.Value.ToString("dd-MM-yyyy"); + } + + CustomFields = customFields; + } + + public int Id { get; set; } + public string Name { get; set; } + public string CandidateNumber { get; set; } + + public bool IsSelfReg { get; set; } + public bool IsExternalReg { get; set; } + public bool IsActive { get; set; } + public bool IsAdmin { get; set; } + public bool IsPasswordSet { get; set; } + + public string? Email { get; set; } + public string? JobGroup { get; set; } + public string? RegistrationDate { get; set; } + + public List CustomFields { get; set; } + } +} diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/SearchableDelegateViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/SearchableDelegateViewModel.cs index ad10620c25..60736aceb2 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/SearchableDelegateViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/SearchableDelegateViewModel.cs @@ -1,59 +1,23 @@ namespace DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates { - using System.Collections.Generic; - using System.Globalization; - using DigitalLearningSolutions.Data.Models.User; - using DigitalLearningSolutions.Web.ViewModels.Common; - /* TODO: Search and sort functionality is part of HEEDLS-491. Filename includes 'Searchable' to avoid having to change name later */ public class SearchableDelegateViewModel { - public SearchableDelegateViewModel(DelegateUserCard delegateUser, List customFields) + public SearchableDelegateViewModel(DelegateInfoViewModel delegateInfoViewModel) { - Id = delegateUser.Id; - Name = delegateUser.SearchableName; - CandidateNumber = delegateUser.CandidateNumber; - - IsSelfReg = delegateUser.SelfReg; - IsExternalReg = delegateUser.ExternalReg; - IsActive = delegateUser.Active; - IsAdmin = delegateUser.AdminId.HasValue; - IsPasswordSet = delegateUser.Password != null; - - Email = delegateUser.EmailAddress; - JobGroup = delegateUser.JobGroupName; - if (delegateUser.DateRegistered.HasValue) - { - CultureInfo originalCulture = CultureInfo.CurrentCulture; - CultureInfo.CurrentCulture = new CultureInfo("en-GB"); - RegistrationDate = delegateUser.DateRegistered.Value.ToShortDateString(); - CultureInfo.CurrentCulture = originalCulture; - } - - CustomFields = customFields; + DelegateInfo = delegateInfoViewModel; } - public int Id { get; set; } - public string Name { get; set; } - public string CandidateNumber { get; set; } - - public bool IsSelfReg { get; set; } - public bool IsExternalReg { get; set; } - public bool IsActive { get; set; } - public bool IsAdmin { get; set; } - public bool IsPasswordSet { get; set; } + public DelegateInfoViewModel DelegateInfo { get; set; } public string RegStatusTagName => - IsSelfReg ? "Self registered" + (IsExternalReg ? " (External)" : "") : "Registered by centre"; - public string ActiveTagName => IsActive ? "Active" : "Inactive"; - public string PasswordTagName => IsPasswordSet ? "Password set" : "Password not set"; - - public string? Email { get; set; } - public string? JobGroup { get; set; } - public string? RegistrationDate { get; set; } + DelegateInfo.IsSelfReg + ? "Self registered" + (DelegateInfo.IsExternalReg ? " (External)" : "") + : "Registered by centre"; - public List CustomFields { get; set; } + public string ActiveTagName => DelegateInfo.IsActive ? "Active" : "Inactive"; + public string PasswordTagName => DelegateInfo.IsPasswordSet ? "Password set" : "Password not set"; } } diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml index e0dc1a41cb..f2fd6f05a1 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml @@ -2,18 +2,18 @@ @using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates @model SearchableDelegateViewModel @{ - var activeTagCss = Model.IsActive ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; - var passwordTagCss = Model.IsPasswordSet ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; + var activeTagCss = Model.DelegateInfo.IsActive ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; + var passwordTagCss = Model.DelegateInfo.IsPasswordSet ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; } @*TODO: Search and sort functionality is part of HEEDLS-491. Filename includes 'Searchable' to avoid having to change name later*@ -
+
- - @Model.Name (@Model.CandidateNumber) + + @Model.DelegateInfo.Name (@Model.DelegateInfo.CandidateNumber) @@ -22,7 +22,7 @@ @(Model.ActiveTagName) @(Model.RegStatusTagName) @(Model.PasswordTagName) - @if (Model.IsAdmin) { + @if (Model.DelegateInfo.IsAdmin) { Admin }
@@ -30,30 +30,30 @@
Name
-
@Model.Name
+
@Model.DelegateInfo.Name
Email
-
@Model.Email
+
@Model.DelegateInfo.Email
ID
-
@Model.CandidateNumber
+
@Model.DelegateInfo.CandidateNumber
Registration date
-
@Model.RegistrationDate
+
@Model.DelegateInfo.RegistrationDate
Job group
-
@Model.JobGroup
+
@Model.DelegateInfo.JobGroup
- @foreach (CustomFieldViewModel customField in Model.CustomFields) { + @foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
@customField.Answer
@@ -61,7 +61,7 @@ }
- Manage delegate + Manage delegate Set password
From 3925df67d9c13fb29ac34a0ecce5443f6faa7d65 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 11:44:52 +0100 Subject: [PATCH 05/15] HEEDLS-554 Display delegate info and tags on View Delegate page --- .../Delegates/ViewDelegateController.cs | 25 ++++++- .../Delegates/DelegateInfoViewModel.cs | 2 + .../Delegates/ViewDelegateViewModel.cs | 20 ++++++ .../Delegates/ViewDelegate/Index.cshtml | 66 +++++++++++++++++-- 4 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/ViewDelegateViewModel.cs diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs index 63e8c84cc3..2c09d67c58 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Delegates/ViewDelegateController.cs @@ -1,6 +1,8 @@ namespace DigitalLearningSolutions.Web.Controllers.TrackingSystem.Delegates { + using DigitalLearningSolutions.Data.DataServices; using DigitalLearningSolutions.Web.Helpers; + using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.FeatureManagement.Mvc; @@ -10,9 +12,30 @@ [Route("TrackingSystem/Delegates/View/{delegateId:int}")] public class ViewDelegateController : Controller { + private readonly CustomPromptHelper customPromptHelper; + private readonly IUserDataService userDataService; + + public ViewDelegateController(IUserDataService userDataService, CustomPromptHelper customPromptHelper) + { + this.userDataService = userDataService; + this.customPromptHelper = customPromptHelper; + } + public IActionResult Index(int delegateId) { - return View(); + var centreId = User.GetCentreId(); + var delegateUser = userDataService.GetDelegateUserCardById(delegateId); + + if (delegateUser == null || delegateUser.CentreId != centreId) + { + return new NotFoundResult(); + } + + var customFields = customPromptHelper.GetCustomFieldViewModelsForCentre(centreId, delegateUser); + var delegateInfo = new DelegateInfoViewModel(delegateUser, customFields); + var model = new ViewDelegateViewModel(delegateInfo); + + return View(model); } } } diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs index bb17106e70..1d73844048 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs @@ -24,6 +24,7 @@ public DelegateInfoViewModel(DelegateUserCard delegateUser, List CustomFields { get; set; } } diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/ViewDelegateViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/ViewDelegateViewModel.cs new file mode 100644 index 0000000000..815c6b5067 --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/ViewDelegateViewModel.cs @@ -0,0 +1,20 @@ +namespace DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates +{ + public class ViewDelegateViewModel + { + public ViewDelegateViewModel(DelegateInfoViewModel delegateInfoViewModel) + { + DelegateInfo = delegateInfoViewModel; + } + + public DelegateInfoViewModel DelegateInfo { get; set; } + + public string RegStatusTagName => + DelegateInfo.IsSelfReg + ? "Self registered" + (DelegateInfo.IsExternalReg ? " (External)" : "") + : "Registered by centre"; + + public string ActiveTagName => DelegateInfo.IsActive ? "Active" : "Inactive"; + public string PasswordTagName => DelegateInfo.IsPasswordSet ? "Password set" : "Password not set"; + } +} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index dac8d07588..dc499696ed 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -1,11 +1,18 @@ -@using Microsoft.Extensions.Configuration -@inject IConfiguration Configuration +@inject IConfiguration Configuration +@using DigitalLearningSolutions.Web.ViewModels.Common +@using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates +@using Microsoft.Extensions.Configuration +@model ViewDelegateViewModel @{ ViewData["Title"] = "View delegate"; ViewData["Application"] = "Tracking System"; ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/TrackingSystem/Centre/Dashboard"; ViewData["HeaderPathName"] = "Tracking System"; + + var activeTagCss = Model.DelegateInfo.IsActive ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; + var passwordTagCss = Model.DelegateInfo.IsPasswordSet ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; + } @section NavMenuItems { @@ -13,11 +20,62 @@ } @section NavBreadcrumbs { - + }
-

View delegate

+

+ @Model.DelegateInfo.Name +

+ +
+ @(Model.ActiveTagName) + @(Model.RegStatusTagName) + @(Model.PasswordTagName) + @if (Model.DelegateInfo.IsAdmin) { + Admin + } +
+ +
+
+
Name
+
@Model.DelegateInfo.Name
+
+ +
+
Email
+
@Model.DelegateInfo.Email
+
+ +
+
ID
+
@Model.DelegateInfo.CandidateNumber
+
+ +
+
Alias
+
@Model.DelegateInfo.AliasId
+
+ +
+
Registration date
+
@Model.DelegateInfo.RegistrationDate
+
+ +
+
Job group
+
@Model.DelegateInfo.JobGroup
+
+ + @foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) { +
+
@customField.CustomPrompt
+
@customField.Answer
+
+ } +
+
From bfd10f5ecc0124d121f80e9a0c4e22c3cfc5f07f Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 13:11:57 +0100 Subject: [PATCH 06/15] HEEDLS-554 Display buttons on ViewDelegate page based on active status --- .../Styles/trackingSystem/viewDelegate.scss | 25 +++++++++++ .../Delegates/ViewDelegate/Index.cshtml | 41 +++++++++++++++++-- 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss diff --git a/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss new file mode 100644 index 0000000000..012c0a7edd --- /dev/null +++ b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss @@ -0,0 +1,25 @@ +@import "~nhsuk-frontend/packages/core/all"; + + +.view-delegate-top-button-group { + text-align: right; + + @media (max-width: 768px) { + text-align: unset; + margin-bottom: nhsuk-spacing(4); + } +} + +.view-delegate-button { + padding-top: nhsuk-spacing(2); + padding-bottom: nhsuk-spacing(2); + + @media (max-width: 1024px) { + margin-top: nhsuk-spacing(1); + margin-bottom: nhsuk-spacing(1); + } + + @media (max-width: 375px) { + width: 100%; + } +} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index dc499696ed..72beccf21e 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -4,6 +4,8 @@ @using Microsoft.Extensions.Configuration @model ViewDelegateViewModel + + @{ ViewData["Title"] = "View delegate"; ViewData["Application"] = "Tracking System"; @@ -25,11 +27,20 @@
-

- @Model.DelegateInfo.Name -

+
+
+

@Model.DelegateInfo.Name

+
+ @if (Model.DelegateInfo.IsActive) { + + } +
-
+
@(Model.ActiveTagName) @(Model.RegStatusTagName) @(Model.PasswordTagName) @@ -38,6 +49,7 @@ }
+

Details

Name
@@ -77,5 +89,26 @@ }
+ +
From e47b871e22974ed088aef7f68a0b6b085402857e Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 13:19:03 +0100 Subject: [PATCH 07/15] HEEDLS-554 Display hyphen to indicate no value for optional DelegateUser fields --- .../TrackingSystem/Delegates/ViewDelegate/Index.cshtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index 72beccf21e..8a5deb8b6d 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -58,7 +58,7 @@
Email
-
@Model.DelegateInfo.Email
+
@(Model.DelegateInfo.Email ?? "-")
@@ -68,23 +68,23 @@
Alias
-
@Model.DelegateInfo.AliasId
+
@(Model.DelegateInfo.AliasId ?? "-")
Registration date
-
@Model.DelegateInfo.RegistrationDate
+
@(Model.DelegateInfo.RegistrationDate ?? "-")
Job group
-
@Model.DelegateInfo.JobGroup
+
@(Model.DelegateInfo.JobGroup ?? "-")
@foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
-
@customField.Answer
+
@(customField.Answer ?? "-")
} From ba628e335da38644fff3639b238eb1de9868c5ec Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 13:28:53 +0100 Subject: [PATCH 08/15] HEEDLS-554 Fix SearchableDelegateVM tests; add ViewDelegateVM and DelegateInfoVM tests; fix date string --- .../DelegateInfoViewModelTests.cs | 29 ++++++++ .../SearchableDelegateViewModelTests.cs | 31 +++------ .../ViewDelegateViewModelTests.cs | 67 +++++++++++++++++++ .../Delegates/DelegateInfoViewModel.cs | 2 +- 4 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/DelegateInfoViewModelTests.cs create mode 100644 DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/ViewDelegateViewModelTests.cs diff --git a/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/DelegateInfoViewModelTests.cs b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/DelegateInfoViewModelTests.cs new file mode 100644 index 0000000000..ae3f695786 --- /dev/null +++ b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/DelegateInfoViewModelTests.cs @@ -0,0 +1,29 @@ +namespace DigitalLearningSolutions.Web.Tests.ViewModels.TrackingSystem.Delegates.AllDelegates +{ + using System; + using System.Collections.Generic; + using DigitalLearningSolutions.Data.Models.User; + using DigitalLearningSolutions.Web.ViewModels.Common; + using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates; + using FluentAssertions; + using NUnit.Framework; + + public class DelegateInfoViewModelTests + { + private readonly List customFields = new List(); + + [Test] + public void DelegateInfoViewModel_sets_reg_date_string_correctly() + { + // Given + var date = new DateTime(2021, 05, 13); + var user = new DelegateUserCard { DateRegistered = date }; + + // When + var model = new DelegateInfoViewModel(user, customFields); + + // Then + model.RegistrationDate.Should().Be("13/05/2021"); + } + } +} diff --git a/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/SearchableDelegateViewModelTests.cs b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/SearchableDelegateViewModelTests.cs index d0625b03d1..8deb88c0bf 100644 --- a/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/SearchableDelegateViewModelTests.cs +++ b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/SearchableDelegateViewModelTests.cs @@ -1,6 +1,5 @@ namespace DigitalLearningSolutions.Web.Tests.ViewModels.TrackingSystem.Delegates.AllDelegates { - using System; using System.Collections.Generic; using DigitalLearningSolutions.Data.Models.User; using DigitalLearningSolutions.Web.ViewModels.Common; @@ -20,8 +19,8 @@ public void SearchableDelegateViewModel_sets_active_tag_name_correctly() var inactiveUser = new DelegateUserCard { Active = false }; // When - var activeModel = new SearchableDelegateViewModel(activeUser, customFields); - var inactiveModel = new SearchableDelegateViewModel(inactiveUser, customFields); + var activeModel = new SearchableDelegateViewModel(new DelegateInfoViewModel(activeUser, customFields)); + var inactiveModel = new SearchableDelegateViewModel(new DelegateInfoViewModel(inactiveUser, customFields)); // Then activeModel.ActiveTagName.Should().Be("Active"); @@ -36,8 +35,8 @@ public void SearchableDelegateViewModel_sets_password_tag_name_correctly() var pwNotSetUser = new DelegateUserCard { Password = null }; // When - var pwSetModel = new SearchableDelegateViewModel(pwSetUser, customFields); - var pwNotSetModel = new SearchableDelegateViewModel(pwNotSetUser, customFields); + var pwSetModel = new SearchableDelegateViewModel(new DelegateInfoViewModel(pwSetUser, customFields)); + var pwNotSetModel = new SearchableDelegateViewModel(new DelegateInfoViewModel(pwNotSetUser, customFields)); // Then pwSetModel.PasswordTagName.Should().Be("Password set"); @@ -53,28 +52,16 @@ public void SearchableDelegateViewModel_sets_regstatus_tag_name_correctly() var centreRegUser = new DelegateUserCard { SelfReg = false }; // When - var selfRegModel = new SearchableDelegateViewModel(selfRegUser, customFields); - var selfRegExternalModel = new SearchableDelegateViewModel(selfRegExternalUser, customFields); - var centreRegModel = new SearchableDelegateViewModel(centreRegUser, customFields); + var selfRegModel = new SearchableDelegateViewModel(new DelegateInfoViewModel(selfRegUser, customFields)); + var selfRegExternalModel = + new SearchableDelegateViewModel(new DelegateInfoViewModel(selfRegExternalUser, customFields)); + var centreRegModel = + new SearchableDelegateViewModel(new DelegateInfoViewModel(centreRegUser, customFields)); // Then selfRegModel.RegStatusTagName.Should().Be("Self registered"); selfRegExternalModel.RegStatusTagName.Should().Be("Self registered (External)"); centreRegModel.RegStatusTagName.Should().Be("Registered by centre"); } - - [Test] - public void SearchableDelegateViewModel_sets_reg_date_string_correctly() - { - // Given - var date = new DateTime(2021, 05, 13); - var user = new DelegateUserCard { DateRegistered = date }; - - // When - var model = new SearchableDelegateViewModel(user, customFields); - - // Then - model.RegistrationDate.Should().Be("13/05/2021"); - } } } diff --git a/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/ViewDelegateViewModelTests.cs b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/ViewDelegateViewModelTests.cs new file mode 100644 index 0000000000..3889a9ab71 --- /dev/null +++ b/DigitalLearningSolutions.Web.Tests/ViewModels/TrackingSystem/Delegates/AllDelegates/ViewDelegateViewModelTests.cs @@ -0,0 +1,67 @@ +namespace DigitalLearningSolutions.Web.Tests.ViewModels.TrackingSystem.Delegates.AllDelegates +{ + using System.Collections.Generic; + using DigitalLearningSolutions.Data.Models.User; + using DigitalLearningSolutions.Web.ViewModels.Common; + using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates; + using FluentAssertions; + using NUnit.Framework; + + public class ViewDelegateViewModelTests + { + private readonly List customFields = new List(); + + [Test] + public void ViewDelegateViewModel_sets_active_tag_name_correctly() + { + // Given + var activeUser = new DelegateUserCard { Active = true }; + var inactiveUser = new DelegateUserCard { Active = false }; + + // When + var activeModel = new ViewDelegateViewModel(new DelegateInfoViewModel(activeUser, customFields)); + var inactiveModel = new ViewDelegateViewModel(new DelegateInfoViewModel(inactiveUser, customFields)); + + // Then + activeModel.ActiveTagName.Should().Be("Active"); + inactiveModel.ActiveTagName.Should().Be("Inactive"); + } + + [Test] + public void ViewDelegateViewModel_sets_password_tag_name_correctly() + { + // Given + var pwSetUser = new DelegateUserCard { Password = "pw" }; + var pwNotSetUser = new DelegateUserCard { Password = null }; + + // When + var pwSetModel = new ViewDelegateViewModel(new DelegateInfoViewModel(pwSetUser, customFields)); + var pwNotSetModel = new ViewDelegateViewModel(new DelegateInfoViewModel(pwNotSetUser, customFields)); + + // Then + pwSetModel.PasswordTagName.Should().Be("Password set"); + pwNotSetModel.PasswordTagName.Should().Be("Password not set"); + } + + [Test] + public void ViewDelegateViewModel_sets_regstatus_tag_name_correctly() + { + // Given + var selfRegUser = new DelegateUserCard { SelfReg = true, ExternalReg = false }; + var selfRegExternalUser = new DelegateUserCard { SelfReg = true, ExternalReg = true }; + var centreRegUser = new DelegateUserCard { SelfReg = false }; + + // When + var selfRegModel = new ViewDelegateViewModel(new DelegateInfoViewModel(selfRegUser, customFields)); + var selfRegExternalModel = + new ViewDelegateViewModel(new DelegateInfoViewModel(selfRegExternalUser, customFields)); + var centreRegModel = + new ViewDelegateViewModel(new DelegateInfoViewModel(centreRegUser, customFields)); + + // Then + selfRegModel.RegStatusTagName.Should().Be("Self registered"); + selfRegExternalModel.RegStatusTagName.Should().Be("Self registered (External)"); + centreRegModel.RegStatusTagName.Should().Be("Registered by centre"); + } + } +} diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs index 1d73844048..fa2562cf15 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/Delegates/DelegateInfoViewModel.cs @@ -22,7 +22,7 @@ public DelegateInfoViewModel(DelegateUserCard delegateUser, List Date: Thu, 15 Jul 2021 18:54:52 +0100 Subject: [PATCH 09/15] HEEDLS-554 Remove unneeded row/col divs from ViewDelegates page --- .../Delegates/ViewDelegate/Index.cshtml | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index 8a5deb8b6d..25a67ba19b 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -26,20 +26,18 @@ }
-
-
-
-

@Model.DelegateInfo.Name

-
- @if (Model.DelegateInfo.IsActive) { - - } +
+

@Model.DelegateInfo.Name

+
+ @if (Model.DelegateInfo.IsActive) { + + } +
@(Model.ActiveTagName) @(Model.RegStatusTagName) @@ -109,6 +107,5 @@ }
-
From a5d564a44b97da762b9cc306f4bc2e31472214f8 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Thu, 15 Jul 2021 18:57:52 +0100 Subject: [PATCH 10/15] HEEDLS-554 Do not match admin when getting DelegateUserCard if admin email is blank To prevent the case where a centre has an admin with blank email, and any delegate at that centre with a blank email has a 'matching' email --- .../DataServices/UserDataServiceTests.cs | 64 +++++++++++++++---- .../DataServices/UserDataService.cs | 8 ++- 2 files changed, 59 insertions(+), 13 deletions(-) diff --git a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs index 03b5e62081..72b2e107fd 100644 --- a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs +++ b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs @@ -448,16 +448,38 @@ public void GetDelegateUserCardsByCentreId_populates_DelegateUser_fields_correct public void GetDelegateUserCardsByCentreId_populates_DelegateUserCard_admin_fields_correctly() { // When - var userCards = userDataService.GetDelegateUserCardsByCentreId(279); + var userCards = userDataService.GetDelegateUserCardsByCentreId(101); // Then - var userCard = userCards.Single(user => user.Id == 97055); + var userCard = userCards.Single(user => user.Id == 254480); userCard.Active.Should().BeTrue(); userCard.SelfReg.Should().BeTrue(); - userCard.ExternalReg.Should().BeFalse(); - userCard.AdminId.Should().Be(74); - userCard.AliasId.Should().Be(""); - userCard.JobGroupId.Should().Be(6); + userCard.ExternalReg.Should().BeTrue(); + userCard.AdminId.Should().Be(1); + userCard.AliasId.Should().Be("kevin.whittaker1@nhs.net"); + userCard.JobGroupId.Should().Be(9); + } + + [Test] + public void GetDelegateUserCardsByCentreId_does_not_match_admin_if_not_admin_in_this_centre() + { + // When + var userCards = userDataService.GetDelegateUserCardsByCentreId(409); + + // Then + var userCard = userCards.Single(user => user.Id == 268530); + userCard.AdminId.Should().BeNull(); + } + + [Test] + public void GetDelegateUserCardsByCentreId_does_not_match_Admin_if_Admin_email_address_is_blank() + { + // When + var userCards = userDataService.GetDelegateUserCardsByCentreId(279); + + // Then + var userCard = userCards.First(user => user.EmailAddress == ""); + userCard.AdminId.Should().BeNull(); } [Test] @@ -480,15 +502,35 @@ public void GetDelegateUserCardById_populates_DelegateUser_fields_correctly() public void GetDelegateUserCardById_populates_DelegateUserCard_fields_correctly() { // When - var userCard = userDataService.GetDelegateUserCardById(97055)!; + var userCard = userDataService.GetDelegateUserCardById(254480)!; // Then userCard.Active.Should().BeTrue(); userCard.SelfReg.Should().BeTrue(); - userCard.ExternalReg.Should().BeFalse(); - userCard.AdminId.Should().Be(74); - userCard.AliasId.Should().Be(""); - userCard.JobGroupId.Should().Be(6); + userCard.ExternalReg.Should().BeTrue(); + userCard.AdminId.Should().Be(1); + userCard.AliasId.Should().Be("kevin.whittaker1@nhs.net"); + userCard.JobGroupId.Should().Be(9); + } + + [Test] + public void GetDelegateUserCardById_does_not_match_admin_if_not_admin_in_this_centre() + { + // When + var userCard = userDataService.GetDelegateUserCardById(268530)!; + + // Then + userCard.AdminId.Should().BeNull(); + } + + [Test] + public void GetDelegateUserCardById_does_not_match_Admin_if_Admin_email_address_is_blank() + { + // When + var userCard = userDataService.GetDelegateUserCardById(41300)!; + + // Then + userCard.AdminId.Should().BeNull(); } } } diff --git a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs index 1c422726f0..eea061074f 100644 --- a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs @@ -165,7 +165,9 @@ FROM Candidates AS cd cd.Active, (SELECT AdminID FROM AdminUsers au - WHERE au.Email = cd.EmailAddress AND au.CentreID = cd.CentreID + WHERE au.Email = cd.EmailAddress + AND au.CentreID = cd.CentreID + AND au.Email != '' ) AS AdminID, cd.AliasID FROM Candidates AS cd @@ -247,7 +249,9 @@ public List GetDelegateUserCardsByCentreId(int centreId) cd.Active, (SELECT AdminID FROM AdminUsers au - WHERE au.Email = cd.EmailAddress AND au.CentreID = cd.CentreID + WHERE au.Email = cd.EmailAddress + AND au.CentreID = cd.CentreID + AND au.Email != '' ) AS AdminID, cd.AliasID FROM Candidates AS cd From 08703989e59ff3f4c7d3bc198714bd1f482e871f Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Mon, 19 Jul 2021 11:21:16 +0100 Subject: [PATCH 11/15] HEEDLS-554 Add visually hidden text to indicate fields with no value; minor formatting changes --- .../Styles/trackingSystem/viewDelegate.scss | 1 - .../Delegates/ViewDelegate/Index.cshtml | 41 +++++++++++++++---- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss index 012c0a7edd..8b414818d9 100644 --- a/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss +++ b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss @@ -1,6 +1,5 @@ @import "~nhsuk-frontend/packages/core/all"; - .view-delegate-top-button-group { text-align: right; diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index 25a67ba19b..ca48f58449 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -11,10 +11,8 @@ ViewData["Application"] = "Tracking System"; ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/TrackingSystem/Centre/Dashboard"; ViewData["HeaderPathName"] = "Tracking System"; - var activeTagCss = Model.DelegateInfo.IsActive ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; var passwordTagCss = Model.DelegateInfo.IsPasswordSet ? "nhsuk-tag nhsuk-tag--green" : "nhsuk-tag nhsuk-tag--red"; - } @section NavMenuItems { @@ -31,8 +29,8 @@
@if (Model.DelegateInfo.IsActive) { } @@ -56,7 +54,12 @@
Email
-
@(Model.DelegateInfo.Email ?? "-")
+
+ @(Model.DelegateInfo.Email ?? "-") + @if (Model.DelegateInfo.Email == null) { + No value set + } +
@@ -66,23 +69,43 @@
Alias
-
@(Model.DelegateInfo.AliasId ?? "-")
+
+ @(Model.DelegateInfo.AliasId ?? "-") + @if (Model.DelegateInfo.AliasId == null) { + No value set + } +
Registration date
-
@(Model.DelegateInfo.RegistrationDate ?? "-")
+
+ @(Model.DelegateInfo.RegistrationDate ?? "-") + @if (Model.DelegateInfo.RegistrationDate == null) { + No value set + } +
Job group
-
@(Model.DelegateInfo.JobGroup ?? "-")
+
+ @(Model.DelegateInfo.JobGroup ?? "-") + @if (Model.DelegateInfo.JobGroup == null) { + No value set + } +
@foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
-
@(customField.Answer ?? "-")
+
+ @(customField.Answer ?? "-") + @if (customField.Answer == null) { + No value set + } +
} From 6db5dcf274db2abb155b2eb05e7437e780627440 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Mon, 19 Jul 2021 11:40:14 +0100 Subject: [PATCH 12/15] HEEDLS-554 Move Deactivate account button to new line --- .../Styles/trackingSystem/viewDelegate.scss | 1 + .../TrackingSystem/Delegates/ViewDelegate/Index.cshtml | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss index 8b414818d9..d926f51ff8 100644 --- a/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss +++ b/DigitalLearningSolutions.Web/Styles/trackingSystem/viewDelegate.scss @@ -12,6 +12,7 @@ .view-delegate-button { padding-top: nhsuk-spacing(2); padding-bottom: nhsuk-spacing(2); + margin-bottom: nhsuk-spacing(2); @media (max-width: 1024px) { margin-top: nhsuk-spacing(1); diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index ca48f58449..d75bed9313 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -121,9 +121,11 @@ Promote to admin - - Deactivate account - + } else { Reactivate account From 101d324c123dfd433481a0666070b6c6c1ab2532 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Mon, 19 Jul 2021 13:57:47 +0100 Subject: [PATCH 13/15] HEEDLS-554 Update delegate-admin linking condition in GetDelegateUserCards; update tests; add accessibility test --- .../DataServices/UserDataServiceTests.cs | 53 ++++++++++++++----- .../DataServices/UserDataService.cs | 8 ++- .../BasicAccessibilityTests.cs | 1 + 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs index 72b2e107fd..1040c1e001 100644 --- a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs +++ b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs @@ -451,13 +451,13 @@ public void GetDelegateUserCardsByCentreId_populates_DelegateUserCard_admin_fiel var userCards = userDataService.GetDelegateUserCardsByCentreId(101); // Then - var userCard = userCards.Single(user => user.Id == 254480); + var userCard = userCards.Single(user => user.Id == 3); userCard.Active.Should().BeTrue(); - userCard.SelfReg.Should().BeTrue(); - userCard.ExternalReg.Should().BeTrue(); + userCard.SelfReg.Should().BeFalse(); + userCard.ExternalReg.Should().BeFalse(); userCard.AdminId.Should().Be(1); - userCard.AliasId.Should().Be("kevin.whittaker1@nhs.net"); - userCard.JobGroupId.Should().Be(9); + userCard.AliasId.Should().Be(""); + userCard.JobGroupId.Should().Be(10); } [Test] @@ -472,7 +472,7 @@ public void GetDelegateUserCardsByCentreId_does_not_match_admin_if_not_admin_in_ } [Test] - public void GetDelegateUserCardsByCentreId_does_not_match_Admin_if_Admin_email_address_is_blank() + public void GetDelegateUserCardsByCentreId_does_not_match_admin_if_admin_email_address_is_blank() { // When var userCards = userDataService.GetDelegateUserCardsByCentreId(279); @@ -482,6 +482,21 @@ public void GetDelegateUserCardsByCentreId_does_not_match_Admin_if_Admin_email_a userCard.AdminId.Should().BeNull(); } + [Test] + public void GetDelegateUserCardsByCentreId_does_not_match_admin_if_password_does_not_match() + { + // When + var userCards = userDataService.GetDelegateUserCardsByCentreId(101); + + // Then + var adminUser = userDataService.GetAdminUserById(1)!; + var userCard = userCards.Single(user => user.Id == 254480); + userCard.EmailAddress.Should().Be(adminUser.EmailAddress); + userCard.CentreId.Should().Be(adminUser.CentreId); + userCard.Password.Should().NotBe(adminUser.Password); + userCard.AdminId.Should().BeNull(); + } + [Test] public void GetDelegateUserCardById_populates_DelegateUser_fields_correctly() { @@ -502,15 +517,15 @@ public void GetDelegateUserCardById_populates_DelegateUser_fields_correctly() public void GetDelegateUserCardById_populates_DelegateUserCard_fields_correctly() { // When - var userCard = userDataService.GetDelegateUserCardById(254480)!; + var userCard = userDataService.GetDelegateUserCardById(3)!; // Then userCard.Active.Should().BeTrue(); - userCard.SelfReg.Should().BeTrue(); - userCard.ExternalReg.Should().BeTrue(); + userCard.SelfReg.Should().BeFalse(); + userCard.ExternalReg.Should().BeFalse(); userCard.AdminId.Should().Be(1); - userCard.AliasId.Should().Be("kevin.whittaker1@nhs.net"); - userCard.JobGroupId.Should().Be(9); + userCard.AliasId.Should().Be(""); + userCard.JobGroupId.Should().Be(10); } [Test] @@ -524,7 +539,7 @@ public void GetDelegateUserCardById_does_not_match_admin_if_not_admin_in_this_ce } [Test] - public void GetDelegateUserCardById_does_not_match_Admin_if_Admin_email_address_is_blank() + public void GetDelegateUserCardById_does_not_match_admin_if_admin_email_address_is_blank() { // When var userCard = userDataService.GetDelegateUserCardById(41300)!; @@ -532,5 +547,19 @@ public void GetDelegateUserCardById_does_not_match_Admin_if_Admin_email_address_ // Then userCard.AdminId.Should().BeNull(); } + + [Test] + public void GetDelegateUserCardById_does_not_match_admin_if_password_does_not_match() + { + // When + var userCard = userDataService.GetDelegateUserCardById(254480)!; + + // Then + var adminUser = userDataService.GetAdminUserById(1)!; + userCard.EmailAddress.Should().Be(adminUser.EmailAddress); + userCard.CentreId.Should().Be(adminUser.CentreId); + userCard.Password.Should().NotBe(adminUser.Password); + userCard.AdminId.Should().BeNull(); + } } } diff --git a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs index eea061074f..aa99e2513f 100644 --- a/DigitalLearningSolutions.Data/DataServices/UserDataService.cs +++ b/DigitalLearningSolutions.Data/DataServices/UserDataService.cs @@ -165,7 +165,9 @@ FROM Candidates AS cd cd.Active, (SELECT AdminID FROM AdminUsers au - WHERE au.Email = cd.EmailAddress + WHERE (au.Email = cd.EmailAddress + OR au.Email = cd.AliasID) + AND au.Password = cd.Password AND au.CentreID = cd.CentreID AND au.Email != '' ) AS AdminID, @@ -249,7 +251,9 @@ public List GetDelegateUserCardsByCentreId(int centreId) cd.Active, (SELECT AdminID FROM AdminUsers au - WHERE au.Email = cd.EmailAddress + WHERE (au.Email = cd.EmailAddress + OR au.Email = cd.AliasID) + AND au.Password = cd.Password AND au.CentreID = cd.CentreID AND au.Email != '' ) AS AdminID, diff --git a/DigitalLearningSolutions.Web.AutomatedUiTests/AccessibilityTests/BasicAccessibilityTests.cs b/DigitalLearningSolutions.Web.AutomatedUiTests/AccessibilityTests/BasicAccessibilityTests.cs index 61e5032f61..00ed3e37c7 100644 --- a/DigitalLearningSolutions.Web.AutomatedUiTests/AccessibilityTests/BasicAccessibilityTests.cs +++ b/DigitalLearningSolutions.Web.AutomatedUiTests/AccessibilityTests/BasicAccessibilityTests.cs @@ -39,6 +39,7 @@ public void Page_has_no_accessibility_errors(string url, string pageTitle) [InlineData("/TrackingSystem/Centre/TopCourses", "Top courses")] [InlineData("/TrackingSystem/CourseSetup", "Centre course setup")] [InlineData("/TrackingSystem/Delegates/All", "Delegates")] + [InlineData("/TrackingSystem/Delegates/View/1", "xxxxx xxxxxxxxx")] [InlineData("/TrackingSystem/Delegates/Approve", "Approve delegate registrations")] [InlineData("/TrackingSystem/Delegates/BulkUpload", "Bulk upload/update delegates")] [InlineData("/NotificationPreferences", "Notification preferences")] From 35446dae7333d90d2b9aa29e8cbf3a87a9823db7 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Mon, 19 Jul 2021 15:51:44 +0100 Subject: [PATCH 14/15] HEEDLS-554 Use dash and visually hidden text to indicate no value for fields which may be null or empty Also rename a test --- .../DataServices/UserDataServiceTests.cs | 2 +- .../CentreConfigurationViewModel.cs | 4 +- .../Dashboard/_DashboardCentreDetails.cshtml | 25 +++++++++--- ...reConfigurationCentreContentDetails.cshtml | 40 +++++++++++++++---- .../_CentreConfigurationCentreDetails.cshtml | 10 ++++- ...reConfigurationCentreManagerDetails.cshtml | 20 ++++++++-- .../_SearchableDelegateCard.cshtml | 28 +++++++++++-- .../Delegates/ViewDelegate/Index.cshtml | 10 ++--- 8 files changed, 108 insertions(+), 31 deletions(-) diff --git a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs index 1040c1e001..d6e982dc45 100644 --- a/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs +++ b/DigitalLearningSolutions.Data.Tests/DataServices/UserDataServiceTests.cs @@ -445,7 +445,7 @@ public void GetDelegateUserCardsByCentreId_populates_DelegateUser_fields_correct } [Test] - public void GetDelegateUserCardsByCentreId_populates_DelegateUserCard_admin_fields_correctly() + public void GetDelegateUserCardsByCentreId_populates_DelegateUserCard_fields_correctly() { // When var userCards = userDataService.GetDelegateUserCardsByCentreId(101); diff --git a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/CentreConfiguration/CentreConfigurationViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/CentreConfiguration/CentreConfigurationViewModel.cs index faf4dec13f..d128a204e1 100644 --- a/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/CentreConfiguration/CentreConfigurationViewModel.cs +++ b/DigitalLearningSolutions.Web/ViewModels/TrackingSystem/CentreConfiguration/CentreConfigurationViewModel.cs @@ -32,8 +32,8 @@ public CentreConfigurationViewModel(Centre centre) public int CentreId { get; set; } public string CentreName { get; set; } public string RegionName { get; set; } - public string NotifyEmail { get; set; } - public string BannerText { get; set; } + public string? NotifyEmail { get; set; } + public string? BannerText { get; set; } public byte[]? SignatureImage { get; set; } public byte[]? CentreLogo { get; set; } public string? ContactForename { get; set; } diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml index f193f650bc..dda768305e 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml @@ -62,7 +62,10 @@ Centre manager
- @Model.CentreDetails.CentreManager + @(Model.CentreDetails.CentreManager ?? "-") + @if (string.IsNullOrEmpty(Model.CentreDetails.CentreManager)) { + No value set + }
@@ -71,7 +74,10 @@ Email
- @Model.CentreDetails.Email + @(Model.CentreDetails.Email ?? "-") + @if (string.IsNullOrEmpty(Model.CentreDetails.Email)) { + No value set + }
@@ -80,7 +86,10 @@ Contact number
- @Model.CentreDetails.Telephone + @(Model.CentreDetails.Telephone ?? "-") + @if (string.IsNullOrEmpty(Model.CentreDetails.Telephone)) { + No value set + }
@@ -89,7 +98,10 @@ Centre support details
- @Model.CentreDetails.BannerText + @(Model.CentreDetails.BannerText ?? "-") + @if (string.IsNullOrEmpty(Model.CentreDetails.BannerText)) { + No value set + }
@@ -107,7 +119,10 @@ Pre-approved IPs
- @Model.CentreDetails.ApprovedIps + @(Model.CentreDetails.ApprovedIps ?? "-") + @if (string.IsNullOrEmpty(Model.CentreDetails.ApprovedIps)) { + No value set + }
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml index 95e9d7de11..5799b8242b 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml @@ -18,7 +18,10 @@ Centre telephone
- @Model.CentreTelephone + @(Model.CentreTelephone ?? "-") + @if (string.IsNullOrEmpty(Model.CentreTelephone)) { + No value set + }
@@ -27,7 +30,10 @@ Centre email
- @Model.CentreEmail + @(Model.CentreEmail ?? "-") + @if (string.IsNullOrEmpty(Model.CentreEmail)) { + No value set + }
@@ -36,7 +42,10 @@ Centre postcode
- @Model.CentrePostcode + @(Model.CentrePostcode ?? "-") + @if (string.IsNullOrEmpty(Model.CentrePostcode)) { + No value set + }
@@ -54,7 +63,10 @@ Opening hours
- @Model.OpeningHours + @(Model.OpeningHours ?? "-") + @if (string.IsNullOrEmpty(Model.OpeningHours)) { + No value set + }
@@ -63,7 +75,10 @@ Centre web address
- @Model.CentreWebAddress + @(Model.CentreWebAddress ?? "-") + @if (string.IsNullOrEmpty(Model.CentreWebAddress)) { + No value set + }
@@ -72,7 +87,10 @@ Organisations covered
- @Model.OrganisationsCovered + @(Model.OrganisationsCovered ?? "-") + @if (string.IsNullOrEmpty(Model.OrganisationsCovered)) { + No value set + }
@@ -81,7 +99,10 @@ Training venues
- @Model.TrainingVenues + @(Model.TrainingVenues ?? "-") + @if (string.IsNullOrEmpty(Model.TrainingVenues)) { + No value set + }
@@ -90,7 +111,10 @@ Other information
- @Model.OtherInformation + @(Model.OtherInformation ?? "-") + @if (string.IsNullOrEmpty(Model.OtherInformation)) { + No value set + }
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml index 81e149b821..c7906e9c8f 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml @@ -16,7 +16,10 @@ Notify email
- @Model.NotifyEmail + @(Model.NotifyEmail ?? "-") + @if (string.IsNullOrEmpty(Model.NotifyEmail)) { + No value set + }
@@ -25,7 +28,10 @@ Banner text
- @Model.BannerText + @(Model.BannerText ?? "-") + @if (string.IsNullOrEmpty(Model.BannerText)) { + No value set + }
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml index ebbc48d4ed..8f97c74377 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml @@ -14,7 +14,10 @@ First name
- @Model.ContactForename + @(Model.ContactForename ?? "-") + @if (string.IsNullOrEmpty(Model.ContactForename)) { + No value set + }
@@ -23,7 +26,10 @@ Last name
- @Model.ContactSurname + @(Model.ContactSurname ?? "-") + @if (string.IsNullOrEmpty(Model.ContactSurname)) { + No value set + }
@@ -32,7 +38,10 @@ Email
- @Model.ContactEmail + @(Model.ContactEmail ?? "-") + @if (string.IsNullOrEmpty(Model.ContactEmail)) { + No value set + }
@@ -41,7 +50,10 @@ Telephone
- @Model.ContactTelephone + @(Model.ContactTelephone ?? "-") + @if (string.IsNullOrEmpty(Model.ContactTelephone)) { + No value set + }
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml index f2fd6f05a1..b2d21c3be6 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml @@ -35,7 +35,12 @@
Email
-
@Model.DelegateInfo.Email
+
+ @(Model.DelegateInfo.Email ?? "-") + @if (string.IsNullOrEmpty(Model.DelegateInfo.Email)) { + No value set + } +
@@ -45,18 +50,33 @@
Registration date
-
@Model.DelegateInfo.RegistrationDate
+
+ @(Model.DelegateInfo.RegistrationDate ?? "-") + @if (string.IsNullOrEmpty(Model.DelegateInfo.RegistrationDate)) { + No value set + } +
Job group
-
@Model.DelegateInfo.JobGroup
+
+ @(Model.DelegateInfo.JobGroup ?? "-") + @if (string.IsNullOrEmpty(Model.DelegateInfo.JobGroup)) { + No value set + } +
@foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
-
@customField.Answer
+
+ @(customField.Answer ?? "-") + @if (string.IsNullOrEmpty(customField.Answer)) { + No value set + } +
} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index d75bed9313..af60721479 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -56,7 +56,7 @@
Email
@(Model.DelegateInfo.Email ?? "-") - @if (Model.DelegateInfo.Email == null) { + @if (string.IsNullOrEmpty(Model.DelegateInfo.Email)) { No value set }
@@ -71,7 +71,7 @@
Alias
@(Model.DelegateInfo.AliasId ?? "-") - @if (Model.DelegateInfo.AliasId == null) { + @if (string.IsNullOrEmpty(Model.DelegateInfo.AliasId)) { No value set }
@@ -81,7 +81,7 @@
Registration date
@(Model.DelegateInfo.RegistrationDate ?? "-") - @if (Model.DelegateInfo.RegistrationDate == null) { + @if (string.IsNullOrEmpty(Model.DelegateInfo.RegistrationDate)) { No value set }
@@ -91,7 +91,7 @@
Job group
@(Model.DelegateInfo.JobGroup ?? "-") - @if (Model.DelegateInfo.JobGroup == null) { + @if (string.IsNullOrEmpty(Model.DelegateInfo.JobGroup)) { No value set }
@@ -102,7 +102,7 @@
@customField.CustomPrompt
@(customField.Answer ?? "-") - @if (customField.Answer == null) { + @if (string.IsNullOrEmpty(customField.Answer)) { No value set }
From fe4a1f872cb93c31fc7978bd5b1efb9741b2ae71 Mon Sep 17 00:00:00 2001 From: Ibrahim Munir-Zubair Date: Mon, 19 Jul 2021 16:49:01 +0100 Subject: [PATCH 15/15] HEEDLS-554 Create SummaryFieldValue component and use in summary tables across tracking system and my account --- .../MyAccount/_AccountSummaryCard.cshtml | 12 +--- .../Views/MyAccount/_MyDetailsCard.cshtml | 16 ++--- .../Shared/_CustomPromptSummaryListRow.cshtml | 4 +- .../Views/Shared/_SummaryFieldValue.cshtml | 11 ++++ .../Dashboard/_DashboardCentreDetails.cshtml | 59 ++++------------- ...reConfigurationCentreContentDetails.cshtml | 60 +++--------------- .../_CentreConfigurationCentreDetails.cshtml | 14 +---- ...reConfigurationCentreManagerDetails.cshtml | 28 ++------- .../_SearchableDelegateCard.cshtml | 52 +++++++-------- .../Delegates/ViewDelegate/Index.cshtml | 63 ++++++++----------- 10 files changed, 91 insertions(+), 228 deletions(-) create mode 100644 DigitalLearningSolutions.Web/Views/Shared/_SummaryFieldValue.cshtml diff --git a/DigitalLearningSolutions.Web/Views/MyAccount/_AccountSummaryCard.cshtml b/DigitalLearningSolutions.Web/Views/MyAccount/_AccountSummaryCard.cshtml index ea89760b80..5afbed44ba 100644 --- a/DigitalLearningSolutions.Web/Views/MyAccount/_AccountSummaryCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/MyAccount/_AccountSummaryCard.cshtml @@ -8,9 +8,7 @@
Centre
-
- @Model.Centre -
+
@if (Model.User?.Length > 0) { @@ -18,9 +16,7 @@
User
-
- @Model.User -
+ } @@ -29,9 +25,7 @@
Delegate id
-
- @Model.DelegateNumber -
+ } diff --git a/DigitalLearningSolutions.Web/Views/MyAccount/_MyDetailsCard.cshtml b/DigitalLearningSolutions.Web/Views/MyAccount/_MyDetailsCard.cshtml index 0a4f73aed8..0eba131922 100644 --- a/DigitalLearningSolutions.Web/Views/MyAccount/_MyDetailsCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/MyAccount/_MyDetailsCard.cshtml @@ -12,27 +12,21 @@
First name
-
- @Model.FirstName -
+
Last name
-
- @Model.Surname -
+
Email address
-
- @Model.User -
+
@if (Model.DelegateNumber != null) { @@ -40,9 +34,7 @@
Job group
-
- @Model.JobGroup -
+ foreach (var customField in Model.CustomFields) { diff --git a/DigitalLearningSolutions.Web/Views/Shared/_CustomPromptSummaryListRow.cshtml b/DigitalLearningSolutions.Web/Views/Shared/_CustomPromptSummaryListRow.cshtml index 1d4fd7eb11..b73b6cc2fe 100644 --- a/DigitalLearningSolutions.Web/Views/Shared/_CustomPromptSummaryListRow.cshtml +++ b/DigitalLearningSolutions.Web/Views/Shared/_CustomPromptSummaryListRow.cshtml @@ -5,7 +5,5 @@
@Model.CustomPrompt@(Model.Mandatory ? "" : " (optional)")
-
- @Model.Answer -
+ diff --git a/DigitalLearningSolutions.Web/Views/Shared/_SummaryFieldValue.cshtml b/DigitalLearningSolutions.Web/Views/Shared/_SummaryFieldValue.cshtml new file mode 100644 index 0000000000..701bec233b --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/Shared/_SummaryFieldValue.cshtml @@ -0,0 +1,11 @@ +@model string? + +@if (string.IsNullOrEmpty(Model)) { +
+ - No value set +
+} else { +
+ @Model +
+} diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml index dda768305e..e3ba6a1c38 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/Dashboard/_DashboardCentreDetails.cshtml @@ -16,114 +16,77 @@
Centre ranking
-
- @Model.CentreDetails.CentreRank -
+
Centre name
-
- @Model.CentreDetails.CentreName -
+
Centre number
-
- @Model.CentreDetails.CentreId -
+
Region
-
- @Model.CentreDetails.Region -
+
Contract type
-
- @Model.CentreDetails.ContractType -
+
Centre manager
-
- @(Model.CentreDetails.CentreManager ?? "-") - @if (string.IsNullOrEmpty(Model.CentreDetails.CentreManager)) { - No value set - } -
+
Email
-
- @(Model.CentreDetails.Email ?? "-") - @if (string.IsNullOrEmpty(Model.CentreDetails.Email)) { - No value set - } -
+
Contact number
-
- @(Model.CentreDetails.Telephone ?? "-") - @if (string.IsNullOrEmpty(Model.CentreDetails.Telephone)) { - No value set - } -
+
Centre support details
-
- @(Model.CentreDetails.BannerText ?? "-") - @if (string.IsNullOrEmpty(Model.CentreDetails.BannerText)) { - No value set - } -
+
Your IP address
-
- @Model.CentreDetails.IpAddress -
+
Pre-approved IPs
-
- @(Model.CentreDetails.ApprovedIps ?? "-") - @if (string.IsNullOrEmpty(Model.CentreDetails.ApprovedIps)) { - No value set - } -
+
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml index 5799b8242b..f5d800a9da 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreContentDetails.cshtml @@ -17,105 +17,63 @@
Centre telephone
-
- @(Model.CentreTelephone ?? "-") - @if (string.IsNullOrEmpty(Model.CentreTelephone)) { - No value set - } -
+
Centre email
-
- @(Model.CentreEmail ?? "-") - @if (string.IsNullOrEmpty(Model.CentreEmail)) { - No value set - } -
+
Centre postcode
-
- @(Model.CentrePostcode ?? "-") - @if (string.IsNullOrEmpty(Model.CentrePostcode)) { - No value set - } -
+
Show centre on map
-
- @showCentreOnMap -
+
Opening hours
-
- @(Model.OpeningHours ?? "-") - @if (string.IsNullOrEmpty(Model.OpeningHours)) { - No value set - } -
+
Centre web address
-
- @(Model.CentreWebAddress ?? "-") - @if (string.IsNullOrEmpty(Model.CentreWebAddress)) { - No value set - } -
+
Organisations covered
-
- @(Model.OrganisationsCovered ?? "-") - @if (string.IsNullOrEmpty(Model.OrganisationsCovered)) { - No value set - } -
+
Training venues
-
- @(Model.TrainingVenues ?? "-") - @if (string.IsNullOrEmpty(Model.TrainingVenues)) { - No value set - } -
+
Other information
-
- @(Model.OtherInformation ?? "-") - @if (string.IsNullOrEmpty(Model.OtherInformation)) { - No value set - } -
+
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml index c7906e9c8f..1d4f5614de 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreDetails.cshtml @@ -15,24 +15,14 @@
Notify email
-
- @(Model.NotifyEmail ?? "-") - @if (string.IsNullOrEmpty(Model.NotifyEmail)) { - No value set - } -
+
Banner text
-
- @(Model.BannerText ?? "-") - @if (string.IsNullOrEmpty(Model.BannerText)) { - No value set - } -
+
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml index 8f97c74377..159f26aab5 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/CentreConfiguration/_CentreConfigurationCentreManagerDetails.cshtml @@ -13,48 +13,28 @@
First name
-
- @(Model.ContactForename ?? "-") - @if (string.IsNullOrEmpty(Model.ContactForename)) { - No value set - } -
+
Last name
-
- @(Model.ContactSurname ?? "-") - @if (string.IsNullOrEmpty(Model.ContactSurname)) { - No value set - } -
+
Email
-
- @(Model.ContactEmail ?? "-") - @if (string.IsNullOrEmpty(Model.ContactEmail)) { - No value set - } -
+
Telephone
-
- @(Model.ContactTelephone ?? "-") - @if (string.IsNullOrEmpty(Model.ContactTelephone)) { - No value set - } -
+
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml index b2d21c3be6..18eb36810f 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/AllDelegates/_SearchableDelegateCard.cshtml @@ -29,54 +29,44 @@
-
Name
-
@Model.DelegateInfo.Name
+
+ Name +
+
-
Email
-
- @(Model.DelegateInfo.Email ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.Email)) { - No value set - } -
+
+ Email +
+
-
ID
-
@Model.DelegateInfo.CandidateNumber
+
+ ID +
+
-
Registration date
-
- @(Model.DelegateInfo.RegistrationDate ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.RegistrationDate)) { - No value set - } -
+
+ Registration date +
+
-
Job group
-
- @(Model.DelegateInfo.JobGroup ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.JobGroup)) { - No value set - } -
+
+ Job group +
+
@foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
-
- @(customField.Answer ?? "-") - @if (string.IsNullOrEmpty(customField.Answer)) { - No value set - } -
+
}
diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml index af60721479..2b95a56776 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Delegates/ViewDelegate/Index.cshtml @@ -48,64 +48,51 @@

Details

-
Name
-
@Model.DelegateInfo.Name
+
+ Name +
+
-
Email
-
- @(Model.DelegateInfo.Email ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.Email)) { - No value set - } -
+
+ Email +
+
-
ID
-
@Model.DelegateInfo.CandidateNumber
+
+ ID +
+
-
Alias
-
- @(Model.DelegateInfo.AliasId ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.AliasId)) { - No value set - } -
+
+ Alias +
+
-
Registration date
-
- @(Model.DelegateInfo.RegistrationDate ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.RegistrationDate)) { - No value set - } -
+
+ Registration date +
+
-
Job group
-
- @(Model.DelegateInfo.JobGroup ?? "-") - @if (string.IsNullOrEmpty(Model.DelegateInfo.JobGroup)) { - No value set - } -
+
+ Job group +
+
@foreach (CustomFieldViewModel customField in Model.DelegateInfo.CustomFields) {
@customField.CustomPrompt
-
- @(customField.Answer ?? "-") - @if (string.IsNullOrEmpty(customField.Answer)) { - No value set - } -
+
}