Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ecruit into CON-2110-Recruit-content-delete-the-advert
  • Loading branch information
reachash committed Aug 13, 2020
2 parents 2ddfb62 + c0d37e5 commit fd59615
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ManageNotificationsOrchestrator : EntityValidatingOrchestrator<User
{
private readonly IRecruitVacancyClient _recruitVacancyClient;

private const string NotificationTypesIsRequiredForTheFirstTime = "Choose when you’d like to receive emails";
private const string NotificationTypesIsRequiredForTheFirstTime = "Select when you want to receive emails about your adverts and applications";
private readonly EntityValidationResult _notificationTypeIsRequiredForTheFirstTime = new EntityValidationResult
{
Errors = new[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
@model Esfa.Recruit.Employer.Web.ViewModels.ManageNotifications.ConfirmUnsubscribeNotificationsViewModel
@{
ViewBag.Vpv = "/recruitment/employer/page-confirm-unsubscribe-notifications";
ViewBag.Title = "Are you sure you want to stop receiving emails about adverts and applications?";
}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<partial name=@PartialNames.ValidationSummary model='new ValidationSummaryViewModel { ModelState = ViewData.ModelState }' />
<form method="post">
<div class="govuk-form-group">
<div esfa-validation-marker-for="ConfirmUnsubscribe" class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--xl">
<h1 class="govuk-fieldset__heading">
Are you sure you want to stop receiving all recruitment emails?
</h1>
<h1 class="govuk-fieldset__heading">
Are you sure you want to stop receiving emails about adverts and applications?
</h1>
</legend>
<span esfa-validation-message-for="ConfirmUnsubscribe" class="govuk-error-message"></span>
<div class="govuk-radios govuk-radios--inline">
<div class="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="confirm_yes" asp-for="@Model.ConfirmUnsubscribe" type="radio" value="true" />
<label class="govuk-label govuk-radios__label" for="confirm_yes">
Yes
Yes
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="confirm_no" asp-for="@Model.ConfirmUnsubscribe" type="radio" value="false" />
<label class="govuk-label govuk-radios__label" for="confirm_no">
No
No
</label>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,35 @@
@using Esfa.Recruit.Vacancies.Client.Domain.Entities;
@{
ViewBag.Vpv = "/recruitment/employer/page-manage-notifications";
ViewBag.Title = "Manage your emails";
}

@model ManageNotificationsViewModel
<div class="govuk-grid-row">
<h1 class="govuk-heading-l govuk-!-margin-bottom-6">Manage your recruitment emails</h1>
</div>

<div class="govuk-grid-row">
<div class="govuk-gird-column-two-thirds">

<partial name=@PartialNames.ValidationSummary model='new ValidationSummaryViewModel { ModelState = ViewData.ModelState }' />

<h1 class="govuk-heading-l govuk-!-margin-bottom-6">Manage your emails</h1>

<form method="post">
<div class="govuk-form-group">
<div esfa-validation-marker-for="HasAnySubscription" class="govuk-form-group">
<fieldset class="govuk-fieldset" aria-describedby="when-conditional-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h2 class="govuk-fieldset__heading">
When do you want to be sent recruitment emails?
When do you want to receive emails about your adverts and applications?
</h2>
</legend>
<span id="when-conditional-hint" class="govuk-hint">
Choose when you’d like emails
Select all that apply.
</span>
<div class="govuk-checkboxes" data-module="checkboxes">
<span esfa-validation-message-for="HasAnySubscription" class="govuk-error-message"></span>
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" asp-for="IsVacancyRejectedSelected" id="notifications-rejected" type="checkbox">
<label class="govuk-label govuk-checkboxes__label" for="notifications-rejected">
<span class="govuk-visually-hidden">Get notifications when </span>Vacancies are rejected after review
<span class="govuk-visually-hidden">Get notifications </span>When an advert is rejected after review
</label>
</div>
<div asp-hide="true">
Expand All @@ -41,15 +44,15 @@
<div class="govuk-checkboxes__item govuk-checkboxes--conditional">
<input class="govuk-checkboxes__input" asp-for="IsApplicationSubmittedSelected" id="notifications-new" type="checkbox" data-aria-controls="conditional-when-conditional">
<label class="govuk-label govuk-checkboxes__label" for="notifications-new">
<span class="govuk-visually-hidden">Get notifications when </span>There are new applications
<span class="govuk-visually-hidden">Get notifications </span>When you have new applications
</label>
</div>
<div>
<div class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-when-conditional">
<div esfa-validation-marker-for="NotificationFrequency" class="govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" id="conditional-when-conditional">
<fieldset class="govuk-fieldset" aria-describedby="when-conditional-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--s">
<h1 class="govuk-fieldset__heading">
How often do you want to be sent new application emails?
How often do you want to receive emails about new applications?
</h1>
</legend>
<span esfa-validation-message-for="NotificationFrequency" class="govuk-error-message"></span>
Expand All @@ -61,7 +64,7 @@
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" value="@NotificationFrequency.Daily" asp-for="NotificationFrequency" id="notification-frequency-daily" type="radio" >
<input class="govuk-radios__input" value="@NotificationFrequency.Daily" asp-for="NotificationFrequency" id="notification-frequency-daily" type="radio">
<label class="govuk-label govuk-radios__label" for="notification-frequency-daily">
@NotificationFrequency.Daily
</label>
Expand All @@ -79,36 +82,39 @@
</div>
</fieldset>
</div>
<div class="govuk-form-group">
<div esfa-validation-marker-for="NotificationScope" class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h2 class="govuk-fieldset__heading">
What emails would you like to receive?
</h2>
<h2 class="govuk-fieldset__heading">
Which adverts do you want to receive emails about?
</h2>
</legend>
<div class="govuk-radios" data-module="radios">
<span esfa-validation-message-for="NotificationScope" class="govuk-error-message"></span>
<div class="govuk-radios__item">
<input class="govuk-radios__input" value="UserSubmittedVacancies" id="notification-scope-user-submitted" asp-for="NotificationScope" type="radio">
<label class="govuk-label govuk-radios__label" for="notification-scope-user-submitted">
Only emails about vacancies you have submitted
Only the adverts you submitted
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" value="OrganisationVacancies" id="notification-scope-organisation" asp-for="NotificationScope" type="radio">
<label class="govuk-label govuk-radios__label" for="notification-scope-organisation">
Emails about all vacancies for your organisation
All apprenticeship adverts for your organisation
</label>
</div>
</div>
</fieldset>
</div>
<div class="govuk-form-group">
<p asp-show="@Model.HasAnySubscription" class="govuk-body">
<a asp-route="@RouteNames.ConfirmUnsubscribeNotifications_Get" class="govuk-link">Unsubscribe from all recruitment emails</a>
<a asp-route="@RouteNames.ConfirmUnsubscribeNotifications_Get" class="govuk-link">Unsubscribe from all emails about adverts and applications</a>
</p>
<button class="govuk-button submit" type="submit">Save and continue</button>
<a asp-route="@RouteNames.Dashboard_Get" class="govuk-link das-button-link">Return to dashboard</a>

<div class="govuk-body">
<a asp-route="@RouteNames.Dashboard_Get" class="govuk-link">Return to dashboard</a>
</div>
</div>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
@{
ViewBag.Vpv = "/recruitment/employer/page-notification-unsubscribed-acknowledgement";
ViewBag.Title = "You’ve successfully unsubscribed from all advert and application emails";
}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">
You’ve successfully unsubscribed from recruitment emails
You’ve successfully unsubscribed from all advert and application emails
</h1>
</div>
<p>You’ll no longer get emails when you have updates to your vacancies. You can view updates on your recruitment dashboard.</p>

<div class="govuk-body">
<p>You will not receive emails when there are updates to your adverts or when you have new applications.</p>
<p>You can view updates on your dashboard.</p>
</div>

<a asp-route="@RouteNames.Dashboard_Get" class="govuk-button govuk-!-margin-bottom-6" esfa-automation="create-vacancy">Return to dashboard</a>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
@model Esfa.Recruit.Employer.Web.ViewModels.ManageNotifications.ManageNotificationsAcknowledgementViewModel
@{
ViewBag.Vpv = "/recruitment/employer/page-notifications-updated-acknowledgement";
ViewBag.Title = "You’ve successfully saved your email preferences";
}

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">
You’ve successfully saved your recruitment email preferences
You’ve successfully saved your email preferences
</h1>
</div>

<p asp-show="@Model.IsUserSubmittedVacanciesSelected">We'll send emails to <b>@Model.UserEmail</b> when your submitted vacancies:</p>
<p asp-hide="@Model.IsUserSubmittedVacanciesSelected">We'll send emails to <b>@Model.UserEmail</b> when vacancies:</p>
<div class="govuk-body">

<ul class="govuk-list govuk-list--bullet">
<li asp-show="@Model.IsVacancyRejectedSelected">
are rejected after review
</li>
@*User submitted and only one option selected*@
<p asp-show="(Model.IsUserSubmittedVacanciesSelected && Model.IsVacancyRejectedSelected && !Model.IsApplicationSubmittedSelected)"> We'll email <b>@Model.UserEmail</b> about any adverts you submit. You'll get emails when an advert is rejected after review. </p>
<p asp-show="(Model.IsUserSubmittedVacanciesSelected && !Model.IsVacancyRejectedSelected && Model.IsApplicationSubmittedSelected)"> We'll email <b>@Model.UserEmail</b> about any adverts you submit. You'll get emails when you receive new applications (@Model.Frequency). </p>

<li asp-show="@Model.IsVacancyClosingSoonSelected">
are closing soon
</li>

<li asp-show="@Model.IsApplicationSubmittedSelected">
receive new applications (@Model.Frequency)
</li>
</ul>
@*All organisation and only one option selected*@
<p asp-show="(!Model.IsUserSubmittedVacanciesSelected && Model.IsVacancyRejectedSelected && !Model.IsApplicationSubmittedSelected)"> We'll email <b>@Model.UserEmail</b> about all apprenticeship adverts for your organisation. You'll get emails when an advert is rejected after review. </p>
<p asp-show="(!Model.IsUserSubmittedVacanciesSelected && !Model.IsVacancyRejectedSelected && Model.IsApplicationSubmittedSelected)"> We'll email <b>@Model.UserEmail</b> about all apprenticeship adverts for your organisation. You'll get emails when you receive new applications (@Model.Frequency). </p>

<div asp-show="Model.IsVacancyRejectedSelected && Model.IsApplicationSubmittedSelected">
<p asp-show="Model.IsUserSubmittedVacanciesSelected"> We'll email <b>@Model.UserEmail</b> about any adverts you submit. You'll get emails when: </p>
<p asp-show="!Model.IsUserSubmittedVacanciesSelected"> We'll email <b>@Model.UserEmail</b> about all apprenticeship adverts for your organisation. You'll get emails when: </p>

<ul class="govuk-list govuk-list--bullet">
<li>
an advert is rejected after review
</li>
<li>
you receive new applications (@Model.Frequency)
</li>
</ul>
</div>
</div>

<a asp-route="@RouteNames.Dashboard_Get" class="govuk-button govuk-!-margin-bottom-6" esfa-automation="create-vacancy">Return to dashboard</a>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task GiveAllTheTypesAreUnselectedAndPersistedPreferencesAreEmpty_Th
var result =await sut.UpdateUserNotificationPreferencesAsync(new ManageNotificationsEditModel(), new VacancyUser());
result.Errors.HasErrors.Should().BeTrue();
result.Errors.Errors.Count.Should().Be(1);
result.Errors.Errors.First().ErrorMessage.Should().Be("Choose when you’d like to receive emails");
result.Errors.Errors.First().ErrorMessage.Should().Be("Select when you want to receive emails about your adverts and applications");
}

private ManageNotificationsOrchestrator GetSut()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static class CreateVacancyOptionsConfirmationMessages

public static class UnsubscribeNotificationsConfirmationMessages
{
public const string SelectionRequired = "Please confirm if you’d like to unsubscribe";
public const string SelectionRequired = "Select yes if you want to stop receiving emails about adverts and applications";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public UserNotificationPreferencesValidator()
RuleFor(t => t.NotificationScope)
.NotNull()
.WithErrorCode("1101")
.WithMessage("Choose what emails you’d like to receive");
.WithMessage("Select which adverts you want to receive emails about");
});

When(n => (n.NotificationTypes & NotificationTypes.ApplicationSubmitted) == NotificationTypes.ApplicationSubmitted, () =>
{
RuleFor(s => s.NotificationFrequency)
.NotNull()
.WithErrorCode("1102")
.WithMessage("Choose how often you’d like new application emails");
.WithMessage("Select how often you want to receive emails about new applications");
});
}
}
Expand Down

0 comments on commit fd59615

Please sign in to comment.