diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingMessage.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingMessage.cs index 3befe9e8e..22ab8c779 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingMessage.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingMessage.cs @@ -3,6 +3,8 @@ using System.Threading.Tasks; using AutoFixture; using AutoFixture.NUnit3; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; @@ -33,12 +35,27 @@ public void Arrange() [Test, AutoData] public async Task GetMessage_ValidModel_ShouldReturnMessageViewModelWithMappedValues(MessageRequest request) { + _fixture.WithLegalEntityNameStoredInTempData(); + var result = await _fixture.Sut.Message(request); var model = result.VerifyReturnsViewModel().WithModel(); _fixture.VerifyViewModelIsMappedCorrectly(model); } + [Test, AutoData] + public async Task GetMessage_ValidModel_ForProvider_ShouldPopulateLegalEntityNameFromTempData( + [Frozen] MessageRequest request) + { + request.LegalEntityName = null; + _fixture.WithLegalEntityNameStoredInTempData(); + + var result = await _fixture.Sut.Message(request); + + var model = result.VerifyReturnsViewModel().WithModel(); + _fixture.VerifyLegalEntityNamePopulatedFromTempData(model); + } + [Test, AutoData] public async Task PostMessage_WithValidRequest_ShouldAddCohortAndReturnRedirectResult(MessageViewModel model, CreateCohortResponse createCohortResponse) { @@ -80,7 +97,8 @@ public CreateCohortWithOtherPartyControllerTestFixture() MapperResult = new CreateCohortWithOtherPartyRequest(); ModelMapperMock = new Mock(); - ModelMapperMock.Setup(x => x.Map(It.IsAny())) + ModelMapperMock + .Setup(x => x.Map(It.IsAny())) .ReturnsAsync(() => MapperResult); MessageViewModel = autoFixture.Create(); @@ -108,6 +126,14 @@ public CreateCohortWithOtherPartyControllerTestFixture WithInvalidModel() return this; } + public CreateCohortWithOtherPartyControllerTestFixture WithLegalEntityNameStoredInTempData() + { + var tempData = new TempDataDictionary(new DefaultHttpContext(), Mock.Of()); + tempData[nameof(MessageRequest.LegalEntityName)] = MessageViewModel.LegalEntityName; + Sut.TempData = tempData; + return this; + } + public CreateCohortWithOtherPartyControllerTestFixture SetCreateCohortResponse( CreateCohortResponse createCohortResponse) { @@ -159,6 +185,12 @@ public CreateCohortWithOtherPartyControllerTestFixture VerifyViewModelIsMappedCo return this; } + + public CreateCohortWithOtherPartyControllerTestFixture VerifyLegalEntityNamePopulatedFromTempData(MessageViewModel model) + { + Assert.AreEqual(MessageViewModel.LegalEntityName, model.LegalEntityName); + return this; + } } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingPostAssign.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingPostAssign.cs index bd89efa46..38a05dd7c 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingPostAssign.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Controllers/CohortControllerTests/WhenCallingPostAssign.cs @@ -1,6 +1,10 @@ -using AutoFixture.NUnit3; +using System.Collections.Generic; +using System.ComponentModel.Design; +using AutoFixture.NUnit3; using FluentAssertions; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Routing; using Moq; using NUnit.Framework; @@ -64,6 +68,32 @@ public void And_Provider_Adding_Apprentices_Then_Redirect_To_Message( result.RouteValues.Should().BeEquivalentTo(expectedRouteValues); } + [Test, MoqAutoData] + public void And_Provider_Adding_Apprentices_Then_Legal_Entity_Name_Stored_In_TempData( + [Frozen] AssignViewModel viewModel, + [Frozen] Mock tempDataProvider, + [Frozen] CohortController controller) + { + var tempdata = new TempDataDictionary(new DefaultHttpContext(), tempDataProvider.Object); + controller.TempData = tempdata; + var expectedRouteValues = new RouteValueDictionary(new + { + viewModel.AccountHashedId, + viewModel.AccountLegalEntityHashedId, + viewModel.ReservationId, + viewModel.StartMonthYear, + viewModel.CourseCode, + viewModel.ProviderId, + viewModel.TransferSenderId, + Origin = viewModel.ReservationId.HasValue ? Origin.Reservations : Origin.Apprentices + }); + viewModel.WhoIsAddingApprentices = WhoIsAddingApprentices.Provider; + + var result = controller.Assign(viewModel) as RedirectToActionResult; + + Assert.True(controller.TempData.Contains(new KeyValuePair(nameof(viewModel.LegalEntityName), viewModel.LegalEntityName))); + } + [Test, MoqAutoData] public void And_Unknown_Adding_Apprentices_Then_Redirect_To_Error( AssignViewModel viewModel, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ApprenticeViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ApprenticeViewModelMapperTests.cs index e7e4323bc..4828e9369 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ApprenticeViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ApprenticeViewModelMapperTests.cs @@ -65,6 +65,12 @@ public void AccountLegalEntityHashedIdIsMappedCorrectly() Assert.AreEqual(_source.AccountLegalEntityHashedId, _result.AccountLegalEntityHashedId); } + [Test] + public void AccountLegalEntityNameIsMappedCorrectly() + { + Assert.AreEqual(_accountLegalEntityResponse.LegalEntityName, _result.LegalEntityName); + } + [Test] public void StartDateIsMappedCorrectly() { diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ConfirmDeleteViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ConfirmDeleteViewModelMapperTests.cs index f2e4225a4..5bd7b54da 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ConfirmDeleteViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/ConfirmDeleteViewModelMapperTests.cs @@ -43,6 +43,14 @@ public async Task ProviderNameIsMappedCorrectly() Assert.AreEqual(fixture.Cohort.ProviderName, result.ProviderName); } + [Test] + public async Task LegalEntityNameIsMappedCorrectly() + { + var fixture = new ConfirmDeleteViewModelMapperTestsFixture(); + var result = await fixture.Map(); + Assert.AreEqual(fixture.Cohort.LegalEntityName, result.LegalEntityName); + } + [Test] public async Task DraftApprenticeshipTotalCountIsReportedCorrectly() { diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/MessageViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/MessageViewModelMapperTests.cs index 13c2092e2..829bf5b15 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/MessageViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/MessageViewModelMapperTests.cs @@ -62,6 +62,11 @@ public void ThenAccountLegalEntityHashedIdIsMapperCorrectly() Assert.AreEqual(_source.AccountLegalEntityHashedId, _result.AccountLegalEntityHashedId); } [Test] + public void ThenLegalEntityNameIsMappedCorrectly() + { + Assert.AreEqual(_source.LegalEntityName, _source.LegalEntityName); + } + [Test] public void ThenCourseCodeIsMapperCorrectly() { Assert.AreEqual(_source.CourseCode, _result.CourseCode); diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingAssignRequestToViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingAssignRequestToViewModel.cs index 779ce7140..610eb7ceb 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingAssignRequestToViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingAssignRequestToViewModel.cs @@ -1,15 +1,19 @@ using System.Threading.Tasks; using AutoFixture.NUnit3; using FluentAssertions; +using Moq; using NUnit.Framework; +using SFA.DAS.CommitmentsV2.Api.Client; +using SFA.DAS.CommitmentsV2.Api.Types.Responses; using SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Cohort; using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort; +using SFA.DAS.Testing.AutoFixture; namespace SFA.DAS.EmployerCommitmentsV2.Web.UnitTests.Mappers.Cohort { public class WhenMappingAssignRequestToViewModel { - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_AccountHashedId( AssignRequest request, AssignViewModelMapper mapper) @@ -19,7 +23,7 @@ public async Task Then_Maps_AccountHashedId( viewModel.AccountHashedId.Should().Be(request.AccountHashedId); } - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_EmployerAccountLegalEntityPublicHashedId( AssignRequest request, AssignViewModelMapper mapper) @@ -29,7 +33,23 @@ public async Task Then_Maps_EmployerAccountLegalEntityPublicHashedId( viewModel.AccountLegalEntityHashedId.Should().Be(request.AccountLegalEntityHashedId); } - [Test, AutoData] + [Test, MoqAutoData] + public async Task Then_Maps_LegalEntityName( + [Frozen] AssignRequest request, + [Frozen] AccountLegalEntityResponse response, + [Frozen] Mock commitmentsApiClientMock, + AssignViewModelMapper mapper) + { + commitmentsApiClientMock + .Setup(x => x.GetAccountLegalEntity(request.AccountLegalEntityId, default)) + .ReturnsAsync(response); + + var viewModel = await mapper.Map(request); + + viewModel.LegalEntityName.Should().Be(response.LegalEntityName); + } + + [Test, MoqAutoData] public async Task Then_Maps_ReservationId( AssignRequest request, AssignViewModelMapper mapper) @@ -39,7 +59,7 @@ public async Task Then_Maps_ReservationId( viewModel.ReservationId.Should().Be(request.ReservationId); } - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_StartMonthYear( AssignRequest request, AssignViewModelMapper mapper) @@ -49,7 +69,7 @@ public async Task Then_Maps_StartMonthYear( viewModel.StartMonthYear.Should().Be(request.StartMonthYear); } - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_CourseCode( AssignRequest request, AssignViewModelMapper mapper) @@ -59,7 +79,7 @@ public async Task Then_Maps_CourseCode( viewModel.CourseCode.Should().Be(request.CourseCode); } - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_UkPrn( AssignRequest request, AssignViewModelMapper mapper) @@ -69,7 +89,7 @@ public async Task Then_Maps_UkPrn( viewModel.ProviderId.Should().Be(request.ProviderId); } - [Test, AutoData] + [Test, MoqAutoData] public async Task Then_Maps_TransferSenderId( AssignRequest request, AssignViewModelMapper mapper) diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequest.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequest.cs index 58f5236c9..ca0ce0014 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequest.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequest.cs @@ -61,6 +61,19 @@ public async Task ThenMapsEmployerAccountLegalEntityPublicHashedId( Assert.AreEqual(viewModel.AccountLegalEntityHashedId, result.AccountLegalEntityHashedId); } + [Test, MoqAutoData] + public async Task ThenMapsLegalEntityName( + SelectProviderViewModel viewModel, + long providerId, + ConfirmProviderRequestMapper mapper) + { + viewModel.ProviderId = providerId.ToString(); + + var result = await mapper.Map(viewModel); + + Assert.AreEqual(viewModel.LegalEntityName, result.LegalEntityName); + } + [Test, MoqAutoData] public async Task ThenMapsStartMonthYear( SelectProviderViewModel viewModel, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequestToViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequestToViewModel.cs index cc6bbea91..029a0b9c9 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequestToViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingConfirmProviderRequestToViewModel.cs @@ -36,6 +36,17 @@ public async Task Then_Maps_EmployerAccountLegalEntityPublicHashedId( viewModel.AccountLegalEntityHashedId.Should().Be(request.AccountLegalEntityHashedId); } + [Test, MoqAutoData] + public async Task Then_Maps_LegalEntityName( + ConfirmProviderRequest request, + [Frozen] Mock commitmentsApiClient, + ConfirmProviderViewModelMapper mapper) + { + var viewModel = await mapper.Map(request); + + viewModel.LegalEntityName.Should().Be(request.LegalEntityName); + } + [Test, MoqAutoData] public async Task Then_Maps_ReservationId( ConfirmProviderRequest request, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingSelectProviderRequestToViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingSelectProviderRequestToViewModel.cs index 94b96f224..213157165 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingSelectProviderRequestToViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/Cohort/WhenMappingSelectProviderRequestToViewModel.cs @@ -1,86 +1,101 @@ -using System.Threading.Tasks; -using AutoFixture.NUnit3; +using AutoFixture; +using Moq; using NUnit.Framework; +using SFA.DAS.CommitmentsV2.Api.Client; +using SFA.DAS.CommitmentsV2.Api.Types.Responses; using SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Cohort; using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort; using SFA.DAS.Testing.AutoFixture; +using System.Threading; +using System.Threading.Tasks; namespace SFA.DAS.EmployerCommitmentsV2.Web.UnitTests.Mappers.Cohort { [TestFixture] public class WhenMappingSelectProviderRequestToViewModel { + private SelectProviderRequest _request; + private Mock _commitmentsApiClientMock; + private AccountLegalEntityResponse _commitmentsApiClientResponse; + private SelectProviderViewModelMapper _mapper; - [Test, AutoData] - public async Task ThenMapsReservationId( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [SetUp] + public void Setup() { - var result = await mapper.Map(request); + var autoFixture = new Fixture(); + _request = autoFixture.Create(); + _commitmentsApiClientResponse = autoFixture.Create(); - Assert.AreEqual(request.ReservationId, result.ReservationId); + _commitmentsApiClientMock = new Mock(); + _commitmentsApiClientMock + .Setup(x => x.GetAccountLegalEntity(_request.AccountLegalEntityId, CancellationToken.None)) + .ReturnsAsync(_commitmentsApiClientResponse); + + _mapper = new SelectProviderViewModelMapper(_commitmentsApiClientMock.Object); } - [Test, MoqAutoData] - public async Task ThenMapsAccountHashedId( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsReservationId() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.AccountHashedId, result.AccountHashedId); + Assert.AreEqual(_request.ReservationId, result.ReservationId); } - [Test, MoqAutoData] - public async Task ThenMapsCourseCode( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsAccountHashedId() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.CourseCode, result.CourseCode); + Assert.AreEqual(_request.AccountHashedId, result.AccountHashedId); } - [Test, MoqAutoData] - public async Task ThenMapsStartMonthYear( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsLegalEntityName() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.StartMonthYear, result.StartMonthYear); + Assert.AreEqual(_commitmentsApiClientResponse.LegalEntityName, result.LegalEntityName); } - [Test, MoqAutoData] - public async Task ThenMapsEmployerAccountLegalEntityPublicHashedId( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsCourseCode() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.AccountLegalEntityHashedId, result.AccountLegalEntityHashedId); + Assert.AreEqual(_request.CourseCode, result.CourseCode); } + [Test] + public async Task ThenMapsStartMonthYear() + { + var result = await _mapper.Map(_request); + + Assert.AreEqual(_request.StartMonthYear, result.StartMonthYear); + } - [Test, MoqAutoData] - public async Task ThenMapsTransferSenderId( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsEmployerAccountLegalEntityPublicHashedId() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.TransferSenderId, result.TransferSenderId); + Assert.AreEqual(_request.AccountLegalEntityHashedId, result.AccountLegalEntityHashedId); } + [Test] + public async Task ThenMapsTransferSenderId() + { + var result = await _mapper.Map(_request); + + Assert.AreEqual(_request.TransferSenderId, result.TransferSenderId); + } - [Test, MoqAutoData] - public async Task ThenMapsOrigin( - SelectProviderRequest request, - SelectProviderViewModelMapper mapper) + [Test] + public async Task ThenMapsOrigin() { - var result = await mapper.Map(request); + var result = await _mapper.Map(_request); - Assert.AreEqual(request.ReservationId.HasValue ? Origin.Reservations : Origin.Apprentices, result.Origin); + Assert.AreEqual(_request.ReservationId.HasValue ? Origin.Reservations : Origin.Apprentices, result.Origin); } } -} +} \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapperTests.cs index 0bd5947a8..e6364eca6 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapperTests.cs @@ -123,6 +123,12 @@ public void ProviderNameIsMappedCorrectly() Assert.AreEqual(_cohort.ProviderName, _result.ProviderName); } + [Test] + public void LegalEntityNameIsMappedCorrectly() + { + Assert.AreEqual(_cohort.LegalEntityName, _result.LegalEntityName); + } + [TestCase(123, true)] [TestCase(null, false)] public async Task CoursesAreMappedCorrectlyWithLevy(long? transferSenderId, bool fundedByTransfer) diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapperTests.cs index 8e975e6b8..2fe76c6e1 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapperTests.cs @@ -91,6 +91,7 @@ public async Task ThenMapsRequestValuesToViewModel() Assert.AreEqual(f.DeleteApprenticeshipRequest.AccountHashedId, result.AccountHashedId); Assert.AreEqual(f.DeleteApprenticeshipRequest.Origin, result.Origin); Assert.AreEqual(f.DeleteApprenticeshipRequest.CohortReference, result.CohortReference); + Assert.AreEqual(f.GetCohortResponse.LegalEntityName, result.LegalEntityName); Assert.IsTrue(result.IsLastApprenticeshipInCohort); } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapperTests.cs index 989383c15..922e40b29 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapperTests.cs @@ -163,6 +163,12 @@ public void ProviderNameIsMappedCorrectly() Assert.AreEqual(_cohort.ProviderName, _result.ProviderName); } + [Test] + public void LegalEntityNameIsMappedCorrectly() + { + Assert.AreEqual(_source.Cohort.LegalEntityName, _result.LegalEntityName); + } + [TestCase(123, true)] [TestCase(null, false)] public async Task CoursesAreMappedCorrectlyWhenAccountIsLevy(long? transferSenderId, bool fundedByTransfer) diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapperTests.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapperTests.cs index ef6a010ca..60f9aa6ff 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapperTests.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web.UnitTests/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapperTests.cs @@ -104,6 +104,12 @@ public void ThenReferenceIsMappedCorrectly() Assert.AreEqual(_draftApprenticeship.Reference, _result.Reference); } + [Test] + public void ThenLegalEntityNameIsMappedCorrectly() + { + Assert.AreEqual(_request.Cohort.LegalEntityName, _result.LegalEntityName); + } + [Test] public void ThenTrainingCourseIsMappedCorrectly() { diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Controllers/CohortController.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Controllers/CohortController.cs index 172f389d3..6e39ecdf6 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Controllers/CohortController.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Controllers/CohortController.cs @@ -236,6 +236,7 @@ public IActionResult Assign(AssignViewModel model) case WhoIsAddingApprentices.Employer: return RedirectToAction("Apprentice", "Cohort", routeValues); case WhoIsAddingApprentices.Provider: + TempData[nameof(model.LegalEntityName)] = model.LegalEntityName; return RedirectToAction("Message", routeValues); default: return RedirectToAction("Error", "Error"); @@ -263,6 +264,7 @@ public async Task Apprentice(ApprenticeViewModel model) [Route("add/message")] public async Task Message(MessageRequest request) { + request.LegalEntityName = TempData[nameof(request.LegalEntityName)] as string; var model = await _modelMapper.Map(request); return View(model); } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ApprenticeViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ApprenticeViewModelMapper.cs index e8ed30e15..a0e5288b5 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ApprenticeViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ApprenticeViewModelMapper.cs @@ -35,6 +35,7 @@ public async Task Map(ApprenticeRequest source) AccountHashedId = source.AccountHashedId, AccountLegalEntityId = source.AccountLegalEntityId, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, + LegalEntityName = ale.LegalEntityName, StartDate = new MonthYearModel(source.StartMonthYear), ReservationId = source.ReservationId, CourseCode = source.CourseCode, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/AssignViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/AssignViewModelMapper.cs index 172156b5f..599fdb1a5 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/AssignViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/AssignViewModelMapper.cs @@ -1,23 +1,34 @@ -using System.Threading.Tasks; +using SFA.DAS.CommitmentsV2.Api.Client; using SFA.DAS.CommitmentsV2.Shared.Interfaces; using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort; +using System.Threading.Tasks; namespace SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Cohort { public class AssignViewModelMapper : IMapper { - public Task Map(AssignRequest request) + private readonly ICommitmentsApiClient _commitmentsApiClient; + + public AssignViewModelMapper(ICommitmentsApiClient commitmentsApiClient) { - return Task.FromResult(new AssignViewModel + _commitmentsApiClient = commitmentsApiClient; + } + + public async Task Map(AssignRequest request) + { + var accountLegalEntity = await _commitmentsApiClient.GetAccountLegalEntity(request.AccountLegalEntityId); + + return new AssignViewModel { AccountHashedId = request.AccountHashedId, AccountLegalEntityHashedId = request.AccountLegalEntityHashedId, + LegalEntityName = accountLegalEntity.LegalEntityName, ReservationId = request.ReservationId, StartMonthYear = request.StartMonthYear, CourseCode = request.CourseCode, ProviderId = request.ProviderId, TransferSenderId = request.TransferSenderId - }); + }; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmDeleteViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmDeleteViewModelMapper.cs index 9d8d8339d..3ed54b8e5 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmDeleteViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmDeleteViewModelMapper.cs @@ -32,6 +32,7 @@ public async Task Map(DetailsRequest source) AccountHashedId = source.AccountHashedId, CohortReference = source.CohortReference, ProviderName = cohort.ProviderName, + LegalEntityName = cohort.LegalEntityName, Courses = GroupCourses(draftApprenticeships) }; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderRequestMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderRequestMapper.cs index 6f90bfd43..4ef12af48 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderRequestMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderRequestMapper.cs @@ -13,6 +13,7 @@ public Task Map(SelectProviderViewModel source) AccountHashedId = source.AccountHashedId, CourseCode = source.CourseCode, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, + LegalEntityName = source.LegalEntityName, ProviderId = long.Parse(source.ProviderId), ReservationId = source.ReservationId, StartMonthYear = source.StartMonthYear, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderViewModelMapper.cs index 6887b27c9..1ba896182 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/ConfirmProviderViewModelMapper.cs @@ -22,6 +22,7 @@ public async Task Map(ConfirmProviderRequest source) { AccountHashedId = source.AccountHashedId, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, + LegalEntityName = source.LegalEntityName, ReservationId = source.ReservationId, StartMonthYear = source.StartMonthYear, CourseCode = source.CourseCode, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/MessageViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/MessageViewModelMapper.cs index caed30df5..f41831115 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/MessageViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/MessageViewModelMapper.cs @@ -22,6 +22,7 @@ public async Task Map(MessageRequest source) { AccountHashedId = source.AccountHashedId, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, + LegalEntityName = source.LegalEntityName, ProviderId = source.ProviderId, StartMonthYear = source.StartMonthYear, CourseCode = source.CourseCode, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/SelectProviderViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/SelectProviderViewModelMapper.cs index 1d529766f..d9318f6f4 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/SelectProviderViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Cohort/SelectProviderViewModelMapper.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using SFA.DAS.CommitmentsV2.Api.Client; using SFA.DAS.CommitmentsV2.Shared.Interfaces; using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort; @@ -6,20 +7,29 @@ namespace SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Cohort { public class SelectProviderViewModelMapper : IMapper { - public Task Map(SelectProviderRequest source) + private readonly ICommitmentsApiClient _commitmentsApiClient; + + public SelectProviderViewModelMapper(ICommitmentsApiClient commitmentsApiClient) { - var result = new SelectProviderViewModel + _commitmentsApiClient = commitmentsApiClient; + } + + public async Task Map(SelectProviderRequest source) + { + var accountLegalEntity = await _commitmentsApiClient.GetAccountLegalEntity(source.AccountLegalEntityId); + + return new SelectProviderViewModel { AccountHashedId = source.AccountHashedId, CourseCode = source.CourseCode, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, + LegalEntityName = accountLegalEntity.LegalEntityName, StartMonthYear = source.StartMonthYear, ReservationId = source.ReservationId, TransferSenderId = source.TransferSenderId, Origin = source.ReservationId.HasValue ? Origin.Reservations : Origin.Apprentices }; - return Task.FromResult(result); } } } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapper.cs index f01a9eb6b..434e5d45c 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/AddDraftApprenticeshipViewModelMapper.cs @@ -39,6 +39,7 @@ public async Task Map(AddDraftApprenticeshipReq CohortId = source.CohortId, AccountLegalEntityHashedId = source.AccountLegalEntityHashedId, AccountLegalEntityId = source.AccountLegalEntityId, + LegalEntityName = cohort.LegalEntityName, ReservationId = source.ReservationId, StartDate = new MonthYearModel(source.StartMonthYear), CourseCode = source.CourseCode, diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapper.cs index f7a4efd70..2328b3402 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/DeleteDraftApprenticeshipViewModelMapper.cs @@ -45,7 +45,8 @@ public async Task Map(DeleteApprenticeshipRe AccountHashedId = source.AccountHashedId, DraftApprenticeshipHashedId = source.DraftApprenticeshipHashedId, CohortReference = source.CohortReference, - Origin = source.Origin + Origin = source.Origin, + LegalEntityName = cohort.LegalEntityName }; } } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapper.cs index 7f62e2785..143e90a47 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/EditDraftApprenticeshipViewModelMapper.cs @@ -45,6 +45,7 @@ public async Task Map(EditDraftApprenticeshipRequ Reference = draftApprenticeship.Reference, AccountHashedId = source.Request.AccountHashedId, ProviderName = cohort.ProviderName, + LegalEntityName = source.Cohort.LegalEntityName, IsContinuation = draftApprenticeship.IsContinuation, Courses = (cohort.IsFundedByTransfer || cohort.LevyStatus == ApprenticeshipEmployerType.NonLevy) && !draftApprenticeship.IsContinuation ? await _trainingProgrammeApiClient.GetStandardTrainingProgrammes() diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapper.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapper.cs index ac4b884e5..3442e7409 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapper.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/DraftApprenticeship/ViewDraftApprenticeshipViewModelMapper.cs @@ -36,7 +36,8 @@ public async Task Map(ViewDraftApprenticeshipRequ Cost = draftApprenticeship.Cost, StartDate = draftApprenticeship.StartDate, EndDate = draftApprenticeship.EndDate, - Reference = draftApprenticeship.Reference + Reference = draftApprenticeship.Reference, + LegalEntityName = source.Cohort.LegalEntityName }; return await Task.FromResult(result); diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeRequest.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeRequest.cs index 3f19ddbf4..0c0b2700c 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeRequest.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeRequest.cs @@ -2,10 +2,9 @@ namespace SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort { - public class ApprenticeRequest : AssignRequest, IAuthorizationContextModel + public class ApprenticeRequest : AssignRequest { public long AccountId { get; set; } - public long AccountLegalEntityId { get; set; } public bool AutoCreated { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeViewModel.cs index 46b965722..ea02fb328 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ApprenticeViewModel.cs @@ -10,6 +10,7 @@ public class ApprenticeViewModel : DraftApprenticeshipViewModel, IAuthorizationC public long AccountLegalEntityId { get; set; } public string AccountLegalEntityHashedId { get; set; } + public string LegalEntityName { get; set; } public string TransferSenderId { get; set; } public long? DecodedTransferSenderId { get; set; } public Origin Origin { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/AssignViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/AssignViewModel.cs index 22509f0f9..1fda7701b 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/AssignViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/AssignViewModel.cs @@ -8,6 +8,7 @@ public class AssignViewModel public string AccountHashedId { get; set; } public Guid? ReservationId { get; set; } public string AccountLegalEntityHashedId { get; set; } + public string LegalEntityName { get; set; } public string StartMonthYear { get; set; } public string CourseCode { get; set; } public long ProviderId { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmDeleteViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmDeleteViewModel.cs index cac1ba2be..eb5653531 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmDeleteViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmDeleteViewModel.cs @@ -10,6 +10,7 @@ public class ConfirmDeleteViewModel : IAuthorizationContextModel public string CohortReference { get; set; } public long CohortId { get; set; } public string ProviderName { get; set; } + public string LegalEntityName { get; set; } public int DraftApprenticeshipsCount => Courses?.Sum(c => c.NumberOfDraftApprenticeships) ?? 0; public IReadOnlyCollection Courses { get; set; } public bool? ConfirmDeletion { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderRequest.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderRequest.cs index 2cf15d0f1..161e05534 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderRequest.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderRequest.cs @@ -3,5 +3,6 @@ public class ConfirmProviderRequest : SelectProviderRequest { public long ProviderId { get; set; } + public string LegalEntityName { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderViewModel.cs index 1fef32fff..1a255a275 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/ConfirmProviderViewModel.cs @@ -6,6 +6,7 @@ public class ConfirmProviderViewModel : IndexViewModel { public long ProviderId { get; set; } public string ProviderName { get; set; } + public string LegalEntityName { get; set; } public bool? UseThisProvider { get; set; } public string TransferSenderId { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/IndexRequest.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/IndexRequest.cs index 8463c76f0..8ebe3802d 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/IndexRequest.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/IndexRequest.cs @@ -1,10 +1,11 @@ using System; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; +using SFA.DAS.Authorization.ModelBinding; namespace SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort { - public class IndexRequest + public class IndexRequest : IAuthorizationContextModel { [FromRoute] public string AccountHashedId { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/MessageViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/MessageViewModel.cs index 451f30c76..49314b603 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/MessageViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/MessageViewModel.cs @@ -1,5 +1,5 @@ -using System; -using SFA.DAS.Authorization.ModelBinding; +using SFA.DAS.Authorization.ModelBinding; +using System; namespace SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort { @@ -9,6 +9,7 @@ public class MessageViewModel : IAuthorizationContextModel public long AccountId { get; set; } public Guid? ReservationId { get; set; } public string AccountLegalEntityHashedId { get; set; } + public string LegalEntityName { get; set; } public long AccountLegalEntityId { get; set; } public string StartMonthYear { get; set; } public string CourseCode { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderRequest.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderRequest.cs index 778bdc879..d82501300 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderRequest.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderRequest.cs @@ -1,8 +1,11 @@ -namespace SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort +using SFA.DAS.Authorization.ModelBinding; + +namespace SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort { public class SelectProviderRequest : IndexRequest { public string TransferSenderId { get; set; } + public long AccountLegalEntityId { get; set; } public Origin Origin { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderViewModel.cs index 74e796cf7..0fc398340 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Cohort/SelectProviderViewModel.cs @@ -8,6 +8,7 @@ public class SelectProviderViewModel public string AccountHashedId { get; set; } public Guid? ReservationId { get; set; } public string AccountLegalEntityHashedId { get; set; } + public string LegalEntityName { get; set; } public string StartMonthYear { get; set; } public string CourseCode { get; set; } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/AddDraftApprenticeshipViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/AddDraftApprenticeshipViewModel.cs index 6583e3422..a91cfd9cb 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/AddDraftApprenticeshipViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/AddDraftApprenticeshipViewModel.cs @@ -10,6 +10,7 @@ public class AddDraftApprenticeshipViewModel : DraftApprenticeshipViewModel, IAu public long AccountLegalEntityId { get; set; } public string AccountLegalEntityHashedId { get; set; } + public string LegalEntityName { get; set; } public string TransferSenderHashedId { get; set; } public bool AutoCreatedReservation { get; set; } } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/DeleteDraftApprenticeshipViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/DeleteDraftApprenticeshipViewModel.cs index f488aca41..c872b53de 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/DeleteDraftApprenticeshipViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/DeleteDraftApprenticeshipViewModel.cs @@ -14,5 +14,6 @@ public class DeleteDraftApprenticeshipViewModel : DraftApprenticeshipViewModel, [FromQuery] public DeleteDraftApprenticeshipOrigin Origin { get; set; } public string FullName => $"{FirstName} {LastName}"; + public string LegalEntityName { get; set; } } } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/EditDraftApprenticeshipViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/EditDraftApprenticeshipViewModel.cs index 69ddf58bd..081d2ddc7 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/EditDraftApprenticeshipViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/EditDraftApprenticeshipViewModel.cs @@ -17,5 +17,6 @@ public EditDraftApprenticeshipViewModel() public string AccountHashedId { get; set; } public string DraftApprenticeshipHashedId { get; set; } public long DraftApprenticeshipId { get; set; } + public string LegalEntityName { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/ViewDraftApprenticeshipViewModel.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/ViewDraftApprenticeshipViewModel.cs index adbf22beb..2b8f4f060 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/ViewDraftApprenticeshipViewModel.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/DraftApprenticeship/ViewDraftApprenticeshipViewModel.cs @@ -15,5 +15,6 @@ public class ViewDraftApprenticeshipViewModel : IDraftApprenticeshipViewModel public DateTime? EndDate { get; set; } public int? Cost { get; set; } public string Reference { get; set; } + public string LegalEntityName { get; set; } } } diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Shared/GaData.cs b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Shared/GaData.cs index a5ce924a4..7cb79089a 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Shared/GaData.cs +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Models/Shared/GaData.cs @@ -8,6 +8,7 @@ public class GaData public string UserId { get; set; } public string Vpv { get; set; } public string Acc { get; set; } + public string Org { get; set; } public IDictionary Extras { get; set; } = new Dictionary(); } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Apprentice.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Apprentice.cshtml index 2418f6075..465219801 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Apprentice.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Apprentice.cshtml @@ -5,6 +5,7 @@ @{ ViewData["Title"] = "Add apprentice details"; ViewBag.GaData.Vpv = "/unapproved/add/apprentice"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Approved.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Approved.cshtml index 7df5cefa7..eaf0cfc81 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Approved.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Approved.cshtml @@ -5,6 +5,7 @@ @{ ViewData["Title"] = "Approved"; ViewBag.GaData.Vpv = "/unapproved/cohort/approved"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Assign.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Assign.cshtml index d448f473b..6a5a22227 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Assign.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Assign.cshtml @@ -4,6 +4,7 @@ @{ ViewBag.Title = "Start adding apprentices"; ViewBag.GaData.Vpv = "/unapproved/add/assign"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmDelete.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmDelete.cshtml index bf6a0c19e..bff76283a 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmDelete.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmDelete.cshtml @@ -4,6 +4,7 @@ @{ ViewBag.GaData.Vpv = "/unapproved/delete"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmProvider.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmProvider.cshtml index 05f6eae7f..c090133c8 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmProvider.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/ConfirmProvider.cshtml @@ -4,6 +4,7 @@ @{ ViewBag.Title = "Confirm training provider"; ViewBag.GaData.Vpv = "/unapproved/add/confirm-provider"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Details.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Details.cshtml index 4e2d64efc..cd48c0cf9 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Details.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Details.cshtml @@ -7,6 +7,7 @@ @{ ViewData["Title"] = Model.PageTitle; ViewBag.GaData.Vpv = "/unapproved/cohort"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Finished.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Finished.cshtml index 843a82235..ad4702e32 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Finished.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Finished.cshtml @@ -4,6 +4,7 @@ @{ ViewData["Title"] = "Instructions sent"; ViewBag.GaData.Vpv = "/unapproved/add/finished"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Message.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Message.cshtml index 323fc77c7..b2bb7f908 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Message.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Message.cshtml @@ -3,6 +3,7 @@ @{ ViewData["Title"] = "Message for your training provider"; ViewBag.GaData.Vpv = "/unapproved/add/message"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/SelectProvider.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/SelectProvider.cshtml index 0fb22169b..2f9e4169a 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/SelectProvider.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/SelectProvider.cshtml @@ -5,6 +5,7 @@ ViewData["Title"] = "Apprenticeships"; ViewBag.Title = "Add training provider details"; ViewBag.GaData.Vpv = "/unapproved/add/select-provider"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Sent.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Sent.cshtml index d80866e1f..255f4c63b 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Sent.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Cohort/Sent.cshtml @@ -1,10 +1,12 @@ -@using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort + +@using SFA.DAS.EmployerCommitmentsV2.Web.Models.Cohort @using SFA.DAS.EmployerUrlHelper.Mvc @model SentViewModel @{ ViewData["Title"] = "Notification sent to training provider"; ViewBag.GaData.Vpv = "/unapproved/sent"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/AddDraftApprenticeship.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/AddDraftApprenticeship.cshtml index ff5550e27..e974c9dfc 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/AddDraftApprenticeship.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/AddDraftApprenticeship.cshtml @@ -4,6 +4,7 @@ @{ ViewData["Title"] = "Add apprentice details"; ViewBag.GaData.Vpv = "/unapproved/cohort/apprentices/add"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/DeleteDraftApprenticeship.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/DeleteDraftApprenticeship.cshtml index 6fabd7674..e06cb696c 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/DeleteDraftApprenticeship.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/DeleteDraftApprenticeship.cshtml @@ -10,6 +10,7 @@ : Url.Action("Details", new { Model.AccountHashedId, Model.CohortReference, Model.DraftApprenticeshipHashedId }); ViewBag.GaData.Vpv = "/unapproved/cohort/apprentices/apprentice/delete"; + ViewBag.GaData.Org = Model.LegalEntityName; } @**@ diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/Edit.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/Edit.cshtml index ec089b49e..f08ee4af7 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/Edit.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/Edit.cshtml @@ -6,6 +6,7 @@ @{ ViewData["Title"] = "Apprenticeships"; ViewBag.GaData.Vpv = "/unapproved/cohort/apprentices/apprentice/edit"; + ViewBag.GaData.Org = Model.LegalEntityName; }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/View.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/View.cshtml index 9bec8c3ca..aff760bfa 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/View.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/DraftApprenticeship/View.cshtml @@ -4,6 +4,8 @@ @{ ViewData["Title"] = "View apprentice details"; ViewBag.GaData.Vpv = "/unapproved/cohort/apprentices/apprentice"; + ViewBag.GaData.Org = Model.LegalEntityName; + }
diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_AssignHiddenPartial.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_AssignHiddenPartial.cshtml index c1647cbe9..47ab4d44b 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_AssignHiddenPartial.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_AssignHiddenPartial.cshtml @@ -7,4 +7,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_GoogleAnalyticsInfo.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_GoogleAnalyticsInfo.cshtml index 10db76de9..a670851df 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_GoogleAnalyticsInfo.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_GoogleAnalyticsInfo.cshtml @@ -13,7 +13,7 @@ 'userID': '@ViewBag.GaData.UserId', 'vpv': '@ViewBag.GaData.Vpv', 'acc': '@ViewBag.GaData.Acc', - 'org': '' + 'org': '@ViewBag.GaData.Org' @if (ViewBag.GaData.Extras.Count>0) { @Html.Raw(","); diff --git a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_SelectProviderHiddenPartial.cshtml b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_SelectProviderHiddenPartial.cshtml index 3cf3e685b..61cc6ec8d 100644 --- a/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_SelectProviderHiddenPartial.cshtml +++ b/src/SFA.DAS.EmployerCommitmentsV2.Web/Views/Shared/_SelectProviderHiddenPartial.cshtml @@ -5,4 +5,6 @@ - \ No newline at end of file + + +