mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Refactor period blocks.
This commit is contained in:
@@ -134,32 +134,7 @@
|
||||
</div>
|
||||
{% if periods.count > 0 %}
|
||||
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
|
||||
{% for period in periods %}
|
||||
{% if (period.spent != 0 or period.earned != 0) %}
|
||||
<div class="box {% if period.date == end %}box-solid box-primary{% endif %}">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><a href="{{ route('accounts.show',[account.id,period.start,period.end]) }}">{{ period.name }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover">
|
||||
{% if period.spent != 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'spent'|_ }}</td>
|
||||
<td style="text-align: right;">{{ formatAmountByCurrency(currency, period.spent) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if period.earned != 0 %}
|
||||
<tr>
|
||||
<td style="width: 33%;">{{ 'earned'|_ }}</td>
|
||||
<td style="text-align: right;">{{ formatAmountByCurrency(currency, period.earned) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% include 'list.periods' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@@ -42,28 +42,7 @@
|
||||
|
||||
{% if periods.count > 0 %}
|
||||
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
|
||||
{% for period in periods %}
|
||||
{% if period.count > 0 %}
|
||||
<div class="box {% if period.date == start %}box-solid box-primary{% endif %}">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><a href="{{ route('budgets.no-budget',[period.start.format('Y-m-d'), period.end.format('Y-m-d')]) }}">{{ period.name }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover">
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'transactions'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'spent'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.sum|formatAmount }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% include 'list.periods' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@@ -87,44 +87,7 @@
|
||||
</div>
|
||||
{% if periods.count > 0 %}
|
||||
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
|
||||
{% for period in periods %}
|
||||
{% if period.spent != 0 or period.earned != 0 or period.sum != 0 %}
|
||||
<div class="box {% if period.date == end %}box-solid box-primary{% endif %}">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><a href="{{ route('categories.show',[category.id, period.start.format('Y-m-d'),period.end.format('Y-m-d')]) }}">{{ period.name }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover">
|
||||
{% if period.spent != 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'spent'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.spent|formatAmount }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if period.earned != 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'earned'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.earned|formatAmount }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if period.earned != 0 and period.spent != 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'sum'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.sum|formatAmount }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if period.transferred != 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'transferred'|_ }}</td>
|
||||
<td style="text-align: right;" class="text-info">{{ period.transferred|formatAmountPlain }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% include 'list.periods' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
44
resources/views/list/periods.twig
Normal file
44
resources/views/list/periods.twig
Normal file
@@ -0,0 +1,44 @@
|
||||
{% for period in periods %}
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"><a href="{{ period.route }}">{{ period.title }}</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-hover">
|
||||
{% if period.transactions > 0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'transactions'|_ }}</td>
|
||||
<td style="text-align: right;">{{ period.transactions }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for arr in period.spent %}
|
||||
{% if arr.amount !=0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'spent'|_ }}</td>
|
||||
<td style="text-align: right;">{{ formatAmountByCurrency(arr.currency, arr.amount) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% for arr in period.earned %}
|
||||
{% if arr.amount !=0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'earned'|_ }}</td>
|
||||
<td style="text-align: right;">{{ formatAmountByCurrency(arr.currency, arr.amount) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% for arr in period.transferred %}
|
||||
{% if arr.amount !=0 %}
|
||||
<tr>
|
||||
<td style="width:33%;">{{ 'transferred'|_ }}</td>
|
||||
<td style="text-align: right;"><span class="text-info">{{ formatAmountByCurrency(arr.currency, arr.amount, false) }}</span></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
Reference in New Issue
Block a user