mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-10 23:45:48 -06:00
Optimize some views for category report
This commit is contained in:
parent
a294f757ff
commit
c5d2fabfec
@ -20,7 +20,6 @@ use FireflyIII\Helpers\Collector\JournalCollector;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator
|
||||
@ -232,7 +231,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$transactions = $collector->getJournals();
|
||||
$transactions = self::filterExpenses($transactions, $accountIds);
|
||||
|
||||
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@ $(function () {
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// set values from cookies, if any:
|
||||
if (readCookie('report-type') !== null) {
|
||||
$('select[name="report_type"]').val(readCookie('report-type'));
|
||||
@ -26,7 +25,7 @@ $(function () {
|
||||
if ((readCookie('report-accounts') !== null)) {
|
||||
var arr = readCookie('report-accounts').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('input[type="checkbox"][value="' + val + '"]').prop('checked', true);
|
||||
$('input[class="account-checkbox"][type="checkbox"][value="' + val + '"]').prop('checked', true);
|
||||
});
|
||||
}
|
||||
|
||||
@ -55,13 +54,24 @@ function getReportOptions() {
|
||||
$('#extra-options').empty();
|
||||
$('#extra-options').addClass('loading');
|
||||
console.log('Changed report type to ' + reportType);
|
||||
|
||||
$.getJSON('reports/options/' + reportType, function (data) {
|
||||
$('#extra-options').removeClass('loading').html(data.html);
|
||||
setOptionalFromCookies();
|
||||
}).fail(function () {
|
||||
$('#extra-options').removeClass('loading').addClass('error');
|
||||
});
|
||||
}
|
||||
|
||||
function setOptionalFromCookies() {
|
||||
if ((readCookie('report-categories') !== null)) {
|
||||
var arr = readCookie('report-categories').split(',');
|
||||
arr.forEach(function (val) {
|
||||
$('input[class="category-checkbox"][type="checkbox"][value="' + val + '"]').prop('checked', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function catchSubmit() {
|
||||
"use strict";
|
||||
// date, processed:
|
||||
@ -78,7 +88,15 @@ function catchSubmit() {
|
||||
}
|
||||
});
|
||||
|
||||
// all category ids to come
|
||||
// all category ids:
|
||||
//category-checkbox
|
||||
var categories = [];
|
||||
$.each($('.category-checkbox'), function (i, v) {
|
||||
var c = $(v);
|
||||
if (c.prop('checked')) {
|
||||
categories.push(c.val());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// remember all
|
||||
@ -86,6 +104,7 @@ function catchSubmit() {
|
||||
// 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-start', moment(picker.startDate).format("YYYYMMDD"), 365);
|
||||
createCookie('report-end', moment(picker.endDate).format("YYYYMMDD"), 365);
|
||||
}
|
||||
|
@ -669,6 +669,7 @@ return [
|
||||
'report_type' => 'Report type',
|
||||
'report_type_default' => 'Default financial report',
|
||||
'report_type_audit' => 'Transaction history overview (audit)',
|
||||
'report_type_category' => 'Category report',
|
||||
'report_type_meta-history' => 'Categories, budgets and bills overview',
|
||||
'more_info_help' => 'More information about these types of reports can be found in the help pages. Press the (?) icon in the top right corner.',
|
||||
'report_included_accounts' => 'Included accounts',
|
||||
|
@ -3,6 +3,6 @@
|
||||
</p>
|
||||
{% for category in categories %}
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="category[]" value="{{ category.id }}"> {{ category.name }}
|
||||
<input type="checkbox" class="category-checkbox" name="category[]" value="{{ category.id }}"> {{ category.name }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user