Better view for accounts and I fixed a html error.

This commit is contained in:
James Cole
2016-12-12 20:02:33 +01:00
parent 14f9da544a
commit 7e0ef6d43e
7 changed files with 60 additions and 160 deletions

View File

@@ -248,7 +248,7 @@ class AccountController extends Controller
// generate entries for each period (and cache those) // generate entries for each period (and cache those)
$entries = $this->periodEntries($account); $entries = $this->periodEntries($account);
return view('accounts.show', compact('account', 'what', 'entries', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri')); return view('accounts.show', compact('account', 'entries', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
} }
/** /**
@@ -274,7 +274,8 @@ class AccountController extends Controller
$start = $repository->oldestJournalDate($account); $start = $repository->oldestJournalDate($account);
$end = $repository->newestJournalDate($account); $end = $repository->newestJournalDate($account);
return view('accounts.show-by-date', compact('account', 'journals', 'subTitle', 'start', 'end','chartUri')); // same call, except "entries".
return view('accounts.show', compact('account', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
} }
/** /**
@@ -300,7 +301,8 @@ class AccountController extends Controller
$journals = $collector->getPaginatedJournals(); $journals = $collector->getPaginatedJournals();
$journals->setPath('accounts/show/' . $account->id . '/' . $date); $journals->setPath('accounts/show/' . $account->id . '/' . $date);
return view('accounts.show-by-date', compact('category', 'date', 'account', 'journals', 'subTitle', 'carbon', 'start', 'end','chartUri')); // same call, except "entries".
return view('accounts.show', compact('account', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));
} }
/** /**

View File

@@ -68,29 +68,33 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account) { 'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type); $what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->parent('accounts.index', $what); $breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(e($account->name), route('accounts.show', [$account->id])); $breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'accounts.show.date', function (BreadCrumbGenerator $breadcrumbs, Account $account, Carbon $date) { 'accounts.show.date', function (BreadCrumbGenerator $breadcrumbs, Account $account, Carbon $start, Carbon $end) {
$startString = $start->formatLocalized(strval(trans('config.month_and_day')));
$endString = $end->formatLocalized(strval(trans('config.month_and_day')));
$title = sprintf('%s (%s)', $account->name, trans('firefly.from_to', ['start' => $startString, 'end' => $endString]));
$breadcrumbs->parent('accounts.show', $account); $breadcrumbs->parent('accounts.show', $account);
$breadcrumbs->push($title, route('accounts.show.date', [$account->id, $start->format('Y-m-d')]));
$range = Preferences::get('viewRange', '1M')->data;
$title = $account->name . ' (' . Navigation::periodShow($date, $range) . ')';
$breadcrumbs->push($title, route('accounts.show.date', [$account->id, $date->format('Y-m-d')]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'accounts.show.all', function (BreadCrumbGenerator $breadcrumbs, Account $account) { 'accounts.show.all', function (BreadCrumbGenerator $breadcrumbs, Account $account, Carbon $start, Carbon $end) {
$startString = $start->formatLocalized(strval(trans('config.month_and_day')));
$endString = $end->formatLocalized(strval(trans('config.month_and_day')));
$title = sprintf('%s (%s)', $account->name, trans('firefly.from_to', ['start' => $startString, 'end' => $endString]));
$breadcrumbs->parent('accounts.show', $account); $breadcrumbs->parent('accounts.show', $account);
$breadcrumbs->push($title, route('accounts.show.all', [$account->id, $start->format('Y-m-d')]));
$title = sprintf('%s (%s)', $account->name, strtolower(trans('firefly.everything')));
$breadcrumbs->push($title, route('accounts.show.all', [$account->id]));
} }
); );

View File

@@ -526,6 +526,7 @@ return [
'select_more_than_one_account' => 'Please select more than one account', 'select_more_than_one_account' => 'Please select more than one account',
'select_more_than_one_category' => 'Please select more than one category', 'select_more_than_one_category' => 'Please select more than one category',
'select_more_than_one_budget' => 'Please select more than one budget', 'select_more_than_one_budget' => 'Please select more than one budget',
'from_to' => 'From :start to :end',
// categories: // categories:
'new_category' => 'New category', 'new_category' => 'New category',

View File

@@ -1,110 +0,0 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account, carbon) }}
{% endblock %}
{% block content %}
<div class="row">
<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'|_ }} (period)</h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">
<div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('accounts.edit', account.id) }}"><i class="fa fa-pencil fa-fw"></i> {{ 'edit'|_ }}</a></li>
<li><a href="{{ route('accounts.delete', account.id) }}"><i class="fa fa-trash fa-fw"></i> {{ 'delete'|_ }}</a></li>
</ul>
</div>
</div>
</div>
<div class="box-body">
<canvas id="overview-chart" style="width:100%;height:350px;" height="350"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'expenses_by_category'|_ }}</h3>
</div>
<div class="box-body">
<div style="width:60%;margin:0 auto;">
<canvas id="account-cat-out" style="margin:0 auto;" height="150" width="150"></canvas>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'expenses_by_budget'|_ }}</h3>
</div>
<div class="box-body">
<div style="width:60%;margin:0 auto;">
<canvas id="account-budget-out" style="margin:0 auto;" height="150" width="150"></canvas>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'income_by_category'|_ }}</h3>
</div>
<div class="box-body">
<div style="width:60%;margin:0 auto;">
<canvas id="account-cat-in" style="margin:0 auto;" height="150" width="150"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body">
{% include 'list.journals-tasker' with {sorting:true} %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var accountID = {{ account.id }};
var dateString = "{{ date|escape }}";
// uri's for charts:
var chartUri = '{{ chartUri }}';
var incomeCategoryUri = '{{ route('chart.account.income-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
var expenseCategoryUri = '{{ route('chart.account.expense-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
var expenseBudgetUri = '{{ route('chart.account.expense-budget', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
</script>
<script type="text/javascript" src="js/lib/Chart.bundle.min.js"></script>
<script type="text/javascript" src="js/ff/charts.defaults.js"></script>
<script type="text/javascript" src="js/ff/charts.js"></script>
<script src="js/lib/jquery-ui.min.js" type="text/javascript"></script>
<script src="js/lib/jquery.color-2.1.2.min.js" type="text/javascript"></script>
<script src="js/ff/accounts/show.js" type="text/javascript"></script>
<script type="text/javascript" src="js/ff/transactions/list.js"></script>
{% endblock %}

View File

@@ -1,7 +1,7 @@
{% extends "./layout/default" %} {% extends "./layout/default" %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account) }} {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account, start, end) }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@@ -9,7 +9,8 @@
<div class="col-lg-12 col-md-10 col-sm-12"> <div class="col-lg-12 col-md-10 col-sm-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ account.name }}</h3> <h3 class="box-title">{{ account.name }}
({{ trans('firefly.from_to', {start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }})</h3>
<!-- ACTIONS MENU --> <!-- ACTIONS MENU -->
<div class="box-tools pull-right"> <div class="box-tools pull-right">
@@ -68,7 +69,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-lg-10 col-md-10 col-sm-12"> <div class="{% if entries %}col-lg-10 col-md-10 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3> <h3 class="box-title">{{ 'transactions'|_ }}</h3>
@@ -84,6 +85,7 @@
</div> </div>
</div> </div>
</div> </div>
{% if entries %}
<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12"> <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">
{% for entry in entries %} {% for entry in entries %}
{% if entry[2] != 0 or entry[3] != 0 %} {% if entry[2] != 0 or entry[3] != 0 %}
@@ -113,6 +115,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
</div> </div>

View File

@@ -9,7 +9,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ 'overview'|_ }} (month)</h3> <h3 class="box-title">{{ 'overview'|_ }} ({{ 'month'|_ }})</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<canvas id="period" style="width:100%" height="350"></canvas> <canvas id="period" style="width:100%" height="350"></canvas>
@@ -19,7 +19,7 @@
<div class="col-lg-6 col-md-6 col-sm-12"> <div class="col-lg-6 col-md-6 col-sm-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ 'overview'|_ }} (all)</h3> <h3 class="box-title">{{ 'overview'|_ }} ({{ 'all'|_ }})</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<canvas id="all" style="width:100%;" height="350"></canvas> <canvas id="all" style="width:100%;" height="350"></canvas>

View File

@@ -16,8 +16,8 @@
</div> </div>
</td> </td>
<td data-value="{{ tag.tag }}"> <td data-value="{{ tag.tag }}">
<a href="{{ route('tags.show',tag.id) }}">{{ tag.tag }}</a>< <a href="{{ route('tags.show',tag.id) }}">{{ tag.tag }}</a>
/td> </td>
<td>{{ ('tag'~tag.tagMode)|_ }}</td> <td>{{ ('tag'~tag.tagMode)|_ }}</td>
</tr> </tr>
{% endfor %} {% endfor %}