Ajax some report parts.

This commit is contained in:
James Cole
2016-10-30 18:29:26 +01:00
parent 73f87e30c2
commit 7821c52842
10 changed files with 282 additions and 133 deletions

View File

@@ -67,8 +67,17 @@
</div>
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12">
<!-- budgets -->
{% include 'reports/partials/budgets.twig' %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding loading" id="budgetReport">
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="box">
@@ -127,6 +136,7 @@
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
var categoryReportUrl = '{{ route('reports.data.categoryReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
var balanceReportUrl = '{{ route('reports.data.balanceReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
var budgetReportUrl = '{{ route('reports.data.budgetReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
</script>
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>
<script type="text/javascript" src="js/ff/reports/default/month.js"></script>

View File

@@ -90,32 +90,7 @@
<div class="box-header with-border">
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>&nbsp;</th>
{% for date, header in budgets.get('headers') %}
<th>{{ header }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% set spentData = budgets.get('spent') %}
{% for budgetId, budgetName in budgets.get('budgets') %}
<tr>
<th>
<a title="{{ budgetName }}" href="#" data-budget="{{ budgetId }}" class="budget-chart-activate">{{ budgetName }}</a>
</th>
{% for date, header in budgets.get('headers') %}
<td>{{ spentData[budgetId][date]|formatAmount }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<div class="box-body no-padding table-responsive loading" id="budgetOverview">
</div>
</div>
</div>
@@ -150,6 +125,7 @@
<!-- some URL's -->
var accountReportUrl = '{{ route('reports.data.accountReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
var inOutReportUrl = '{{ route('reports.data.inOutReport', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
var budgetYearOverviewUrl = '{{ route('reports.data.budgetYearOverview', [start.format('Ymd'), end.format('Ymd'), accountIds]) }}';
</script>
<script type="text/javascript" src="js/ff/reports/default/all.js"></script>

View File

@@ -0,0 +1,25 @@
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>&nbsp;</th>
{% for date, header in budgets.get('headers') %}
<th>{{ header }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% set spentData = budgets.get('spent') %}
{% for budgetId, budgetName in budgets.get('budgets') %}
<tr>
<th>
<a title="{{ budgetName }}" href="#" data-budget="{{ budgetId }}" class="budget-chart-activate">{{ budgetName }}</a>
</th>
{% for date, header in budgets.get('headers') %}
<td>{{ spentData[budgetId][date]|formatAmount }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -1,87 +1,79 @@
<div class="box">
<table class="table table-hover">
<thead>
<tr>
<th>{{ 'budget'|_ }}</th>
<th>{{ 'date'|_ }}</th>
<th>{{ 'budgeted'|_ }}</th>
<th>{{ 'spent'|_ }}</th>
<th>{{ 'left'|_ }}</th>
<th>{{ 'overspent'|_ }}</th>
</tr>
</thead>
<tbody>
{% for budgetLine in budgets.getBudgetLines %}
<tr>
<td>
{% if budgetLine.getBudget.id %}
<a href="{{ route('budgets.show',budgetLine.getBudget.id) }}">{{ budgetLine.getBudget.name }}</a>
{% else %}
<em>{{ 'no_budget'|_ }}</em>
{% endif %}
</td>
<td>
{% if budgetLine.getRepetition.id %}
<a href="{{ route('budgets.showWithRepetition', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">
{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}
&mdash;
{{ budgetLine.getRepetition.enddate.formatLocalized(monthAndDayFormat) }}
</a>
{% endif %}
</td>
<td>
{% if budgetLine.getRepetition.id %}
{{ budgetLine.getRepetition.amount|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
<td>
{% if budgetLine.getSpent != 0 %}
{{ budgetLine.getSpent|formatAmount }} <i class="fa fa-fw text-muted fa-info-circle firefly-info-button"
data-location="budget-spent-amount" data-budget-id="{{ budgetLine.getBudget.id }}"
></i>
{% endif %}
<div class="box-header with-border">
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<thead>
<tr>
<th>{{ 'budget'|_ }}</th>
<th>{{ 'date'|_ }}</th>
<th>{{ 'budgeted'|_ }}</th>
<th>{{ 'spent'|_ }}</th>
<th>{{ 'left'|_ }}</th>
<th>{{ 'overspent'|_ }}</th>
</tr>
</thead>
<tbody>
{% for budgetLine in budgets.getBudgetLines %}
<tr>
<td>
{% if budgetLine.getBudget.id %}
<a href="{{ route('budgets.show',budgetLine.getBudget.id) }}">{{ budgetLine.getBudget.name }}</a>
{% else %}
<em>{{ 'no_budget'|_ }}</em>
{% endif %}
</td>
<td>
{% if budgetLine.getRepetition.id %}
<a href="{{ route('budgets.showWithRepetition', [budgetLine.getBudget.id, budgetLine.getRepetition.id]) }}">
{{ budgetLine.getRepetition.startdate.formatLocalized(monthAndDayFormat) }}
&mdash;
{{ budgetLine.getRepetition.enddate.formatLocalized(monthAndDayFormat) }}
</a>
{% endif %}
</td>
<td>
{% if budgetLine.getRepetition.id %}
{{ budgetLine.getRepetition.amount|formatAmount }}
{% else %}
{{ 0|formatAmount }}
{% endif %}
</td>
<td>
{% if budgetLine.getSpent != 0 %}
{{ budgetLine.getSpent|formatAmount }} <i class="fa fa-fw text-muted fa-info-circle firefly-info-button"
data-location="budget-spent-amount" data-budget-id="{{ budgetLine.getBudget.id }}"
></i>
{% endif %}
{% if budgetLine.getSpent == 0 %}
{{ budgetLine.getSpent|formatAmount }}
{% endif %}
{% if budgetLine.getSpent == 0 %}
{{ budgetLine.getSpent|formatAmount }}
{% endif %}
</td>
<td>
{% if(budgetLine.getOverspent == 0) %}
{{ budgetLine.getLeft|formatAmount }}
{% endif %}
</td>
<td>
{% if budgetLine.getOverspent != 0 %}
{{ budgetLine.getOverspent|formatAmount }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="2"><em>{{ 'sum'|_ }}</em></td>
<td>{{ budgets.getBudgeted|formatAmount }}</td>
<td>
{% if budgets.getSpent != 0 %}
<span class="text-danger">{{ budgets.getSpent|formatAmountPlain }}</span>
{% endif %}
{% if budgets.getSpent == 0 %}
{{ budgets.getSpent|formatAmount }}
{% endif %}
</td>
<td>{{ budgets.getLeft|formatAmount }}</td>
<td><span class="text-danger">{{ budgets.getOverspent|formatAmountPlain }}</span></td>
</tr>
</tfoot>
</table>
</div>
</div>
</td>
<td>
{% if(budgetLine.getOverspent == 0) %}
{{ budgetLine.getLeft|formatAmount }}
{% endif %}
</td>
<td>
{% if budgetLine.getOverspent != 0 %}
{{ budgetLine.getOverspent|formatAmount }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="2"><em>{{ 'sum'|_ }}</em></td>
<td>{{ budgets.getBudgeted|formatAmount }}</td>
<td>
{% if budgets.getSpent != 0 %}
<span class="text-danger">{{ budgets.getSpent|formatAmountPlain }}</span>
{% endif %}
{% if budgets.getSpent == 0 %}
{{ budgets.getSpent|formatAmount }}
{% endif %}
</td>
<td>{{ budgets.getLeft|formatAmount }}</td>
<td><span class="text-danger">{{ budgets.getOverspent|formatAmountPlain }}</span></td>
</tr>
</tfoot>
</table>