Skip to content

TD-5761: Revised my account screen implementation #1341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.8.0" />
<PackageReference Include="BuildWebCompiler" Version="1.12.405" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.9" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.52" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.13" />
Expand Down
423 changes: 376 additions & 47 deletions LearningHub.Nhs.WebUI/Controllers/MyAccountController.cs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions LearningHub.Nhs.WebUI/Helpers/CommonValidationErrorMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,30 @@ public static class CommonValidationErrorMessages
/// Message if the validation token expired.
/// </summary>
public const string EmailChangeValidationTokenInvalidMessage = "We cannot find the page you are looking for";

/// <summary>
/// Message if the validation token expired.
/// </summary>
public const string InvalidSecurityQuestionAnswer = "Enter an answer";

/// <summary>
/// Message if the validation token expired.
/// </summary>
public const string EmploymentDetailsUpdated = "Your employment details has been changed";

/// <summary>
/// security question Success Message.
/// </summary>
public const string SecurityQuestionSuccessMessage = "Your security questions has been changed";

/// <summary>
/// location Success Message.
/// </summary>
public const string LocationDetailsSuccessMessage = "Your location details has been changed";

/// <summary>
/// location Success Message.
/// </summary>
public const string PersonalDetailsSuccessMessage = "Your personal details has been changed";
}
}
35 changes: 35 additions & 0 deletions LearningHub.Nhs.WebUI/Helpers/SelectListHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace LearningHub.Nhs.WebUI.Helpers
{
using System.Collections.Generic;
using System.Linq;
using elfhHub.Nhs.Models.Common;
using Microsoft.AspNetCore.Mvc.Rendering;

/// <summary>
/// SelectListHelper.
/// </summary>
public static class SelectListHelper
{
/// <summary>
/// MapOptionsToSelectListItems.
/// </summary>
/// <param name="options">options.</param>
/// <param name="selectedId">selectedId.</param>
/// <returns>SelectListItem.</returns>
public static IEnumerable<SelectListItem> MapOptionsToSelectListItems(IEnumerable<GenericListViewModel> options, int? selectedId = null)
{
return options.Select(o => new SelectListItem(o.Name, o.Id.ToString(), o.Id == selectedId)).ToList();
}

/// <summary>
/// MapSelectListWithSelection.
/// </summary>
/// <param name="options">options.</param>
/// <param name="selectedId">selectedId.</param>
/// <returns>SelectListItem.</returns>
public static IEnumerable<SelectListItem> MapSelectListWithSelection(IEnumerable<SelectListItem> options, string selectedId = null)
{
return options.Select(o => new SelectListItem(o.Text, o.Value, o.Value == selectedId)).ToList();
}
}
}
12 changes: 12 additions & 0 deletions LearningHub.Nhs.WebUI/Interfaces/ICountryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,17 @@ public interface ICountryService
/// </summary>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
Task<List<Country>> GetAllAsync();

/// <summary>
/// The GetAllUKCountries.
/// </summary>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
Task<List<GenericListViewModel>> GetAllUKCountries();

/// <summary>
/// The GetAllNonUKCountries.
/// </summary>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
Task<List<GenericListViewModel>> GetAllNonUKCountries();
}
}
40 changes: 40 additions & 0 deletions LearningHub.Nhs.WebUI/Interfaces/IUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,5 +478,45 @@ public interface IUserService
/// <param name="szString">the string.</param>
/// <returns>base64 string.</returns>
string Base64MD5HashDigest(string szString);

/// <summary>
/// The get current user profile for My account.
/// </summary>
/// <returns>The <see cref="Task{MyAccountPersonalDetailsViewModel}"/>.</returns>
Task<MyAccountPersonalDetailsViewModel> GetMyAccountPersonalDetailsAsync();

/// <summary>
/// Update MyAccount Personal Details Async.
/// </summary>
/// <param name="userId">userId.</param>
/// <param name="model">MyAccountPersonalDetailsViewModel.</param>
/// <returns>The <see cref="Task"/>.</returns>
Task UpdateMyAccountPersonalDetailsAsync(int userId, MyAccountPersonalDetailsViewModel model);

/// <summary>
/// Get MyEmployment Details Async.
/// </summary>
/// <returns>The <see cref="Task{MyAccountEmploymentDetailsViewModel}"/>.</returns>
Task<MyAccountEmploymentDetailsViewModel> GetMyEmploymentDetailsAsync();

/// <summary>
/// Get MyAccount Security Details Async.
/// </summary>
/// <returns>The <see cref="Task{MyAccountSecurityViewModel}"/>.</returns>
Task<MyAccountSecurityViewModel> GetMyAccountSecurityDetailsAsync();

/// <summary>
/// Get MyAccount Location Details Async.
/// </summary>
/// <returns>The <see cref="Task{MyAccountLocationViewModel}"/>.</returns>
Task<MyAccountLocationViewModel> GetMyAccountLocationDetailsAsync();

/// <summary>
/// Update MyAccount Location Details Async.
/// </summary>
/// <param name="userId">userId.</param>
/// <param name="model">MyAccountLocationViewModel.</param>
/// <returns>The <see cref="Task"/>.</returns>
Task UpdateMyAccountLocationDetailsAsync(int userId, MyAccountLocationViewModel model);
}
}
2 changes: 1 addition & 1 deletion LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.9" />
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.11" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Include="GDS.MultiPageFormData" Version="1.0.6" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.72" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ public static IEnumerable<SideNavigationGroup> GetGroupedMenus()
new SideNavigationItem
{
Text = "Personal details",
Controller = "Account",
Action = "PersonalDetails",
IsActive = route => MatchRoute(route, "Account", "PersonalDetails"),
Controller = "MyAccount",
Action = "Index",
IsActive = route => MatchRoute(route, "MyAccount", "Index"),
},
new SideNavigationItem
{
Text = "My employment",
Controller = "Account",
Action = "MyEmployment",
IsActive = route => MatchRoute(route, "Account", "MyEmployment"),
Controller = "MyAccount",
Action = "MyEmploymentDetails",
IsActive = route => MatchRoute(route, "MyAccount", "MyEmploymentDetails"),
},
new SideNavigationItem
{
Text = "Security",
Controller = "Account",
Action = "Security",
IsActive = route => MatchRoute(route, "Account", "Security"),
Controller = "MyAccount",
Action = "MyAccountSecurity",
IsActive = route => MatchRoute(route, "MyAccount", "MyAccountSecurity"),
},
new SideNavigationItem
{
Text = "Notification",
Controller = "Account",
Action = "Notification",
IsActive = route => MatchRoute(route, "Account", "Notification"),
Controller = "Notification",
Action = "Index",
IsActive = route => MatchRoute(route, "Notification", "Index"),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
namespace LearningHub.Nhs.WebUI.Models.UserProfile
{
using System;

/// <summary>
/// Defines the <see cref="MyAccountEmploymentDetailsViewModel" />.
/// </summary>
public class MyAccountEmploymentDetailsViewModel
{
/// <summary>
/// Gets or sets the Id.
/// </summary>
public int Id { get; set; }

/// <summary>
/// Gets or sets the Country.
/// </summary>
public string Country { get; set; }

/// <summary>
/// Gets or sets the Region.
/// </summary>
public string Region { get; set; }

/// <summary>
/// Gets or sets the CountryName.
/// </summary>
public string CountryName { get; set; }

/// <summary>
/// Gets or sets the RegionName.
/// </summary>
public string RegionName { get; set; }

/// <summary>
/// Gets or sets the user employment id.
/// </summary>
public int EmploymentId { get; set; }

/// <summary>
/// Gets or sets the job role id.
/// </summary>
public int? JobRoleId { get; set; }

/// <summary>
/// Gets or sets the CurrentRole.
/// </summary>
public string JobRole { get; set; }

/// <summary>
/// Gets or sets the medical council id.
/// </summary>
public int? MedicalCouncilId { get; set; }

/// <summary>
/// Gets or sets the ProfessionalRegistrationNumber.
/// </summary>
public string MedicalCouncilNo { get; set; }

/// <summary>
/// Gets or sets the grade id.
/// </summary>
public int? GradeId { get; set; }

/// <summary>
/// Gets or sets the Grade.
/// </summary>
public string Grade { get; set; }

/// <summary>
/// Gets or sets the specialty id.
/// </summary>
public int? SpecialtyId { get; set; }

/// <summary>
/// Gets or sets the PrimarySpecialty.
/// </summary>
public string PrimarySpecialty { get; set; }

/// <summary>
/// Gets or sets the StartDate.
/// </summary>
public DateTimeOffset? JobStartDate { get; set; }

/// <summary>
/// Gets or sets the location id.
/// </summary>
public int LocationId { get; set; }

/// <summary>
/// Gets or sets the PlaceOfWork.
/// </summary>
public string PlaceOfWork { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace LearningHub.Nhs.WebUI.Models.UserProfile
{
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.AspNetCore.Mvc.Rendering;
using NHSUKViewComponents.Web.ViewModels;

/// <summary>
/// Defines the <see cref="MyAccountLocationViewModel" />.
/// </summary>
public class MyAccountLocationViewModel
{
/// <summary>
/// Gets or sets the country id.
/// </summary>
[DisplayName("Country")]
public int? SelectedCountryId { get; set; }

/// <summary>
/// Gets or sets the region id.
/// </summary>
[DisplayName("Region")]
public int? SelectedRegionId { get; set; }

/// <summary>
/// Gets or sets selected country name.
/// </summary>
public string SelectedCountryName { get; set; }

/// <summary>
/// Gets or sets selected region name.
/// </summary>
public string SelectedRegionName { get; set; }

/// <summary>
/// Gets or sets the country id.
/// </summary>
public int? SelectedOtherCountryId { get; set; }

/// <summary>
/// Gets or sets a value indicating whether SelectedOtherCountry.
/// </summary>
public bool HasSelectedOtherCountry { get; set; }

/// <summary>
/// Gets or sets a value indicating whether SelectedRegion.
/// </summary>
public bool HasSelectedRegion { get; set; }

/// <summary>
/// Gets or sets the Country.
/// </summary>
public List<RadiosItemViewModel> Country { get; set; }

/// <summary>
/// Gets or sets the OtherCountryOptions.
/// </summary>
public IEnumerable<SelectListItem> OtherCountryOptions { get; set; }

/// <summary>
/// Gets or sets the RegionOptions.
/// </summary>
public IEnumerable<SelectListItem> RegionOptions { get; set; }
}
}
Loading
Loading