Files
firefly-iii/public/js/index.js

33 lines
852 B
JavaScript
Raw Normal View History

2015-06-27 12:04:53 +02:00
/* globals $, columnChart, google, lineChart, pieChart, stackedColumnChart, areaChart */
2015-02-06 07:23:26 +01:00
google.setOnLoadCallback(drawChart);
function drawChart() {
2015-05-24 20:48:31 +02:00
"use strict";
2015-06-27 12:04:53 +02:00
areaChart('chart/account/frontpage', 'accounts-chart');
pieChart('chart/bill/frontpage', 'bills-chart');
stackedColumnChart('chart/budget/frontpage', 'budgets-chart');
columnChart('chart/category/frontpage', 'categories-chart');
2015-05-16 09:57:31 +02:00
2015-03-06 08:20:27 +01:00
getBoxAmounts();
}
function getBoxAmounts() {
2015-05-24 18:22:41 +02:00
"use strict";
var boxes = ['in', 'out', 'bills-unpaid', 'bills-paid'];
2015-05-24 18:22:41 +02:00
for (var x in boxes) {
2015-03-06 08:20:27 +01:00
var box = boxes[x];
2015-05-24 18:22:41 +02:00
$.getJSON('/json/box/' + box).success(putData).fail(failData);
2015-03-06 08:20:27 +01:00
}
2015-02-06 07:23:26 +01:00
}
2015-05-24 18:22:41 +02:00
function putData(data) {
"use strict";
$('#box-' + data.box).html(data.amount);
}
function failData() {
"use strict";
console.log('Failed to get box!');
}