Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mployerapprenticeshipsservice into TM-133-Hide_the_option_to_create_a_transfers_pledge_from_levy_receivers_and_non-levy_employers
  • Loading branch information
sscaife committed Sep 14, 2021
2 parents 19160d5 + 4f5cfff commit 8d54d43
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ public void Arrange()
{
new ApprenticeshipStatusSummary
{
ActiveCount = 0,PausedCount = 0,PendingApprovalCount = 0,LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
ActiveCount = 0,
PausedCount = 0,
PendingApprovalCount = 0,
CompletedCount = 0,
LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
}
});

Expand Down Expand Up @@ -229,7 +233,27 @@ public async Task ThenTheAgreementIsCheckedToSeeIfItHasBeenSignedAndHasActiveCom
{
new ApprenticeshipStatusSummary
{
ActiveCount = 1,PausedCount = 1,PendingApprovalCount = 1,LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
ActiveCount = 1,
PausedCount = 1,
PendingApprovalCount = 1,
LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
}
});

Assert.ThrowsAsync<InvalidRequestException>(() => _handler.Handle(_command));
}

[Test]
public async Task ThenTheAgreementIsCheckedToSeeIfItHasBeenSignedAndHasWithdrawnCommitments()
{
_commitmentsApi
.Setup(x => x.GetEmployerAccountSummary(ExpectedAccountId))
.ReturnsAsync(new List<ApprenticeshipStatusSummary>
{
new ApprenticeshipStatusSummary
{
WithdrawnCount = 1,
LegalEntityIdentifier = _expectedAgreement.LegalEntityCode
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<Version>1.0.16</Version>
</PackageReference>
<PackageReference Include="SFA.DAS.MA.Shared.UI">
<Version>1.1.72</Version>
<Version>1.1.75</Version>
</PackageReference>
<PackageReference Include="SFA.DAS.NLog.Logger" Version="1.2.1" />
<PackageReference Include="SFA.DAS.NLog.Targets.Redis" Version="1.2.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
@model OrchestratorResponse<NotificationSettingsViewModel>
@{ViewBag.Title = "Notification Settings"; }
@{ ViewBag.PageId = "notification-settings"; }
@{ViewBag.HideNav = true; }
@using SFA.DAS.EmployerAccounts.Web.Helpers
@model OrchestratorResponse<NotificationSettingsViewModel>

<form method="post">
@{
ViewBag.Title = "Notification Settings";
ViewBag.PageId = "notification-settings";
ViewBag.HideNav = true;
}

<form method="post">
<div class="grid-row">
<div class="column-two-thirds">

<h1 class="heading-xlarge">Notification Settings</h1>
<p>Choose which accounts you want to receive cohort and apprentice updates from.</p>
<p>Changes to these settings won't affect service emails, such as password resets.</p>

@Html.AntiForgeryToken()

<input type="hidden" value="@Model.Data.HashedId" name="HashedId" />

<table>
<thead>
<tr>
Expand All @@ -24,55 +26,46 @@
<th scope="col">No emails</th>
</tr>
</thead>

<tbody>

@for (var i = 0; i < Model.Data.NotificationSettings.Count; i++)
{
var setting = Model.Data.NotificationSettings[i];

<tr>
<td class="notification-row">
@setting.Name
@setting.Name

@Html.Hidden($"NotificationSettings[{i}].HashedAccountId", setting.HashedAccountId)
@Html.Hidden($"NotificationSettings[{i}].Name", setting.Name)
@Html.Hidden($"NotificationSettings[{i}].Id", setting.Id)
</td>

<td class="notification-row">

@{ var trueId = $"NotificationSettings-true-{i}";
@{
var trueId = $"NotificationSettings-true-{i}";
var falseId = $"NotificationSettings-false-{i}";

}
}

<label for="@trueId" class="block-label selection-button-radio" aria-label="Send emails">
@Html.RadioButton($"NotificationSettings[{i}].ReceiveNotifications", true, setting.ReceiveNotifications, new { id = trueId } )
</label>

@Html.RadioButton($"NotificationSettings[{i}].ReceiveNotifications", true, setting.ReceiveNotifications, new { id = trueId })
</label>
</td>

<td class="notification-row">
<label for="@falseId" class="block-label selection-button-radio" aria-label="Stop emails">
@Html.RadioButton($"NotificationSettings[{i}].ReceiveNotifications", false, !setting.ReceiveNotifications, new { id = falseId })
</label>

</td>

</tr>
}

</tbody>
</table>

<button type="submit" class="button">Update</button>


<a href="@Url.Action("Index", "Home")" class="button text-link">Cancel</a>
</table>

<p><button type="submit" class="button">Update</button></p>
<p><a href="@Url.Action("Index", "Home")" class="text-link">Cancel</a></p>
</div>
</div>

</form>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private async Task ValidateLegalEntityHasNoCommitments(EmployerAgreementView agr
&& c.LegalEntityIdentifier.Equals(agreement.LegalEntityCode)
&& c.LegalEntityOrganisationType == agreement.LegalEntitySource);

if (commitment != null && (commitment.ActiveCount + commitment.PausedCount + commitment.PendingApprovalCount) != 0)
if (commitment != null && (commitment.ActiveCount + commitment.PausedCount + commitment.PendingApprovalCount + commitment.WithdrawnCount) != 0)
{
validationResult.AddError(nameof(agreement.HashedAgreementId), "Agreement has already been signed and has active commitments");
throw new InvalidRequestException(validationResult.ValidationDictionary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public HashingRegistry()
.Ctor<IHashingService>()
.Is(c =>
new HashingService.HashingService(
c.GetInstance<EmployerAccountsConfiguration>() .PublicAllowedAccountLegalEntityHashstringCharacters,
c.GetInstance<EmployerAccountsConfiguration>().PublicAllowedAccountLegalEntityHashstringCharacters,
c.GetInstance<EmployerAccountsConfiguration>().PublicAllowedAccountLegalEntityHashstringSalt));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private async Task<bool> SetRemovedStatusBasedOnCommitments(long accountId, Acco

return commitmentConnectedToEntity == null || (commitmentConnectedToEntity.ActiveCount +
commitmentConnectedToEntity.PendingApprovalCount +
commitmentConnectedToEntity.WithdrawnCount +
commitmentConnectedToEntity.PausedCount) == 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<Version>1.0.5</Version>
</PackageReference>
<PackageReference Include="SFA.DAS.MA.Shared.UI">
<Version>1.1.72</Version>
<Version>1.1.75</Version>
</PackageReference>
<PackageReference Include="SFA.DAS.NLog.Logger" Version="1.2.1" />
<PackageReference Include="SFA.DAS.NLog.Targets.Redis" Version="1.2.1" />
Expand Down

0 comments on commit 8d54d43

Please sign in to comment.