Improve search and display of results.

This commit is contained in:
James Cole 2017-07-15 17:19:12 +02:00
parent 22144b78ea
commit accbdea942
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
18 changed files with 225 additions and 587 deletions

View File

@ -16,6 +16,7 @@ namespace FireflyIII\Http\Controllers;
use FireflyIII\Support\Search\SearchInterface; use FireflyIII\Support\Search\SearchInterface;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Response;
use View; use View;
/** /**
@ -51,9 +52,14 @@ class SearchController extends Controller
*/ */
public function index(Request $request, SearchInterface $searcher) public function index(Request $request, SearchInterface $searcher)
{ {
$query = $request->get('q'); $fullQuery = $request->get('q');
return view('search.index',compact('query')); // parse search terms:
$searcher->parseQuery($fullQuery);
$query = $searcher->getWordsAsString();
$subTitle = trans('breadcrumbs.search_result', ['query' => $query]);
return view('search.index', compact('query', 'fullQuery', 'subTitle'));
// yes, hard coded values: // yes, hard coded values:
$minSearchLen = 1; $minSearchLen = 1;
@ -98,4 +104,19 @@ class SearchController extends Controller
return view('search.index', compact('rawQuery', 'hasModifiers', 'modifiers', 'subTitle', 'limit', 'query', 'result')); return view('search.index', compact('rawQuery', 'hasModifiers', 'modifiers', 'subTitle', 'limit', 'query', 'result'));
} }
public function search(Request $request, SearchInterface $searcher)
{
$fullQuery = $request->get('query');
// parse search terms:
$searcher->parseQuery($fullQuery);
$searcher->setLimit(20);
$transactions = $searcher->searchTransactions();
$html = view('search.search', compact('transactions'))->render();
return Response::json(['count' => $transactions->count(), 'html' => $html]);
}
} }

View File

@ -680,7 +680,7 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'search.index', function (BreadCrumbGenerator $breadcrumbs, $query) { 'search.index', function (BreadCrumbGenerator $breadcrumbs, $query) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search.index')); $breadcrumbs->push(trans('breadcrumbs.search_result', ['query' => e($query)]), route('search.index'));
} }
); );

View File

@ -86,17 +86,17 @@ class Modifier
case 'date': case 'date':
case 'on': case 'on':
$res = self::sameDate($transaction->date, $modifier['value']); $res = self::sameDate($transaction->date, $modifier['value']);
Log::debug(sprintf('Date is %s? %s', $modifier['value'], var_export($res, true))); Log::debug(sprintf('Date same as %s? %s', $modifier['value'], var_export($res, true)));
break; break;
case 'date_before': case 'date_before':
case 'before': case 'before':
$res = self::dateBefore($transaction->date, $modifier['value']); $res = self::dateBefore($transaction->date, $modifier['value']);
Log::debug(sprintf('Date is %s? %s', $modifier['value'], var_export($res, true))); Log::debug(sprintf('Date before %s? %s', $modifier['value'], var_export($res, true)));
break; break;
case 'date_after': case 'date_after':
case 'after': case 'after':
$res = self::dateAfter($transaction->date, $modifier['value']); $res = self::dateAfter($transaction->date, $modifier['value']);
Log::debug(sprintf('Date is %s? %s', $modifier['value'], var_export($res, true))); Log::debug(sprintf('Date before %s? %s', $modifier['value'], var_export($res, true)));
break; break;
} }

View File

@ -17,11 +17,6 @@ namespace FireflyIII\Support\Search;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter; use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -98,112 +93,20 @@ class Search implements SearchInterface
} }
} }
/**
* @return Collection
*/
public function searchAccounts(): Collection
{
$words = $this->words;
$accounts = $this->user->accounts()
->accountTypeIn([AccountType::DEFAULT, AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE, AccountType::BENEFICIARY])
->get(['accounts.*']);
/** @var Collection $result */
$result = $accounts->filter(
function (Account $account) use ($words) {
if ($this->strpos_arr(strtolower($account->name), $words)) {
return $account;
}
return false;
}
);
$result = $result->slice(0, $this->limit);
return $result;
}
/**
* @return Collection
*/
public function searchBudgets(): Collection
{
/** @var Collection $set */
$set = auth()->user()->budgets()->get();
$words = $this->words;
/** @var Collection $result */
$result = $set->filter(
function (Budget $budget) use ($words) {
if ($this->strpos_arr(strtolower($budget->name), $words)) {
return $budget;
}
return false;
}
);
$result = $result->slice(0, $this->limit);
return $result;
}
/**
* @return Collection
*/
public function searchCategories(): Collection
{
$words = $this->words;
$categories = $this->user->categories()->get();
/** @var Collection $result */
$result = $categories->filter(
function (Category $category) use ($words) {
if ($this->strpos_arr(strtolower($category->name), $words)) {
return $category;
}
return false;
}
);
$result = $result->slice(0, $this->limit);
return $result;
}
/**
* @return Collection
*/
public function searchTags(): Collection
{
$words = $this->words;
$tags = $this->user->tags()->get();
/** @var Collection $result */
$result = $tags->filter(
function (Tag $tag) use ($words) {
if ($this->strpos_arr(strtolower($tag->tag), $words)) {
return $tag;
}
return false;
}
);
$result = $result->slice(0, $this->limit);
return $result;
}
/** /**
* @return Collection * @return Collection
*/ */
public function searchTransactions(): Collection public function searchTransactions(): Collection
{ {
Log::debug('Start of searchTransactions()');
$pageSize = 100; $pageSize = 100;
$processed = 0; $processed = 0;
$page = 1; $page = 1;
$result = new Collection(); $result = new Collection();
$startTime = microtime(true);
do { do {
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
$collector->setUser($this->user);
$collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page); $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page);
if ($this->hasModifiers()) { if ($this->hasModifiers()) {
$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation(); $collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();
@ -247,7 +150,11 @@ class Search implements SearchInterface
Log::debug(sprintf('reachedEndOfList: %s', var_export($reachedEndOfList, true))); Log::debug(sprintf('reachedEndOfList: %s', var_export($reachedEndOfList, true)));
Log::debug(sprintf('foundEnough: %s', var_export($foundEnough, true))); Log::debug(sprintf('foundEnough: %s', var_export($foundEnough, true)));
} while (!$reachedEndOfList && !$foundEnough); // break at some point so the script does not crash:
$currentTime = microtime(true) - $startTime;
Log::debug(sprintf('Have been running for %f seconds.', $currentTime));
} while (!$reachedEndOfList && !$foundEnough && $currentTime <= 30);
$result = $result->slice(0, $this->limit); $result = $result->slice(0, $this->limit);

View File

@ -38,25 +38,6 @@ interface SearchInterface
*/ */
public function parseQuery(string $query); public function parseQuery(string $query);
/**
* @return Collection
*/
public function searchAccounts(): Collection;
/**
* @return Collection
*/
public function searchBudgets(): Collection;
/**
* @return Collection
*/
public function searchCategories(): Collection;
/**
* @return Collection
*/
public function searchTags(): Collection;
/** /**
* @return Collection * @return Collection

View File

@ -0,0 +1,35 @@
/*
* index.js
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
/** global: searchQuery,searchUri */
$(function () {
"use strict";
startSearch(searchQuery);
});
function startSearch(query) {
$.post(searchUri, {query: query}).done(presentSearchResults).fail(searchFailure);
}
function searchFailure() {
$('.result_row').hide();
$('.error_row').show();
}
function presentSearchResults(data) {
$('.search_ongoing').hide();
$('p.search_count').show();
$('span.search_count').text(data.count);
$('.search_box').find('.overlay').remove();
$('.search_results').html(data.html).show();
}

View File

@ -24,7 +24,7 @@ return [
'edit_bill' => 'Edit bill ":name"', 'edit_bill' => 'Edit bill ":name"',
'delete_bill' => 'Delete bill ":name"', 'delete_bill' => 'Delete bill ":name"',
'reports' => 'Reports', 'reports' => 'Reports',
'searchResult' => 'Search for ":query"', 'search_result' => 'Search results for ":query"',
'withdrawal_list' => 'Expenses', 'withdrawal_list' => 'Expenses',
'deposit_list' => 'Revenue, income and deposits', 'deposit_list' => 'Revenue, income and deposits',
'transfer_list' => 'Transfers', 'transfer_list' => 'Transfers',

View File

@ -27,8 +27,7 @@ return [
'showEverything' => 'Show everything', 'showEverything' => 'Show everything',
'never' => 'Never', 'never' => 'Never',
'search_results_for' => 'Search results for ":query"', 'search_results_for' => 'Search results for ":query"',
'advanced_search' => 'Advanced search', 'no_results_for_empty_search' => 'Your search was empty, so nothing was found.',
'advanced_search_intro' => 'There are several modifiers that you can use in your search to narrow down the results. If you use any of these, the search will <em>only</em> return transactions. Please click the <i class="fa fa-question-circle"></i>-icon for more information.',
'bounced_error' => 'The message sent to :email bounced, so no access for you.', 'bounced_error' => 'The message sent to :email bounced, so no access for you.',
'deleted_error' => 'These credentials do not match our records.', 'deleted_error' => 'These credentials do not match our records.',
'general_blocked_error' => 'Your account has been disabled, so you cannot login.', 'general_blocked_error' => 'Your account has been disabled, so you cannot login.',
@ -69,13 +68,6 @@ return [
'two_factor_lost_fix_owner' => 'Otherwise, email the site owner, <a href="mailto::site_owner">:site_owner</a> and ask them to reset your two factor authentication.', 'two_factor_lost_fix_owner' => 'Otherwise, email the site owner, <a href="mailto::site_owner">:site_owner</a> and ask them to reset your two factor authentication.',
'warning_much_data' => ':days days of data may take a while to load.', 'warning_much_data' => ':days days of data may take a while to load.',
'registered' => 'You have registered successfully!', 'registered' => 'You have registered successfully!',
'search' => 'Search',
'search_found_accounts' => 'Found :count account(s) for your query.',
'search_found_categories' => 'Found :count category(ies) for your query.',
'search_found_budgets' => 'Found :count budget(s) for your query.',
'search_found_tags' => 'Found :count tag(s) for your query.',
'search_found_transactions' => 'Found :count transaction(s) for your query.',
'results_limited' => 'The results are limited to :count entries.',
'tagbalancingAct' => 'Balancing act', 'tagbalancingAct' => 'Balancing act',
'tagadvancePayment' => 'Advance payment', 'tagadvancePayment' => 'Advance payment',
'tagnothing' => '', 'tagnothing' => '',
@ -152,6 +144,15 @@ return [
'transfer_exchange_rate_instructions' => 'Source asset account "@source_name" only accepts transactions in @source_currency. Destination asset account "@dest_name" only accepts transactions in @dest_currency. You must provide the transferred amount correctly in both currencies.', 'transfer_exchange_rate_instructions' => 'Source asset account "@source_name" only accepts transactions in @source_currency. Destination asset account "@dest_name" only accepts transactions in @dest_currency. You must provide the transferred amount correctly in both currencies.',
'transaction_data' => 'Transaction data', 'transaction_data' => 'Transaction data',
// search
'search' => 'Search',
'search_found_transactions' => 'Number of transactions found:',
'general_search_error' => 'An error occured while searching. Please check the log files for more information.',
'search_box' => 'Search',
'search_box_intro' => 'Welcome to the search function of Firefly III. Enter your search query in the box. Make sure you check out the help file because the search is pretty advanced.',
'search_error' => 'Error while searching',
'search_searching' => 'Searching ...',
// repeat frequencies: // repeat frequencies:
'repeat_freq_yearly' => 'yearly', 'repeat_freq_yearly' => 'yearly',
'repeat_freq_monthly' => 'monthly', 'repeat_freq_monthly' => 'monthly',

View File

@ -70,11 +70,8 @@ return [
'warning_much_data' => 'Het kan even duren voor :days dagen aan gegevens geladen zijn.', 'warning_much_data' => 'Het kan even duren voor :days dagen aan gegevens geladen zijn.',
'registered' => 'Je bent geregistreerd!', 'registered' => 'Je bent geregistreerd!',
'search' => 'Zoeken', 'search' => 'Zoeken',
'search_found_accounts' => ':count rekening(en) gevonden bij je zoekopdracht.',
'search_found_categories' => ':count categorie(en) gevonden bij je zoekopdracht.',
'search_found_budgets' => ':count budget(ten) gevonden bij je zoekopdracht.',
'search_found_tags' => ':count tag(s) gevonden bij je zoekopdracht.',
'search_found_transactions' => ':count transactie(s) gevonden bij je zoekopdracht.', 'search_found_transactions' => ':count transactie(s) gevonden bij je zoekopdracht.',
'results_limited' => 'Er worden maximaal :count resultaten getoond.', 'results_limited' => 'Er worden maximaal :count resultaten getoond.',
'tagbalancingAct' => 'Balancerende tag', 'tagbalancingAct' => 'Balancerende tag',
'tagadvancePayment' => 'Vooruitbetaalde tag', 'tagadvancePayment' => 'Vooruitbetaalde tag',

View File

@ -5,31 +5,22 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% 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="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="box box-primary"> <div class="box box-primary">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ 'advanced_search'|_ }}</h3> <h3 class="box-title">{{ 'search_box'|_ }}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<p> <p>
{{ 'advanced_search_intro'|_ }} {{ 'search_box_intro'|_ }}
</p> </p>
{# search form #} {# search form #}
<form class="form-horizontal" action="{{ route('search.index') }}" method="get"> <form class="form-horizontal" action="{{ route('search.index') }}" method="get">
<div class="form-group"> <div class="form-group">
<label for="query" class="col-sm-1 control-label">Query</label> <label for="query" class="col-sm-1 control-label">Query</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" name="q" id="query" value="{{ rawQuery }}" class="form-control" placeholder="{{ rawQuery }}"> <input type="text" name="q" id="query" value="{{ fullQuery }}" class="form-control" placeholder="{{ fullQuery }}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -40,116 +31,67 @@
</form> </form>
</div> </div>
</div> </div>
<p>{{ trans('firefly.results_limited', {count: limit}) }}</p>
</div> </div>
</div> </div>
{% if hasModifiers %} {% if query %}
<div class="row result_row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box search_box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
</div>
<div class="box-body">
<p class="search_ongoing text-center" style="margin-top:70px;">
{{ 'search_searching'|_ }}
</p>
<p class="search_count" style="display: none;">
{{ 'search_found_transactions'|_ }} <span class="search_count"></span>
</p>
<div class="search_results" style="display: none;">
</div>
{# loading indicator #}
<div class="overlay">
<i class="fa fa-refresh fa-spin"></i>
</div>
</div>
</div>
</div>
</div>
<div class="row error_row" style="display:none; ">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box box-danger">
<div class="box-header with-border">
<h3 class="box-title">{{ 'search_error'|_ }}</h3>
</div>
<div class="box-body">
<p class="search_ongoing">
{{ 'general_search_error'|_ }}
</p>
</div>
</div>
</div>
</div>
{% endif %}
{% if query == "" %}
<div class="row"> <div class="row">
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 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">{{ 'transactions'|_ }}</h3> <h3 class="box-title">{{ 'search_results'|_ }}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<p> <p>{{ 'no_results_for_empty_search'|_ }}</p>
{{ trans('firefly.search_found_transactions', {count: result.transactions|length}) }}
</p>
{% include 'search.partials.transactions-large' with {'journals' : result.transactions} %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% else %}
<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>
</div>
<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>
{% endif %} {% endif %}
{% if result.categories|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">{{ 'categories'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ trans('firefly.search_found_categories', {count: result.categories|length}) }}
</p>
{% include 'search.partials.categories' %}
</div>
</div>
</div>
{% endif %}
{% if result.tags|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">{{ 'tags'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ trans('firefly.search_found_tags', {count: result.tags|length}) }}
</p>
{% include 'search.partials.tags' %}
</div>
</div>
</div>
{% endif %}
{% if result.accounts|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">{{ 'accounts'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ trans('firefly.search_found_accounts', {count: result.accounts|length}) }}
</p>
{% include 'search.partials.accounts' %}
</div>
</div>
</div>
{% endif %}
{% if result.budgets|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">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body">
<p>
{{ trans('firefly.search_found_budgets', {count: result.budgets|length}) }}
</p>
{% include 'search.partials.budgets' %}
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
{% endif %}
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script type="text/javascript" src="js/lib/bootstrap-sortable.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var query = '{{ query }}'; var searchQuery = "{{ fullQuery|escape('js') }}";
var searchUri = "{{ route('search.search') }}";
</script> </script>
{% endblock %} <script type="text/javascript" src="js/ff/search/index.js"></script>
{% block styles %}
<link rel="stylesheet" href="css/bootstrap-sortable.css" type="text/css" media="all"/>
{% endblock %} {% endblock %}

View File

@ -1,36 +0,0 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th data-defaultsign="az">{{ trans('list.name') }}</th>
<th data-defaultsign="az" class="hidden-sm hidden-xs">{{ trans('list.type') }}</th>
<th data-defaultsign="az" class="hidden-sm hidden-xs">{{ trans('list.role') }}</th>
<th data-defaultsign="az" 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 data-value="{{ account.name }}">
<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' %}
{{ ('account_role_'~entry.data)|_ }}
{% endif %}
{% endfor %}
</td>
<td class="hidden-sm hidden-xs">{{ account.iban }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,24 +0,0 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th data-defaultsign="az">{{ 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 data-value="{{ budget.name }}">
<a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,24 +0,0 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th data-defaultsign="az">{{ 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 data-value="{{ category.name }}">
<a href="{{ route('categories.show',category.id) }}">{{ category.name }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,26 +0,0 @@
<table class="table table-hover sortable">
<thead>
<tr>
<th class="hidden-sm hidden-xs" data-defaultsort="disabled">&nbsp;</th>
<th data-defaultsign="az">{{ trans('list.name') }}</th>
<th data-defaultsign="az">{{ 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 data-value="{{ tag.tag }}">
<a href="{{ route('tags.show',tag.id) }}">{{ tag.tag }}</a>
</td>
<td>{{ ('tag'~tag.tagMode)|_ }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,130 +0,0 @@
{{ journals.render|raw }}
<table class="table table-hover table-condensed {% if sorting %}sortable-table{% endif %}">
<thead>
<tr class="ignore">
<th class="hidden-xs no_select_boxes" colspan="2">&nbsp;</th>
<th class="hidden-xs select_boxes" colspan="2" style="display: none;"><input name="select_all" class="select_all" type="checkbox"/></th>
<th>{{ trans('list.description') }}</th>
<th>{{ trans('list.amount') }}</th>
<th class="hidden-sm hidden-xs">{{ trans('list.date') }}</th>
<th class="hidden-xs">{{ trans('list.from') }}</th>
<th class="hidden-xs">{{ trans('list.to') }}</th>
<!-- Hide budgets? -->
{% if not hideBudgets %}
<th class="hidden-xs"><i class="fa fa-tasks fa-fw" title="{{ trans('list.budget') }}"></i></th>
{% endif %}
<!-- Hide categories? -->
{% if not hideCategories %}
<th class="hidden-xs"><i class="fa fa-bar-chart fa-fw" title="{{ trans('list.category') }}"></i></th>
{% endif %}
<!-- Hide bills? -->
{% if not hideBills %}
<th class="hidden-xs"><i class="fa fa-fw fa-rotate-right" title="{{ trans('list.bill') }}"></i></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for transaction in journals %}
<tr class="drag" data-date="{{ transaction.date.format('Y-m-d') }}" data-id="{{ transaction.journal_id }}">
<td class="hidden-xs">
<div class="select_single" style="display:none;">
<input name="select_all_single[]" class="select_all_single" value="{{ transaction.journal_id }}" type="checkbox"/>
</div>
<div class="btn-group btn-group-xs edit_buttons edit_tr_buttons">{% if sorting %}<a href="#" class="handle btn btn-default btn-xs"><i
class="fa fa-fw fa-arrows-v"></i></a>{% endif %}<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 style="text-align: right;">
<span style="margin-right:5px;">
{# TODO replace with new format code #}
XX.XX
</span>
</td>
<td class="hidden-sm hidden-xs">
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
</td>
<td class="hidden-xs">
{{ transactionSourceAccount(transaction) }}
</td>
<td class="hidden-xs">
{{ transactionDestinationAccount(transaction) }}
</td>
<!-- Do NOT hide the budget? -->
{% if not hideBudgets %}
<td class="hidden-xs">
{{ transactionBudgets(transaction) }}
</td>
{% endif %}
<!-- Do NOT hide the category? -->
{% if not hideCategories %}
<td class="hidden-xs">
{{ transactionCategories(transaction) }}
</td>
{% endif %}
<!-- Do NOT hide the bill? -->
{% if not hideBills %}
<td class="hidden-xs">
{% if transaction.bill_id %}
<a href="{{ route('bills.show',transaction.bill_id) }}">{{ transaction.bill_name }}</a>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
<div class="row mass_edit_all hidden-xs" 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 hidden-xs">
<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>

View File

@ -1,78 +0,0 @@
{{ journals.render|raw }}
<table class="table table-hover table-compressed sortable">
<thead>
<tr class="ignore">
<th data-defaultsort="disabled" class="hidden-xs" colspan="2">&nbsp;</th>
<th data-defaultsort="disabled">{{ trans('list.description') }}</th>
<th data-defaultsign="_19">{{ trans('list.amount') }}</th>
<th data-defaultsign="month" class="hidden-sm hidden-xs">{{ trans('list.date') }}</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<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 data-value="{{ transaction.transaction_amount }}">
{# TODO replace with new format code #}
XX.XX
</td>
<td class="hidden-sm hidden-xs" data-value="{{ transaction.date.format('Y-m-d H:i:s') }}">
{{ 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>

View File

@ -0,0 +1,72 @@
<table class="table table-hover table-condensed">
<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>
<th class="hidden-xs">{{ trans('list.from') }}</th>
<th class="hidden-xs">{{ trans('list.to') }}</th>
<th class="hidden-xs"><i class="fa fa-tasks fa-fw" title="{{ trans('list.budget') }}"></i></th>
<th class="hidden-xs"><i class="fa fa-bar-chart fa-fw" title="{{ trans('list.category') }}"></i></th>
<th class="hidden-xs"><i class="fa fa-fw fa-rotate-right" title="{{ trans('list.bill') }}"></i></th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td class="hidden-xs">
<div class="btn-group btn-group-xs">
<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 style="text-align: right;">
<span style="margin-right:5px;">
{{ transactionAmount(transaction) }}
</span>
</td>
<td class="hidden-sm hidden-xs">
{{ transaction.date.formatLocalized(monthAndDayFormat) }}
</td>
<td class="hidden-xs">
{{ transactionSourceAccount(transaction) }}
</td>
<td class="hidden-xs">
{{ transactionDestinationAccount(transaction) }}
</td>
<td class="hidden-xs">
{{ transactionBudgets(transaction) }}
</td>
<td class="hidden-xs">
{{ transactionCategories(transaction) }}
</td>
<td class="hidden-xs">
{% if transaction.bill_id %}
<a href="{{ route('bills.show',transaction.bill_id) }}">{{ transaction.bill_name }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -641,7 +641,7 @@ Route::group(
Route::group( Route::group(
['middleware' => 'user-full-auth', 'prefix' => 'search', 'as' => 'search.'], function () { ['middleware' => 'user-full-auth', 'prefix' => 'search', 'as' => 'search.'], function () {
Route::get('', ['uses' => 'SearchController@index', 'as' => 'index']); Route::get('', ['uses' => 'SearchController@index', 'as' => 'index']);
Route::any('search', ['uses' => 'SearchController@search', 'as' => 'search']);
} }
); );