Some code to get #384 working.

This commit is contained in:
James Cole
2017-12-10 17:55:06 +01:00
parent b93a96db23
commit 54c449f11b
7 changed files with 469 additions and 10 deletions

View File

@@ -0,0 +1,36 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsign="az">{{ 'category'|_ }}</th>
<th style="text-align: right;">{{ 'spent'|_ }}</th>
<th style="text-align: right;">{{ 'earned'|_ }}</th>
</tr>
</thead>
<tbody>
{% for categoryId, entry in together %}
<tr>
<td data-value="{% if entry.category.name|length ==0 %}{{ 'noCategory'|_ }}{% else %}{{ entry.category.name }}{% endif %}">
<a href="{{ route('categories.show', categoryId) }}">{% if entry.category.name|length ==0 %}{{ 'noCategory'|_ }}{% else %}{{ entry.category.name }}{% endif %}</a>
</td>
<td style="text-align: right;">
{% if entry.spent|length ==0 %}
{{ '0'|formatAmount }}
{% else %}
{% for expense in entry.spent %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %}
{% endif %}
</td>
<td style="width:20px;">
{% if entry.earned|length ==0 %}
{{ '0'|formatAmount }}
{% else %}
{% for income in entry.earned %}
{{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br />
{% endfor %}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,37 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsign="az">{{ 'name'|_ }}</th>
<th data-defaultsign="az">{{ 'period'|_ }}</th>
<th class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'spent'|_ }}</th>
<th class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'earned'|_ }}</th>
</tr>
</thead>
<tbody>
{% for name, periods in result %}
{% for periodIndex, period in periods %}
<tr>
<td>{{ name }}</td>
<td data-value="{{ periodIndex }}">{{ period.period }}</td>
<td style="text-align: right;" >
{% if period.spent|length == 0%}
{{ '0'|formatAmount }}
{% endif %}
{% for expense in period.spent %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %}
</td>
<td style="text-align: right;" >
{% if period.earned|length == 0 %}
{{ '0'|formatAmount }}
{% endif %}
{% for income in period.earned %}
{{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br />
{% endfor %}
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,33 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th data-defaultsign="az">{{ 'name'|_ }}</th>
<th class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'spent'|_ }}</th>
<th class="hidden-xs" style="text-align: right;" data-defaultsort="disabled">{{ 'earned'|_ }}</th>
</tr>
</thead>
<tbody>
{% for name, amounts in result %}
<tr>
<td>{{ name }}</td>
<td style="text-align: right;" >
{% if amounts.spent|length == 0%}
{{ '0'|formatAmount }}
{% endif %}
{% for expense in amounts.spent %}
{{ formatAmountBySymbol(expense.sum, expense.currency.symbol, expense.currency.dp) }}<br />
{% endfor %}
</td>
<td style="text-align: right;" >
{% if amounts.earned|length == 0 %}
{{ '0'|formatAmount }}
{% endif %}
{% for income in amounts.earned %}
{{ formatAmountBySymbol(income.sum, income.currency.symbol, income.currency.dp) }}<br />
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>