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
17 changes: 9 additions & 8 deletions DigitalLearningSolutions.Data/DataServices/CentresDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void UpdateCentreDetailsForSuperAdmin(
string centreName,
int centreTypeId,
int regionId,
string? centreEmail,
string? registrationEmail,
string? ipPrefix,
bool showOnMap
);
Expand Down Expand Up @@ -180,7 +180,7 @@ ORDER BY CentreName"
c.ContactSurname,
c.ContactEmail,
c.ContactTelephone,
c.AutoRegisterManagerEmail AS CentreEmail,
c.AutoRegisterManagerEmail AS RegistrationEmail,
c.ShowOnMap,
c.CMSAdministrators AS CmsAdministratorSpots,
c.CMSManagers AS CmsManagerSpots,
Expand All @@ -192,7 +192,8 @@ ORDER BY CentreName"
c.ServerSpaceBytes,
cty.CentreType,
c.CandidateByteLimit,
c.ContractReviewDate
c.ContractReviewDate,
c.pwEmail as CentreEmail
FROM Centres AS c
INNER JOIN Regions AS r ON r.RegionID = c.RegionID
INNER JOIN ContractTypes AS ct ON ct.ContractTypeID = c.ContractTypeId
Expand Down Expand Up @@ -232,7 +233,7 @@ FROM Centres AS c
c.ContactEmail,
c.ContactTelephone,
c.pwTelephone AS CentreTelephone,
c.AutoRegisterManagerEmail AS CentreEmail,
c.AutoRegisterManagerEmail AS RegistrationEmail,
c.pwPostCode AS CentrePostcode,
c.ShowOnMap,
c.Long AS Longitude,
Expand All @@ -253,7 +254,7 @@ FROM Centres AS c
c.ServerSpaceBytes,
c.CentreTypeID,
ctp.CentreType,
c.pwEmail as RegistrationEmail
c.pwEmail as CentreEmail
FROM Centres AS c
INNER JOIN Regions AS r ON r.RegionID = c.RegionID
INNER JOIN ContractTypes AS ct ON ct.ContractTypeID = c.ContractTypeId
Expand Down Expand Up @@ -472,7 +473,7 @@ public void UpdateCentreDetailsForSuperAdmin(
string centreName,
int centreTypeId,
int regionId,
string? centreEmail,
string? registrationEmail,
string? ipPrefix,
bool showOnMap
)
Expand All @@ -482,7 +483,7 @@ bool showOnMap
CentreName = @centreName,
CentreTypeId = @centreTypeId,
RegionId = @regionId,
AutoRegisterManagerEmail = @centreEmail,
AutoRegisterManagerEmail = @registrationEmail,
IPPrefix = @ipPrefix,
ShowOnMap = @showOnMap
WHERE CentreId = @centreId",
Expand All @@ -491,7 +492,7 @@ bool showOnMap
centreName,
centreTypeId,
regionId,
centreEmail,
registrationEmail,
ipPrefix,
showOnMap,
centreId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void EditCentreDetails_updates_centre_and_redirects_with_successful_save(
CentreTypeId = 1,
CentreType = "NHS Organisation",
RegionName = "National",
CentreEmail = "[email protected]",
RegistrationEmail = "[email protected]",
IpPrefix = "12.33.4",
ShowOnMap = true,
RegionId = 13
Expand All @@ -99,7 +99,7 @@ public void EditCentreDetails_updates_centre_and_redirects_with_successful_save(
model.CentreName,
model.CentreTypeId,
model.RegionId,
model.CentreEmail,
model.RegistrationEmail,
model.IpPrefix,
model.ShowOnMap))
.MustHaveHappenedOnceExactly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public IActionResult Index(
{
var baseUrl = config.GetAppRootPath();
var supportEmail = this.configService.GetConfigValue("SupportEmail");
baseUrl = baseUrl+"/RegisterAdmin?centreId={centreId}".Replace("{centreId}", item.Centre.CentreId.ToString());
baseUrl = baseUrl + "/RegisterAdmin?centreId={centreId}".Replace("{centreId}", item.Centre.CentreId.ToString());
Email welcomeEmail = this.passwordResetService.GenerateEmailInviteForCentreManager(centreEntity.Centre.CentreName, centreEntity.Centre.AutoRegisterManagerEmail, baseUrl, supportEmail);
centreEntity.Centre.EmailInvite = "mailto:" + string.Join(",", welcomeEmail.To) + "?subject=" + welcomeEmail.Subject + "&body=" + welcomeEmail.Body.TextBody.Replace("&", "%26");
}
Expand Down Expand Up @@ -295,7 +295,7 @@ public IActionResult EditCentreDetails(EditCentreDetailsSuperAdminViewModel mode
model.CentreName.Trim(),
model.CentreTypeId,
model.RegionId,
model.CentreEmail,
model.RegistrationEmail,
model.IpPrefix?.Trim(),
model.ShowOnMap
);
Expand Down
6 changes: 3 additions & 3 deletions DigitalLearningSolutions.Web/Services/CentresService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void UpdateCentreDetailsForSuperAdmin(
string centreName,
int centreTypeId,
int regionId,
string? centreEmail,
string? registrationEmail,
string? ipPrefix,
bool showOnMap
);
Expand Down Expand Up @@ -227,9 +227,9 @@ public void UpdateCentreManagerDetails(int centreId, string firstName, string la
return centresDataService.GetAllCentres(activeOnly);
}

public void UpdateCentreDetailsForSuperAdmin(int centreId, string centreName, int centreTypeId, int regionId, string? centreEmail, string? ipPrefix, bool showOnMap)
public void UpdateCentreDetailsForSuperAdmin(int centreId, string centreName, int centreTypeId, int regionId, string? registrationEmail, string? ipPrefix, bool showOnMap)
{
centresDataService.UpdateCentreDetailsForSuperAdmin(centreId, centreName, centreTypeId, regionId, centreEmail, ipPrefix, showOnMap);
centresDataService.UpdateCentreDetailsForSuperAdmin(centreId, centreName, centreTypeId, regionId, registrationEmail, ipPrefix, showOnMap);
}

public CentreSummaryForRoleLimits GetRoleLimitsForCentre(int centreId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public EditCentreDetailsSuperAdminViewModel(Centre centre)
IpPrefix = centre.IpPrefix?.Trim();
ShowOnMap = centre.ShowOnMap;
RegionId = centre.RegionId;
RegistrationEmail = centre.RegistrationEmail;
}

public int CentreId { get; set; }
Expand All @@ -37,5 +38,10 @@ public EditCentreDetailsSuperAdminViewModel(Centre centre)
[RegularExpression(@"^[\d.,\s]+$", ErrorMessage = "IP Prefix can contain only digits, stops, commas and spaces")]
public string? IpPrefix { get; set; }
public bool ShowOnMap { get; set; }

[MaxLength(250, ErrorMessage = "Email must be 250 characters or fewer")]
[EmailAddress(ErrorMessage = "Enter an email in the correct format, like [email protected]")]
[NoWhitespace(ErrorMessage = "Email must not contain any whitespace characters")]
public string? RegistrationEmail { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,70 @@
<div class="nhsuk-grid-column-full">
@if (errorHasOccurred)
{
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.CentreName), nameof(Model.CentreEmail)})" />
<vc:error-summary order-of-property-names="@(new[] { nameof(Model.CentreName), nameof(Model.RegistrationEmail)})" />
}

<h1 class="nhsuk-heading-xl">Edit centre details</h1>
<form class="nhsuk-u-margin-bottom-3" method="post" novalidate asp-action="EditCentreDetails">
@Html.HiddenFor(x=>x.CentreType)
@Html.HiddenFor(x=>x.RegionName)
@Html.HiddenFor(x => x.CentreType)
@Html.HiddenFor(x => x.RegionName)
<div class="nhsuk-grid-column-full">
<vc:text-input asp-for="CentreName"
label="Centre name"
populate-with-current-value="true"
type="text"
spell-check="false"
autocomplete="off"
hint-text=""
css-class="nhsuk-u-width-one-half"
required="true" />
<vc:text-input asp-for="CentreName"
label="Centre name"
populate-with-current-value="true"
type="text"
spell-check="false"
autocomplete="off"
hint-text=""
css-class="nhsuk-u-width-one-half"
required="true" />

<vc:select-list asp-for="@nameof(Model.CentreTypeId)"
label="Centre type"
value="@Model.CentreType.ToString()"
hint-text=""
required="true"
css-class="nhsuk-u-width-one-half"
default-option=""
select-list-options="@ViewBag.CentreTypes" />
<vc:select-list asp-for="@nameof(Model.CentreTypeId)"
label="Centre type"
value="@Model.CentreType.ToString()"
hint-text=""
required="true"
css-class="nhsuk-u-width-one-half"
default-option=""
select-list-options="@ViewBag.CentreTypes" />

<vc:select-list asp-for="@nameof(Model.RegionId)"
label="Region"
value="@Model.RegionName.ToString()"
hint-text=""
required="true"
css-class="nhsuk-u-width-one-half"
default-option=""
select-list-options="@ViewBag.Regions" />
<vc:select-list asp-for="@nameof(Model.RegionId)"
label="Region"
value="@Model.RegionName.ToString()"
hint-text=""
required="true"
css-class="nhsuk-u-width-one-half"
default-option=""
select-list-options="@ViewBag.Regions" />

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

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

<div class="nhsuk-checkboxes__item">
<input class="nhsuk-checkboxes__input" id="ShowOnMap" name="ShowOnMap" asp-for="@Model.ShowOnMap" type="checkbox">
<label class="nhsuk-label nhsuk-checkboxes__label" for="ShowOnMap">
Show on find your centre
</label>
</div>
<div class="nhsuk-checkboxes__item">
<input class="nhsuk-checkboxes__input" id="ShowOnMap" name="ShowOnMap" asp-for="@Model.ShowOnMap" type="checkbox">
<label class="nhsuk-label nhsuk-checkboxes__label" for="ShowOnMap">
Show on find your centre
</label>
</div>

</div>

<button class="nhsuk-button nhsuk-u-margin-top-6" type="submit" value="save">Save</button>
</form>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<b>Registration email</b>
</dt>
<dd class="nhsuk-summary-list__value">
@Model.CentreEmail
@Model.RegistrationEmail
</dd>
</div>

Expand Down Expand Up @@ -201,7 +201,7 @@
<b>Contract review date</b>
</dt>
<dd class="nhsuk-summary-list__value">
@string.Format("{0:dd/MM/yyyy}",@Model.ContractReviewDate)
@string.Format("{0:dd/MM/yyyy}", @Model.ContractReviewDate)
</dd>
</div>
</dl>
Expand Down
Loading