Added floating leg fixings to the IRS web demo deals page.

This commit is contained in:
Clinton Alexander 2017-05-04 17:18:38 +01:00 committed by Clinton Alexander
parent f45c3cc214
commit 1c2ae89374
2 changed files with 31 additions and 1 deletions

View File

@ -4,6 +4,16 @@ define(['angular', 'utils/semantic', 'services/NodeApi', 'services/HttpErrorHand
angular.module('irsViewer').controller('DealController', function DealController($http, $scope, $routeParams, nodeService, httpErrorHandler) {
semantic.init($scope, nodeService.isLoading);
let handleHttpFail = httpErrorHandler.createErrorHandler($scope);
nodeService.getDeal($routeParams.dealId).then((deal) => $scope.deal = deal, handleHttpFail);
let decorateDeal = (deal) => {
let paymentSchedule = deal.calculation.floatingLegPaymentSchedule;
Object.keys(paymentSchedule).map((key, index) => {
const sign = paymentSchedule[key].rate.positive ? 1 : -1;
paymentSchedule[key].ratePercent = paymentSchedule[key].rate.ratioUnit ? (paymentSchedule[key].rate.ratioUnit.value * 100 * sign).toFixed(5) + "%": "";
});
return deal;
};
nodeService.getDeal($routeParams.dealId).then((deal) => $scope.deal = decorateDeal(deal), handleHttpFail);
});
});

View File

@ -200,6 +200,26 @@
</div>
</td>
</tr>
<tr class="center aligned">
<td colspan="2">
<div class="ui accordion">
<div class="title">
<i class="dropdown icon"></i>
Fixings
</div>
<div class="content">
<table class="ui celled small table">
<tbody>
<tr class="center aligned" ng-repeat="fixing in deal.calculation.floatingLegPaymentSchedule">
<td>{{fixing.fixingDate[0]}}-{{fixing.fixingDate[1]}}-{{fixing.fixingDate[2]}}</td>
<td>{{fixing.ratePercent}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>