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
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ public class MyAccountPersonalDetailsViewModel
/// <summary>
/// Gets or sets the FirstName.
/// </summary>
[Required(ErrorMessage = "Enter a first name")]
[StringLength(50, MinimumLength = 1, ErrorMessage = "First name must be less than 50 characters.")]
[DisplayName("First name")]
public string FirstName { get; set; }

/// <summary>
/// Gets or sets the LastName.
/// </summary>
[Required(ErrorMessage = "Enter a last name")]
[StringLength(50, MinimumLength = 1, ErrorMessage = "Last name must be less than 50 characters.")]
[DisplayName("Last name")]
public string LastName { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions LearningHub.Nhs.WebUI/Services/UserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1943,8 +1943,6 @@ public async Task UpdateMyAccountPersonalDetailsAsync(int userId, MyAccountPerso
PersonalDetailsViewModel personalDetailsViewModel = new PersonalDetailsViewModel
{
UserId = userId,
FirstName = model.FirstName.Trim(),
LastName = model.LastName.Trim(),
PreferredName = model.PreferredName?.Trim(),
SecondaryEmailAddress = model.SecondaryEmailAddress,
};
Expand Down
94 changes: 48 additions & 46 deletions LearningHub.Nhs.WebUI/Views/MyAccount/ChangePersonalDetails.cshtml
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
@model LearningHub.Nhs.WebUI.Models.UserProfile.MyAccountPersonalDetailsViewModel

@{
ViewData["DisableValidation"] = true;
ViewData["Title"] = "My Account - Change first name";
var errorHasOccurred = !ViewData.ModelState.IsValid;
ViewData["DisableValidation"] = true;
ViewData["Title"] = "My Account - Change first name";
var errorHasOccurred = !ViewData.ModelState.IsValid;
}
<div class="bg-white">
<div class="nhsuk-width-container app-width-container">
<vc:back-link asp-controller="MyAccount" asp-action="Index" link-text="Go back to my account" />
<div class="nhsuk-width-container app-width-container">
<vc:back-link asp-controller="MyAccount" asp-action="Index" link-text="Go back to my account" />
<form asp-controller="MyAccount" asp-action="UpdatePersonalDetails" method="post">
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full nhsuk-u-padding-bottom-5">
@if (errorHasOccurred)
{
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.FirstName) })" />
}
<div>
@if (errorHasOccurred)
{
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.FirstName) })" />
}
<div>
<h1 class="nhsuk-heading-xl">Update personal details</h1>
<vc:text-input asp-for="FirstName"
</div>
@* TD-6335-Temporliy disabling updte names *@
@* <vc:text-input asp-for="FirstName"
label="First name"
populate-with-current-value="true"
type="text"
Expand All @@ -27,7 +29,7 @@
css-class="nhsuk-u-width-one-half"
required="true"
required-client-side-error-message="Enter a first name" />
</div>


<div>
<vc:text-input asp-for="LastName"
Expand All @@ -41,30 +43,30 @@
required="true"
required-client-side-error-message="Enter a last name" />
</div>
*@
<div>
<vc:text-input asp-for="PreferredName"
label="Preferred name"
populate-with-current-value="true"
type="text"
spell-check="false"
hint-text=""
autocomplete="nickname"
css-class="nhsuk-u-width-one-half"
required="false" />
</div>

<div>
<vc:text-input asp-for="PreferredName"
label="Preferred name"
populate-with-current-value="true"
type="text"
spell-check="false"
hint-text=""
autocomplete="nickname"
css-class="nhsuk-u-width-one-half"
required="false" />
</div>

<div>
<vc:text-input asp-for="PrimaryEmailAddress"
label="Work email"
populate-with-current-value="true"
type="text"
spell-check="false"
hint-text=""
autocomplete="email"
css-class="nhsuk-u-width-one-half"
required="true" />
</div>
<div>
<vc:text-input asp-for="PrimaryEmailAddress"
label="Work email"
populate-with-current-value="true"
type="text"
spell-check="false"
hint-text=""
autocomplete="email"
css-class="nhsuk-u-width-one-half"
required="true" />
</div>

<div>
<vc:text-input asp-for="SecondaryEmailAddress"
Expand All @@ -77,14 +79,14 @@
css-class="nhsuk-u-width-one-half"
required="false" />
</div>
<div class="nhsuk-u-padding-bottom-5">
<button class="nhsuk-button" data-module="nhsuk-button" type="submit">
Save changes
</button>
</div>
</div>
</div>
</form>
</div>

<div class="nhsuk-u-padding-bottom-5">
<button class="nhsuk-button" data-module="nhsuk-button" type="submit">
Save changes
</button>
</div>
</div>
</div>
</form>
</div>
</div>
Loading