mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds , picker:true, minDate, expenseRestShow:true, incomeRestShow:true, year, month, hideTheRest, showTheRest, showTheRestExpense, hideTheRestExpense, columnChart, lineChart, stackedColumnChart */
|
|
|
|
|
|
$(function () {
|
|
"use strict";
|
|
drawChart();
|
|
|
|
// click open the top X income list:
|
|
$('#showIncomes').click(showIncomes);
|
|
// click open the top X expense list:
|
|
$('#showExpenses').click(showExpenses);
|
|
});
|
|
|
|
|
|
function drawChart() {
|
|
"use strict";
|
|
|
|
lineChart('chart/report/net-worth/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'net-worth');
|
|
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) {
|
|
"use strict";
|
|
var link = $(e.target);
|
|
var budgetId = link.data('budget');
|
|
console.log('Budget id is ' + budgetId);
|
|
$('#budget_chart').empty();
|
|
columnChart('chart/budget/period/' + budgetId + '/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'budget_chart');
|
|
|
|
return false;
|
|
}
|
|
|
|
function showIncomes() {
|
|
"use strict";
|
|
if (incomeRestShow) {
|
|
// hide everything, make button say "show"
|
|
$('#showIncomes').text(showTheRest);
|
|
$('.incomesCollapsed').removeClass('in').addClass('out');
|
|
|
|
// toggle:
|
|
incomeRestShow = false;
|
|
} else {
|
|
// show everything, make button say "hide".
|
|
$('#showIncomes').text(hideTheRest);
|
|
$('.incomesCollapsed').removeClass('out').addClass('in');
|
|
|
|
// toggle:
|
|
incomeRestShow = true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function showExpenses() {
|
|
"use strict";
|
|
if (expenseRestShow) {
|
|
// hide everything, make button say "show"
|
|
$('#showExpenses').text(showTheRestExpense);
|
|
$('.expenseCollapsed').removeClass('in').addClass('out');
|
|
|
|
// toggle:
|
|
expenseRestShow = false;
|
|
} else {
|
|
// show everything, make button say "hide".
|
|
$('#showExpenses').text(hideTheRestExpense);
|
|
$('.expenseCollapsed').removeClass('out').addClass('in');
|
|
|
|
// toggle:
|
|
expenseRestShow = true;
|
|
}
|
|
|
|
return false;
|
|
} |