firefly-iii/resources/twig/budgets/show.twig

127 lines
6.2 KiB
Twig
Raw Normal View History

2015-05-02 02:06:07 -05:00
{% extends "./layout/default.twig" %}
2015-06-19 13:59:14 -05:00
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, budget, repetition) }}
{% endblock %}
2015-05-02 02:06:07 -05:00
{% block content %}
2015-06-27 01:06:24 -05:00
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-7">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'overview'|_ }}</h3>
2015-05-02 02:06:07 -05:00
2015-06-27 01:06:24 -05:00
<!-- ACTIONS MENU -->
<div class="pull-right">
<div class="btn-group">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
{{ 'actions'|_ }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="{{ route('budgets.edit',budget.id) }}"><i class="fa fa-pencil fa-fw"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('budgets.delete',budget.id) }}"><i class="fa fa-trash fa-fw"></i> {{ 'delete'|_ }}</a></li>
</ul>
</div>
2015-05-02 02:06:07 -05:00
</div>
</div>
2015-06-27 01:06:24 -05:00
<div class="box-body">
2015-06-27 13:39:50 -05:00
{% if Config.get('firefly.chart') == 'google' %}
<div id="budgetOverview"></div>
{% endif %}
{% if Config.get('firefly.chart') == 'chartjs' %}
<canvas id="budgetOverview" style="width:100%;height:400px;"></canvas>
{% endif %}
2015-06-27 01:06:24 -05:00
</div>
2015-05-02 02:06:07 -05:00
</div>
2015-06-27 01:06:24 -05:00
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
{% include 'list/journals.twig' %}
2015-05-02 02:06:07 -05:00
</div>
</div>
2015-06-27 01:06:24 -05:00
<div class="col-lg-3 col-md-3 col-sm-5">
{% if limits|length == 1 %}
<p class="small text-center"><a href="{{ route('budgets.show',budget.id) }}">{{ 'showEverything'|_ }}</a></p>
{% endif %}
2015-05-02 02:06:07 -05:00
2015-06-27 01:06:24 -05:00
{% for limit in limits %}
{% for rep in limit.limitRepetitions %}
2015-12-13 03:05:13 -06:00
{% set spentInRep = spentInRepetition(rep) %}
2015-06-27 01:06:24 -05:00
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('budgets.show',[budget.id,rep.id]) }}">{{ rep.startdate.formatLocalized(monthFormat) }}</a>
</h3>
2015-05-02 02:06:07 -05:00
</div>
2015-06-27 01:06:24 -05:00
<div class="box-body">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
{{ 'amount'|_ }}: {{ rep.amount|formatAmount }}
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
{{ 'spent'|_ }}: {{ spentInRep|formatAmount }}
2015-06-27 01:06:24 -05:00
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
2015-12-12 01:12:27 -06:00
{% set overspent = rep.amount + spentInRep < 0 %}
2015-10-03 15:29:34 -05:00
2015-06-27 01:06:24 -05:00
{% if overspent %}
{% set pct = (spentInRep != 0 ? (rep.amount / (spentInRep*-1))*100 : 0) %} <!-- must have -1 here -->
2015-06-27 01:06:24 -05:00
<div class="progress progress-striped">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{{ pct|round }}" aria-valuemin="0"
aria-valuemax="100" style="width: {{ pct|round }}%;"></div>
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="{{ (100-pct)|round }}"
aria-valuemin="0" aria-valuemax="100" style="width: {{ (100-pct)|round }}%;"></div>
</div>
{% else %}
{% set amount = rep.amount %}
{% set pct = (amount != 0 ? (((spentInRep*-1) / amount)*100) : 0) %} <!-- must have -1 here -->
2015-06-27 01:06:24 -05:00
<div class="progress progress-striped">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{{ pct|round }}" aria-valuemin="0"
aria-valuemax="100" style="width: {{ pct|round }}%;"></div>
</div>
{% endif %}
</div>
2015-05-02 02:06:07 -05:00
</div>
</div>
</div>
2015-06-27 01:06:24 -05:00
{% endfor %}
2015-05-02 02:06:07 -05:00
{% endfor %}
2015-06-27 01:06:24 -05:00
{% if limits|length == 1 %}
<p class="small text-center"><a href="{{ route('budgets.show',budget.id) }}">{{ 'showEverything'|_ }}</a></p>
{% endif %}
2015-05-02 02:06:07 -05:00
2015-06-27 01:06:24 -05:00
</div>
2015-05-02 02:06:07 -05:00
</div>
{% endblock %}
{% block scripts %}
2015-06-27 01:06:24 -05:00
<script type="text/javascript">
var budgetID = {{budget.id}};
{% if repetition.id %}
2015-05-02 02:06:07 -05:00
var repetitionID = {{repetition.id}};
var year = {{repetition.startdate.format('Y')}};
2015-06-27 01:06:24 -05:00
{% else %}
2015-05-02 02:06:07 -05:00
var year = {{Session.get('start').format('Y')}};
2015-06-27 01:06:24 -05:00
{% endif %}
2015-05-02 02:06:07 -05:00
2015-06-27 01:06:24 -05:00
</script>
2015-05-02 02:06:07 -05:00
2015-06-27 01:06:24 -05:00
<!-- load the libraries and scripts necessary for Google Charts: -->
2015-06-27 05:04:53 -05:00
{% if Config.get('firefly.chart') == 'google' %}
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/gcharts.js"></script>
{% endif %}
{% if Config.get('firefly.chart') == 'chartjs' %}
<script type="text/javascript" src="js/Chart.min.js"></script>
<script type="text/javascript" src="js/charts.js"></script>
{% endif %}
2015-06-27 01:06:24 -05:00
<script type="text/javascript" src="js/budgets.js"></script>
2015-05-02 02:06:07 -05:00
{% endblock %}