diff --git a/app/controllers/MigrateController.php b/app/controllers/MigrateController.php index 19b115f8e3..a9bd16c200 100644 --- a/app/controllers/MigrateController.php +++ b/app/controllers/MigrateController.php @@ -11,7 +11,8 @@ class MigrateController extends BaseController */ public function index() { - return View::make('migrate.index')->with('index', 'Migration'); + return View::make('migrate.index')->with('index', 'Migration')->with('title','Migrate')-> + with('subTitle','From Firefly II to Firefly III'); } /** diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php index 906251bb3a..c761cbf207 100644 --- a/app/controllers/PiggybankController.php +++ b/app/controllers/PiggybankController.php @@ -49,10 +49,20 @@ class PiggybankController extends BaseController */ public function createPiggybank() { - $periods = Config::get('firefly.piggybank_periods'); - $accounts = $this->_accounts->getActiveDefaultAsSelectList(); + /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ + $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); - return View::make('piggybanks.create-piggybank')->with('accounts', $accounts)->with('periods', $periods); + + $periods = Config::get('firefly.piggybank_periods'); + $list = $this->_accounts->getActiveDefault(); + $accounts = $toolkit->makeSelectList($list); + + View::share('title', 'Piggy banks'); + View::share('subTitle', 'Create new'); + View::share('mainTitleIcon', 'fa-sort-amount-asc'); + + return View::make('piggybanks.create-piggybank')->with('accounts', $accounts) + ->with('periods', $periods); } /** @@ -60,8 +70,16 @@ class PiggybankController extends BaseController */ public function createRepeated() { + /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ + $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); + $periods = Config::get('firefly.piggybank_periods'); - $accounts = $this->_accounts->getActiveDefaultAsSelectList(); + $list = $this->_accounts->getActiveDefault(); + $accounts = $toolkit->makeSelectList($list); + + View::share('title', 'Repeated expenses'); + View::share('subTitle', 'Create new'); + View::share('mainTitleIcon', 'fa-rotate-right'); return View::make('piggybanks.create-repeated')->with('accounts', $accounts)->with('periods', $periods); } @@ -73,6 +91,15 @@ class PiggybankController extends BaseController */ public function delete(Piggybank $piggyBank) { + View::share('subTitle', 'Delete "'.$piggyBank->name.'"'); + if($piggyBank->repeats == 1) { + View::share('title', 'Repeated expenses'); + View::share('mainTitleIcon', 'fa-rotate-right'); + } else { + View::share('title', 'Piggy banks'); + View::share('mainTitleIcon', 'fa-sort-amount-asc'); + } + return View::make('piggybanks.delete')->with('piggybank', $piggyBank); } @@ -98,12 +125,29 @@ class PiggybankController extends BaseController */ public function edit(Piggybank $piggyBank) { - $accounts = $this->_accounts->getActiveDefaultAsSelectList(); + /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ + $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); + + $list = $this->_accounts->getActiveDefault(); + $accounts = $toolkit->makeSelectList($list); $periods = Config::get('firefly.piggybank_periods'); + + + View::share('subTitle','Edit "'.$piggyBank->name.'"'); + + + if ($piggyBank->repeats == 1) { + View::share('title','Repeated expenses'); + View::share('mainTitleIcon', 'fa-rotate-left'); + return View::make('piggybanks.edit-repeated')->with('piggybank', $piggyBank)->with('accounts', $accounts) ->with('periods', $periods); } else { + // piggy bank. + View::share('title','Piggy banks'); + View::share('mainTitleIcon', 'fa-sort-amount-asc'); + return View::make('piggybanks.edit-piggybank')->with('piggybank', $piggyBank)->with('accounts', $accounts) ->with('periods', $periods); } @@ -114,7 +158,7 @@ class PiggybankController extends BaseController /** * @return $this */ - public function index() + public function piggybanks() { $countRepeating = $this->_repository->countRepeating(); $countNonRepeating = $this->_repository->countNonrepeating(); @@ -134,6 +178,44 @@ class PiggybankController extends BaseController } } + View::share('title', 'Piggy banks'); + View::share('subTitle', 'Save for big expenses'); + View::share('mainTitleIcon', 'fa-sort-amount-asc'); + + return View::make('piggybanks.index')->with('piggybanks', $piggybanks) + ->with('countRepeating', $countRepeating) + ->with('countNonRepeating', $countNonRepeating) + ->with('accounts', $accounts); + } + + /** + * @return $this + */ + public function repeated() + { + $countRepeating = $this->_repository->countRepeating(); + $countNonRepeating = $this->_repository->countNonrepeating(); + + $piggybanks = $this->_repository->get(); + + // get the accounts with each piggy bank and check their balance; Fireflyy might needs to + // show the user a correction. + + $accounts = []; + /** @var \Piggybank $piggybank */ + foreach ($piggybanks as $piggybank) { + $account = $piggybank->account; + $id = $account->id; + if (!isset($accounts[$id])) { + $accounts[$id] = ['account' => $account, 'left' => $this->_repository->leftOnAccount($account)]; + } + } + + View::share('title', 'Repeated expenses'); + View::share('subTitle', 'Save for returning bills'); + View::share('mainTitleIcon', 'fa-rotate-left'); + + return View::make('piggybanks.index')->with('piggybanks', $piggybanks) ->with('countRepeating', $countRepeating) ->with('countNonRepeating', $countNonRepeating) @@ -203,6 +285,18 @@ class PiggybankController extends BaseController $leftOnAccount = $this->_repository->leftOnAccount($piggyBank->account); $balance = $piggyBank->account->balance(); + View::share('subTitle',$piggyBank->name); + + if($piggyBank->repeats == 1) { + // repeated expense. + View::share('title','Repeated expenses'); + View::share('mainTitleIcon', 'fa-rotate-left'); + } else { + // piggy bank. + View::share('title','Piggy banks'); + View::share('mainTitleIcon', 'fa-sort-amount-asc'); + } + return View::make('piggybanks.show')->with('piggyBank', $piggyBank)->with('leftOnAccount', $leftOnAccount) ->with('balance', $balance); } @@ -226,7 +320,7 @@ class PiggybankController extends BaseController Session::flash('success', 'New piggy bank "' . $piggyBank->name . '" created!'); Event::fire('piggybanks.store', [$piggyBank]); - return Redirect::route('piggybanks.index'); + return Redirect::route('piggybanks.index.piggybanks'); } else { @@ -254,8 +348,7 @@ class PiggybankController extends BaseController if ($piggyBank->id) { Session::flash('success', 'New piggy bank "' . $piggyBank->name . '" created!'); Event::fire('piggybanks.store', [$piggyBank]); - - return Redirect::route('piggybanks.index'); + return Redirect::route('piggybanks.index.repeated'); } else { Session::flash('error', 'Could not save piggy bank: ' . $piggyBank->errors()->first()); diff --git a/app/controllers/PreferencesController.php b/app/controllers/PreferencesController.php index 246720d24b..2e1d82bcda 100644 --- a/app/controllers/PreferencesController.php +++ b/app/controllers/PreferencesController.php @@ -22,6 +22,8 @@ class PreferencesController extends BaseController $this->_accounts = $accounts; $this->_preferences = $preferences; + View::share('title','Preferences'); + View::share('mainTitleIcon','fa-gear'); } /** diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php index 2ae0db6295..a7bbf4d55d 100644 --- a/app/controllers/ProfileController.php +++ b/app/controllers/ProfileController.php @@ -22,6 +22,9 @@ class ProfileController extends BaseController */ public function index() { + View::share('title','Profile'); + View::share('subTitle',Auth::user()->email); + View::share('mainTitleIcon','fa-user'); return View::make('profile.index'); } @@ -30,6 +33,9 @@ class ProfileController extends BaseController */ public function changePassword() { + View::share('title',Auth::user()->email); + View::share('subTitle','Change your password'); + View::share('mainTitleIcon','fa-user'); return View::make('profile.change-password'); } diff --git a/app/controllers/RecurringController.php b/app/controllers/RecurringController.php index 6eb63cdd94..404a9f3c46 100644 --- a/app/controllers/RecurringController.php +++ b/app/controllers/RecurringController.php @@ -17,6 +17,9 @@ class RecurringController extends BaseController public function __construct(RTR $repository) { $this->_repository = $repository; + + View::share('title','Recurring transactions'); + View::share('mainTitleIcon','fa-rotate-right'); } /** @@ -24,6 +27,7 @@ class RecurringController extends BaseController */ public function create() { + View::share('subTitle','Create new'); $periods = \Config::get('firefly.periods_to_text'); return View::make('recurring.create')->with('periods', $periods); @@ -36,6 +40,7 @@ class RecurringController extends BaseController */ public function delete(RecurringTransaction $recurringTransaction) { + View::share('subTitle','Delete "' .$recurringTransaction->name.'"'); return View::make('recurring.delete')->with('recurringTransaction', $recurringTransaction); } @@ -67,6 +72,8 @@ class RecurringController extends BaseController { $periods = \Config::get('firefly.periods_to_text'); + View::share('subTitle','Edit "' .$recurringTransaction->name.'"'); + return View::make('recurring.edit')->with('periods', $periods)->with( 'recurringTransaction', $recurringTransaction ); @@ -79,6 +86,8 @@ class RecurringController extends BaseController { $list = $this->_repository->get(); + + return View::make('recurring.index')->with('list', $list); } @@ -87,6 +96,7 @@ class RecurringController extends BaseController */ public function show(RecurringTransaction $recurringTransaction) { + View::share('subTitle',$recurringTransaction->name); return View::make('recurring.show')->with('recurring', $recurringTransaction); } diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index b84832650f..8bd880a8e2 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -22,6 +22,7 @@ class TransactionController extends BaseController { $this->_repository = $repository; View::share('title', 'Transactions'); + View::share('mainTitleIcon', 'fa-repeat'); } /** @@ -37,8 +38,8 @@ class TransactionController extends BaseController // get asset accounts with names and id's. /** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */ $accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface'); - $accounts = $accountRepository->getOfTypes(['Asset account','Default account']); - $assetAccounts = $toolkit->makeSelectList($accounts); + $list = $accountRepository->getActiveDefault(); + $assetAccounts = $toolkit->makeSelectList($list); // get budgets as a select list. @@ -64,6 +65,12 @@ class TransactionController extends BaseController */ public function delete(TransactionJournal $transactionJournal) { + View::share( + 'subTitle', + 'Delete ' . strtolower($transactionJournal->transactionType->type) . ' "' . $transactionJournal->description + . '"' + ); + return View::make('transactions.delete')->with('journal', $transactionJournal); @@ -95,9 +102,18 @@ class TransactionController extends BaseController // some lists prefilled: // get accounts with names and id's. + /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ + $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); + + // get asset accounts with names and id's. /** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */ $accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface'); - $accounts = $accountRepository->getActiveDefaultAsSelectList(); + $list = $accountRepository->getActiveDefault(); + $accounts = $toolkit->makeSelectList($list); + + View::share( + 'subTitle', 'Edit ' . strtolower($journal->transactionType->type) . ' "' . $journal->description . '"' + ); // get budgets as a select list. /** @var \Firefly\Storage\Budget\BudgetRepositoryInterface $budgetRepository */ @@ -156,8 +172,8 @@ class TransactionController extends BaseController public function expenses() { $transactionType = $this->_repository->getTransactionType('Withdrawal'); - $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); - $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); + $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); + $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); if ($start <= $end && !is_null($start) && !is_null($end)) { $journals = $this->_repository->paginate($transactionType, 25, $start, $end); $filtered = true; @@ -168,17 +184,17 @@ class TransactionController extends BaseController $filters = null; } - + View::share('subTitleIcon', 'fa-long-arrow-left'); return View::make('transactions.index')->with('journals', $journals)->with('filtered', $filtered)->with( 'filters', $filters - ); + )->with('subTitle', 'Expenses'); } public function revenue() { $transactionType = $this->_repository->getTransactionType('Deposit'); - $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); - $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); + $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); + $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); if ($start <= $end && !is_null($start) && !is_null($end)) { $journals = $this->_repository->paginate($transactionType, 25, $start, $end); $filtered = true; @@ -189,18 +205,18 @@ class TransactionController extends BaseController $filters = null; } - + View::share('subTitleIcon', 'fa-long-arrow-right'); return View::make('transactions.index')->with('journals', $journals)->with('filtered', $filtered)->with( 'filters', $filters - ); + )->with('subTitle', 'Revenue'); } public function transfers() { $transactionType = $this->_repository->getTransactionType('Transfer'); - $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); - $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); + $start = is_null(Input::get('startdate')) ? null : new Carbon(Input::get('startdate')); + $end = is_null(Input::get('enddate')) ? null : new Carbon(Input::get('enddate')); if ($start <= $end && !is_null($start) && !is_null($end)) { $journals = $this->_repository->paginate($transactionType, 25, $start, $end); $filtered = true; @@ -211,10 +227,10 @@ class TransactionController extends BaseController $filters = null; } - + View::share('subTitleIcon', 'fa-arrows-h'); return View::make('transactions.index')->with('journals', $journals)->with('filtered', $filtered)->with( 'filters', $filters - ); + )->with('subTitle', 'Transfers'); } @@ -248,6 +264,8 @@ class TransactionController extends BaseController */ public function show(TransactionJournal $journal) { + View::share('subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'); + return View::make('transactions.show')->with('journal', $journal); } @@ -260,8 +278,8 @@ class TransactionController extends BaseController { $journal = $this->_repository->store($what, Input::all()); - if($journal->errors()->count() > 0) { - Session::flash('error', 'Could not save transaction: ' . $journal->errors()->first().'!'); + if ($journal->errors()->count() > 0) { + Session::flash('error', 'Could not save transaction: ' . $journal->errors()->first() . '!'); return Redirect::route('transactions.create', [$what])->withInput()->withErrors($journal->errors()); } @@ -282,7 +300,7 @@ class TransactionController extends BaseController if (Input::get('create') == '1') { return Redirect::route('transactions.create', [$what])->withInput(); } else { - switch($what) { + switch ($what) { case 'withdrawal': return Redirect::route('transactions.expenses'); break; @@ -296,7 +314,7 @@ class TransactionController extends BaseController } } else { - Session::flash('error', 'Could not save transaction: ' . $journal->errors()->first().'!'); + Session::flash('error', 'Could not save transaction: ' . $journal->errors()->first() . '!'); return Redirect::route('transactions.create', [$what])->withInput()->withErrors($journal->errors()); } diff --git a/app/views/migrate/index.blade.php b/app/views/migrate/index.blade.php index 6524f0a9be..dec6859517 100644 --- a/app/views/migrate/index.blade.php +++ b/app/views/migrate/index.blade.php @@ -2,18 +2,14 @@ @section('content')
-

Firefly
- Migration -

+

+ Read the wiki to read more about how data migration. +

  1. Upload firefly-export-****-**-**.json
  2. Wait..
  3. Done!
- -

-   -

{{Form::open(['files' => true,'url' => route('migrate.upload')])}}
diff --git a/app/views/partials/menu.blade.php b/app/views/partials/menu.blade.php index 74f95dd58c..7274303d40 100644 --- a/app/views/partials/menu.blade.php +++ b/app/views/partials/menu.blade.php @@ -12,13 +12,14 @@