Skip to content

Commit

Permalink
TM-302 updated Financial Breakdown ViewModel with projection data
Browse files Browse the repository at this point in the history
  • Loading branch information
jawwadbaig committed Apr 14, 2022
1 parent 30a9758 commit 70b76fe
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<ActionResult> Index(string hashedAccountId)
public async Task<ActionResult> FinancialBreakdown(string hashedAccountId)
{
var viewModel = await _transfersOrchestrator.GetFinancialBreakdownViewModel(hashedAccountId);
return View();
return View(viewModel);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task<OrchestratorResponse<IndexViewModel>> GetIndexViewModel(string
var accountDetail = _accountApiClient.GetAccount(hashedAccountId);

var renderCreateTransfersPledgeButtonTask = _authorizationService.IsAuthorizedAsync(EmployerUserRole.OwnerOrTransactor);
// var renderApplicationListButton = _featureTogglesService.GetFeatureToggle("ApplicationList");
var renderApplicationListButton = _featureTogglesService.GetFeatureToggle("ApplicationList");

await Task.WhenAll(indexTask, renderCreateTransfersPledgeButtonTask, accountDetail);

Expand All @@ -61,7 +61,7 @@ public async Task<OrchestratorResponse<IndexViewModel>> GetIndexViewModel(string
PledgesCount = indexTask.Result.PledgesCount,
ApplicationsCount = indexTask.Result.ApplicationsCount,
RenderCreateTransfersPledgeButton = renderCreateTransfersPledgeButtonTask.Result,
RenderApplicationListButton = true,//renderApplicationListButton.IsEnabled,
RenderApplicationListButton = renderApplicationListButton.IsEnabled,
StartingTransferAllowance = accountDetail.Result.StartingTransferAllowance,
FinancialYearString = DateTime.UtcNow.ToFinancialYearString(),
HashedAccountID = hashedAccountId
Expand All @@ -73,13 +73,22 @@ public async Task<OrchestratorResponse<FinancialBreakdownViewModel>> GetFinancia
{
var accountId = _hashingService.DecodeValue(hashedAccountId);
var financialBreakdownTask = await _manageApprenticeshipsService.GetFinancialBreakdown(accountId);
var accountDetail = await _accountApiClient.GetAccount(hashedAccountId);

return new OrchestratorResponse<FinancialBreakdownViewModel>
{
Data = new FinancialBreakdownViewModel
{
TransferConnections = financialBreakdownTask.TransferConnections,
HashedAccountID = hashedAccountId
HashedAccountID = hashedAccountId,
AcceptedPledgeApplications = financialBreakdownTask.AcceptedPledgeApplications,
ApprovedPledgeApplications = financialBreakdownTask.ApprovedPledgeApplications,
Commitments = financialBreakdownTask.Commitments,
PledgeOriginatedCommitments = financialBreakdownTask.PledgeOriginatedCommitments,
FundsIn = financialBreakdownTask.FundsIn,
NumberOfMonths = financialBreakdownTask.NumberOfMonths,
ProjectionStartDate = financialBreakdownTask.ProjectionStartDate,
StartingTransferAllowance = accountDetail.StartingTransferAllowance
}
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
namespace SFA.DAS.EmployerFinance.Web.ViewModels.Transfers
using System;

namespace SFA.DAS.EmployerFinance.Web.ViewModels.Transfers
{
public class FinancialBreakdownViewModel
{
public decimal StartingTransferAllowance { get; set; }
public string FinancialYearString { get; set; }
public string HashedAccountID { get; set; }
public long TransferConnections { get; set; }
public decimal TransferConnections { get; set; }
public decimal FundsIn { get; set; }
public decimal Commitments { get; set; }
public decimal ApprovedPledgeApplications { get; set; }
public decimal AcceptedPledgeApplications { get; set; }
public decimal PledgeOriginatedCommitments { get; set; }
public DateTime ProjectionStartDate { get; set; }
public int NumberOfMonths { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using System.Globalization
@model OrchestratorResponse<SFA.DAS.EmployerFinance.Web.ViewModels.Transfers.FinancialBreakdownViewModel>
@{
ViewBag.PageID = "transfers-breakdown";
ViewBag.Section = "finance";
Expand Down Expand Up @@ -35,12 +36,8 @@
<table>
<tr>
<th scope="row">Your transfer allowance</th>
<td class="numeric">£20</td>
</tr>
<tr>
<th scope="row">Deduction for in-house apprenticeships</th>
<td class="numeric">£20</td>
</tr>
<td class="numeric">@Model.Data.StartingTransferAllowance.ToString("C0", culture)</td>
</tr>
</table>
<details>
<summary><span class="summary">How is my available transfer allowance calculated?</span></summary>
Expand Down Expand Up @@ -70,15 +67,15 @@
<table>
<tr>
<th scope="row">Approved applications: live</th>
<td class="numeric">£20</td>
<td class="numeric">@Model.Data.ApprovedPledgeApplications</td>
</tr>
<tr>
<th scope="row">Approved applications: not live yet</th>
<td class="numeric">£20</td>
<td class="numeric">@Model.Data.AcceptedPledgeApplications</td>
</tr>
<tr>
<th scope="row">Transfer connections</th>
<td class="numeric">£20</td>
<td class="numeric">@Model.Data.TransferConnections</td>
</tr>
<tr>
<th scope="row">Total estimated spend</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public class GetFinancialBreakdownResponse
public long AcceptedPledgeApplications { get; set; }
public long PledgeOriginatedCommitments { get; set; }
public long TransferConnections { get; set; }
public long FundsIn { get; set; }
public int NumberOfMonths { get; set; }
public DateTime ProjectionStartDate { get; set;}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task<GetIndexResponse> GetIndex(long accountId)

public async Task<GetFinancialBreakdownResponse> GetFinancialBreakdown(long accountId)
{
return await _apiClient.Get<GetFinancialBreakdownResponse>(new GetIndexRequest(accountId));
return await _apiClient.Get<GetFinancialBreakdownResponse>(new GetFinancialBreakdownRequest(accountId));
}
}
}

0 comments on commit 70b76fe

Please sign in to comment.