Merge pull request #190 from hhartono/master

InVenture Score Prototype
This commit is contained in:
Nayan Ambali 2013-10-19 06:18:24 -07:00
commit 4a65a5770a
4 changed files with 267 additions and 3 deletions

View File

@ -241,6 +241,96 @@
scope.downloadClientIdentifierDocument=function (identifierId, documentId){
console.log(identifierId,documentId);
};
// *********************** InVenture controller ***********************
scope.fetchInventureScore = function(){
// dummy data for the graph - DEBUG purpose
var inventureScore = getRandomInt(450,800);
var natAverage = getRandomInt(450,800);
var industryAverage = getRandomInt(450,800);
var inventureMinScore = 300;
var inventureMaxScore = 850;
// dummy data for inventure loan recommendation - DEBUG purpose
scope.inventureAgricultureLimit = '21,000';
scope.inventureFishermenLimit = '27,500';
scope.inventureHousingLimit = '385,000';
scope.inventureBusinessLimit = '10,000';
// this part is used to generate data to see the look of the graph
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// CHART1 - comparison chart control
var comparisonData = [
{
key: "Score Comparison",
values: [
{
"label" : "National Average",
"value" : (natAverage)
},
{
"label" : "Agriculture Average",
"value" : (industryAverage)
},
{
"label" : "This Client",
"value" : (inventureScore)
}
]
}
];
// add the comparison chart to the viewclient.html
nv.addGraph(function() {
var comparisonChart = nv.models.discreteBarChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.staggerLabels(true)
.tooltips(true)
.showValues(true);
// set all display value to integer
comparisonChart.yAxis.tickFormat(d3.format('d'));
comparisonChart.valueFormat(d3.format('d'));
comparisonChart.forceY([inventureMinScore, inventureMaxScore]);
d3.select('#inventureBarChart svg')
.datum(comparisonData)
.transition().duration(1500)
.call(comparisonChart);
nv.utils.windowResize(comparisonChart.update);
return comparisonChart;
});
// CHART2 - inventure score bullet chart control
nv.addGraph(function() {
var bullet = nv.models.bulletChart()
.tooltips(false);
d3.select('#inventureBulletChart svg')
.datum(scoreData())
.transition().duration(1500)
.call(bullet);
nv.utils.windowResize(bullet.update);
return bullet;
});
function scoreData() {
return {
"title": "",
"ranges": [(inventureMinScore - 300), (inventureMaxScore - 300)],
"measures": [(inventureScore - 300)],
"markers": [(inventureScore - 300)]};
}
// this will be used to display the score on the viewclient.html
scope.inventureScore = inventureScore;
};
}
});

View File

@ -584,4 +584,74 @@ div[data-tree-model] li .selected {
margin-left: -90px;
border-left-width: 1px;
margin-right: 90px;
}
}
/* Inventure */
.inventureTabTitle a {
font-weight: bold;
color: #FF6600;
}
#inventureBulletChart .nv-tick text {
display: none;
}
.inventureMainBorder {
border: 1.5px solid #DDDDDD;
padding:15px;
}
.inventureCategoryTitle {
background-color: #E8E8E8;
border-bottom: 1.5px solid #DDDDDD;
padding: 10px 15px;
margin: -15px -15px 15px;
}
.inventureBulletLegendCell {
width:90px;
text-align:center;
}
.inventureRecommendationTable {
font-size: 18px;
margin-left: auto;
margin-right: auto;
}
.inventureTableTopBorder {
border-top: 3px solid #DDDDDD;
}
.inventureRecommendationCellTitle {
font-weight:bold;
color:#333;
}
.inventureRecommendationCellType {
width:125px;
height:25px;
text-align:center;
}
.inventureRecommendationCellAmount {
width:175px;
height:25px;
text-align:center;
}
.inventureRecommendationCellLeftGap {
width:7px;
text-align:center;
border-right: 2px solid #DDDDDD;
}
.inventureTooltip .tooltip-inner {
white-space: pre-wrap;
font-size: 13px;
}
.inventureRecommendationCellRightGap {
width:7px;
text-align:center;
}

View File

@ -4051,8 +4051,8 @@ input[type="submit"].btn.btn-mini {
.nav-tabs > li > a,
.nav-pills > li > a {
padding-right: 12px;
padding-left: 12px;
padding-right: 10px;
padding-left: 10px;
margin-right: 2px;
line-height: 14px;
}

View File

@ -289,6 +289,110 @@
</table>
</div>
</tab>
<!-- ************************ start of InVenture code ************************ -->
<tab class="inventureTabTitle" heading="InVenture Score" select="fetchInventureScore()">
<!-- chart1 - comparison chart -->
<div class="span6 paddedleft0 paddedtop">
<div class="inventureMainBorder">
<div class="inventureCategoryTitle">
<strong class="ng-binding">Score Comparison</strong>
</div>
<div class="inventureTooltip" style="margin: -47px 0px 0px 390px;">
<a tooltip="The graph below compares an individual's data to averages in his/her key peer groups such as locale and industry."><img src="http://smsinventure.org/mifos/img/question-mark.png" alt="Question" height="18px" width="18px"></img></a>
</div>
<div id="inventureBarChart" style="margin: 20px -15px -15px; height:417px;">
<svg></svg>
</div>
</div>
</div>
<!-- chart2 - inventure score chart -->
<div class="span5 paddedtop" style="width:440px;">
<div class="inventureMainBorder" style="height:175px;">
<div class="inventureCategoryTitle">
<strong class="ng-binding">InVenture Score</strong>
</div>
<div class="inventureTooltip" style="margin: -47px 0px 0px 390px;">
<a tooltip=" InVenture calculates a person's overall risk using a combination of demographic, financial, and credit data to calculate a score ranging from 300 - 850."><img src="http://smsinventure.org/mifos/img/question-mark.png" alt="Question" height="18px" width="18px"></img></a>
</div>
<div id="score" style="margin: 30px 0 -15px;">
<p style="text-align: center; font-size: 25px;">InVenture Score: <strong>{{inventureScore}}</strong></p>
</div>
<div id="inventureBulletChart" style="margin: 25px 0px -25px -90px; width:500px; height:35px;">
<svg></svg>
</div>
<div id="inventureBulletChartLegend" style="margin: 30px 0px 0px -10px;">
<table cellspacing="0" cellpadding="0" style="font-size: 14px; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td class="inventureBulletLegendCell">300-450<br><strong>Bad</strong></td>
<td class="inventureBulletLegendCell">451-550<br><strong>Fair</strong></td>
<td class="inventureBulletLegendCell">551-700<br><strong>Good</strong></td>
<td class="inventureBulletLegendCell">701-850<br><strong>Excellent</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- chart3 - inventure loan recommendation -->
<div class="span5" style="padding-top:20px; width:440px;">
<div class="inventureMainBorder" style="height:210px;">
<div class="inventureCategoryTitle">
<strong class="ng-binding">InVenture Loan Recommendation</strong>
</div>
<div class="inventureTooltip" style="margin: -47px 0px 0px 390px;">
<a tooltip="InVenture uses all relevant data to recommend a maximum credit amount & protect against over indebtedness."><img src="http://smsinventure.org/mifos/img/question-mark.png" alt="Question" height="18px" width="18px"></img></a>
</div>
<div id="inventureRecommendation" style="margin: 35px 0px 0px 0px;">
<table cellspacing="10" cellpadding="2" class="inventureRecommendationTable">
<tr>
<td class="inventureRecommendationCellType inventureRecommendationCellTitle">Loan Type</td>
<td class="inventureRecommendationCellLeftGap"></td>
<td class="inventureRecommendationCellRightGap"></td>
<td class="inventureRecommendationCellType inventureRecommendationCellTitle">Credit Limit &#8377; (Rs)</td>
</tr>
<tr class="inventureTableTopBorder">
<td class="inventureRecommendationCellType">Agriculture</td>
<td class="inventureRecommendationCellLeftGap"></td>
<td class="inventureRecommendationCellRightGap"></td>
<td class="inventureRecommendationCellAmount">{{inventureAgricultureLimit}}</td>
</tr>
<tr>
<td class="inventureRecommendationCellType">Fishermen</td>
<td class="inventureRecommendationCellLeftGap"></td>
<td class="inventureRecommendationCellRightGap"></td>
<td class="inventureRecommendationCellAmount">{{inventureFishermenLimit}}</td>
</tr>
<tr>
<td class="inventureRecommendationCellType">Housing</td>
<td class="inventureRecommendationCellLeftGap"></td>
<td class="inventureRecommendationCellRightGap"></td>
<td class="inventureRecommendationCellAmount">{{inventureHousingLimit}}</td>
</tr>
<tr>
<td class="inventureRecommendationCellType">Business</td>
<td class="inventureRecommendationCellLeftGap"></td>
<td class="inventureRecommendationCellRightGap"></td>
<td class="inventureRecommendationCellAmount">{{inventureBusinessLimit}}</td>
</tr>
</table>
</div>
</div>
</div>
</tab>
<!-- ************************ end of InVenture code ************************ -->
</tabset>
</div>
</div>