Skip to content

Commit

Permalink
Merge pull request #2211 from SkillsFundingAgency/CON-3951---Revamped…
Browse files Browse the repository at this point in the history
…-legal-agreements-page

CON-3951 - Revamped legal agreements page
  • Loading branch information
narendranogothu authored Oct 27, 2021
2 parents e5082e7 + 3f875ca commit 19244b5
Show file tree
Hide file tree
Showing 12 changed files with 226 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async Task ThenTheValuesAreReturnedInTheResponseFromTheRequestForAllOrgan
var actual = await _orchestrator.GetOrganisationAgreements(AccountLegalEntityHashedId);

//Assert
Assert.IsNotNull(actual.Data.Any());
Assert.IsNotNull(actual.Data.Agreements.Any());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public async Task<ActionResult> WhenDoYouWantToView(int? choice, string agreemen
public async Task<ActionResult> ViewAllAgreements(string hashedAccountId, string accountLegalEntityHashedId)
{
var model = await _orchestrator.GetOrganisationAgreements(accountLegalEntityHashedId);
return View(model);
return View(model.Data);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@ public static class ControllerConstants
public const string ApproveOrRejectApprentice = "ApproveOrRejectApprentice";
public const string ViewApprenticeBeforeApprove = "ViewApprenticeBeforeApprove";
public const string ViewAllAgreementActionName = "ViewAllAgreements";
public const string InsetText = "Inset";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -320,30 +320,34 @@ public virtual async Task<OrchestratorResponse<ConfirmOrganisationToRemoveViewMo
return response;
}

public virtual async Task<OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>> GetOrganisationAgreements(string accountLegalEntityHashedId)
public virtual async Task<OrchestratorResponse<OrganisationAgreementsViewModel>> GetOrganisationAgreements(string accountLegalEntityHashedId)
{
var response = new OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>();
var response = new OrchestratorResponse<OrganisationAgreementsViewModel>();

try
{
var result = await _mediator.SendAsync(new GetOrganisationAgreementsRequest
{
AccountLegalEntityHashedId = accountLegalEntityHashedId
});

response.Data = _mapper.Map<ICollection<EmployerAgreementDto>, ICollection<OrganisationAgreementViewModel>>(result.Agreements);

response.Data = new OrganisationAgreementsViewModel
{
AgreementId = accountLegalEntityHashedId,
Agreements = _mapper.Map<ICollection<EmployerAgreementDto>, ICollection<OrganisationAgreementViewModel>>(result.Agreements)
};
}
catch (InvalidRequestException ex)
{
return new OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>
return new OrchestratorResponse<OrganisationAgreementsViewModel>
{
Status = HttpStatusCode.BadRequest,
Exception = ex
};
}
catch (UnauthorizedAccessException)
{
return new OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>
return new OrchestratorResponse<OrganisationAgreementsViewModel>
{
Status = HttpStatusCode.Unauthorized
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
<Compile Include="Models\AccountContext.cs" />
<Compile Include="Models\ReturnUrlModel.cs" />
<Compile Include="Models\HashedAccountIdModel.cs" />
<Compile Include="ViewModels\OrganisationAgreementsViewModel.cs" />
<Compile Include="ViewModels\TermsAndConditionsNewViewModel.cs" />
<Compile Include="ViewModels\TriageViewModel.cs" />
<Compile Include="OrchestratorResponse.cs" />
Expand Down Expand Up @@ -864,8 +865,6 @@
<Content Include="Views\EmployerTeam\SingleApprenticeshipReadyForReview.cshtml" />
<Content Include="Views\EmployerTeam\SingleApprenticeshipContinueWithProvider.cshtml" />
<Content Include="Views\EmployerAgreement\ViewAllAgreements.cshtml" />
<Content Include="Views\Shared\_AcceptedAgreement.cshtml" />
<Content Include="Views\Shared\_NotAcceptedAgreement.cshtml" />
<Content Include="Views\EmployerAgreement\CannotRemoveOrganisation.cshtml" />
<Content Include="Views\EmployerTeam\Empty.cshtml" />
<Content Include="Views\EmployerAgreement\AcceptedEmployerAgreement.cshtml" />
Expand All @@ -875,6 +874,8 @@
<Content Include="Views\Shared\_Agreement_v6.cshtml" />
<Content Include="Views\SearchOrganisation\ConfirmOrganisationDetails.cshtml" />
<Content Include="Views\Home\TermsAndConditions.cshtml" />
<Content Include="Views\EmployerAgreement\_AwaitingAcceptance.cshtml" />
<Content Include="Views\EmployerAgreement\_AcceptedAgreement.cshtml" />
<Content Include="Views\Home\TermsAndConditionsOverview.cshtml" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ public class OrganisationAgreementViewModel

public string AccountLegalEntityPublicHashedId => AccountLegalEntity.PublicHashedId;
public string SignedDateText => SignedDate.HasValue ? SignedDate.Value.ToString("dd MMMM yyyy") : "";

public string GetAgreementTabListId => $"#v{Template.VersionNumber}-agreement";
public string GetAgreementTabPanelId => $"v{Template.VersionNumber}-agreement";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace SFA.DAS.EmployerAccounts.Web.ViewModels
{
public class OrganisationAgreementsViewModel
{
public OrganisationAgreementsViewModel()
{
Agreements = new Collection<OrganisationAgreementViewModel>();
}

public ICollection<OrganisationAgreementViewModel> Agreements { get; set; }

public string AgreementId { get; set; }

public bool HasSignedAgreements => Agreements.Any(agreement => agreement.SignedDate != null);
public bool HasUnsignedAgreement => Agreements.Any(agreement => agreement.SignedDate == null);

public OrganisationAgreementViewModel UnsignedAgreement => Agreements.Single(agreement => agreement.SignedDate == null);

public IEnumerable<OrganisationAgreementViewModel> SignedAgreements => Agreements.Where(agreement => agreement.SignedDate != null);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@using SFA.DAS.EmployerAccounts.Web.Extensions
@model OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>
@using SFA.DAS.EmployerAccounts.Web.Helpers
@model OrganisationAgreementsViewModel

@{
Layout = "~/Views/Shared/_Layout_CDN.cshtml";
Expand All @@ -8,109 +9,38 @@
ViewBag.Section = "organisations";
ViewBag.ZenDeskLabel = "eas-your-esfa-agreement";
ViewBag.GaData.Vpv = "/accounts/agreements/view-your-agreement/agreement-details";
var tabsCount = 0;
}

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

<h1 class="govuk-heading-xl">
Your agreements with the Education and Skills Funding Agency (<abbr>ESFA</abbr>)
</h1>

<h1 class="govuk-heading-xl">Your agreements with the Education and Skills Funding Agency (<abbr>ESFA</abbr>)</h1>
<h3 class="govuk-heading-l">Agreement ID: @Model.AgreementId</h3>
</div>
</div>

<div class="govuk-grid-row">

<div class="govuk-grid-column-full">

<div class="govuk-tabs" data-module="govuk-tabs">

<h2 class="govuk-tabs__title">
By published dates
</h2>
<hr class="govuk-!-margin-top-6 govuk-!-margin-bottom-6">

<ul class="govuk-tabs__list">
@if (Model.HasUnsignedAgreement)
{
@Html.Partial("_AwaitingAcceptance", Model.UnsignedAgreement, new ViewDataDictionary {{ ControllerConstants.InsetText, Model.UnsignedAgreement.Template.InsetText(Model.Agreements)}})
}

@foreach (var item in Model.Data)
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h3 class="govuk-heading-m">Accepted agreements</h3>
@if (Model.HasSignedAgreements)
{
<div class="govuk-accordion" data-module="govuk-accordion" id="accordion-default">
@foreach (var agreement in Model.SignedAgreements)
{
tabsCount++;
<li class="govuk-tabs__list-item@(tabsCount == 1 ? "" : " govuk-tabs__list-item--selected")">
<a class="govuk-tabs__tab" href="@item.GetAgreementTabListId">
@item.Template.PublishedInfo
</a>
</li>
@Html.Partial("_AcceptedAgreement", agreement, new ViewDataDictionary{{ControllerConstants.InsetText, agreement.Template.InsetText(Model.Agreements) } })
}
</ul>
@foreach (var item in Model.Data)
{
<div class="govuk-tabs__panel" id="@item.GetAgreementTabPanelId">

@if (item.SignedDate != null)
{
ViewBag.SelectedTab = @item.Template.VersionNumber;

<strong class="govuk-tag govuk-tag--green govuk-!-margin-bottom-4">
Accepted on @item.SignedDateText
</strong>

ViewBag.BreadCrumbsTrail = @item.AccountLegalEntity.Name;

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

<h3 class="govuk-heading-l govuk-!-margin-bottom-0">
Agreement between @item.AccountLegalEntity.Name and <abbr>ESFA</abbr>
</h3>

<span class="govuk-caption-m govuk-!-margin-bottom-6">@item.Template.PublishedInfo</span>

@if (@item.Template.InsetText(Model.Data) != string.Empty)
{
<div class="govuk-inset-text">
@item.Template.InsetText(Model.Data)
</div>
}

</div>
</div>

@Html.Partial("_AcceptedAgreement", item)
}
else
{
<strong class="govuk-tag govuk-tag--red govuk-!-margin-bottom-4">
NOT ACCEPTED YET
</strong>

ViewBag.BreadCrumbsTrail = @item.AccountLegalEntity.Name;

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

<h3 class="govuk-heading-l">
Agreement between @item.AccountLegalEntity.Name and <abbr>ESFA</abbr>
</h3>

<span class="govuk-caption-m govuk-!-margin-bottom-6">@item.Template.PublishedInfo</span>

@if (@item.Template.InsetText(Model.Data) != string.Empty)
{
<div class="govuk-inset-text">
@item.Template.InsetText(Model.Data)
</div>
}

</div>
</div>

@Html.Partial("_NotAcceptedAgreement", item)
}
</div>
}

</div>
</div>
}
else
{
<h3 class="govuk-heading-s govuk-!-margin-bottom-9">You have no accepted agreements</h3>
}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
@using SFA.DAS.EmployerAccounts.Web.Helpers
@model SFA.DAS.EmployerAccounts.Web.ViewModels.OrganisationAgreementViewModel

<div class="govuk-accordion__section ">
<div class="govuk-accordion__section-header">
<h2 class="govuk-accordion__section-heading">
<span class="govuk-accordion__section-button" id="[email protected]">
@Model.Template.PublishedInfo
</span>
</h2>
<strong class="govuk-tag govuk-tag--green govuk-!-margin-top-3">
Accepted on @Model.SignedDateText
</strong>
</div>
<div id="[email protected]" class="govuk-accordion__section-content" aria-labelledby="[email protected]">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-m">
@Model.Template.PublishedInfo
</span>
<h3 class="govuk-heading-m">
Agreement between @Model.AccountLegalEntity.Name and <abbr>ESFA</abbr>
</h3>
<div class="govuk-inset-text">
@ViewData[ControllerConstants.InsetText]
</div>
<span class="govuk-caption-m">
This agreement allows you to spend funds for <b>@Model.AccountLegalEntity.Name</b>.
</span>
<hr class=" govuk-!-margin-top-9 govuk-!-margin-bottom-9">
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-third">
<p class="govuk-body">
<b>Parties</b>
</p>
</div>
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body">
<i>
<b>The Secretary of State for Education acting through the Education and Skills Funding Agency an executive agency of the Department for Education</b><br>
Cheylesmore House<br>
Quinton Road<br>
Coventry<br>
CV1 2WT
</i>
</p>
@if (Model.OrganisationLookupPossible)
{
<i>
<p class="govuk-body">
<b>BARBERRY COVENTRY LIMITED</b><br>
@Html.CommaSeperatedAddressToHtml(@Model.AccountLegalEntity.Address)

</p>
</i>
<p>
<i>
<a href="@Url.Action("review", "organisation", new
{
Model.HashedAccountId,
Model.HashedAgreementId,
Model.AccountLegalEntityPublicHashedId
})" class="govuk-link govuk-link--no-visited-state govuk-!-font-size-19">Update these details</a>
</i>
</p>
}
</div>
</div>
<div class="govuk-grid-row govuk-!-margin-top-9 govuk-!-margin-bottom-9">
<div class="govuk-grid-column-one-third">
<p class="govuk-body">
<b>Document</b>
</p>
</div>
<div class="govuk-grid-column-two-thirds">
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-third">
<a href="@Url.EmployerAccountsAction($"agreements/{Model.HashedAgreementId}/view")" aria-hidden="true">
<img src="/dist/images/pub-cover-html.png" alt=".">
</a>
</div>
<div class="govuk-grid-column-two-thirds">
<a href="@Url.EmployerAccountsAction($"agreements/{Model.HashedAgreementId}/view")" class="govuk-link">Your <abbr>ESFA</abbr> agreement</a>
<p class="govuk-body">HTML</p>
<p></p>
</div>
</div>
</div>
</div>
<hr class=" govuk-!-margin-top-9 govuk-!-margin-bottom-9">
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h3 class="govuk-heading-m">
This agreement has been accepted
</h3>
<table class="govuk-table">
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th scope="col" class="govuk-table__header">Accepted by:</th>
<td class="govuk-table__cell">@Model.SignedByName</td>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">On behalf of:</th>
<td class="govuk-table__cell">@Model.AccountLegalEntity.Name</td>
</tr>
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">Address: </th>
<td class="govuk-table__cell">@Model.AccountLegalEntity.Address</td>
</tr>
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">Accepted on:</th>
<td class="govuk-table__cell">@Model.SignedDateText</td>
</tr>
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header">Agreement ID:</th>
<td class="govuk-table__cell">@Model.AccountLegalEntityPublicHashedId</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Loading

0 comments on commit 19244b5

Please sign in to comment.