mirror of
https://github.com/corda/corda.git
synced 2025-01-01 18:56:44 +00:00
Quick fix for dropdowns and moved deal into requirejs func. Moved day count lookup to a util.
This commit is contained in:
parent
5d5d88e909
commit
a8051e9413
@ -1,54 +1,53 @@
|
||||
"use strict"
|
||||
|
||||
let Deal = function(dealViewModel) {
|
||||
let now = new Date();
|
||||
let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}`
|
||||
define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => {
|
||||
let Deal = function(dealViewModel) {
|
||||
let now = new Date();
|
||||
let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}`
|
||||
|
||||
this.toJson = () => {
|
||||
let fixedLeg = {};
|
||||
let floatingLeg = {};
|
||||
let common = {};
|
||||
_.assign(fixedLeg, dealViewModel.fixedLeg);
|
||||
_.assign(floatingLeg, dealViewModel.floatingLeg);
|
||||
_.assign(common, dealViewModel.common);
|
||||
_.assign(fixedLeg.fixedRate, fixedRateViewModel);
|
||||
this.toJson = () => {
|
||||
let fixedLeg = {};
|
||||
let floatingLeg = {};
|
||||
let common = {};
|
||||
_.assign(fixedLeg, dealViewModel.fixedLeg);
|
||||
_.assign(floatingLeg, dealViewModel.floatingLeg);
|
||||
_.assign(common, dealViewModel.common);
|
||||
_.assign(fixedLeg.fixedRate, fixedRateViewModel);
|
||||
|
||||
fixedLeg.fixedRate = Number(fixedLeg.fixedRate) / 100;
|
||||
fixedLeg.notional.token = common.baseCurrency;
|
||||
fixedLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||
fixedLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||
fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } };
|
||||
fixedLeg.dayCountBasisDay = dayCountBasisLookup[fixedLeg.dayCountBasis].day;
|
||||
fixedLeg.dayCountBasisYear = dayCountBasisLookup[fixedLeg.dayCountBasis].year;
|
||||
delete fixedLeg.dayCountBasis;
|
||||
fixedLeg.fixedRate = Number(fixedLeg.fixedRate) / 100;
|
||||
fixedLeg.notional.token = common.baseCurrency;
|
||||
fixedLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||
fixedLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||
fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } };
|
||||
fixedLeg.dayCountBasisDay = dayCountBasisLookup[fixedLeg.dayCountBasis].day;
|
||||
fixedLeg.dayCountBasisYear = dayCountBasisLookup[fixedLeg.dayCountBasis].year;
|
||||
delete fixedLeg.dayCountBasis;
|
||||
|
||||
floatingLeg.notional.token = common.baseCurrency;
|
||||
floatingLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||
floatingLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||
floatingLeg.dayCountBasisDay = dayCountBasisLookup[floatingLeg.dayCountBasis].day;
|
||||
floatingLeg.dayCountBasisYear = dayCountBasisLookup[floatingLeg.dayCountBasis].year;
|
||||
delete floatingLeg.dayCountBasis;
|
||||
floatingLeg.notional.token = common.baseCurrency;
|
||||
floatingLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||
floatingLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||
floatingLeg.dayCountBasisDay = dayCountBasisLookup[floatingLeg.dayCountBasis].day;
|
||||
floatingLeg.dayCountBasisYear = dayCountBasisLookup[floatingLeg.dayCountBasis].year;
|
||||
delete floatingLeg.dayCountBasis;
|
||||
|
||||
common.tradeID = tradeId;
|
||||
common.eligibleCurrency = common.baseCurrency;
|
||||
common.independentAmounts.token = common.baseCurrency;
|
||||
common.threshold.token = common.baseCurrency;
|
||||
common.minimumTransferAmount.token = common.baseCurrency;
|
||||
common.rounding.token = common.baseCurrency;
|
||||
delete common.effectiveDate;
|
||||
delete common.terminationDate;
|
||||
common.tradeID = tradeId;
|
||||
common.eligibleCurrency = common.baseCurrency;
|
||||
common.independentAmounts.token = common.baseCurrency;
|
||||
common.threshold.token = common.baseCurrency;
|
||||
common.minimumTransferAmount.token = common.baseCurrency;
|
||||
common.rounding.token = common.baseCurrency;
|
||||
delete common.effectiveDate;
|
||||
delete common.terminationDate;
|
||||
|
||||
let json = {
|
||||
fixedLeg: fixedLeg,
|
||||
floatingLeg: floatingLeg,
|
||||
calculation: calculationModel,
|
||||
common: common
|
||||
}
|
||||
let json = {
|
||||
fixedLeg: fixedLeg,
|
||||
floatingLeg: floatingLeg,
|
||||
calculation: calculationModel,
|
||||
common: common
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
return json;
|
||||
};
|
||||
};
|
||||
|
||||
define([], () => {
|
||||
return Deal;
|
||||
})
|
||||
|
@ -121,14 +121,6 @@ let dealViewModel = {
|
||||
common: commonViewModel
|
||||
};
|
||||
|
||||
// TODO: Fill out this lookup table and use it to inject into the view.
|
||||
let dayCountBasisLookup = {
|
||||
"30/360": {
|
||||
"day": "D30",
|
||||
"year": "Y360"
|
||||
}
|
||||
}
|
||||
|
||||
define([
|
||||
'angular',
|
||||
'angularRoute',
|
||||
|
@ -76,7 +76,6 @@ define(['angular', 'lodash'], (angular, _) => {
|
||||
}
|
||||
|
||||
this.isLoading = () => {
|
||||
console.log("IS LOADING");
|
||||
return _.reduce(Object.keys(curLoading), (last, key) => {
|
||||
return (last || curLoading[key]);
|
||||
}, false);
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="sixteen wide column">
|
||||
<div class="field">
|
||||
<label>Base Currency</label>
|
||||
<select class="ui dropdown fluid" name="token" ng-model="deal.common.baseCurrency">
|
||||
<select class="ui fluid" name="token" ng-model="deal.common.baseCurrency">
|
||||
<option value="EUR">EUR</option>
|
||||
<option value="USD">USD</option>
|
||||
<option value="GBP">GBP</option>
|
||||
@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Payment Frequency</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.fixedLeg.paymentFrequency">
|
||||
<select class="ui selection " ng-model="deal.fixedLeg.paymentFrequency">
|
||||
<option value="Annual">Annual</option>
|
||||
<option value="SemiAnnual">Semi Annual</option>
|
||||
<option value="Quarterly">Quarterly</option>
|
||||
@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Day Count Basis</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.fixedLeg.dayCountBasis">
|
||||
<select class="ui selection " ng-model="deal.fixedLeg.dayCountBasis">
|
||||
<option>30/360</option>
|
||||
<option>30E/360</option>
|
||||
<option>30E/360 (IDSA)</option>
|
||||
@ -71,7 +71,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Roll Convention</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.fixedLeg.rollConvention">
|
||||
<select class="ui selection " ng-model="deal.fixedLeg.rollConvention">
|
||||
<option value="Following">Following</option>
|
||||
<option value="Preceding">Preceding</option>
|
||||
<option value="ModifiedFollowing">Modified following</option>
|
||||
@ -85,7 +85,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Payment Delay</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.fixedLeg.paymentDelay">
|
||||
<select class="ui selection " ng-model="deal.fixedLeg.paymentDelay">
|
||||
<option value="0">T+00D</option>
|
||||
<option value="1">T+01D</option>
|
||||
<option value="2" selected="selected">T+02D</option>
|
||||
@ -94,7 +94,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Interest Period Adjustment</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.fixedLeg.interestPeriodAdjustment">
|
||||
<select class="ui selection " ng-model="deal.fixedLeg.interestPeriodAdjustment">
|
||||
<option value="Adjusted">Adjusted</option>
|
||||
<option value="Unadjusted">Unadjusted</option>
|
||||
</select>
|
||||
@ -112,7 +112,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Payment Frequency</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.paymentFrequency">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.paymentFrequency">
|
||||
<option value="Annual">Annual</option>
|
||||
<option value="Quarterly">Quarterly</option>
|
||||
<option value="SemiAnnual">Semi Annual</option>
|
||||
@ -120,7 +120,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Day Count Basis</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.dayCountBasis">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.dayCountBasis">
|
||||
<option>1/1</option>
|
||||
<option>30/360</option>
|
||||
<option>30E/360</option>
|
||||
@ -138,7 +138,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Roll Convention</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.rollConvention">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.rollConvention">
|
||||
<option value="Following">Following</option>
|
||||
<option value="Preceding">Preceding</option>
|
||||
<option value="ModifiedFollowing">Modified following</option>
|
||||
@ -148,7 +148,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Fixing Roll Convention</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.fixingRollConvention">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.fixingRollConvention">
|
||||
<option value="Following">Following</option>
|
||||
<option value="Preceding">Preceding</option>
|
||||
<option value="ModifiedFollowing">Modified following</option>
|
||||
@ -166,7 +166,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Payment Delay</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.paymentDelay">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.paymentDelay">
|
||||
<option value="0">T+00D</option>
|
||||
<option value="1">T+01D</option>
|
||||
<option value="2">T+02D</option>
|
||||
@ -175,7 +175,7 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Interest Period Adjustment</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.interestPeriodAdjustment">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.interestPeriodAdjustment">
|
||||
<option value="Adjusted">Adjusted</option>
|
||||
<option value="Unadjusted">Unadjusted</option>
|
||||
</select>
|
||||
@ -186,14 +186,14 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Reset Rule</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.resetRule">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.resetRule">
|
||||
<option value="InAdvance">In Advance</option>
|
||||
<option value="InArrears">In Arrears</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Fixings Per Payment</label>
|
||||
<select class="ui selection dropdown" ng-model="deal.floatingLeg.fixingsPerPayment">
|
||||
<select class="ui selection " ng-model="deal.floatingLeg.fixingsPerPayment">
|
||||
<option value="Annual">Annual</option>
|
||||
<option value="Quarterly" selected="selected">Quarterly</option>
|
||||
<option value="SemiAnnual">Semi Annual</option>
|
||||
|
Loading…
Reference in New Issue
Block a user