mirror of
https://github.com/corda/corda.git
synced 2025-01-17 10:20:02 +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"
|
"use strict"
|
||||||
|
|
||||||
let Deal = function(dealViewModel) {
|
define(['utils/dayCountBasisLookup'], (dayCountBasisLookup) => {
|
||||||
let now = new Date();
|
let Deal = function(dealViewModel) {
|
||||||
let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}`
|
let now = new Date();
|
||||||
|
let tradeId = `T${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getUTCHours()}:${now.getUTCMinutes()}:${now.getUTCSeconds()}:${now.getUTCMilliseconds()}`
|
||||||
|
|
||||||
this.toJson = () => {
|
this.toJson = () => {
|
||||||
let fixedLeg = {};
|
let fixedLeg = {};
|
||||||
let floatingLeg = {};
|
let floatingLeg = {};
|
||||||
let common = {};
|
let common = {};
|
||||||
_.assign(fixedLeg, dealViewModel.fixedLeg);
|
_.assign(fixedLeg, dealViewModel.fixedLeg);
|
||||||
_.assign(floatingLeg, dealViewModel.floatingLeg);
|
_.assign(floatingLeg, dealViewModel.floatingLeg);
|
||||||
_.assign(common, dealViewModel.common);
|
_.assign(common, dealViewModel.common);
|
||||||
_.assign(fixedLeg.fixedRate, fixedRateViewModel);
|
_.assign(fixedLeg.fixedRate, fixedRateViewModel);
|
||||||
|
|
||||||
fixedLeg.fixedRate = Number(fixedLeg.fixedRate) / 100;
|
fixedLeg.fixedRate = Number(fixedLeg.fixedRate) / 100;
|
||||||
fixedLeg.notional.token = common.baseCurrency;
|
fixedLeg.notional.token = common.baseCurrency;
|
||||||
fixedLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
fixedLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||||
fixedLeg.terminationDate = formatDateForNode(common.terminationDate);
|
fixedLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||||
fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } };
|
fixedLeg.fixedRate = { ratioUnit: { value: fixedLeg.fixedRate } };
|
||||||
fixedLeg.dayCountBasisDay = dayCountBasisLookup[fixedLeg.dayCountBasis].day;
|
fixedLeg.dayCountBasisDay = dayCountBasisLookup[fixedLeg.dayCountBasis].day;
|
||||||
fixedLeg.dayCountBasisYear = dayCountBasisLookup[fixedLeg.dayCountBasis].year;
|
fixedLeg.dayCountBasisYear = dayCountBasisLookup[fixedLeg.dayCountBasis].year;
|
||||||
delete fixedLeg.dayCountBasis;
|
delete fixedLeg.dayCountBasis;
|
||||||
|
|
||||||
floatingLeg.notional.token = common.baseCurrency;
|
floatingLeg.notional.token = common.baseCurrency;
|
||||||
floatingLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
floatingLeg.effectiveDate = formatDateForNode(common.effectiveDate);
|
||||||
floatingLeg.terminationDate = formatDateForNode(common.terminationDate);
|
floatingLeg.terminationDate = formatDateForNode(common.terminationDate);
|
||||||
floatingLeg.dayCountBasisDay = dayCountBasisLookup[floatingLeg.dayCountBasis].day;
|
floatingLeg.dayCountBasisDay = dayCountBasisLookup[floatingLeg.dayCountBasis].day;
|
||||||
floatingLeg.dayCountBasisYear = dayCountBasisLookup[floatingLeg.dayCountBasis].year;
|
floatingLeg.dayCountBasisYear = dayCountBasisLookup[floatingLeg.dayCountBasis].year;
|
||||||
delete floatingLeg.dayCountBasis;
|
delete floatingLeg.dayCountBasis;
|
||||||
|
|
||||||
common.tradeID = tradeId;
|
common.tradeID = tradeId;
|
||||||
common.eligibleCurrency = common.baseCurrency;
|
common.eligibleCurrency = common.baseCurrency;
|
||||||
common.independentAmounts.token = common.baseCurrency;
|
common.independentAmounts.token = common.baseCurrency;
|
||||||
common.threshold.token = common.baseCurrency;
|
common.threshold.token = common.baseCurrency;
|
||||||
common.minimumTransferAmount.token = common.baseCurrency;
|
common.minimumTransferAmount.token = common.baseCurrency;
|
||||||
common.rounding.token = common.baseCurrency;
|
common.rounding.token = common.baseCurrency;
|
||||||
delete common.effectiveDate;
|
delete common.effectiveDate;
|
||||||
delete common.terminationDate;
|
delete common.terminationDate;
|
||||||
|
|
||||||
let json = {
|
let json = {
|
||||||
fixedLeg: fixedLeg,
|
fixedLeg: fixedLeg,
|
||||||
floatingLeg: floatingLeg,
|
floatingLeg: floatingLeg,
|
||||||
calculation: calculationModel,
|
calculation: calculationModel,
|
||||||
common: common
|
common: common
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
define([], () => {
|
|
||||||
return Deal;
|
return Deal;
|
||||||
})
|
})
|
||||||
|
@ -121,14 +121,6 @@ let dealViewModel = {
|
|||||||
common: commonViewModel
|
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([
|
define([
|
||||||
'angular',
|
'angular',
|
||||||
'angularRoute',
|
'angularRoute',
|
||||||
|
@ -76,7 +76,6 @@ define(['angular', 'lodash'], (angular, _) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isLoading = () => {
|
this.isLoading = () => {
|
||||||
console.log("IS LOADING");
|
|
||||||
return _.reduce(Object.keys(curLoading), (last, key) => {
|
return _.reduce(Object.keys(curLoading), (last, key) => {
|
||||||
return (last || curLoading[key]);
|
return (last || curLoading[key]);
|
||||||
}, false);
|
}, false);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="sixteen wide column">
|
<div class="sixteen wide column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Base Currency</label>
|
<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="EUR">EUR</option>
|
||||||
<option value="USD">USD</option>
|
<option value="USD">USD</option>
|
||||||
<option value="GBP">GBP</option>
|
<option value="GBP">GBP</option>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Payment Frequency</label>
|
<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="Annual">Annual</option>
|
||||||
<option value="SemiAnnual">Semi Annual</option>
|
<option value="SemiAnnual">Semi Annual</option>
|
||||||
<option value="Quarterly">Quarterly</option>
|
<option value="Quarterly">Quarterly</option>
|
||||||
@ -53,7 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Day Count Basis</label>
|
<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>30/360</option>
|
||||||
<option>30E/360</option>
|
<option>30E/360</option>
|
||||||
<option>30E/360 (IDSA)</option>
|
<option>30E/360 (IDSA)</option>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Roll Convention</label>
|
<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="Following">Following</option>
|
||||||
<option value="Preceding">Preceding</option>
|
<option value="Preceding">Preceding</option>
|
||||||
<option value="ModifiedFollowing">Modified following</option>
|
<option value="ModifiedFollowing">Modified following</option>
|
||||||
@ -85,7 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Payment Delay</label>
|
<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="0">T+00D</option>
|
||||||
<option value="1">T+01D</option>
|
<option value="1">T+01D</option>
|
||||||
<option value="2" selected="selected">T+02D</option>
|
<option value="2" selected="selected">T+02D</option>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Interest Period Adjustment</label>
|
<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="Adjusted">Adjusted</option>
|
||||||
<option value="Unadjusted">Unadjusted</option>
|
<option value="Unadjusted">Unadjusted</option>
|
||||||
</select>
|
</select>
|
||||||
@ -112,7 +112,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Payment Frequency</label>
|
<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="Annual">Annual</option>
|
||||||
<option value="Quarterly">Quarterly</option>
|
<option value="Quarterly">Quarterly</option>
|
||||||
<option value="SemiAnnual">Semi Annual</option>
|
<option value="SemiAnnual">Semi Annual</option>
|
||||||
@ -120,7 +120,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Day Count Basis</label>
|
<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>1/1</option>
|
||||||
<option>30/360</option>
|
<option>30/360</option>
|
||||||
<option>30E/360</option>
|
<option>30E/360</option>
|
||||||
@ -138,7 +138,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Roll Convention</label>
|
<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="Following">Following</option>
|
||||||
<option value="Preceding">Preceding</option>
|
<option value="Preceding">Preceding</option>
|
||||||
<option value="ModifiedFollowing">Modified following</option>
|
<option value="ModifiedFollowing">Modified following</option>
|
||||||
@ -148,7 +148,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Fixing Roll Convention</label>
|
<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="Following">Following</option>
|
||||||
<option value="Preceding">Preceding</option>
|
<option value="Preceding">Preceding</option>
|
||||||
<option value="ModifiedFollowing">Modified following</option>
|
<option value="ModifiedFollowing">Modified following</option>
|
||||||
@ -166,7 +166,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Payment Delay</label>
|
<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="0">T+00D</option>
|
||||||
<option value="1">T+01D</option>
|
<option value="1">T+01D</option>
|
||||||
<option value="2">T+02D</option>
|
<option value="2">T+02D</option>
|
||||||
@ -175,7 +175,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Interest Period Adjustment</label>
|
<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="Adjusted">Adjusted</option>
|
||||||
<option value="Unadjusted">Unadjusted</option>
|
<option value="Unadjusted">Unadjusted</option>
|
||||||
</select>
|
</select>
|
||||||
@ -186,14 +186,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Reset Rule</label>
|
<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="InAdvance">In Advance</option>
|
||||||
<option value="InArrears">In Arrears</option>
|
<option value="InArrears">In Arrears</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Fixings Per Payment</label>
|
<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="Annual">Annual</option>
|
||||||
<option value="Quarterly" selected="selected">Quarterly</option>
|
<option value="Quarterly" selected="selected">Quarterly</option>
|
||||||
<option value="SemiAnnual">Semi Annual</option>
|
<option value="SemiAnnual">Semi Annual</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user