Quick links.

This commit is contained in:
James Cole
2015-12-15 12:38:18 +01:00
parent 0303b45707
commit 301528e2d2
7 changed files with 98 additions and 13 deletions

View File

@@ -87,7 +87,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
$accountIds = join(';', $accountIds);
$accountIds = join(',', $accountIds);
return view(
'reports.default.year',
@@ -127,7 +127,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
$accountIds = join(';', $accountIds);
$accountIds = join(',', $accountIds);
// continue!
return view(
@@ -159,7 +159,7 @@ class ReportController extends Controller
foreach ($accounts as $account) {
$accountIds[] = $account->id;
}
$accountIds = join(';', $accountIds);
$accountIds = join(',', $accountIds);
return view(
'reports.default.multi-year', compact('budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'report_type')

View File

@@ -35,7 +35,7 @@ Route::bind(
'accountList',
function ($value) {
if (Auth::check()) {
$ids = explode(';', $value);
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.editable', 1)
@@ -49,6 +49,24 @@ Route::bind(
throw new NotFoundHttpException;
}
);
// budget list
Route::bind(
'budgetList',
function ($value) {
if (Auth::check()) {
$ids = explode(',', $value);
/** @var \Illuminate\Support\Collection $object */
$object = Budget::where('budgets.active', 1)
->whereIn('budgets.id', $ids)
->where('budgets.user_id', Auth::user()->id)
->get(['budgets.*']);
if ($object->count() > 0) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
// Date
Route::bind(
@@ -357,8 +375,8 @@ Route::group(
Route::get('/chart/budget/frontpage', ['uses' => 'Chart\BudgetController@frontpage']);
// this chart is used in reports:
Route::get('/chart/budget/year/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\BudgetController@year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
Route::get('/chart/budget/year/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'Chart\BudgetController@year']);
Route::get('/chart/budget/multi-year/{report_type}/{start_date}/{end_date}/{accountList}/{budgetList}', ['uses' => 'Chart\BudgetController@multiYear']);
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'Chart\BudgetController@budgetLimit']);
Route::get('/chart/budget/{budget}', ['uses' => 'Chart\BudgetController@budget']);

View File

@@ -8,7 +8,6 @@ $(function () {
});
function drawChart() {
"use strict";
@@ -17,10 +16,30 @@ function drawChart() {
columnChart('chart/report/in-out-sum/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart');
$.each($('.account-chart'), function(i,v) {
$.each($('.account-chart'), function (i, v) {
var holder = $(v);
console.log(holder.data('id'));
console.log('Will draw chart for account #' + holder.data('id'));
});
// draw budget chart based on selected budgets:
$('.budget-checkbox').on('change', updateBudgetChart);
}
function updateBudgetChart(e) {
console.log('will update budget chart.');
// get all budget ids:
var budgets = [];
$.each($('.budget-checkbox'), function (i, v) {
var current = $(v);
if (current.prop('checked')) {
budgets.push(current.val());
}
});
var budgetIds = budgets.join(',');
// draw chart. Redraw when exists? Not sure if we support that.
columnChart('chart/budget/multi-year/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds + '/' + budgetIds, 'budgets-chart');
}

View File

@@ -64,7 +64,7 @@ function catchSubmit() {
$.each($('.account-checkbox'), function (i, v) {
var c = $(v);
if (c.prop('checked')) {
url += c.val() + ';';
url += c.val() + ',';
accounts.push(c.val());
count++;
}

View File

@@ -375,7 +375,15 @@ return [
// 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
'report_default' => 'Default financial report for :start until :end',
'quick_link_reports' => 'Quick links',
'quick_link_default_report' => 'Default financial report',
'report_this_month_shared' => 'Current month, all shared accounts',
'report_this_month_non_shared' => 'Current month, all not-shared accounts',
'report_this_year_shared' => 'Current year, all shared accounts',
'report_this_year_non_shared' => 'Current year, all not-shared accounts',
'report_all_time_shared' => 'All-time, all shared accounts',
'report_all_time_non_shared' => 'All-time, all not-shared accounts',
'reports_can_bookmark' => 'Remember that reports can be bookmarked.',
'incomeVsExpenses' => 'Income vs. expenses',
'accountBalances' => 'Account balances',
'balanceStartOfYear' => 'Balance at start of year',

View File

@@ -58,9 +58,12 @@
</div>
<div class="row">
<div class="col-lg-12">
<label class="checkbox-inline">
<input type="checkbox" class="budget-checkbox" name="budgets[]" value="0"> {{ 'noBudget'|_ }}
</label>
{% for budget in budgets %}
<label class="checkbox-inline">
<input type="checkbox" name="budgets[]" value="{{ budget.id }}"> {{ budget.name }}
<input type="checkbox" class="budget-checkbox" name="budgets[]" value="{{ budget.id }}"> {{ budget.name }}
</label>
{% endfor %}
</div>

View File

@@ -82,6 +82,43 @@
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'quick_link_reports'|_ }}</h3>
</div>
<div class="box-body">
<h4>{{ 'quick_link_default_report'|_ }}</h4>
<ul>
<li>
<a href="#">{{ 'report_this_month_shared'|_ }}</a>
</li>
<li>
<a href="#">{{ 'report_this_month_non_shared'|_ }}</a>
</li>
</ul>
<ul>
<li>
<a href="#">{{ 'report_this_year_shared'|_ }}</a>
</li>
<li>
<a href="#">{{ 'report_this_year_non_shared'|_ }}</a>
</li>
</ul>
<ul>
<li>
<a href="#">{{ 'report_all_time_shared'|_ }}</a>
</li>
<li>
<a href="#">{{ 'report_all_time_non_shared'|_ }}</a>
</li>
</ul>
<p>
<em>{{ 'reports_can_bookmark'|_ }}</em>
</p>
</div>
</div>
</div>
</div>
{% endblock %}