mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Lots of changes.
This commit is contained in:
parent
92af4e5c96
commit
f5437a17f8
@ -7,10 +7,10 @@ use FireflyIII\Http\Requests\CategoryFormRequest;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
use Input;
|
||||
|
||||
|
||||
/**
|
||||
@ -38,44 +38,6 @@ class CategoryController extends Controller
|
||||
return view('categories.create')->with('subTitle', 'Create a new category');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function show(Category $category, CategoryRepositoryInterface $repository)
|
||||
{
|
||||
$hideCategory = true; // used in list.
|
||||
$page = intval(Input::get('page'));
|
||||
$offset = $page > 0 ? $page * 50 : 0;
|
||||
$set = $category->transactionJournals()->withRelevantData()->take(50)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||
$count = $category->transactionJournals()->count();
|
||||
|
||||
$journals = new LengthAwarePaginator($set, $count, 50, $page);
|
||||
|
||||
return view('categories.show', compact('category', 'journals', 'hideCategory'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function noCategory()
|
||||
{
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->startOfMonth());
|
||||
$list = Auth::user()
|
||||
->transactionjournals()
|
||||
->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNull('category_transaction_journal.id')
|
||||
->before($end)
|
||||
->after($start)
|
||||
->orderBy('transaction_journals.date')
|
||||
->get(['transaction_journals.*']);
|
||||
$subTitle = 'Transactions without a category in ' . $start->format('F Y');
|
||||
|
||||
return view('categories.noCategory', compact('list', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
@ -122,11 +84,60 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$categories = Auth::user()->categories()->get();
|
||||
$categories = Auth::user()->categories()->orderBy('name', 'ASC')->get();
|
||||
|
||||
$categories->each(
|
||||
function (Category $category) {
|
||||
$latest = $category->transactionjournals()->orderBy('date', 'DESC')->first();
|
||||
if ($latest) {
|
||||
$category->lastActivity = $latest->date;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return view('categories.index', compact('categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function noCategory()
|
||||
{
|
||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||
$end = Session::get('end', Carbon::now()->startOfMonth());
|
||||
$list = Auth::user()
|
||||
->transactionjournals()
|
||||
->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->whereNull('category_transaction_journal.id')
|
||||
->before($end)
|
||||
->after($start)
|
||||
->orderBy('transaction_journals.date')
|
||||
->get(['transaction_journals.*']);
|
||||
$subTitle = 'Transactions without a category in ' . $start->format('F Y');
|
||||
|
||||
return view('categories.noCategory', compact('list', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function show(Category $category, CategoryRepositoryInterface $repository)
|
||||
{
|
||||
$hideCategory = true; // used in list.
|
||||
$page = intval(Input::get('page'));
|
||||
$offset = $page > 0 ? $page * 50 : 0;
|
||||
$set = $category->transactionJournals()->withRelevantData()->take(50)->offset($offset)->orderBy('date', 'DESC')->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
$count = $category->transactionJournals()->count();
|
||||
|
||||
$journals = new LengthAwarePaginator($set, $count, 50, $page);
|
||||
|
||||
return view('categories.show', compact('category', 'journals', 'hideCategory'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CategoryFormRequest $request
|
||||
* @param CategoryRepositoryInterface $repository
|
||||
|
@ -13,6 +13,7 @@ use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\LimitRepetition;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
@ -455,36 +456,32 @@ class GoogleChartController extends Controller
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Category $category
|
||||
* @param $year
|
||||
* @param Category $category
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function categoriesAndSpending(Category $category, $year, GChart $chart)
|
||||
public function categoryOverviewChart(Category $category, GChart $chart)
|
||||
{
|
||||
try {
|
||||
new Carbon('01-01-' . $year);
|
||||
} catch (Exception $e) {
|
||||
return view('error')->with('message', 'Invalid year.');
|
||||
}
|
||||
// oldest transaction in category:
|
||||
/** @var TransactionJournal $first */
|
||||
$first = $category->transactionjournals()->orderBy('date', 'ASC')->first();
|
||||
$start = $first->date;
|
||||
/** @var Preference $range */
|
||||
$range = Preferences::get('viewRange', '1M');
|
||||
// jump to start of week / month / year / etc (TODO).
|
||||
$start = Navigation::startOfPeriod($start, $range->data);
|
||||
|
||||
$chart->addColumn('Month', 'date');
|
||||
$chart->addColumn('Budgeted', 'number');
|
||||
$chart->addColumn('Period', 'date');
|
||||
$chart->addColumn('Spent', 'number');
|
||||
|
||||
$start = new Carbon('01-01-' . $year);
|
||||
$end = clone $start;
|
||||
$end->endOfYear();
|
||||
$end = new Carbon;
|
||||
while ($start <= $end) {
|
||||
|
||||
$currentEnd = clone $start;
|
||||
$currentEnd->endOfMonth();
|
||||
$spent = floatval($category->transactionjournals()->before($end)->after($start)->lessThan(0)->sum('amount')) * -1;
|
||||
$budgeted = null;
|
||||
$currentEnd = Navigation::endOfPeriod($start, $range->data);
|
||||
$spent = floatval($category->transactionjournals()->before($currentEnd)->after($start)->lessThan(0)->sum('amount')) * -1;
|
||||
$chart->addRow(clone $start, $spent);
|
||||
|
||||
$chart->addRow(clone $start, $budgeted, $spent);
|
||||
|
||||
$start->addMonth();
|
||||
$start = Navigation::addPeriod($start, $range->data, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -495,6 +492,36 @@ class GoogleChartController extends Controller
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Category $category
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function categoryPeriodChart(Category $category, GChart $chart)
|
||||
{
|
||||
// oldest transaction in category:
|
||||
/** @var TransactionJournal $first */
|
||||
$start = Session::get('start');
|
||||
$chart->addColumn('Period', 'date');
|
||||
$chart->addColumn('Spent', 'number');
|
||||
|
||||
$end = Session::get('end');
|
||||
while ($start <= $end) {
|
||||
$spent = floatval($category->transactionjournals()->onDate($start)->lessThan(0)->sum('amount')) * -1;
|
||||
$chart->addRow(clone $start, $spent);
|
||||
$start->addDay();
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
|
||||
return Response::json($chart->getData());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
|
@ -10,6 +10,8 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
use Input;
|
||||
use Redirect;
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class RelatedController
|
||||
@ -128,6 +130,34 @@ class RelatedController extends Controller
|
||||
return Response::json(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
|
||||
*
|
||||
* @param TransactionJournal $parentJournal
|
||||
* @param TransactionJournal $childJournal
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getRemoveRelation(TransactionJournal $parentJournal, TransactionJournal $childJournal)
|
||||
{
|
||||
$groups = $parentJournal->transactiongroups()->get();
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
foreach ($group->transactionjournals()->get() as $loopJournal) {
|
||||
if ($loopJournal->id == $childJournal->id) {
|
||||
// remove from group:
|
||||
$group->transactionjournals()->detach($childJournal);
|
||||
}
|
||||
}
|
||||
if ($group->transactionjournals()->count() == 1) {
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return Redirect::to(URL::previous());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
@ -138,19 +168,9 @@ class RelatedController extends Controller
|
||||
|
||||
$search = e(trim(Input::get('searchValue')));
|
||||
|
||||
$result = $repository->searchRelated($search, $journal);
|
||||
$result->each(
|
||||
function (TransactionJournal $journal) {
|
||||
/** @var Transaction $t */
|
||||
foreach ($journal->transactions()->get() as $t) {
|
||||
if ($t->amount > 0) {
|
||||
$journal->amount = $t->amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
$journals = $repository->searchRelated($search, $journal);
|
||||
return view('related.searchResult',compact('journals'));
|
||||
|
||||
return Response::json($result->toArray());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -229,18 +229,9 @@ class TransactionController extends Controller
|
||||
$t->after = $t->before + $t->amount;
|
||||
}
|
||||
);
|
||||
$members = new Collection;
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($journal->transactiongroups()->get() as $group) {
|
||||
/** @var TransactionJournal $loopJournal */
|
||||
foreach ($group->transactionjournals()->get() as $loopJournal) {
|
||||
if ($loopJournal->id != $journal->id) {
|
||||
$members->push($loopJournal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('transactions.show', compact('journal', 'members'))->with(
|
||||
|
||||
return view('transactions.show', compact('journal'))->with(
|
||||
'subTitle', e($journal->transactiontype->type) . ' "' . e($journal->description) . '"'
|
||||
);
|
||||
}
|
||||
|
@ -230,12 +230,15 @@ Route::group(
|
||||
Route::get('/chart/budget/{budget}/spending/{year?}', ['uses' => 'GoogleChartController@budgetsAndSpending']);
|
||||
Route::get('/chart/budgets/spending/{year?}', ['uses' => 'GoogleChartController@allBudgetsAndSpending']);
|
||||
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']);
|
||||
Route::get('/chart/category/{category}/spending/{year}', ['uses' => 'GoogleChartController@categoriesAndSpending']);
|
||||
|
||||
Route::get('/chart/reports/income-expenses/{year}', ['uses' => 'GoogleChartController@yearInExp']);
|
||||
Route::get('/chart/reports/income-expenses-sum/{year}', ['uses' => 'GoogleChartController@yearInExpSum']);
|
||||
Route::get('/chart/bills/{bill}', ['uses' => 'GoogleChartController@billOverview']);
|
||||
Route::get('/chart/piggy-history/{piggyBank}', ['uses' => 'GoogleChartController@piggyBankHistory']);
|
||||
|
||||
Route::get('/chart/category/{category}/period', ['uses' => 'GoogleChartController@categoryPeriodChart']);
|
||||
Route::get('/chart/category/{category}/overview', ['uses' => 'GoogleChartController@categoryOverviewChart']);
|
||||
|
||||
/**
|
||||
* Help Controller
|
||||
*/
|
||||
@ -284,6 +287,7 @@ Route::group(
|
||||
Route::get('/related/alreadyRelated/{tj}', ['uses' => 'RelatedController@alreadyRelated', 'as' => 'related.alreadyRelated']);
|
||||
Route::post('/related/relate/{tj}/{tjSecond}', ['uses' => 'RelatedController@relate', 'as' => 'related.relate']);
|
||||
Route::post('/related/removeRelation/{tj}/{tjSecond}', ['uses' => 'RelatedController@removeRelation', 'as' => 'related.removeRelation']);
|
||||
Route::get('/related/remove/{tj}/{tjSecond}', ['uses' => 'RelatedController@getRemoveRelation', 'as' => 'related.getRemoveRelation']);
|
||||
Route::get('/related/related/{tj}', ['uses' => 'RelatedController@related', 'as' => 'related.related']);
|
||||
Route::post('/related/search/{tj}', ['uses' => 'RelatedController@search', 'as' => 'related.search']);
|
||||
|
||||
|
@ -28,20 +28,27 @@ class Navigation
|
||||
$add = ($skip + 1);
|
||||
|
||||
$functionMap = [
|
||||
'1D' => 'addDays',
|
||||
'daily' => 'addDays',
|
||||
'1W' => 'addWeeks',
|
||||
'weekly' => 'addWeeks',
|
||||
'week' => 'addWeeks',
|
||||
'1M' => 'addMonths',
|
||||
'month' => 'addMonths',
|
||||
'monthly' => 'addMonths',
|
||||
'3M' => 'addMonths',
|
||||
'quarter' => 'addMonths',
|
||||
'quarterly' => 'addMonths',
|
||||
'6M' => 'addMonths',
|
||||
'half-year' => 'addMonths',
|
||||
'year' => 'addYears',
|
||||
'yearly' => 'addYears',
|
||||
];
|
||||
$modifierMap = [
|
||||
'quarter' => 3,
|
||||
'3M' => 3,
|
||||
'quarterly' => 3,
|
||||
'6M' => 6,
|
||||
'half-year' => 6,
|
||||
];
|
||||
if (!isset($functionMap[$repeatFreq])) {
|
||||
@ -68,24 +75,31 @@ class Navigation
|
||||
$currentEnd = clone $theCurrentEnd;
|
||||
|
||||
$functionMap = [
|
||||
'1D' => 'addDay',
|
||||
'daily' => 'addDay',
|
||||
'1W' => 'addWeek',
|
||||
'week' => 'addWeek',
|
||||
'weekly' => 'addWeek',
|
||||
'1M' => 'addMonth',
|
||||
'month' => 'addMonth',
|
||||
'monthly' => 'addMonth',
|
||||
'3M' => 'addMonths',
|
||||
'quarter' => 'addMonths',
|
||||
'quarterly' => 'addMonths',
|
||||
'6M' => 'addMonths',
|
||||
'half-year' => 'addMonths',
|
||||
'year' => 'addYear',
|
||||
'yearly' => 'addYear',
|
||||
];
|
||||
$modifierMap = [
|
||||
'quarter' => 3,
|
||||
'3M' => 3,
|
||||
'quarterly' => 3,
|
||||
'half-year' => 6,
|
||||
'6M' => 6,
|
||||
];
|
||||
|
||||
$subDay = ['week', 'weekly', 'month', 'monthly', 'quarter', 'quarterly', 'half-year', 'year', 'yearly'];
|
||||
$subDay = ['week', 'weekly', '1W', 'month', 'monthly', '1M', '3M', 'quarter', 'quarterly', '6M', 'half-year', 'year', 'yearly'];
|
||||
|
||||
if (!isset($functionMap[$repeatFreq])) {
|
||||
throw new FireflyException('Cannot do endOfPeriod for $repeat_freq ' . $repeatFreq);
|
||||
@ -298,11 +312,15 @@ class Navigation
|
||||
$date = clone $theDate;
|
||||
|
||||
$functionMap = [
|
||||
'1D' => 'startOfDay',
|
||||
'daily' => 'startOfDay',
|
||||
'1W' => 'startOfWeek',
|
||||
'week' => 'startOfWeek',
|
||||
'weekly' => 'startOfWeek',
|
||||
'month' => 'startOfMonth',
|
||||
'1M' => 'startOfMonth',
|
||||
'monthly' => 'startOfMonth',
|
||||
'3M' => 'firstOfQuarter',
|
||||
'quarter' => 'firstOfQuarter',
|
||||
'quarterly' => 'firstOfQuarter',
|
||||
'year' => 'startOfYear',
|
||||
@ -314,7 +332,7 @@ class Navigation
|
||||
|
||||
return $date;
|
||||
}
|
||||
if ($repeatFreq == 'half-year') {
|
||||
if ($repeatFreq == 'half-year' || $repeatFreq == '6M') {
|
||||
$month = intval($date->format('m'));
|
||||
$date->startOfYear();
|
||||
if ($month >= 7) {
|
||||
|
@ -41,7 +41,7 @@ class FireflyValidator extends Validator
|
||||
*/
|
||||
public function validateUniqueForUser($attribute, $value, $parameters)
|
||||
{
|
||||
$count = DB::table($parameters[0])->where($parameters[1], $value)->count();
|
||||
$count = DB::table($parameters[0])->where($parameters[1], $value)->where('id', '!=', $parameters[2])->count();
|
||||
if ($count == 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
#daterange {cursor:pointer;}
|
||||
#daterange {cursor:pointer;}
|
||||
.google-chart-error {height:30px;background:url('/images/error.png') no-repeat center center;}
|
@ -1,7 +1,8 @@
|
||||
$(function () {
|
||||
|
||||
if (typeof componentID !== 'undefined' && typeof repetitionID === 'undefined') {
|
||||
googleColumnChart('chart/category/' + componentID + '/spending/' + year, 'componentOverview');
|
||||
if (typeof categoryID !== 'undefined') {
|
||||
googleColumnChart('chart/category/' + categoryID + '/overview', 'componentOverview');
|
||||
googleColumnChart('chart/category/' + categoryID + '/period', 'periodOverview');
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,39 +2,38 @@ $(function () {
|
||||
|
||||
$('.currencySelect').click(currencySelect);
|
||||
|
||||
$('#daterange').daterangepicker(
|
||||
{
|
||||
ranges: {
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')],
|
||||
'Next Month': [moment().add('month', 1).startOf('month'), moment().add('month', 1).endOf('month')],
|
||||
'Everything': [firstDate, moment()]
|
||||
},
|
||||
opens: 'left',
|
||||
|
||||
format: 'DD-MM-YYYY',
|
||||
startDate: start,
|
||||
endDate: end
|
||||
$('#daterange').daterangepicker(
|
||||
{
|
||||
ranges: {
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')],
|
||||
'Everything': [firstDate, moment()]
|
||||
},
|
||||
function(start, end, label) {
|
||||
opens: 'left',
|
||||
|
||||
// send post.
|
||||
$.post(dateRangeURL, {
|
||||
start: start.format('YYYY-MM-DD'),
|
||||
end: end.format('YYYY-MM-DD'),
|
||||
label: label,
|
||||
_token: token
|
||||
}).success(function() {
|
||||
window.location.reload(true);
|
||||
}).fail(function() {
|
||||
alert('Could not change date range');
|
||||
format: 'DD-MM-YYYY',
|
||||
startDate: start,
|
||||
endDate: end
|
||||
},
|
||||
function (start, end, label) {
|
||||
|
||||
});
|
||||
// send post.
|
||||
$.post(dateRangeURL, {
|
||||
start: start.format('YYYY-MM-DD'),
|
||||
end: end.format('YYYY-MM-DD'),
|
||||
label: label,
|
||||
_token: token
|
||||
}).success(function () {
|
||||
window.location.reload(true);
|
||||
}).fail(function () {
|
||||
alert('Could not change date range');
|
||||
|
||||
//alert('A date range was chosen: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
|
||||
}
|
||||
});
|
||||
|
||||
);
|
||||
//alert('A date range was chosen: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -42,20 +42,9 @@ function searchRelatedTransactions(e, ID) {
|
||||
var searchValue = $('#relatedSearchValue').val();
|
||||
if (searchValue != '') {
|
||||
$.post('related/search/' + ID, {searchValue: searchValue,_token:token}).success(function (data) {
|
||||
// post each result to some div.
|
||||
$('#relatedSearchResults').empty();
|
||||
|
||||
$.each(data, function (i, row) {
|
||||
var tr = $('<tr>');
|
||||
|
||||
var checkBox = $('<td>').append($('<input>').attr('type', 'checkbox').data('relateto', ID).data('id', row.id).click(doRelateNewTransaction));
|
||||
var description = $('<td>').text(row.description);
|
||||
var amount = $('<td>').html(row.amount);
|
||||
tr.append(checkBox).append(description).append(amount);
|
||||
$('#relatedSearchResults').append(tr);
|
||||
//$('#relatedSearchResults').append($('<div>').text(row.id));
|
||||
});
|
||||
|
||||
// post the results to some div.
|
||||
$('#relatedSearchResultsTitle').show();
|
||||
$('#relatedSearchResults').empty().html(data);
|
||||
|
||||
}).fail(function () {
|
||||
alert('Could not search. Sorry.');
|
||||
|
@ -2,7 +2,17 @@
|
||||
@section('content')
|
||||
{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) !!}
|
||||
<div class="row">
|
||||
<div class="col-lg-9 col-md-9 col-sm-7">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Overview
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="periodOverview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Overview
|
||||
@ -11,6 +21,10 @@
|
||||
<div id="componentOverview"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-md-12">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
@ -21,16 +35,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-5">
|
||||
(TODO)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script type="text/javascript">
|
||||
var componentID = {{$category->id}};
|
||||
var year = {{Session::get('start',\Carbon\Carbon::now()->startOfMonth())->format('Y')}};
|
||||
var categoryID = {{$category->id}};
|
||||
var currencyCode = '{{Amount::getCurrencyCode()}}';
|
||||
</script>
|
||||
<!-- load the libraries and scripts necessary for Google Charts: -->
|
||||
|
@ -109,7 +109,6 @@
|
||||
|
||||
<!-- modal to relate transactions to each other -->
|
||||
<div class="modal fade" id="relationModal">
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
|
||||
|
@ -21,8 +21,11 @@
|
||||
<a href="{{route('categories.show',$category->id)}}" title="{{{$category->name}}}">{{{$category->name}}}</a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@if($category->lastActivity)
|
||||
{{$category->lastActivity->format('jS F Y')}}
|
||||
@else
|
||||
<em>Never</em>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
@ -45,10 +45,10 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-clock-o fa-fw"></i> Home view range
|
||||
<i class="fa fa-clock-o fa-fw"></i> View range
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p class="text-info">By default, Firefly will show you one month of data.</p>
|
||||
<p class="text-info">Some charts are automatically grouped in periods. What period would you prefer?</p>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange" value="1D" @if($viewRange == '1D') checked @endif>
|
||||
|
@ -5,15 +5,18 @@
|
||||
<h4 class="modal-title">Relate "{{{$journal->description}}}" to other transactions</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Use this form to relate this transaction to other transactions. An often used relation is any unexpected expenses and the balancing transfer
|
||||
from a savings account.
|
||||
</p>
|
||||
<form class="form-inline" role="form" id="searchRelated">
|
||||
<div class="form-group">
|
||||
<input type="text" style="width:400px;" class="form-control" name="related" id="relatedSearchValue" placeholder="Search for related transactions">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Search</button>
|
||||
</form>
|
||||
<h5>Search results</h5>
|
||||
<div>
|
||||
<table id="relatedSearchResults" class="table table-bordered table-striped"></table>
|
||||
<h5 id="relatedSearchResultsTitle" style="display:none;">Search results</h5>
|
||||
<div id="relatedSearchResults">
|
||||
</div>
|
||||
<h5>(Already) related transactions</h5>
|
||||
<div>
|
||||
|
58
resources/views/related/searchResult.blade.php
Normal file
58
resources/views/related/searchResult.blade.php
Normal file
@ -0,0 +1,58 @@
|
||||
<table class="table table-bordered table-striped table-condensed">
|
||||
@foreach($journals as $journal)
|
||||
<tr>
|
||||
<td><a href="#">link</a></td>
|
||||
<td>
|
||||
@if($journal->transactiontype->type == 'Withdrawal')
|
||||
<i class="fa fa-long-arrow-left fa-fw" title="Withdrawal"></i>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Deposit')
|
||||
<i class="fa fa-long-arrow-right fa-fw" title="Deposit"></i>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Transfer')
|
||||
<i class="fa fa-arrows-h fa-fw" title="Transfer"></i>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{$journal->date->format('jS M Y')}}</td>
|
||||
<td>
|
||||
<a title="{{$journal->date->format('jS M Y')}}" href="{{route('transactions.show',$journal->id)}}">{{{$journal->description}}}</a>
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactiontype->type == 'Withdrawal')
|
||||
<span class="text-danger">{{Amount::formatTransaction($journal->transactions[0],false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Deposit')
|
||||
<span class="text-success">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Transfer')
|
||||
<span class="text-info">{{Amount::formatTransaction($journal->transactions[1],false)}}</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{{--
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<span class="pull-right small">
|
||||
@if(isset($account))
|
||||
@foreach($journal->transactions as $index => $t)
|
||||
@if($t->account_id == $account->id)
|
||||
{!! Amount::formatTransaction($t) !!}
|
||||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
@foreach($journal->transactions as $index => $t)
|
||||
@if($index == 0)
|
||||
{!! Amount::formatTransaction($t) !!}
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</span>
|
||||
|
||||
</a>
|
||||
--}}
|
||||
@endforeach
|
||||
</table>
|
@ -12,10 +12,6 @@
|
||||
<td>Date</td>
|
||||
<td>{{{$journal->date->format('jS F Y')}}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Currency</td>
|
||||
<td>{{{$journal->transactioncurrency->code}}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Type</td>
|
||||
<td>{{{$journal->transactiontype->type}}}</td>
|
||||
@ -32,13 +28,13 @@
|
||||
</tr>
|
||||
@foreach($journal->budgets()->get() as $budget)
|
||||
<tr>
|
||||
<td>{{$budget->class}}</td>
|
||||
<td>Budget</td>
|
||||
<td><a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@foreach($journal->categories()->get() as $category)
|
||||
<tr>
|
||||
<td>{{$category->class}}</td>
|
||||
<td>Category</td>
|
||||
<td><a href="{{route('categories.show',$category->id)}}">{{{$category->name}}}</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@ -60,18 +56,41 @@
|
||||
<div class="panel-heading">
|
||||
Related transactions
|
||||
</div>
|
||||
@if($members->count() == 0)
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<em>No related transactions</em>
|
||||
</p>
|
||||
</div>
|
||||
@else
|
||||
<table class="table">
|
||||
@foreach($members as $jrnl)
|
||||
@if($journal->transactiongroups()->count() == 0)
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<em>No related transactions</em>
|
||||
</p>
|
||||
</div>
|
||||
@else
|
||||
<table class="table">
|
||||
@foreach($journal->transactiongroups()->get() as $group)
|
||||
<tr>
|
||||
<td><input type="checkbox" checked="checked" data-relatedto="{{$journal->id}}" data-id="{{$jrnl->id}}" class="unrelate-checkbox" /></td>
|
||||
<td><a href="#">{{{$jrnl->description}}}</a></td>
|
||||
<th colspan="2">Group #{{$group->id}} ({{$group->relation}})</th>
|
||||
</tr>
|
||||
@foreach($group->transactionjournals()->where('transaction_journals.id','!=',$journal->id)->get() as $jrnl)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{route('related.getRemoveRelation',[$journal->id, $jrnl->id])}}" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{route('transactions.show',$jrnl->id)}}">{{{$jrnl->description}}}</a>
|
||||
</td>
|
||||
<td>
|
||||
@foreach($jrnl->transactions()->get() as $t)
|
||||
@if($t->amount > 0)
|
||||
{!! Amount::formatTransaction($t) !!}
|
||||
@endif
|
||||
@endforeach
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
{{--
|
||||
<td>
|
||||
<a href="#" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<!--<input type="checkbox" checked="checked" data-relatedto="{{$journal->id}}" data-id="{{$jrnl->id}}" class="unrelate-checkbox" />-->
|
||||
</td>
|
||||
<td><a href="{{route('transactions.show',$jrnl->id)}}">{{{$jrnl->description}}}</a></td>
|
||||
|
||||
<td>
|
||||
@foreach($jrnl->transactions()->get() as $t)
|
||||
@ -80,6 +99,7 @@
|
||||
@endif
|
||||
@endforeach
|
||||
</td>
|
||||
--}}
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user