mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
New stuff and fix for transaction controller [skip ci]
This commit is contained in:
38
app/controllers/CategoryController.php
Normal file
38
app/controllers/CategoryController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class ComponentsController extends BaseController
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class ComponentsController
|
||||
*/
|
||||
class ComponentsController extends BaseController
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -54,9 +54,6 @@ class HomeController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
// get the budgets for this period:
|
||||
$budgets = $this->_budgets->getWithRepetitionsInPeriod($start, \Session::get('range'));
|
||||
|
||||
$transactions = [];
|
||||
foreach ($accounts as $account) {
|
||||
$set = $this->_journal->getByAccountInDateRange($account, 15, $start, $end);
|
||||
@@ -74,9 +71,7 @@ class HomeController extends BaseController
|
||||
}
|
||||
|
||||
// build the home screen:
|
||||
return View::make('index')->with('count', $count)->with('transactions', $transactions)->with(
|
||||
'budgets', $budgets
|
||||
);
|
||||
return View::make('index')->with('count', $count)->with('transactions', $transactions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
34
app/controllers/PiggybankController.php
Normal file
34
app/controllers/PiggybankController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class PiggybankController extends BaseController {
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
}
|
||||
}
|
||||
35
app/controllers/RecurringControlle.php
Normal file
35
app/controllers/RecurringControlle.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class RecurringController extends BaseController {
|
||||
public function create()
|
||||
{
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
}
|
||||
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
public function show()
|
||||
{
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
}
|
||||
}
|
||||
9
app/controllers/ReportController.php
Normal file
9
app/controllers/ReportController.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class ReportController extends BaseController {
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
10
app/controllers/SearchController.php
Normal file
10
app/controllers/SearchController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class SearchController
|
||||
{
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,7 @@ class TransactionController extends BaseController
|
||||
{
|
||||
// get accounts with names and id's.
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
|
||||
@@ -54,6 +52,90 @@ class TransactionController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($journalId)
|
||||
{
|
||||
// get journal:
|
||||
$journal = $this->_journal->find($journalId);
|
||||
|
||||
if ($journal) {
|
||||
// type is useful for display:
|
||||
$what = strtolower($journal->transactiontype->type);
|
||||
|
||||
// some lists prefilled:
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
$budgets[0] = '(no budget)';
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
// data to properly display form:
|
||||
$data = [
|
||||
'date' => $journal->date->format('Y-m-d'),
|
||||
'category' => '',
|
||||
'budget_id' => 0
|
||||
];
|
||||
$category = $journal->categories()->first();
|
||||
if (!is_null($category)) {
|
||||
$data['category'] = $category->name;
|
||||
}
|
||||
switch ($journal->transactiontype->type) {
|
||||
case 'Withdrawal':
|
||||
$data['account_id'] = $journal->transactions[0]->account->id;
|
||||
$data['beneficiary'] = $journal->transactions[1]->account->name;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
$budget = $journal->budgets()->first();
|
||||
if (!is_null($budget)) {
|
||||
$data['budget_id'] = $budget->id;
|
||||
}
|
||||
break;
|
||||
case 'Deposit':
|
||||
$data['account_id'] = $journal->transactions[1]->account->id;
|
||||
$data['beneficiary'] = $journal->transactions[0]->account->name;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
break;
|
||||
case 'Transfer':
|
||||
$data['account_from_id'] = $journal->transactions[1]->account->id;
|
||||
$data['account_to_id'] = $journal->transactions[0]->account->id;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
break;
|
||||
}
|
||||
|
||||
return View::make('transactions.edit')->with('journal', $journal)->with('accounts', $accounts)->with(
|
||||
'what', $what
|
||||
)->with('budgets', $budgets)->with('data', $data);
|
||||
}
|
||||
|
||||
return View::make('error')->with('message', 'Invalid journal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$transactions = $this->_journal->paginate(25);
|
||||
|
||||
return View::make('transactions.index')->with('transactions', $transactions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function show($journalId)
|
||||
{
|
||||
$journal = $this->_journal->find($journalId);
|
||||
if ($journal) {
|
||||
return View::make('transactions.show')->with('journal', $journal);
|
||||
}
|
||||
|
||||
return View::make('error')->with('message', 'Invalid journal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $what
|
||||
*
|
||||
@@ -123,90 +205,6 @@ class TransactionController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$transactions = $this->_journal->paginate(25);
|
||||
|
||||
return View::make('transactions.index')->with('transactions', $transactions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function show($journalId)
|
||||
{
|
||||
$journal = $this->_journal->find($journalId);
|
||||
if ($journal) {
|
||||
return View::make('transactions.show')->with('journal', $journal);
|
||||
}
|
||||
|
||||
return View::make('error')->with('message', 'Invalid journal');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $journalId
|
||||
*
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($journalId)
|
||||
{
|
||||
// get journal:
|
||||
$journal = $this->_journal->find($journalId);
|
||||
|
||||
if ($journal) {
|
||||
// type is useful for display:
|
||||
$what = strtolower($journal->transactiontype->type);
|
||||
|
||||
// some lists prefilled:
|
||||
$budgets = $this->_budgets->getAsSelectList();
|
||||
$budgets[0] = '(no budget)';
|
||||
$accounts = $this->_accounts->getActiveDefaultAsSelectList();
|
||||
|
||||
// data to properly display form:
|
||||
$data = [
|
||||
'date' => $journal->date->format('Y-m-d'),
|
||||
'category' => '',
|
||||
'budget_id' => 0
|
||||
];
|
||||
$category = $journal->categories()->first();
|
||||
if (!is_null($category)) {
|
||||
$data['category'] = $category->name;
|
||||
}
|
||||
switch ($journal->transactiontype->type) {
|
||||
case 'Withdrawal':
|
||||
$data['account_id'] = $journal->transactions[0]->account->id;
|
||||
$data['beneficiary'] = $journal->transactions[1]->account->name;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
$budget = $journal->budgets()->first();
|
||||
if (!is_null($budget)) {
|
||||
$data['budget_id'] = $budget->id;
|
||||
}
|
||||
break;
|
||||
case 'Deposit':
|
||||
$data['account_id'] = $journal->transactions[1]->account->id;
|
||||
$data['beneficiary'] = $journal->transactions[0]->account->name;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
break;
|
||||
case 'Transfer':
|
||||
$data['account_from_id'] = $journal->transactions[1]->account->id;
|
||||
$data['account_to_id'] = $journal->transactions[0]->account->id;
|
||||
$data['amount'] = floatval($journal->transactions[1]->amount);
|
||||
break;
|
||||
}
|
||||
|
||||
return View::make('transactions.edit')->with('journal', $journal)->with('accounts', $accounts)->with(
|
||||
'what', $what
|
||||
)->with('budgets', $budgets)->with('data', $data);
|
||||
}
|
||||
|
||||
return View::make('error')->with('message', 'Invalid journal');
|
||||
}
|
||||
|
||||
public function update($journalId)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user