Ajax some report parts.

This commit is contained in:
James Cole
2016-10-30 18:29:26 +01:00
parent 73f87e30c2
commit 7821c52842
10 changed files with 282 additions and 133 deletions

View File

@@ -1,4 +1,4 @@
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds, lineChart, categoryReportUrl, balanceReportUrl */
/* globals google, budgetReportUrl, startDate ,reportURL, endDate , reportType ,accountIds, lineChart, categoryReportUrl, balanceReportUrl */
$(function () {
@@ -7,6 +7,7 @@ $(function () {
loadCategoryReport();
loadBalanceReport();
loadBudgetReport();
});
function loadCategoryReport() {
@@ -15,12 +16,26 @@ function loadCategoryReport() {
$.get(categoryReportUrl).done(placeCategoryReport).fail(failCategoryReport);
}
function loadBudgetReport() {
"use strict";
console.log('Going to grab ' + budgetReportUrl);
$.get(budgetReportUrl).done(placeBudgetReport).fail(failBudgetReport);
}
function loadBalanceReport() {
"use strict";
console.log('Going to grab ' + categoryReportUrl);
$.get(balanceReportUrl).done(placeBalanceReport).fail(failBalanceReport);
}
function placeBudgetReport(data) {
"use strict";
$('#budgetReport').removeClass('loading').html(data);
listLengthInitial();
triggerInfoClick();
}
function placeBalanceReport(data) {
"use strict";
$('#balanceReport').removeClass('loading').html(data);
@@ -35,6 +50,12 @@ function placeCategoryReport(data) {
triggerInfoClick();
}
function failBudgetReport() {
"use strict";
console.log('Fail budget report data!');
$('#budgetReport').removeClass('loading').addClass('general-chart-error');
}
function failBalanceReport() {
"use strict";
console.log('Fail balance report data!');