Better views for #475

This commit is contained in:
James Cole
2017-01-08 10:19:10 +01:00
parent 6d398a2edf
commit 71e31346e8
6 changed files with 152 additions and 110 deletions

View File

@@ -67,6 +67,13 @@
</div>
</div>
</div>
{% if entries %}
<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('accounts.show.all',[account.id]) }}">{{ 'showEverything'|_ }}</a></p>
</div>
</div>
{% endif %}
<div class="row">
<div class="{% if entries %}col-lg-10 col-md-10 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
@@ -96,22 +103,23 @@
</div>
{% if entries %}
<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
{% for entry in entries %}
{% if entry[2] != 0 or entry[3] != 0 %}
<div class="box">
{% if (entry[2] != 0 or entry[3] != 0) or (accountType == 'Asset account') %}
<div class="box {% if entry[4] == start %}box-solid box-primary{% endif %}">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('accounts.show.date',[account.id,entry[0]]) }}">{{ entry[1] }}</a>
</h3>
</div>
<div class="box-body no-padding">
<table class="table table-hover">
{% if entry[2] != 0 %}
{% if entry[2] != 0 or (accountType == 'Asset account') %}
<tr>
<td style="width:33%;">{{ 'spent'|_ }}</td>
<td style="text-align: right;">{{ entry[2]|formatAmount }}</td>
</tr>
{% endif %}
{% if entry[3] != 0 %}
{% if entry[3] != 0 or (accountType == 'Asset account') %}
<tr>
<td style="width: 33%;">{{ 'earned'|_ }}</td>
<td style="text-align: right;">{{ entry[3]|formatAmount }}</td>
@@ -121,8 +129,8 @@
</div>
</div>
{% endif %}
{% endfor %}
<p class="small text-center"><a href="{{ route('accounts.show.all',[account.id]) }}">{{ 'showEverything'|_ }}</a></p>
</div>
{% endif %}
</div>

View File

@@ -6,7 +6,7 @@
{% block content %}
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-7">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'overview'|_ }}</h3>
@@ -26,6 +26,17 @@
<canvas id="budgetOverview" style="width:100%;" height="400"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-9 col-lg-3 col-md-offset-9 col-md-3 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('budgets.show',budget.id) }}">{{ 'showEverything'|_ }}</a></p>
</div>
</div>
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
@@ -36,13 +47,9 @@
</div>
</div>
</div>
<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 %}
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
{% for limit in limits %}
<div class="box">
<div class="box {% if limit.start_date == budgetLimit.start_date %}box-primary box-solid{% endif %}">
<div class="box-header with-border">
<h3 class="box-title"><a
href="{{ route('budgets.show.limit',[budget.id,limit.id]) }}">
@@ -51,44 +58,42 @@
</a>
</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
{{ 'amount'|_ }}: {{ limit.amount|formatAmount }}
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
{{ 'spent'|_ }}: {{ limit.spent|formatAmount }}
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
{% set overspent = limit.amount + limit.spent < 0 %}
<div class="box-body no-padding">
<table class="table table-hover">
<tr>
<td style="width:33%;">{{ 'amount'|_ }}</td>
<td>{{ limit.amount|formatAmount }}</td>
</tr>
<tr>
<td style="width:33%;">{{ 'spent'|_ }}</td>
<td>{{ limit.spent|formatAmount }}</td>
</tr>
<tr>
<td colspan="2">
{% set overspent = limit.amount + limit.spent < 0 %}
{% if overspent %}
{% set pct = (limit.spent != 0 ? (limit.amount / (limit.spent*-1))*100 : 0) %} <!-- must have -1 here -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" 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 pct = (limit.amount != 0 ? (((limit.spent*-1) / limit.amount)*100) : 0) %} <!-- must have -1 here -->
<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>
{% endif %}
</div>
</div>
{% if overspent %}
{% set pct = (limit.spent != 0 ? (limit.amount / (limit.spent*-1))*100 : 0) %} <!-- must have -1 here -->
<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" 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 pct = (limit.amount != 0 ? (((limit.spent*-1) / limit.amount)*100) : 0) %} <!-- must have -1 here -->
<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>
{% endif %}
</td>
</tr>
</table>
</div>
</div>
{% endfor %}
{% if limits|length == 1 %}
<p class="small text-center"><a href="{{ route('budgets.show',budget.id) }}">{{ 'showEverything'|_ }}</a></p>
{% endif %}
<p class="small text-center"><a href="{{ route('budgets.show',budget.id) }}">{{ 'showEverything'|_ }}</a></p>
</div>
</div>

View File

@@ -6,7 +6,7 @@
{% block content %}
<div class="row">
{% if entries %}
{% if method == 'default' %}
{# both charts #}
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="box">
@@ -29,7 +29,7 @@
</div>
</div>
{% endif %}
{% if not entries and not showAll %}
{% if method == 'date' %}
{# single chart #}
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
@@ -42,7 +42,7 @@
</div>
</div>
{% endif %}
{% if not entries and showAll %}
{% if method == 'all' %}
{# all chart #}
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
@@ -87,7 +87,7 @@
<div class="col-lg-2 col-md-4 col-sm-12 col-xs-12">
{% for entry in entries %}
{% if entry[2] != 0 or entry[3] != 0 %}
<div class="box">
<div class="box {% if entry[4] == start %}box-solid box-primary{% endif %}">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('categories.show.date',[category.id,entry[0]]) }}">{{ entry[1] }}</a>
</h3>