mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Move all layout files to a "v1" directory.
This commit is contained in:
1
public/v1/js/ff/reports/.htaccess
Normal file
1
public/v1/js/ff/reports/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
1
public/v1/js/ff/reports/account/.htaccess
Normal file
1
public/v1/js/ff/reports/account/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
32
public/v1/js/ff/reports/account/month.js
vendored
Normal file
32
public/v1/js/ff/reports/account/month.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* month.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** global: spentUri, categoryUri, budgetUri, expenseUri, incomeUri, mainUri */
|
||||
$(function () {
|
||||
"use strict";
|
||||
doubleYChart(mainUri, 'in-out-chart');
|
||||
|
||||
loadAjaxPartial('inOutAccounts', spentUri);
|
||||
loadAjaxPartial('inOutCategory', categoryUri);
|
||||
loadAjaxPartial('inOutBudget', budgetUri);
|
||||
loadAjaxPartial('topXexpense', expenseUri);
|
||||
loadAjaxPartial('topXincome', incomeUri);
|
||||
|
||||
});
|
||||
|
||||
156
public/v1/js/ff/reports/all.js
vendored
Normal file
156
public/v1/js/ff/reports/all.js
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* all.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** global: startDate, endDate, accountIds */
|
||||
function loadAjaxPartial(holder, uri) {
|
||||
"use strict";
|
||||
$.get(uri).done(function (data) {
|
||||
displayAjaxPartial(data, holder);
|
||||
}).fail(function () {
|
||||
failAjaxPartial(uri, holder);
|
||||
});
|
||||
}
|
||||
|
||||
function failAjaxPartial(uri, holder) {
|
||||
"use strict";
|
||||
var holderObject = $('#' + holder);
|
||||
holderObject.parent().find('.overlay').remove();
|
||||
holderObject.addClass('general-chart-error');
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createCookie(name, value, days) {
|
||||
"use strict";
|
||||
var expires;
|
||||
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
} else {
|
||||
expires = "";
|
||||
}
|
||||
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
|
||||
}
|
||||
|
||||
function readCookie(name) {
|
||||
"use strict";
|
||||
var nameEQ = encodeURIComponent(name) + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) === ' ') {
|
||||
c = c.substring(1, c.length);
|
||||
}
|
||||
if (c.indexOf(nameEQ) === 0) {
|
||||
return decodeURIComponent(c.substring(nameEQ.length, c.length));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function triggerInfoClick() {
|
||||
"use strict";
|
||||
// find the little info buttons and respond to them.
|
||||
$('.firefly-info-button').unbind('click').click(clickInfoButton);
|
||||
}
|
||||
|
||||
function clickInfoButton(e) {
|
||||
"use strict";
|
||||
// find all data tags, regardless of what they are:
|
||||
var element = $(e.target);
|
||||
var attributes = element.data();
|
||||
|
||||
// set wait cursor
|
||||
$('body').addClass('waiting');
|
||||
|
||||
// add some more elements:
|
||||
attributes.startDate = startDate;
|
||||
attributes.endDate = endDate;
|
||||
attributes.accounts = accountIds;
|
||||
|
||||
$.getJSON('popup/general', {attributes: attributes}).done(respondInfoButton).fail(errorInfoButton);
|
||||
}
|
||||
|
||||
function errorInfoButton() {
|
||||
"use strict";
|
||||
// remove wait cursor
|
||||
$('body').removeClass('waiting');
|
||||
alert('Apologies. The requested data is not (yet) available.');
|
||||
}
|
||||
|
||||
function respondInfoButton(data) {
|
||||
"use strict";
|
||||
// remove wait cursor
|
||||
$('body').removeClass('waiting');
|
||||
$('#defaultModal').empty().html(data.html).modal('show');
|
||||
|
||||
}
|
||||
|
||||
function displayAjaxPartial(data, holder) {
|
||||
"use strict";
|
||||
var obj = $('#' + holder);
|
||||
obj.html(data);
|
||||
obj.parent().find('.overlay').remove();
|
||||
|
||||
// call some often needed recalculations and what-not:
|
||||
|
||||
// find a sortable table and make it sortable:
|
||||
if (typeof $.bootstrapSortable === "function") {
|
||||
$.bootstrapSortable(true);
|
||||
}
|
||||
|
||||
// find the info click things and respond to them:
|
||||
triggerInfoClick();
|
||||
|
||||
// trigger list thing
|
||||
listLengthInitial();
|
||||
|
||||
// budget thing in year and multi year report:
|
||||
$('.budget-chart-activate').unbind('click').on('click', clickBudgetChart);
|
||||
|
||||
// category thing in year and multi year report:
|
||||
$('.category-chart-activate').unbind('click').on('click', clickCategoryChart);
|
||||
}
|
||||
|
||||
function clickCategoryChart(e) {
|
||||
"use strict";
|
||||
var link = $(e.target);
|
||||
var categoryId = link.data('category');
|
||||
$('#category_help').remove();
|
||||
|
||||
var URL = 'chart/category/report-period/' + categoryId + '/' + accountIds + '/' + startDate + '/' + endDate;
|
||||
var container = 'category_chart';
|
||||
columnChart(URL, container);
|
||||
return false;
|
||||
}
|
||||
|
||||
function clickBudgetChart(e) {
|
||||
"use strict";
|
||||
var link = $(e.target);
|
||||
var budgetId = link.data('budget');
|
||||
$('#budget_help').remove();
|
||||
|
||||
var URL = 'chart/budget/period/' + budgetId + '/' + accountIds + '/' + startDate + '/' + endDate;
|
||||
var container = 'budget_chart';
|
||||
columnChart(URL, container);
|
||||
return false;
|
||||
}
|
||||
1
public/v1/js/ff/reports/audit/.htaccess
Normal file
1
public/v1/js/ff/reports/audit/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
88
public/v1/js/ff/reports/audit/all.js
vendored
Normal file
88
public/v1/js/ff/reports/audit/all.js
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* all.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: hideable */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
// scan current selection of checkboxes and put them in a cookie:
|
||||
var arr;
|
||||
if ((readCookie('audit-option-checkbox') !== null)) {
|
||||
arr = readCookie('audit-option-checkbox').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('input[type="checkbox"][value="' + val + '"]').prop('checked', true);
|
||||
});
|
||||
} else {
|
||||
// no cookie? read list, store in array 'arr'
|
||||
// all account ids:
|
||||
arr = readCheckboxes();
|
||||
}
|
||||
storeCheckboxes(arr);
|
||||
|
||||
|
||||
// process options:
|
||||
showOnlyColumns(arr);
|
||||
|
||||
// respond to click each button:
|
||||
$('.audit-option-checkbox').click(clickColumnOption);
|
||||
|
||||
});
|
||||
|
||||
function clickColumnOption() {
|
||||
"use strict";
|
||||
var newArr = readCheckboxes();
|
||||
showOnlyColumns(newArr);
|
||||
storeCheckboxes(newArr);
|
||||
}
|
||||
|
||||
function storeCheckboxes(checkboxes) {
|
||||
"use strict";
|
||||
// store new cookie with those options:
|
||||
createCookie('audit-option-checkbox', checkboxes, 365);
|
||||
}
|
||||
|
||||
function readCheckboxes() {
|
||||
"use strict";
|
||||
var checkboxes = [];
|
||||
$.each($('.audit-option-checkbox'), function (i, v) {
|
||||
var c = $(v);
|
||||
if (c.prop('checked')) {
|
||||
//url += c.val() + ',';
|
||||
checkboxes.push(c.val());
|
||||
}
|
||||
});
|
||||
return checkboxes;
|
||||
}
|
||||
|
||||
function showOnlyColumns(checkboxes) {
|
||||
"use strict";
|
||||
|
||||
for (var i = 0; i < hideable.length; i++) {
|
||||
var opt = hideable[i];
|
||||
if (checkboxes.indexOf(opt) > -1) {
|
||||
$('td.hide-' + opt).show();
|
||||
$('th.hide-' + opt).show();
|
||||
} else {
|
||||
$('th.hide-' + opt).hide();
|
||||
$('td.hide-' + opt).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
public/v1/js/ff/reports/budget/.htaccess
Normal file
1
public/v1/js/ff/reports/budget/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
64
public/v1/js/ff/reports/budget/month.js
vendored
Normal file
64
public/v1/js/ff/reports/budget/month.js
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* month.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: budgetExpenseUri, accountExpenseUri, mainUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
drawChart();
|
||||
|
||||
$('#budgets-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('budgets-out-pie-chart', budgetExpenseUri);
|
||||
});
|
||||
|
||||
$('#accounts-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function drawChart() {
|
||||
"use strict";
|
||||
|
||||
// month view:
|
||||
doubleYNonStackedChart(mainUri, 'in-out-chart');
|
||||
|
||||
// draw pie chart of income, depending on "show other transactions too":
|
||||
redrawPieChart('budgets-out-pie-chart', budgetExpenseUri);
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function redrawPieChart(container, uri) {
|
||||
"use strict";
|
||||
var checkbox = $('#' + container + '-checked');
|
||||
|
||||
var others = '0';
|
||||
// check if box is checked:
|
||||
if (checkbox.prop('checked')) {
|
||||
others = '1';
|
||||
}
|
||||
uri = uri.replace('OTHERS', others);
|
||||
|
||||
pieChart(uri, container);
|
||||
|
||||
}
|
||||
1
public/v1/js/ff/reports/category/.htaccess
Normal file
1
public/v1/js/ff/reports/category/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
73
public/v1/js/ff/reports/category/month.js
vendored
Normal file
73
public/v1/js/ff/reports/category/month.js
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* month.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: categoryIncomeUri, categoryExpenseUri, accountIncomeUri, accountExpenseUri, mainUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
drawChart();
|
||||
|
||||
$('#categories-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
|
||||
});
|
||||
|
||||
$('#categories-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
|
||||
});
|
||||
|
||||
$('#accounts-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
|
||||
});
|
||||
|
||||
$('#accounts-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function drawChart() {
|
||||
"use strict";
|
||||
|
||||
// month view:
|
||||
doubleYChart(mainUri, 'in-out-chart');
|
||||
|
||||
// draw pie chart of income, depending on "show other transactions too":
|
||||
redrawPieChart(categoryIncomeUri, 'categories-in-pie-chart');
|
||||
redrawPieChart(categoryExpenseUri, 'categories-out-pie-chart');
|
||||
redrawPieChart(accountIncomeUri, 'accounts-in-pie-chart');
|
||||
redrawPieChart(accountExpenseUri, 'accounts-out-pie-chart');
|
||||
|
||||
}
|
||||
|
||||
function redrawPieChart(uri, container) {
|
||||
"use strict";
|
||||
var checkbox = $('#' + container + '-checked');
|
||||
|
||||
var others = '0';
|
||||
// check if box is checked:
|
||||
if (checkbox.prop('checked')) {
|
||||
others = '1';
|
||||
}
|
||||
uri = uri.replace('OTHERS', others);
|
||||
|
||||
pieChart(uri, container);
|
||||
|
||||
}
|
||||
1
public/v1/js/ff/reports/default/.htaccess
Normal file
1
public/v1/js/ff/reports/default/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
35
public/v1/js/ff/reports/default/all.js
vendored
Normal file
35
public/v1/js/ff/reports/default/all.js
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* all.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: accountReportUri, incomeReportUri, expenseReportUri, incExpReportUri, startDate, endDate, accountIds */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
// load the account report, which this report shows:
|
||||
loadAjaxPartial('accountReport', accountReportUri);
|
||||
|
||||
// load income and expense reports:
|
||||
loadAjaxPartial('incomeReport', incomeReportUri);
|
||||
loadAjaxPartial('expenseReport', expenseReportUri);
|
||||
loadAjaxPartial('incomeVsExpenseReport', incExpReportUri);
|
||||
|
||||
});
|
||||
31
public/v1/js/ff/reports/default/month.js
vendored
Normal file
31
public/v1/js/ff/reports/default/month.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* month.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: categoryReportUri, budgetReportUri, balanceReportUri, accountChartUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
lineChart(accountChartUri, 'account-balances-chart');
|
||||
|
||||
loadAjaxPartial('categoryReport', categoryReportUri);
|
||||
loadAjaxPartial('budgetReport', budgetReportUri);
|
||||
loadAjaxPartial('balanceReport', balanceReportUri);
|
||||
});
|
||||
|
||||
33
public/v1/js/ff/reports/default/multi-year.js
vendored
Normal file
33
public/v1/js/ff/reports/default/multi-year.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* multi-year.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: budgetPeriodReportUri, categoryExpenseUri, categoryIncomeUri, netWorthUri, opChartUri, sumChartUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
lineChart(netWorthUri, 'net-worth');
|
||||
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||
|
||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
||||
loadAjaxPartial('categoryIncome', categoryIncomeUri);
|
||||
});
|
||||
|
||||
33
public/v1/js/ff/reports/default/year.js
vendored
Normal file
33
public/v1/js/ff/reports/default/year.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* year.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: budgetPeriodReportUri, categoryExpenseUri, categoryIncomeUri, netWorthUri, opChartUri, sumChartUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
lineChart(netWorthUri, 'net-worth');
|
||||
columnChartCustomColours(opChartUri, 'income-expenses-chart');
|
||||
columnChartCustomColours(sumChartUri, 'income-expenses-sum-chart');
|
||||
|
||||
loadAjaxPartial('budgetPeriodReport', budgetPeriodReportUri);
|
||||
loadAjaxPartial('categoryExpense', categoryExpenseUri);
|
||||
loadAjaxPartial('categoryIncome', categoryIncomeUri);
|
||||
});
|
||||
|
||||
182
public/v1/js/ff/reports/index.js
vendored
Normal file
182
public/v1/js/ff/reports/index.js
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* index.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: minDate, nonSelectedText, allSelectedText, filterPlaceholder, nSelectedText, selectAllText */
|
||||
|
||||
var defaultMultiSelect = {
|
||||
disableIfEmpty: true,
|
||||
selectAllText: selectAllText,
|
||||
nonSelectedText: nonSelectedText,
|
||||
nSelectedText: nSelectedText,
|
||||
allSelectedText: allSelectedText,
|
||||
includeSelectAllOption: true,
|
||||
enableFiltering: true,
|
||||
enableCaseInsensitiveFiltering: true,
|
||||
filterPlaceholder: filterPlaceholder
|
||||
};
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
|
||||
if ($('#inputDateRange').length > 0) {
|
||||
|
||||
$('#inputDateRange').daterangepicker(
|
||||
{
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD',
|
||||
firstDay: 1
|
||||
},
|
||||
minDate: minDate,
|
||||
drops: 'up'
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// set report type from cookie, if any:
|
||||
if (!(readCookie('report-type') === null)) {
|
||||
$('select[name="report_type"]').val(readCookie('report-type'));
|
||||
}
|
||||
|
||||
// set accounts from cookie
|
||||
if ((readCookie('report-accounts') !== null)) {
|
||||
var arr = readCookie('report-accounts').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('#inputAccounts').find('option[value="' + val + '"]').prop('selected', true);
|
||||
});
|
||||
}
|
||||
|
||||
// make account select a hip new bootstrap multi-select thing.
|
||||
$('#inputAccounts').multiselect(defaultMultiSelect);
|
||||
|
||||
// set date from cookie
|
||||
var startStr = readCookie('report-start');
|
||||
var endStr = readCookie('report-end');
|
||||
if (startStr !== null && endStr !== null && startStr.length === 8 && endStr.length === 8) {
|
||||
var startDate = moment(startStr, "YYYY-MM-DD");
|
||||
var endDate = moment(endStr, "YYYY-MM-DD");
|
||||
var datePicker = $('#inputDateRange').data('daterangepicker');
|
||||
datePicker.setStartDate(startDate);
|
||||
datePicker.setEndDate(endDate);
|
||||
}
|
||||
}
|
||||
|
||||
$('.date-select').on('click', preSelectDate);
|
||||
$('#report-form').on('submit', catchSubmit);
|
||||
$('select[name="report_type"]').on('change', getReportOptions);
|
||||
getReportOptions();
|
||||
|
||||
});
|
||||
|
||||
function getReportOptions() {
|
||||
"use strict";
|
||||
var reportType = $('select[name="report_type"]').val();
|
||||
var boxBody = $('#extra-options');
|
||||
var box = $('#extra-options-box');
|
||||
boxBody.empty();
|
||||
box.find('.overlay').show();
|
||||
|
||||
$.getJSON('reports/options/' + reportType, function (data) {
|
||||
boxBody.html(data.html);
|
||||
setOptionalFromCookies();
|
||||
box.find('.overlay').hide();
|
||||
}).fail(function () {
|
||||
boxBody.addClass('error');
|
||||
box.find('.overlay').hide();
|
||||
});
|
||||
}
|
||||
|
||||
function setOptionalFromCookies() {
|
||||
var arr;
|
||||
// categories
|
||||
if ((readCookie('report-categories') !== null)) {
|
||||
arr = readCookie('report-categories').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('#inputCategories').find('option[value="' + encodeURI(val) + '"]').prop('selected', true);
|
||||
});
|
||||
}
|
||||
$('#inputCategories').multiselect(defaultMultiSelect);
|
||||
|
||||
// and budgets!
|
||||
if ((readCookie('report-budgets') !== null)) {
|
||||
arr = readCookie('report-budgets').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('#inputBudgets').find('option[value="' + encodeURI(val) + '"]').prop('selected', true);
|
||||
});
|
||||
}
|
||||
$('#inputBudgets').multiselect(defaultMultiSelect);
|
||||
|
||||
// and tags!
|
||||
if ((readCookie('report-tags') !== null)) {
|
||||
arr = readCookie('report-tags').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('#inputTags').find('option[value="' + encodeURI(val) + '"]').prop('selected', true);
|
||||
});
|
||||
}
|
||||
$('#inputTags').multiselect(defaultMultiSelect);
|
||||
|
||||
// and expense/revenue thing
|
||||
if ((readCookie('report-exp-rev') !== null)) {
|
||||
arr = readCookie('report-exp-rev').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('#inputExpRevAccounts').find('option[value="' + encodeURI(val) + '"]').prop('selected', true);
|
||||
});
|
||||
}
|
||||
$('#inputExpRevAccounts').multiselect(defaultMultiSelect);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function catchSubmit() {
|
||||
"use strict";
|
||||
// date, processed:
|
||||
var picker = $('#inputDateRange').data('daterangepicker');
|
||||
|
||||
// all account ids:
|
||||
var accounts = $('#inputAccounts').val();
|
||||
var categories = $('#inputCategories').val();
|
||||
var budgets = $('#inputBudgets').val();
|
||||
var tags = $('#inputTags').val();
|
||||
var expRev = $('#inputExpRevAccounts').val();
|
||||
|
||||
// remember all
|
||||
// set cookie to remember choices.
|
||||
createCookie('report-type', $('select[name="report_type"]').val(), 365);
|
||||
createCookie('report-accounts', accounts, 365);
|
||||
createCookie('report-categories', categories, 365);
|
||||
createCookie('report-budgets', budgets, 365);
|
||||
createCookie('report-tags', tags, 365);
|
||||
createCookie('report-exp-rev', expRev, 365);
|
||||
createCookie('report-start', moment(picker.startDate).format("YYYYMMDD"), 365);
|
||||
createCookie('report-end', moment(picker.endDate).format("YYYYMMDD"), 365);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function preSelectDate(e) {
|
||||
"use strict";
|
||||
var link = $(e.target);
|
||||
var picker = $('#inputDateRange').data('daterangepicker');
|
||||
picker.setStartDate(moment(link.data('start'), "YYYY-MM-DD"));
|
||||
picker.setEndDate(moment(link.data('end'), "YYYY-MM-DD"));
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
1
public/v1/js/ff/reports/tag/.htaccess
Normal file
1
public/v1/js/ff/reports/tag/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Options -Indexes
|
||||
78
public/v1/js/ff/reports/tag/month.js
vendored
Normal file
78
public/v1/js/ff/reports/tag/month.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* month.js
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** global: tagIncomeUri, tagExpenseUri, accountIncomeUri, accountExpenseUri, tagBudgetUri, tagCategoryUri, mainUri */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
drawChart();
|
||||
|
||||
$('#tags-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('tags-in-pie-chart', tagIncomeUri);
|
||||
});
|
||||
|
||||
$('#tags-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('tags-out-pie-chart', tagExpenseUri);
|
||||
});
|
||||
|
||||
$('#accounts-in-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
|
||||
});
|
||||
|
||||
$('#accounts-out-pie-chart-checked').on('change', function () {
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
});
|
||||
|
||||
// two extra charts:
|
||||
pieChart(tagBudgetUri, 'budgets-out-pie-chart');
|
||||
pieChart(tagCategoryUri, 'categories-out-pie-chart');
|
||||
|
||||
});
|
||||
|
||||
|
||||
function drawChart() {
|
||||
"use strict";
|
||||
|
||||
// month view:
|
||||
doubleYChart(mainUri, 'in-out-chart');
|
||||
|
||||
// draw pie chart of income, depending on "show other transactions too":
|
||||
redrawPieChart('tags-in-pie-chart', tagIncomeUri);
|
||||
redrawPieChart('tags-out-pie-chart', tagExpenseUri);
|
||||
redrawPieChart('accounts-in-pie-chart', accountIncomeUri);
|
||||
redrawPieChart('accounts-out-pie-chart', accountExpenseUri);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function redrawPieChart(container, uri) {
|
||||
"use strict";
|
||||
var checkbox = $('#' + container + '-checked');
|
||||
|
||||
var others = '0';
|
||||
// check if box is checked:
|
||||
if (checkbox.prop('checked')) {
|
||||
others = '1';
|
||||
}
|
||||
uri = uri.replace('OTHERS', others);
|
||||
|
||||
pieChart(uri, container);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user