mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Updated budget view.
This commit is contained in:
@@ -190,6 +190,7 @@ class BudgetController extends Controller
|
|||||||
$next->addDay();
|
$next->addDay();
|
||||||
$prev = clone $start;
|
$prev = clone $start;
|
||||||
$prev->subDay();
|
$prev->subDay();
|
||||||
|
$prev = Navigation::startOfPeriod($prev, $range);
|
||||||
|
|
||||||
|
|
||||||
$this->repository->cleanupBudgets();
|
$this->repository->cleanupBudgets();
|
||||||
@@ -205,6 +206,32 @@ class BudgetController extends Controller
|
|||||||
$spent = array_sum(array_column($budgetInformation, 'spent'));
|
$spent = array_sum(array_column($budgetInformation, 'spent'));
|
||||||
$budgeted = array_sum(array_column($budgetInformation, 'budgeted'));
|
$budgeted = array_sum(array_column($budgetInformation, 'budgeted'));
|
||||||
|
|
||||||
|
// select thing for last 12 periods:
|
||||||
|
$previousLoop = [];
|
||||||
|
$previousDate = clone $start;
|
||||||
|
$count = 0;
|
||||||
|
while ($count < 12) {
|
||||||
|
$previousDate->subDay();
|
||||||
|
$previousDate = Navigation::startOfPeriod($previousDate, $range);
|
||||||
|
$format = $previousDate->format('Y-m-d');
|
||||||
|
$previousLoop[$format] = Navigation::periodShow($previousDate, $range);
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// select thing for next 12 periods:
|
||||||
|
$nextLoop = [];
|
||||||
|
$nextDate = clone $end;
|
||||||
|
$nextDate->addDay();
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
while ($count < 12) {
|
||||||
|
$format = $nextDate->format('Y-m-d');
|
||||||
|
$nextLoop[$format] = Navigation::periodShow($nextDate, $range);
|
||||||
|
$nextDate = Navigation::endOfPeriod($nextDate, $range);
|
||||||
|
$count++;
|
||||||
|
$nextDate->addDay();
|
||||||
|
}
|
||||||
|
|
||||||
// display info
|
// display info
|
||||||
$currentMonth = Navigation::periodShow($start, $range);
|
$currentMonth = Navigation::periodShow($start, $range);
|
||||||
$nextText = Navigation::periodShow($next, $range);
|
$nextText = Navigation::periodShow($next, $range);
|
||||||
@@ -214,7 +241,7 @@ class BudgetController extends Controller
|
|||||||
'budgets.index',
|
'budgets.index',
|
||||||
compact(
|
compact(
|
||||||
'available', 'currentMonth', 'next', 'nextText', 'prev', 'prevText', 'periodStart', 'periodEnd', 'budgetInformation', 'inactive', 'budgets',
|
'available', 'currentMonth', 'next', 'nextText', 'prev', 'prevText', 'periodStart', 'periodEnd', 'budgetInformation', 'inactive', 'budgets',
|
||||||
'spent', 'budgeted'
|
'spent', 'budgeted', 'previousLoop', 'nextLoop', 'start'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* See the LICENSE file for details.
|
* See the LICENSE file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** global: spent, budgeted, available, currencySymbol */
|
/** global: spent, budgeted, available, currencySymbol, budgetIndexURI */
|
||||||
|
|
||||||
function drawSpentBar() {
|
function drawSpentBar() {
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -99,6 +99,15 @@ $(function () {
|
|||||||
*/
|
*/
|
||||||
$('input[type="number"]').on('input', updateBudgetedAmounts);
|
$('input[type="number"]').on('input', updateBudgetedAmounts);
|
||||||
|
|
||||||
|
//
|
||||||
|
$('.selectPeriod').change(function (e) {
|
||||||
|
var sel = $(e.target).val();
|
||||||
|
if (sel !== "x") {
|
||||||
|
var newURI = budgetIndexURI.replace("REPLACE", sel);
|
||||||
|
window.location.assign(newURI);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateIncome() {
|
function updateIncome() {
|
||||||
|
@@ -20,6 +20,7 @@ return [
|
|||||||
'everything' => 'Everything',
|
'everything' => 'Everything',
|
||||||
'customRange' => 'Custom range',
|
'customRange' => 'Custom range',
|
||||||
'apply' => 'Apply',
|
'apply' => 'Apply',
|
||||||
|
'select_date' => 'Select date..',
|
||||||
'cancel' => 'Cancel',
|
'cancel' => 'Cancel',
|
||||||
'from' => 'From',
|
'from' => 'From',
|
||||||
'to' => 'To',
|
'to' => 'To',
|
||||||
@@ -112,8 +113,8 @@ return [
|
|||||||
'budget_in_period' => 'All transactions for budget ":name" between :start and :end',
|
'budget_in_period' => 'All transactions for budget ":name" between :start and :end',
|
||||||
'chart_budget_in_period' => 'Chart for all transactions for budget ":name" between :start and :end',
|
'chart_budget_in_period' => 'Chart for all transactions for budget ":name" between :start and :end',
|
||||||
'chart_account_in_period' => 'Chart for all transactions for account ":name" between :start and :end',
|
'chart_account_in_period' => 'Chart for all transactions for account ":name" between :start and :end',
|
||||||
'chart_category_in_period' => 'Chart for all transactions for category ":name" between :start and :end',
|
'chart_category_in_period' => 'Chart for all transactions for category ":name" between :start and :end',
|
||||||
'chart_category_all' => 'Chart for all transactions for category ":name"',
|
'chart_category_all' => 'Chart for all transactions for category ":name"',
|
||||||
'budget_in_period_breadcrumb' => 'Between :start and :end',
|
'budget_in_period_breadcrumb' => 'Between :start and :end',
|
||||||
'clone_withdrawal' => 'Clone this withdrawal',
|
'clone_withdrawal' => 'Clone this withdrawal',
|
||||||
'clone_deposit' => 'Clone this deposit',
|
'clone_deposit' => 'Clone this deposit',
|
||||||
|
@@ -98,20 +98,26 @@
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-2">
|
<div class="col-lg-2">
|
||||||
<select class="form-control">
|
<select class="form-control selectPeriod" name="previous">
|
||||||
<option>x</option>
|
<option label="{{ 'select_date'|_ }}" value="x">{{ 'select_date'|_ }}</option>
|
||||||
|
{% for format, previousLabel in previousLoop %}
|
||||||
|
<option label="{{ previousLabel }}" value="{{ format }}">{{ previousLabel }}</option>
|
||||||
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-8 text-center">
|
<div class="col-lg-8 text-center">
|
||||||
<div class="btn btn-group btn-group-lg" style="padding-top:0;">
|
<div class="btn btn-group btn-group-lg" style="padding-top:0;">
|
||||||
<a href="{{ route('budgets.index', [prev.format('Y-m-d')]) }}" class="btn btn-default" title="{{ prevText }}">←</a>
|
<a href="{{ route('budgets.index', [prev.format('Y-m-d')]) }}" class="btn btn-default" title="{{ prevText }}">←</a>
|
||||||
<a href="#" class="btn btn-default">{{ currentMonth }}</a>
|
<a href="{{ route('budgets.index', [start.format('Y-m-d')]) }}" class="btn btn-default">{{ currentMonth }}</a>
|
||||||
<a href="{{ route('budgets.index', [next.format('Y-m-d')]) }}" class="btn btn-default" title="{{ nextText }}">→</a>
|
<a href="{{ route('budgets.index', [next.format('Y-m-d')]) }}" class="btn btn-default" title="{{ nextText }}">→</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 text-right">
|
<div class="col-lg-2 text-right">
|
||||||
<select class="form-control">
|
<select class="form-control selectPeriod" name="next">
|
||||||
<option>x</option>
|
<option label="{{ 'select_date'|_ }}" value="x">{{ 'select_date'|_ }}</option>
|
||||||
|
{% for format, nextLabel in nextLoop %}
|
||||||
|
<option label="{{ nextLabel }}" value="{{ format }}">{{ nextLabel }}</option>
|
||||||
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,10 +137,10 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:10%;"> </th>
|
<th style="width:10%;"> </th>
|
||||||
<th>Budget</th>
|
<th>{{ 'budget'|_ }}</th>
|
||||||
<th style="width:25%;">{{ 'budgeted'|_ }}</th>
|
<th style="width:25%;">{{ 'budgeted'|_ }}</th>
|
||||||
<th>Spent</th>
|
<th>{{ 'spent'|_ }}</th>
|
||||||
<th>Left</th>
|
<th>{{ 'left'|_ }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -264,6 +270,7 @@
|
|||||||
// budgeted data:
|
// budgeted data:
|
||||||
var budgeted = {{ budgeted }};
|
var budgeted = {{ budgeted }};
|
||||||
var available = {{ available }};
|
var available = {{ available }};
|
||||||
|
var budgetIndexURI = "{{ route('budgets.index','REPLACE') }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/ff/budgets/index.js"></script>
|
<script type="text/javascript" src="js/ff/budgets/index.js"></script>
|
||||||
|
Reference in New Issue
Block a user