firefly-iii/resources/views/categories/show.twig
2017-09-12 19:59:07 +02:00

144 lines
7.1 KiB
Twig

{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category, moment, start, end) }}
{% endblock %}
{% block content %}
<div class="row">
{% if moment != 'all' %}
{# both charts #}
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ trans('firefly.chart_category_in_period', {name: category.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) }) }}
</h3>
</div>
<div class="box-body">
<canvas id="specific-period" style="width:100%;height:400px;" height="400" width="100%"></canvas>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ trans('firefly.chart_category_all', {name: category.name }) }}
</h3>
</div>
<div class="box-body">
<canvas id="category-everything" style="width:100%;height:400px;" height="400" width="100%"></canvas>
</div>
</div>
</div>
{% endif %}
{% if moment == 'all' %}
{# all chart #}
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">
{{ trans('firefly.chart_category_all', {name: category.name }) }}
</h3>
</div>
<div class="box-body">
<canvas id="category-everything" style="width:100%;height:400px;" height="400" width="100%"></canvas>
</div>
</div>
</div>
{% endif %}
</div>
{% if periods.count > 0 %}
<div class="row">
<div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('categories.show',[category.id,'all']) }}">{{ 'showEverything'|_ }}</a></p>
</div>
</div>
{% endif %}
<div class="row">
<div class="{% if periods.count > 0 %}col-lg-10 col-md-8 col-sm-12 col-xs-12{% else %}col-lg-12 col-md-12 col-sm-12 col-xs-12{% endif %}">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body">
{% include 'list.journals' with {hideCategories: true, hideBills: true} %}
{% if periods.count > 0 %}
<p>
<i class="fa fa-calendar"></i>
<a href="{{ route('categories.show', [category.id,'all']) }}">
{{ 'show_all_no_filter'|_ }}
</a>
</p>
{% else %}
<p>
<i class="fa fa-calendar"></i>
<a href="{{ route('categories.show', [category.id]) }}">
{{ 'show_the_current_period_and_overview'|_ }}
</a>
</p>
{% endif %}
</div>
</div>
</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 == start %}box-solid box-primary{% endif %}">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('categories.show',[category.id,period.string]) }}">{{ 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 %}
</div>
{% endif %}
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var current = '{{ route('chart.category.current', [category.id]) }}';
var everything = '{{ route('chart.category.all', [category.id]) }}';
var specific = '{{ route('chart.category.specific', [category.id, start.format('Ymd')]) }}';
</script>
<script type="text/javascript" src="js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/charts.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/categories/show.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="js/ff/transactions/list.js?v={{ FF_VERSION }}"></script>
{% endblock %}