Improved search.

This commit is contained in:
James Cole
2016-11-06 14:52:31 +01:00
parent 1ebb59b352
commit 22a2fe3f61
13 changed files with 466 additions and 125 deletions

View File

@@ -5,19 +5,35 @@
{% endblock %}
{% block content %}
{% if query %}
{% if query == "" %}
<div class="row">
<div class="col-lg-12">
<p>{{ 'no_results_for_empty_search'|_ }}</p>
</div>
</div>
{% endif %}
{% if query %}
<div class="row">
<div class="col-lg-12">
<p>{{ trans('firefly.results_limited', {count: limit}) }}</p>
</div>
</div>
<div class="row">
{% if result.transactions|length > 0 %}
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Transactions</h3>
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body no-padding">
{% include 'list.journals-tiny' with {'transactions' : result.transactions} %}
</div>
<div class="box-footer">
<span class="pull-right">Results: {{ result.transactions|length }}</span>
<div class="box-body">
<p>
{{ trans('firefly.search_found_transactions', {count: result.transactions|length}) }}
</p>
{% include 'search.partials.transactions' with {'transactions' : result.transactions} %}
</div>
</div>
</div>
@@ -26,19 +42,13 @@
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Categories</h3>
<h3 class="box-title">{{ 'categories'|_ }}</h3>
</div>
<div class="box-body no-padding">
<div class="list-group">
{% for category in result.categories %}
<a class="list-group-item" title="{{ category.name }}" href="{{ route('categories.show',category.id) }}">
{{ category.name }}
</a>
{% endfor %}
</div>
</div>
<div class="box-footer">
<span class="pull-right">Results: {{ result['categories']|length }}</span>
<div class="box-body">
<p>
{{ trans('firefly.search_found_categories', {count: result.categories|length}) }}
</p>
{% include 'search.partials.categories' %}
</div>
</div>
</div>
@@ -47,13 +57,13 @@
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Tags</h3>
<h3 class="box-title">{{ 'tags'|_ }}</h3>
</div>
<div class="box-body no-padding">
<p>Bla bla</p>
</div>
<div class="box-footer">
<span class="pull-right">Results: {{ result['tags']|length }}</span>
<div class="box-body">
<p>
{{ trans('firefly.search_found_tags', {count: result.tags|length}) }}
</p>
{% include 'search.partials.tags' %}
</div>
</div>
</div>
@@ -62,19 +72,13 @@
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Accounts</h3>
<h3 class="box-title">{{ 'accounts'|_ }}</h3>
</div>
<div class="box-body no-padding">
<div class="list-group">
{% for account in result.accounts %}
<a class="list-group-item" title="{{ account.name }}" href="{{ route('accounts.show',account.id) }}">
{{ account.name }}
</a>
{% endfor %}
</div>
</div>
<div class="box-footer">
<span class="pull-right">Results: {{ result['accounts'].count() }}</span>
<div class="box-body">
<p>
{{ trans('firefly.search_found_accounts', {count: result.accounts|length}) }}
</p>
{% include 'search.partials.accounts' %}
</div>
</div>
</div>
@@ -83,19 +87,13 @@
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Budgets</h3>
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body">
<div class="list-group">
{% for budget in result.budgets %}
<a class="list-group-item" title="{{ budget.name }}" href="{{ route('budgets.show',budget.id) }}">
{{ budget.name }}
</a>
{% endfor %}
</div>
</div>
<div class="box-footer">
<span class="pull-right">Results: {{ result['budgets'].count() }}</span>
<p>
{{ trans('firefly.search_found_budgets', {count: result.budgets|length}) }}
</p>
{% include 'search.partials.budgets' %}
</div>
</div>
</div>
@@ -106,8 +104,8 @@
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var query = '{{ query }}';
</script>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var query = '{{ query }}';
</script>
{% endblock %}

View File

@@ -0,0 +1,34 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th>{{ trans('list.name') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.type') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.role') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.iban') }}</th>
</tr>
</thead>
<tbody>
{% for account in result.accounts %}
<tr>
<td class="hidden-sm hidden-xs">
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" href="{{ route('accounts.edit',account.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('accounts.delete',account.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
</td>
<td><a href="{{ route('accounts.show',account.id) }}">{{ account.name }}</a></td>
<td>{{ trans('firefly.'~account.accountType.type) }}</td>
<td class="hidden-sm hidden-xs">
{% for entry in account.accountmeta %}
{% if entry.name == 'accountRole' %}
{{ trans('firefly.'~entry.data|getAccountRole) }}
{% endif %}
{% endfor %}
</td>
<td class="hidden-sm hidden-xs">{{ account.iban }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,22 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th>{{ trans('list.name') }}</th>
</tr>
</thead>
<tbody>
{% for budget in result.budgets %}
<tr>
<td class="hidden-sm hidden-xs" style="width:10%;">
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" href="{{ route('budgets.edit', budget.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('budgets.delete', budget.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
</td>
<td><a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,22 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th>{{ trans('list.name') }}</th>
</tr>
</thead>
<tbody>
{% for category in result.categories %}
<tr>
<td class="hidden-sm hidden-xs" style="width:10%;">
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" href="{{ route('categories.edit',category.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('categories.delete',category.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
</td>
<td><a href="{{ route('categories.show',category.id) }}">{{ category.name }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,24 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th>{{ trans('list.name') }}</th>
<th>{{ trans('list.type') }}</th>
</tr>
</thead>
<tbody>
{% for tag in result.tags %}
<tr>
<td class="hidden-sm hidden-xs" style="width:10%;">
<div class="btn-group btn-group-xs">
<a class="btn btn-default btn-xs" href="{{ route('tags.edit', tag.id) }}"><i class="fa fa-fw fa-pencil"></i></a>
<a class="btn btn-danger btn-xs" href="{{ route('tags.delete', tag.id) }}"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
</td>
<td><a href="{{ route('tags.show',tag.id) }}">{{ tag.tag }}</a></td>
<td>{{ ('tag'~tag.tagMode)|_ }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@@ -0,0 +1,81 @@
{{ journals.render|raw }}
<table class="table table-hover table-compressed {% if sorting %}sortable-table{% endif %}">
<thead>
<tr class="ignore">
<th class="hidden-xs" colspan="2">&nbsp;</th>
<th>{{ trans('list.description') }}</th>
<th>{{ trans('list.amount') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.date') }}</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr class="drag" data-date="{{ transaction.date.format('Y-m-d') }}" data-id="{{ transaction.journal_id }}">
<td class="hidden-xs">
<div class="btn-group btn-group-xs edit_buttons">
<a href="{{ route('transactions.edit',transaction.journal_id) }}" class="btn btn-xs btn-default"><i class="fa fa-fw fa-pencil"></i></a>
<a href="{{ route('transactions.delete',transaction.journal_id) }}" class="btn btn-xs btn-danger"><i class="fa fa-fw fa-trash-o"></i></a>
</div>
</td>
<td class="hidden-xs">
{{ transaction|typeIconTransaction }}
</td>
<td>
<a href="{{ route('transactions.show',transaction.journal_id) }}">
{% if transaction.transaction_description|length > 0 %}
{{ transaction.transaction_description }} ({{ transaction.description }})
{% else %}
{{ transaction.description }}
{% endif %}
</a>
{{ splitJournalIndicator(transaction.journal_id) }}
{% if transaction.transactionJournal.attachments|length > 0 %}
<i class="fa fa-paperclip"
title="{{ Lang.choice('firefly.nr_of_attachments', journal.attachments|length, {count: journal.attachments|length}) }}"></i>
{% endif %}
</td>
<td>
<!-- format amount of transaction -->
{{ formatAmountWithCode(transaction.transaction_amount, transaction.transaction_currency_code) }}
<!-- and then amount of journal itself. -->
{{ optionalJournalAmount(transaction.journal_id, transaction.transaction_amount,
transaction.transaction_currency_code, transaction.transaction_type_type) }}
</td>
<td class="hidden-sm hidden-xs">
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row mass_edit_all" style="display: none;">
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="mass_button_options btn-group btn-group" style="display:none;">
<a href="#" class="btn btn-default mass_edit"><i class="fa fa-fw fa-pencil"></i> <span>{{ 'edit_selected'|_ }}</span></a>
<a href="#" class="btn btn-danger mass_delete"><i class="fa fa-fw fa-trash"></i> <span>{{ 'delete_selected'|_ }}</span></a>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="mass_buttons btn-group btn-group pull-right">
<a href="#" class="btn btn-default mass_select"><i class="fa fa-fw fa-check-square-o"></i> {{ 'select_transactions'|_ }}</a>
<a href="#" class="btn btn-default mass_stop_select" style="display:none;"><i class="fa faw-fw fa-square-o"
aria-hidden="true"></i> {{ 'stop_selection'|_ }}</a>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{{ journals.render|raw }}
</div>
</div>
<script type="text/javascript">
var edit_selected_txt = "{{ 'edit_selected'|_ }}";
var delete_selected_txt = "{{ 'delete_selected'|_ }}";
</script>