mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
Fixed the charts, added some todo items.
This commit is contained in:
@@ -464,8 +464,8 @@ class GoogleChartController extends BaseController
|
|||||||
$chart->addColumn('Name', 'string');
|
$chart->addColumn('Name', 'string');
|
||||||
$chart->addColumn('Amount', 'number');
|
$chart->addColumn('Amount', 'number');
|
||||||
|
|
||||||
/** @var \FireflyIII\Database\RecurringTransaction $rcr */
|
/** @var \FireflyIII\Database\Recurring $rcr */
|
||||||
$rcr = App::make('FireflyIII\Database\RecurringTransaction');
|
$rcr = App::make('FireflyIII\Database\Recurring');
|
||||||
|
|
||||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use FireflyIII\Exception\NotImplementedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SearchController
|
* Class SearchController
|
||||||
@@ -11,7 +10,10 @@ class SearchController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException;
|
|
||||||
|
/** @var \FireflyIII\Search\Search $searcher */
|
||||||
|
$searcher = App::make('FireflyIII\Search\Search');
|
||||||
|
|
||||||
$subTitle = null;
|
$subTitle = null;
|
||||||
$rawQuery = null;
|
$rawQuery = null;
|
||||||
$result = [];
|
$result = [];
|
||||||
@@ -20,11 +22,11 @@ class SearchController extends BaseController
|
|||||||
$words = explode(' ', $rawQuery);
|
$words = explode(' ', $rawQuery);
|
||||||
$subTitle = 'Results for "' . e($rawQuery) . '"';
|
$subTitle = 'Results for "' . e($rawQuery) . '"';
|
||||||
|
|
||||||
$transactions = $this->_helper->searchTransactions($words);
|
$transactions = $searcher->searchTransactions($words);
|
||||||
$accounts = $this->_helper->searchAccounts($words);
|
$accounts = $searcher->searchAccounts($words);
|
||||||
$categories = $this->_helper->searchCategories($words);
|
$categories = $searcher->searchCategories($words);
|
||||||
$budgets = $this->_helper->searchBudgets($words);
|
$budgets = $searcher->searchBudgets($words);
|
||||||
$tags = $this->_helper->searchTags($words);
|
$tags = $searcher->searchTags($words);
|
||||||
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
|
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -330,7 +330,6 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
|||||||
* @param \RecurringTransaction $recurring
|
* @param \RecurringTransaction $recurring
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws NotImplementedException
|
|
||||||
*/
|
*/
|
||||||
public function scanEverything(\RecurringTransaction $recurring)
|
public function scanEverything(\RecurringTransaction $recurring)
|
||||||
{
|
{
|
||||||
|
107
app/lib/FireflyIII/Search/Search.php
Normal file
107
app/lib/FireflyIII/Search/Search.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: sander
|
||||||
|
* Date: 13/11/14
|
||||||
|
* Time: 21:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FireflyIII\Search;
|
||||||
|
|
||||||
|
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
class Search
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array $words
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function searchAccounts(array $words)
|
||||||
|
{
|
||||||
|
return \Auth::user()->accounts()->with('accounttype')->where(
|
||||||
|
function ($q) use ($words) {
|
||||||
|
foreach ($words as $word) {
|
||||||
|
$q->orWhere('name', 'LIKE', '%' . e($word) . '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $words
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function searchBudgets(array $words)
|
||||||
|
{
|
||||||
|
/** @var Collection $set */
|
||||||
|
$set = \Auth::user()->budgets()->get();
|
||||||
|
$newSet = $set->filter(
|
||||||
|
function (\Budget $b) use ($words) {
|
||||||
|
$found = 0;
|
||||||
|
foreach ($words as $word) {
|
||||||
|
if (!(strpos(strtolower($b->name), strtolower($word)) === false)) {
|
||||||
|
$found++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $found > 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $newSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $words
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function searchCategories(array $words)
|
||||||
|
{
|
||||||
|
/** @var Collection $set */
|
||||||
|
$set = \Auth::user()->categories()->get();
|
||||||
|
$newSet = $set->filter(
|
||||||
|
function (\Category $c) use ($words) {
|
||||||
|
$found = 0;
|
||||||
|
foreach ($words as $word) {
|
||||||
|
if (!(strpos(strtolower($c->name), strtolower($word)) === false)) {
|
||||||
|
$found++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $found > 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $newSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $words
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function searchTags(array $words)
|
||||||
|
{
|
||||||
|
return new Collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $words
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function searchTransactions(array $words)
|
||||||
|
{
|
||||||
|
return \Auth::user()->transactionjournals()->withRelevantData()->where(
|
||||||
|
function ($q) use ($words) {
|
||||||
|
foreach ($words as $word) {
|
||||||
|
$q->orWhere('description', 'LIKE', '%' . e($word) . '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)->get();
|
||||||
|
}
|
||||||
|
}
|
@@ -85,6 +85,7 @@ class Transaction extends Ardent
|
|||||||
*/
|
*/
|
||||||
public function connectPiggybank(\Piggybank $piggybank = null)
|
public function connectPiggybank(\Piggybank $piggybank = null)
|
||||||
{
|
{
|
||||||
|
// TODO connect a piggy bank to a transaction.
|
||||||
throw new NotImplementedException;
|
throw new NotImplementedException;
|
||||||
// if (is_null($piggybank)) {
|
// if (is_null($piggybank)) {
|
||||||
// return true;
|
// return true;
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
<li class="sidebar-search">
|
<li class="sidebar-search">
|
||||||
<form action="{{route('search')}}" method="GET" class="form-inline">
|
<form action="{{route('search')}}" method="GET" class="form-inline">
|
||||||
<div class="input-group custom-search-form">
|
<div class="input-group custom-search-form">
|
||||||
<input type="text" name="q" class="form-control" placeholder="Search...">
|
<input type="text" name="q" class="form-control" value="@if(Input::get('q')){{{Input::get('q')}}}@endif" placeholder="Search...">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" type="submit">
|
<button class="btn btn-default" type="submit">
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
|
@@ -228,6 +228,11 @@ function googleSankeyChart(URL, container) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO fix this method so the layout is nice and dandy.
|
||||||
|
* @param URL
|
||||||
|
* @param container
|
||||||
|
*/
|
||||||
function googleTable(URL, container) {
|
function googleTable(URL, container) {
|
||||||
if ($('#' + container).length == 1) {
|
if ($('#' + container).length == 1) {
|
||||||
$.getJSON(URL).success(function (data) {
|
$.getJSON(URL).success(function (data) {
|
||||||
|
Reference in New Issue
Block a user