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!');

View File

@@ -1,4 +1,4 @@
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds , picker:true, minDate, year, month, columnChart, lineChart, stackedColumnChart */
/* globals google, accountIds, budgetYearOverviewUrl */
var chartDrawn;
var budgetChart;
@@ -7,8 +7,29 @@ $(function () {
chartDrawn = false;
drawChart();
//
loadBudgetOverview();
});
function loadBudgetOverview() {
"use strict";
console.log('Going to grab ' + budgetYearOverviewUrl);
$.get(budgetYearOverviewUrl).done(placeBudgetOverview).fail(failBudgetOverview);
}
function placeBudgetOverview(data) {
"use strict";
$('#budgetOverview').removeClass('loading').html(data);
$('.budget-chart-activate').on('click', clickBudgetChart);
}
function failBudgetOverview() {
"use strict";
console.log('Fail budget overview data!');
$('#budgetOverview').removeClass('loading').addClass('general-chart-error');
}
function drawChart() {
"use strict";
@@ -17,7 +38,7 @@ function drawChart() {
columnChart('chart/report/in-out/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart');
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
$('.budget-chart-activate').on('click', clickBudgetChart);
}
function clickBudgetChart(e) {