firefly-iii/resources/views/v1/list/bills.twig
2021-02-01 06:38:33 +01:00

211 lines
11 KiB
Twig

<div style="padding-left:8px;">
{{ paginator.links('v1.pagination.bootstrap-4')|raw }}
</div>
<table class="table table-responsive table-hover" id="bill-sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs">&nbsp;</th>
<th class="hidden-sm hidden-xs">&nbsp;</th>
<th>{{ trans('list.name') }}</th>
<th class="hidden-sm hidden-md hidden-xs">{{ trans('list.linked_to_rules') }}</th>
<th style="text-align: right;">{{ trans('list.matchingAmount') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.paid_current_period') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.next_expected_match') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.repeat_freq') }}</th>
</tr>
</thead>
{% for objectGroupOrder, objectGroup in bills %}
{% if objectGroup.bills|length > 0 %}
<tbody class="bill-connected-list" {% if objectGroupOrder != 0 %}data-title="{{ objectGroup.object_group_title }}" {% else %}data-title=""{% endif %}>
<tr>
<td class="hidden-sm hidden-xs">&nbsp;</td>
<td class="hidden-sm hidden-xs">&nbsp;</td>
<td colspan="6"><small>{{ objectGroup.object_group_title }}</small></td>
</tr>
{% for entry in objectGroup.bills %}
<tr class="bill-sortable" data-id="{{ entry.id }}" data-name="{{ entry.name }}" data-order="{{ entry.order }}" data-position="{{ loop.index0 }}">
<td class="hidden-sm hidden-xs">
<i class="fa fa-fw fa-bars bill-handle"></i>
</td>
<td class="hidden-sm hidden-xs">
<div class="btn-group btn-group-xs edit_tr_buttons"><a href="{{ route('bills.edit',entry.id) }}" class="btn btn-default btn-xs"><i
class="fa fa-fw fa-pencil"></i></a><a href="{{ route('bills.delete',entry.id) }}" class="btn btn-danger btn-xs"><i
class="fa fa-fw fa-trash-o"></i></a></div>
</td>
<td>
{% if not entry.active %}
<i class="fa fa-fw fa-ban"></i>
{% endif %}
<a href="{{ route('bills.show',entry.id) }}" title="{{ entry.name }}">{{ entry.name }}</a>
{# count attachments #}
{% if entry.attachments.count() > 0 %}
<i class="fa fa-paperclip"></i>
{% endif %}
</td>
<td class="hidden-sm hidden-md hidden-xs rules">
{% if entry.rules|length > 0 %}
<ul class="list-unstyled">
{% for rule in entry.rules %}
<li>
<a href="{{ route('rules.edit', [rule.id]) }}">
{{ rule.title }}
</a>
{% if not rule.active %}({{ 'list_inactive_rule'|_|lower }}){% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</td>
<td style="text-align: right;">
<span style="margin-right:5px;"
title="{{ formatAmountBySymbol(entry.amount_min, entry.currency_symbol, entry.currency_decimal_places, false)|escape }} -- {{ formatAmountBySymbol(entry.amount_max, entry.currency_symbol, entry.currency_decimal_places, false)|escape }}"
>
~ {{ formatAmountBySymbol((entry.amount_max + entry.amount_min)/2, entry.currency_symbol, entry.currency_decimal_places) }}
</span>
</td>
{#
paidDates = 0 (bill not paid in period)
pay_dates = 0 (bill not expected to be paid in this period)
bill is active.
#}
{% if entry.paid_dates|length == 0 and entry.pay_dates|length == 0 and entry.active %}
<td class="paid_in_period text-muted">
{{ trans('firefly.not_expected_period') }}
</td>
<td class="expected_in_period hidden-sm hidden-xs">
{{ formatDate(entry.next_expected_match, monthAndDayFormat) }}
</td>
{% endif %}
{#
paid_dates = 0 (bill not paid in period)
pay_dates > 0 (bill IS expected to be paid in this period)
bill is active
first pay date is in the past.
#}
{% if entry.paid_dates|length == 0 and entry.pay_dates|length > 0 and entry.active %}
<td class="paid_in_period text-warning">
{{ trans('firefly.bill_expected_date', {date: entry.next_expected_match_diff }) }}
</td>
<td class="expected_in_period hidden-sm hidden-xs">
{% for date in entry.pay_dates %}
{{ formatDate(date, monthAndDayFormat) }}<br>
{% endfor %}
</td>
{% endif %}
{#
paid_dates >= 0 (bill is paid X times).
Don't care about pay_dates.
#}
{% if entry.paid_dates|length > 0 and entry.active %}
<td class="paid_in_period text-success">
{% for currentPaid in entry.paid_dates %}
<a href="{{ route('transactions.show',currentPaid.transaction_group_id) }}">
{{ formatDate(currentPaid.date, monthAndDayFormat) }}
</a>
<br/>
{% endfor %}
</td>
<td class="expected_in_period hidden-sm hidden-xs">
{{ formatDate(entry.next_expected_match, monthAndDayFormat) }}
</td>
{% endif %}
{# bill is not active #}
{% if not entry.active %}
<td class="paid_in_period text-muted">
~
</td>
<td class="expected_in_period text-muted hidden-sm hidden-xs">~</td>
{% endif %}
<td class="hidden-sm hidden-xs">
{{ ('repeat_freq_'~entry.repeat_freq)|_ }}
{% if entry.skip > 0 %}
{{ 'skips_over'|_ }} {{ entry.skip }}
{% endif %}
</td>
</tr>
{% endfor %}
{% for sum in sums[objectGroupOrder] %}
{% if '0' != sum.avg %}
<tr>
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- handle -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- buttons -->
<td colspan="2" style="text-align: right;"> <!-- title -->
<small>{{ 'sum'|_ }} ({{ sum.currency_name }}) ({{ 'active_exp_bills_only'|_ }})</small>
</td>
<td style="text-align: right;"> <!-- amount -->
{{ formatAmountBySymbol(sum.avg, sum.currency_symbol, sum.currency_decimal_places) }}
</td>
<td>&nbsp;</td> <!-- paid in period -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- next expected match -->
<td class="hidden-sm hidden-xs">&nbsp;</td><!-- repeats -->
</tr>
{% endif %}
{% if '0' != sum.per_period %}
<tr>
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- handle -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- buttons -->
<td colspan="2" style="text-align: right;"> <!-- title -->
<small>{{ ('per_period_sum_'~sum.period)|_ }} ({{ sum.currency_name }}) ({{ 'active_bills_only'|_ }})</small>
</td>
<td style="text-align: right;"> <!-- amount -->
{{ formatAmountBySymbol(sum.per_period, sum.currency_symbol, sum.currency_decimal_places) }}
</td>
<td>&nbsp;</td> <!-- paid in period -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- next expected match -->
<td class="hidden-sm hidden-xs">&nbsp;</td><!-- repeats -->
</tr>
{% endif %}
{% endfor %}
</tbody>
{% endif %}
{% endfor %}
{% if totals|length > 0 %}
<tfoot>
<tr>
<td colspan="8" style="border-top:1px #777 solid;"></td>
</tr>
{% for sum in totals %}
{% if '0' != sum.avg %}
<tr>
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- handle -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- buttons -->
<td colspan="2" style="text-align: right;"> <!-- title -->
<small>{{ 'sum'|_ }} ({{ sum.currency_name }}) ({{ 'active_exp_bills_only_total'|_ }})</small>
</td>
<td style="text-align: right;"> <!-- amount -->
{{ formatAmountBySymbol(sum.avg, sum.currency_symbol, sum.currency_decimal_places) }}
</td>
<td>&nbsp;</td> <!-- paid in period -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- next expected match -->
<td class="hidden-sm hidden-xs">&nbsp;</td><!-- repeats -->
</tr>
{% endif %}
{% if '0' != sum.per_period %}
<tr>
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- handle -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- buttons -->
<td colspan="2" style="text-align: right;"> <!-- title -->
<small>{{ ('per_period_sum_'~sum.period)|_ }} ({{ sum.currency_name }}) ({{ 'active_bills_only_total'|_ }})</small>
</td>
<td style="text-align: right;"> <!-- amount -->
{{ formatAmountBySymbol(sum.per_period, sum.currency_symbol, sum.currency_decimal_places) }}
</td>
<td>&nbsp;</td> <!-- paid in period -->
<td class="hidden-sm hidden-xs">&nbsp;</td> <!-- next expected match -->
<td class="hidden-sm hidden-xs">&nbsp;</td><!-- repeats -->
</tr>
{% endif %}
{% endfor %}
</tfoot>
{% endif %}
</table>
<div style="padding-left:8px;">
{{ paginator.links('v1.pagination.bootstrap-4')|raw }}
</div>