diff --git a/.env.backup b/.env.backup new file mode 100755 index 0000000000..6e6fd0fa1a --- /dev/null +++ b/.env.backup @@ -0,0 +1,18 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=SomeRandomString + +DB_CONNECTION=mysql +DB_HOST=localhost +DB_DATABASE=homestead +DB_USERNAME=homestead +DB_PASSWORD=secret + +CACHE_DRIVER=file +SESSION_DRIVER=file + +EMAIL_SMTP= +EMAIL_DRIVER=smtp +EMAIL_USERNAME= +EMAIL_PASSWORD= +ANALYTICS_ID= \ No newline at end of file diff --git a/.env.local b/.env.local new file mode 100755 index 0000000000..6e6fd0fa1a --- /dev/null +++ b/.env.local @@ -0,0 +1,18 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=SomeRandomString + +DB_CONNECTION=mysql +DB_HOST=localhost +DB_DATABASE=homestead +DB_USERNAME=homestead +DB_PASSWORD=secret + +CACHE_DRIVER=file +SESSION_DRIVER=file + +EMAIL_SMTP= +EMAIL_DRIVER=smtp +EMAIL_USERNAME= +EMAIL_PASSWORD= +ANALYTICS_ID= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 71dfa14632..2b3beddc88 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ tests/_output/* clover.xml node_modules/ addNewLines.php +.phpstorm.meta.php diff --git a/README.md b/README.md index bc71424d42..39e07788ad 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Firefly III (v3.3.9) +Firefly III (v3.4) =========== [![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii) diff --git a/app/Handlers/Events/ConnectJournalToPiggyBank.php b/app/Handlers/Events/ConnectJournalToPiggyBank.php index 81152e3d97..7278d49691 100644 --- a/app/Handlers/Events/ConnectJournalToPiggyBank.php +++ b/app/Handlers/Events/ConnectJournalToPiggyBank.php @@ -65,6 +65,22 @@ class ConnectJournalToPiggyBank } Log::debug('Found rep! ' . $repetition->id); + + /* + * Add amount when + */ + /** @var Transaction $transaction */ + foreach ($journal->transactions()->get() as $transaction) { + if ($transaction->account_id == $piggyBank->account_id) { + if ($transaction->amount < 0) { + $amount = $amount * -1; + Log::debug('Transaction is away from piggy, so amount becomes ' . $amount); + } else { + Log::debug('Transaction is to from piggy, so amount stays ' . $amount); + } + } + } + $repetition->currentamount += $amount; $repetition->save(); diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index e5e2e8a919..3bd0736110 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -11,6 +11,7 @@ use Input; use Redirect; use Session; use Steam; +use URL; use View; /** @@ -25,6 +26,7 @@ class AccountController extends Controller */ public function __construct() { + parent::__construct(); View::share('mainTitleIcon', 'fa-credit-card'); View::share('title', 'Accounts'); } @@ -39,6 +41,12 @@ class AccountController extends Controller $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $subTitle = 'Create a new ' . e($what) . ' account'; + // put previous url in session if not redirect from store (not "create another"). + if (Session::get('accounts.create.fromStore') !== true) { + Session::put('accounts.create.url', URL::previous()); + } + Session::forget('accounts.create.fromStore'); + return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle')); } @@ -52,6 +60,9 @@ class AccountController extends Controller { $subTitle = 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"'; + // put previous url in session + Session::put('accounts.delete.url', URL::previous()); + return view('accounts.delete', compact('account', 'subTitle')); } @@ -71,7 +82,7 @@ class AccountController extends Controller Session::flash('success', 'The ' . e($typeName) . ' account "' . e($name) . '" was deleted.'); - return Redirect::route('accounts.index', $typeName); + return Redirect::to(Session::get('accounts.delete.url')); } /** @@ -88,6 +99,12 @@ class AccountController extends Controller $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what); $openingBalance = $repository->openingBalanceTransaction($account); + // put previous url in session if not redirect from store (not "return_to_edit"). + if (Session::get('accounts.edit.fromUpdate') !== true) { + Session::put('accounts.edit.url', URL::previous()); + } + Session::forget('accounts.edit.fromUpdate'); + // pre fill some useful values. // the opening balance is tricky: @@ -184,10 +201,15 @@ class AccountController extends Controller Session::flash('success', 'New account "' . $account->name . '" stored!'); if (intval(Input::get('create_another')) === 1) { - return Redirect::route('accounts.create', $request->input('what'))->withInput(); + // set value so create routine will not overwrite URL: + Session::put('accounts.create.fromStore', true); + + return Redirect::route('accounts.create')->withInput(); } - return Redirect::route('accounts.index', $request->input('what')); + // redirect to previous URL. + return Redirect::to(Session::get('accounts.create.url')); + } @@ -200,7 +222,7 @@ class AccountController extends Controller */ public function update(Account $account, AccountFormRequest $request, AccountRepositoryInterface $repository) { - $what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type); + $accountData = [ 'name' => $request->input('name'), 'active' => $request->input('active'), @@ -219,10 +241,14 @@ class AccountController extends Controller Session::flash('success', 'Account "' . $account->name . '" updated.'); if (intval(Input::get('return_to_edit')) === 1) { - return Redirect::route('accounts.edit', $account->id); + // set value so edit routine will not overwrite URL: + Session::put('accounts.edit.fromUpdate', true); + + return Redirect::route('accounts.edit', $account->id)->withInput(['return_to_edit' => 1]); } - return Redirect::route('accounts.index', $what); + // redirect to previous URL. + return Redirect::to(Session::get('accounts.edit.url')); } diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 97bb5bc4b1..079ec4dcf3 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -8,6 +8,7 @@ use Illuminate\Http\Request; use Illuminate\Mail\Message; use Mail; use Session; +use Twig; /** * Class AuthController @@ -47,6 +48,16 @@ class AuthController extends Controller $this->middleware('guest', ['except' => 'getLogout']); } + /** + * Show the application login form. + * + * @return \Illuminate\Http\Response + */ + public function getLogin() + { + return Twig::render('auth.login'); + } + /** * Handle a registration request for the application. * diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.php index d605b3d0ba..c26d595a93 100644 --- a/app/Http/Controllers/BillController.php +++ b/app/Http/Controllers/BillController.php @@ -29,6 +29,7 @@ class BillController extends Controller */ public function __construct() { + parent::__construct(); View::share('title', 'Bills'); View::share('mainTitleIcon', 'fa-calendar-o'); } @@ -83,6 +84,12 @@ class BillController extends Controller { $periods = Config::get('firefly.periods_to_text'); + // put previous url in session if not redirect from store (not "create another"). + if (Session::get('bills.create.fromStore') !== true) { + Session::put('bills.create.url', URL::previous()); + } + Session::forget('bills.create.fromStore'); + return view('bills.create')->with('periods', $periods)->with('subTitle', 'Create new'); } @@ -93,6 +100,9 @@ class BillController extends Controller */ public function delete(Bill $bill) { + // put previous url in session + Session::put('bills.delete.url', URL::previous()); + return view('bills.delete')->with('bill', $bill)->with('subTitle', 'Delete "' . e($bill->name) . '"'); } @@ -107,7 +117,7 @@ class BillController extends Controller Session::flash('success', 'The bill was deleted.'); - return Redirect::route('bills.index'); + return Redirect::to(Session::get('bills.delete.url')); } @@ -120,6 +130,12 @@ class BillController extends Controller { $periods = Config::get('firefly.periods_to_text'); + // put previous url in session if not redirect from store (not "return_to_edit"). + if (Session::get('bills.edit.fromUpdate') !== true) { + Session::put('bills.edit.url', URL::previous()); + } + Session::forget('bills.edit.fromUpdate'); + return view('bills.edit')->with('periods', $periods)->with('bill', $bill)->with('subTitle', 'Edit "' . e($bill->name) . '"'); } @@ -190,10 +206,14 @@ class BillController extends Controller Session::flash('success', 'Bill "' . e($bill->name) . '" stored.'); if (intval(Input::get('create_another')) === 1) { + // set value so create routine will not overwrite URL: + Session::put('bills.create.fromStore', true); + return Redirect::route('bills.create')->withInput(); } - return Redirect::route('bills.index'); + // redirect to previous URL. + return Redirect::to(Session::get('bills.create.url')); } @@ -207,13 +227,17 @@ class BillController extends Controller $billData = $request->getBillData(); $bill = $repository->update($bill, $billData); - if (intval(Input::get('return_to_edit')) === 1) { - return Redirect::route('bills.edit', $bill->id); - } - Session::flash('success', 'Bill "' . e($bill->name) . '" updated.'); - return Redirect::route('bills.index'); + if (intval(Input::get('return_to_edit')) === 1) { + // set value so edit routine will not overwrite URL: + Session::put('bills.edit.fromUpdate', true); + + return Redirect::route('bills.edit', $bill->id)->withInput(['return_to_edit' => 1]); + } + + // redirect to previous URL. + return Redirect::to(Session::get('bills.edit.url')); } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index 92078806b0..9fb31e661e 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -29,8 +29,10 @@ class BudgetController extends Controller */ public function __construct() { + parent::__construct(); View::share('title', 'Budgets'); View::share('mainTitleIcon', 'fa-tasks'); + View::share('hideBudgets', true); } /** @@ -185,12 +187,12 @@ class BudgetController extends Controller return view('error')->with('message', 'Invalid selection.'); } - $hideBudget = true; // used in transaction list. - $journals = $repository->getJournals($budget, $repetition); - $limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget); - $subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name); + $journals = $repository->getJournals($budget, $repetition); + $limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget); + $subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name); + $journals->setPath('/budgets/show/' . $budget->id); - return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget')); + return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle')); } /** diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 09b7b1370d..6b864f11f2 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -26,6 +26,7 @@ class CategoryController extends Controller */ public function __construct() { + parent::__construct(); View::share('title', 'Categories'); View::share('mainTitleIcon', 'fa-bar-chart'); } @@ -51,7 +52,7 @@ class CategoryController extends Controller */ public function delete(Category $category) { - $subTitle = 'Delete category' . e($category->name) . '"'; + $subTitle = 'Delete category "' . e($category->name) . '"'; // put previous url in session Session::put('categories.delete.url', URL::previous()); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index fb7b363590..1af8d4b562 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -3,6 +3,7 @@ use Illuminate\Foundation\Bus\DispatchesCommands; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; +use View; /** * Class Controller @@ -14,4 +15,14 @@ abstract class Controller extends BaseController use DispatchesCommands, ValidatesRequests; + /** + * + */ + public function __construct() + { + View::share('hideBudgets', false); + View::share('hideCategories', false); + View::share('hideBills', false); + View::share('hideTags', false); + } } diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index c0b2fd4258..33e100ca6d 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -27,7 +27,7 @@ class CurrencyController extends Controller */ public function __construct() { - + parent::__construct(); View::share('title', 'Currencies'); View::share('mainTitleIcon', 'fa-usd'); } diff --git a/app/Http/Controllers/GoogleChartController.php b/app/Http/Controllers/GoogleChartController.php index 8b09f1aa0c..b377231d67 100644 --- a/app/Http/Controllers/GoogleChartController.php +++ b/app/Http/Controllers/GoogleChartController.php @@ -144,8 +144,8 @@ class GoogleChartController extends Controller public function allBudgetsHomeChart(GChart $chart, BudgetRepositoryInterface $repository) { $chart->addColumn('Budget', 'string'); - $chart->addColumn('Budgeted', 'number'); - $chart->addColumn('Spent', 'number'); + $chart->addColumn('Left', 'number'); + //$chart->addColumn('Spent', 'number'); $budgets = $repository->getBudgets(); $start = Session::get('start', Carbon::now()->startOfMonth()); @@ -171,7 +171,8 @@ class GoogleChartController extends Controller foreach ($allEntries as $entry) { if ($entry[2] > 0) { - $chart->addRow($entry[0], $entry[1], $entry[2]); + $left = $entry[1] - $entry[2]; + $chart->addRow($entry[0], $left); } } @@ -358,7 +359,7 @@ class GoogleChartController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function budgetsAndSpending(Budget $budget, $year = 0, GChart $chart, BudgetRepositoryInterface $repository) + public function budgetsAndSpending(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget, $year = 0) { $chart->addColumn('Month', 'date'); $chart->addColumn('Budgeted', 'number'); diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 414e015944..d8072669a8 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -1,12 +1,8 @@ get(); + $return = []; + foreach ($list as $entry) { + $return[] = $entry->tag; + } + + return Response::json($return); + + } + /** * @return \Illuminate\Http\JsonResponse */ diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 82960a5dc9..ffd878d59f 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -32,6 +32,7 @@ class PiggyBankController extends Controller */ public function __construct() { + parent::__construct(); View::share('title', 'Piggy banks'); View::share('mainTitleIcon', 'fa-sort-amount-asc'); } diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 7df980e19f..84d2901104 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -20,7 +20,7 @@ class PreferencesController extends Controller */ public function __construct() { - + parent::__construct(); View::share('title', 'Preferences'); View::share('mainTitleIcon', 'fa-gear'); } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 2c61ff4bdd..227ca9fbe4 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -49,7 +49,8 @@ class ProfileController extends Controller /** * */ - public function postDeleteAccount(DeleteAccountFormRequest $request) { + public function postDeleteAccount(DeleteAccountFormRequest $request) + { // old, new1, new2 if (!Hash::check($request->get('password'), Auth::user()->password)) { Session::flash('error', 'Invalid password!'); @@ -60,11 +61,11 @@ class ProfileController extends Controller // DELETE! Auth::user()->delete(); Session::flush(); + return Redirect::route('index'); } - /** * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View */ diff --git a/app/Http/Controllers/RelatedController.php b/app/Http/Controllers/RelatedController.php deleted file mode 100644 index d8d914a3ec..0000000000 --- a/app/Http/Controllers/RelatedController.php +++ /dev/null @@ -1,164 +0,0 @@ -transactiongroups()->get() as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $ids[] = $loopJournal->id; - } - } - } - $unique = array_unique($ids); - $journals = new Collection; - if (count($unique) > 0) { - $journals = Auth::user()->transactionjournals()->whereIn('id', $unique)->get(); - } - $parent = $journal; - - return view('related.alreadyRelated', compact('parent', 'journals')); - } - - /** - * @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 $parentJournal - * @param TransactionJournal $childJournal - * - * @return \Illuminate\Http\JsonResponse - */ - public function relate(TransactionJournal $parentJournal, TransactionJournal $childJournal) - { - $group = new TransactionGroup; - $group->relation = 'balance'; - $group->user_id = Auth::user()->id; - $group->save(); - $group->transactionjournals()->save($parentJournal); - $group->transactionjournals()->save($childJournal); - - return Response::json(true); - - } - - /** - * @param TransactionJournal $journal - * - * @return \Illuminate\View\View - */ - public function related(TransactionJournal $journal) - { - $groups = $journal->transactiongroups()->get(); - $members = new Collection; - /** @var TransactionGroup $group */ - foreach ($groups as $group) { - /** @var TransactionJournal $loopJournal */ - foreach ($group->transactionjournals()->get() as $loopJournal) { - if ($loopJournal->id != $journal->id) { - $members->push($loopJournal); - } - } - } - - return view('related.relate', compact('journal', 'members')); - } - - /** - * @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 removeRelation(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 Response::json(true); - } - - /** - * @param TransactionJournal $journal - * - * @return \Illuminate\Http\JsonResponse - */ - public function search(TransactionJournal $journal, JournalRepositoryInterface $repository) - { - - $search = e(trim(Input::get('searchValue'))); - $parent = $journal; - - $journals = $repository->searchRelated($search, $journal); - - return view('related.searchResult', compact('journals', 'search', 'parent')); - - } - -} diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 9c82e2f7cc..6799c3f3a4 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -47,50 +47,51 @@ class ReportController extends Controller */ public function budget($year = '2014', $month = '1') { - try { - new Carbon($year . '-' . $month . '-01'); - } catch (Exception $e) { - return view('error')->with('message', 'Invalid date'); - } - $date = new Carbon($year . '-' . $month . '-01'); - $start = clone $date; + $date = new Carbon($year . '-' . $month . '-01'); + $subTitle = 'Budget report for ' . $date->format('F Y'); + $subTitleIcon = 'fa-calendar'; + $start = clone $date; + + $start->startOfMonth(); $end = clone $date; $end->endOfMonth(); - $start->subDay(); + // should show shared reports? /** @var Preference $pref */ $pref = Preferences::get('showSharedReports', false); $showSharedReports = $pref->data; + $accountAmounts = []; // array with sums of spent amounts on each account. + $accounts = $this->query->getAllAccounts($start, $end, $showSharedReports); // all accounts and some data. + foreach ($accounts as $account) { - $dayEarly = clone $date; - $subTitle = 'Budget report for ' . $date->format('F Y'); - $subTitleIcon = 'fa-calendar'; - $dayEarly = $dayEarly->subDay(); - $accounts = $this->query->getAllAccounts($start, $end, $showSharedReports); - $start->addDay(); + $budgets = $this->query->getBudgetSummary($account, $start, $end);// get budget summary for this account: + $balancedAmount = $this->query->balancedTransactionsSum($account, $start, $end); + $accountAmounts[$account->id] = $balancedAmount; + // balance out the transactions (see transaction groups & tags) ^^ - $accounts->each( - function (Account $account) use ($start, $end) { - $budgets = $this->query->getBudgetSummary($account, $start, $end); - $balancedAmount = $this->query->balancedTransactionsSum($account, $start, $end); - $array = []; - $hide = true; - foreach ($budgets as $budget) { - $id = intval($budget->id); - $data = $budget->toArray(); - $array[$id] = $data; - if (floatval($data['queryAmount']) != 0) { - $hide = false; - } + // array with budget information for each account: + $array = []; + // should always hide account + $hide = true; + // loop all budgets + foreach ($budgets as $budget) { + $id = intval($budget->id); + $data = $budget->toArray(); + $array[$id] = $data; + + // no longer hide account if any budget has money in it. + if (floatval($data['queryAmount']) != 0) { + $hide = false; } - $account->hide = $hide; - $account->budgetInformation = $array; - $account->balancedAmount = $balancedAmount; - + $accountAmounts[$account->id] += $data['queryAmount']; } - ); + $account->hide = $hide; + $account->budgetInformation = $array; + $account->balancedAmount = $balancedAmount; + + } /** * Start getBudgetsForMonth DONE @@ -101,7 +102,7 @@ class ReportController extends Controller * End getBudgetsForMonth DONE */ - return view('reports.budget', compact('subTitle', 'year', 'month', 'subTitleIcon', 'date', 'accounts', 'budgets', 'dayEarly')); + return view('reports.budget', compact('subTitle', 'accountAmounts', 'year', 'month', 'subTitleIcon', 'date', 'accounts', 'budgets')); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php new file mode 100644 index 0000000000..c0e5e23eb8 --- /dev/null +++ b/app/Http/Controllers/TagController.php @@ -0,0 +1,314 @@ + 'Just a regular tag.', + 'balancingAct' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.', + 'advancePayment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.', + ]; + View::share('tagOptions', $tagOptions); + } + + /** + * @return \Illuminate\View\View + */ + public function create() + { + $subTitle = 'New tag'; + $subTitleIcon = 'fa-tag'; + + $preFilled = [ + 'tagMode' => 'nothing' + ]; + if (!Input::old('tagMode')) { + Session::flash('preFilled', $preFilled); + } + // put previous url in session if not redirect from store (not "create another"). + if (Session::get('tags.create.fromStore') !== true) { + Session::put('tags.create.url', URL::previous()); + } + Session::forget('tags.create.fromStore'); + + return view('tags.create', compact('subTitle', 'subTitleIcon')); + } + + /** + * @param Tag $tag + * + * @return \Illuminate\View\View + */ + public function delete(Tag $tag) + { + $subTitle = 'Delete "' . e($tag->tag) . '"'; + + // put previous url in session + Session::put('tags.delete.url', URL::previous()); + + return view('tags.delete', compact('tag', 'subTitle')); + } + + /** + * @param Tag $tag + * + * @return \Illuminate\Http\RedirectResponse + */ + public function destroy(Tag $tag, TagRepositoryInterface $repository) + { + + $tagName = $tag->tag; + $repository->destroy($tag); + + Session::flash('success', 'Tag "' . e($tagName) . '" was deleted.'); + + return Redirect::to(route('tags.index')); + } + + /** + * @param Tag $tag + * + * @return View + */ + public function edit(Tag $tag) + { + $subTitle = 'Edit tag "' . e($tag->tag) . '"'; + $subTitleIcon = 'fa-tag'; + + /* + * Default tag options (again) + */ + $tagOptions = [ + 'nothing' => 'Just a regular tag.', + 'balancingAct' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.', + 'advancePayment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.', + ]; + + /* + * Can this tag become another type? + */ + $allowToAdvancePayment = true; + $allowToBalancingAct = true; + + /* + * If this tag is a balancing act, and it contains transfers, it cannot be + * changes to an advancePayment. + */ + + if ($tag->tagMode == 'balancingAct') { + foreach ($tag->transactionjournals as $journal) { + if ($journal->transactionType->type == 'Transfer') { + $allowToAdvancePayment = false; + } + } + } + + /* + * If this tag contains more than one expenses, it cannot become an advance payment. + */ + $count = 0; + foreach ($tag->transactionjournals as $journal) { + if ($journal->transactionType->type == 'Withdrawal') { + $count++; + } + } + if($count > 1) { + $allowToAdvancePayment = false; + } + + /* + * If has more than two transactions already, cannot become a balancing act: + */ + if ($tag->transactionjournals->count() > 2) { + $allowToBalancingAct = false; + } + + /* + * If any transaction is a deposit, cannot become a balancing act. + */ + $count = 0; + foreach ($tag->transactionjournals as $journal) { + if ($journal->transactionType->type == 'Deposit') { + $count++; + } + } + if($count > 0) { + $allowToBalancingAct = false; + } + + + // edit tagoptions: + if ($allowToAdvancePayment === false) { + unset($tagOptions['advancePayment']); + } + if ($allowToBalancingAct === false) { + unset($tagOptions['balancingAct']); + } + + + // put previous url in session if not redirect from store (not "return_to_edit"). + if (Session::get('tags.edit.fromUpdate') !== true) { + Session::put('tags.edit.url', URL::previous()); + } + Session::forget('tags.edit.fromUpdate'); + + return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions')); + } + + /** + * @param $state + */ + public function hideTagHelp($state) + { + + $state = $state == 'true' ? true : false; + Preferences::set('hideTagHelp', $state); + + return Response::json(true); + } + + /** + * + */ + public function index() + { + /** @var Preference $helpHiddenPref */ + $helpHiddenPref = Preferences::get('hideTagHelp', false); + $title = 'Tags'; + $mainTitleIcon = 'fa-tags'; + $helpHidden = $helpHiddenPref->data; + $tags = Auth::user()->tags()->get(); + + return view('tags.index', compact('title', 'mainTitleIcon', 'helpHidden', 'tags')); + } + + /** + * @param Tag $tag + * + * @return \Illuminate\View\View + */ + public function show(Tag $tag) + { + $subTitle = $tag->tag; + $subTitleIcon = 'fa-tag'; + + return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon')); + } + + /** + * @param TagFormRequest $request + */ + public function store(TagFormRequest $request, TagRepositoryInterface $repository) + { + if (Input::get('setTag') == 'true') { + $latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null; + $longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null; + $zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null; + } else { + $latitude = null; + $longitude = null; + $zoomLevel = null; + } + + $data = [ + 'tag' => $request->get('tag'), + 'date' => strlen($request->get('date')) > 0 ? new Carbon($request->get('date')) : null, + 'description' => strlen($request->get('description')) > 0 ? $request->get('description') : '', + 'latitude' => $latitude, + 'longitude' => $longitude, + 'zoomLevel' => $zoomLevel, + 'tagMode' => $request->get('tagMode'), + ]; + $repository->store($data); + + Session::flash('success', 'The tag has been created!'); + + if (intval(Input::get('create_another')) === 1) { + // set value so create routine will not overwrite URL: + Session::put('tags.create.fromStore', true); + + return Redirect::route('tags.create')->withInput(); + } + + // redirect to previous URL. + return Redirect::to(Session::get('tags.create.url')); + + } + + /** + * @param Tag $tag + */ + public function update(Tag $tag, TagFormRequest $request, TagRepositoryInterface $repository) + { + if (Input::get('setTag') == 'true') { + $latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null; + $longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null; + $zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null; + } else { + $latitude = null; + $longitude = null; + $zoomLevel = null; + } + + $data = [ + 'tag' => $request->get('tag'), + 'date' => strlen($request->get('date')) > 0 ? new Carbon($request->get('date')) : null, + 'description' => strlen($request->get('description')) > 0 ? $request->get('description') : '', + 'latitude' => $latitude, + 'longitude' => $longitude, + 'zoomLevel' => $zoomLevel, + 'tagMode' => $request->get('tagMode'), + ]; + + $repository->update($tag, $data); + + Session::flash('success', 'Tag "' . e($data['tag']) . '" updated.'); + + if (intval(Input::get('return_to_edit')) === 1) { + // set value so edit routine will not overwrite URL: + Session::put('tags.edit.fromUpdate', true); + + return Redirect::route('tags.edit', $tag->id)->withInput(['return_to_edit' => 1]); + } + + // redirect to previous URL. + return Redirect::to(Session::get('tags.edit.url')); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index 5a3bbfa628..3621bd0440 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -28,6 +28,7 @@ class TransactionController extends Controller */ public function __construct() { + parent::__construct(); View::share('title', 'Transactions'); View::share('mainTitleIcon', 'fa-repeat'); } @@ -134,6 +135,12 @@ class TransactionController extends Controller 'budget_id' => 0, 'piggy_bank_id' => 0 ]; + // get tags: + $tags = []; + foreach ($journal->tags as $tag) { + $tags[] = $tag->tag; + } + $preFilled['tags'] = join(',', $tags); $category = $journal->categories()->first(); if (!is_null($category)) { @@ -150,12 +157,14 @@ class TransactionController extends Controller } $preFilled['amount'] = $journal->amount; - $preFilled['account_id'] = $repository->getAssetAccount($journal); + $preFilled['account_id'] = $journal->assetAccount->id; $preFilled['expense_account'] = $transactions[0]->account->name; $preFilled['revenue_account'] = $transactions[1]->account->name; $preFilled['account_from_id'] = $transactions[1]->account->id; $preFilled['account_to_id'] = $transactions[0]->account->id; + Session::flash('preFilled', $preFilled); + // put previous url in session if not redirect from store (not "return_to_edit"). if (Session::get('transactions.edit.fromUpdate') !== true) { Session::put('transactions.edit.url', URL::previous()); @@ -271,6 +280,7 @@ class TransactionController extends Controller public function store(JournalFormRequest $request, JournalRepositoryInterface $repository) { + $journalData = $request->getJournalData(); $journal = $repository->store($journalData); diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.php index b0da081e4a..1bae744518 100644 --- a/app/Http/Requests/JournalFormRequest.php +++ b/app/Http/Requests/JournalFormRequest.php @@ -42,6 +42,7 @@ class JournalFormRequest extends Request 'date' => new Carbon($this->get('date')), 'budget_id' => intval($this->get('budget_id')), 'category' => $this->get('category'), + 'tags' => explode(',', $this->get('tags')), ]; } diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php new file mode 100644 index 0000000000..f82b055478 --- /dev/null +++ b/app/Http/Requests/TagFormRequest.php @@ -0,0 +1,53 @@ + $tagRule, + 'id' => $idRule, + 'description' => 'min:1', + 'date' => 'date', + 'latitude' => 'numeric|min:-90|max:90', + 'longitude' => 'numeric|min:-90|max:90', + 'tagMode' => 'required|in:nothing,balancingAct,advancePayment' + ]; + } +} \ No newline at end of file diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index cdb6a5226e..ad18780bcb 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -9,8 +9,9 @@ use FireflyIII\Models\Category; use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\Reminder; +use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; - +use FireflyIII\Models\Tag; /* * Back home. */ @@ -22,6 +23,14 @@ Breadcrumbs::register( } ); +Breadcrumbs::register( + 'index', + function (Generator $breadcrumbs) { + + $breadcrumbs->push('Home', route('index')); + } +); + // accounts Breadcrumbs::register( 'accounts.index', function (Generator $breadcrumbs, $what) { @@ -95,6 +104,13 @@ Breadcrumbs::register( } ); +Breadcrumbs::register( + 'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) { + $breadcrumbs->parent('budgets.index'); + $breadcrumbs->push($subTitle, route('budgets.noBudget')); +} +); + Breadcrumbs::register( 'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) { $breadcrumbs->parent('budgets.index'); @@ -142,6 +158,34 @@ Breadcrumbs::register( } ); +Breadcrumbs::register( + 'categories.noCategory', function (Generator $breadcrumbs, $subTitle) { + $breadcrumbs->parent('categories.index'); + $breadcrumbs->push($subTitle, route('categories.noCategory')); +} +); + +// currencies. +Breadcrumbs::register( + 'currency.index', function (Generator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push('Currencies', route('currency.index')); +} +); + +Breadcrumbs::register( + 'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currency.index'); + $breadcrumbs->push('Edit '.$currency->name, route('currency.edit', $currency->id)); +} +); +Breadcrumbs::register( + 'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) { + $breadcrumbs->parent('currency.index'); + $breadcrumbs->push('Delete '.$currency->name, route('currency.delete', $currency->id)); +} +); + // piggy banks Breadcrumbs::register( @@ -350,3 +394,24 @@ Breadcrumbs::register( } ); + +// tags +Breadcrumbs::register( + 'tags.index', function (Generator $breadcrumbs) { + $breadcrumbs->parent('home'); + $breadcrumbs->push('Tags', route('tags.index')); +} +); + +Breadcrumbs::register( + 'tags.create', function (Generator $breadcrumbs) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push('Create tag', route('tags.create')); +} +); +Breadcrumbs::register( + 'tags.show', function (Generator $breadcrumbs, Tag $tag) { + $breadcrumbs->parent('tags.index'); + $breadcrumbs->push(e($tag->tag), route('tags.show', $tag)); +} +); \ No newline at end of file diff --git a/app/Http/routes.php b/app/Http/routes.php index 117edea60e..ecb1e96c3a 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -6,8 +6,10 @@ use FireflyIII\Models\Category; use FireflyIII\Models\LimitRepetition; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\Reminder; +use FireflyIII\Models\Tag; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionJournal; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; // models @@ -15,102 +17,113 @@ Route::bind( 'account', function ($value, $route) { if (Auth::check()) { - $account = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->where('account_types.editable', 1) - ->where('accounts.id', $value) - ->where('user_id', Auth::user()->id) - ->first(['accounts.*']); - if ($account) { - return $account; + $object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') + ->where('account_types.editable', 1) + ->where('accounts.id', $value) + ->where('user_id', Auth::user()->id) + ->first(['accounts.*']); + if ($object) { + return $object; } } - App::abort(404); + throw new NotFoundHttpException; } ); -Route::bind( - 'tjSecond', function ($value, $route) { - if (Auth::check()) { - return TransactionJournal:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); - } - - return null; -} -); - Route::bind( 'tj', function ($value, $route) { if (Auth::check()) { - return TransactionJournal:: - where('id', $value)->where('user_id', Auth::user()->id)->first(); + $object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); Route::bind( 'currency', function ($value, $route) { - return TransactionCurrency::find($value); + if (Auth::check()) { + $object = TransactionCurrency::find($value); + if ($object) { + return $object; + } + } + throw new NotFoundHttpException; } ); Route::bind( 'bill', function ($value, $route) { if (Auth::check()) { - return Bill::where('id', $value)->where('user_id', Auth::user()->id)->first(); + $object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); Route::bind( 'budget', function ($value, $route) { if (Auth::check()) { - return Budget::where('id', $value)->where('user_id', Auth::user()->id)->first(); + $object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); Route::bind( 'reminder', function ($value, $route) { if (Auth::check()) { - return Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first(); + $object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); Route::bind( 'limitrepetition', function ($value, $route) { if (Auth::check()) { - return LimitRepetition::where('limit_repetitions.id', $value) - ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id') - ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->where('budgets.user_id', Auth::user()->id) - ->first(['limit_repetitions.*']); + $object = LimitRepetition::where('limit_repetitions.id', $value) + ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id') + ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') + ->where('budgets.user_id', Auth::user()->id) + ->first(['limit_repetitions.*']); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); Route::bind( 'piggyBank', function ($value, $route) { if (Auth::check()) { - return PiggyBank:: - where('piggy_banks.id', $value) - ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') - ->where('accounts.user_id', Auth::user()->id) - ->first(['piggy_banks.*']); + $object = PiggyBank::where('piggy_banks.id', $value) + ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') + ->where('accounts.user_id', Auth::user()->id) + ->first(['piggy_banks.*']); + if ($object) { + return $object; + } } - return null; + throw new NotFoundHttpException; } ); @@ -118,9 +131,25 @@ Route::bind( 'category', function ($value, $route) { if (Auth::check()) { return Category::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + $object = $object; + } } - return null; + throw new NotFoundHttpException; +} +); + +Route::bind( + 'tag', function ($value, $route) { + if (Auth::check()) { + return Tag::where('id', $value)->where('user_id', Auth::user()->id)->first(); + if ($object) { + $object = $object; + } + } + + throw new NotFoundHttpException; } ); @@ -245,6 +274,7 @@ Route::group( Route::get('/json/expense-accounts', ['uses' => 'JsonController@expenseAccounts', 'as' => 'json.expense-accounts']); Route::get('/json/revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'json.revenue-accounts']); Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']); + Route::get('/json/tags', ['uses' => 'JsonController@tags', 'as' => 'json.tags']); Route::get('/json/box/in', ['uses' => 'JsonController@boxIn', 'as' => 'json.box.in']); Route::get('/json/box/out', ['uses' => 'JsonController@boxOut', 'as' => 'json.box.out']); Route::get('/json/box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'json.box.paid']); @@ -286,16 +316,6 @@ Route::group( Route::post('/profile/delete-account', ['uses' => 'ProfileController@postDeleteAccount', 'as' => 'delete-account-post']); Route::post('/profile/change-password', ['uses' => 'ProfileController@postChangePassword', 'as' => 'change-password-post']); - /** - * Related transactions controller - */ - 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']); - /** * Reminder Controller */ @@ -327,6 +347,22 @@ Route::group( */ Route::get('/search', ['uses' => 'SearchController@index', 'as' => 'search']); + /** + * Tag Controller + */ + Route::get('/tags', ['uses' => 'TagController@index', 'as' => 'tags.index']); + Route::get('/tags/create', ['uses' => 'TagController@create', 'as' => 'tags.create']); + Route::get('/tags/show/{tag}', ['uses' => 'TagController@show', 'as' => 'tags.show']); + Route::get('/tags/edit/{tag}', ['uses' => 'TagController@edit', 'as' => 'tags.edit']); + Route::get('/tags/delete/{tag}', ['uses' => 'TagController@delete', 'as' => 'tags.delete']); + + Route::post('/tags/store', ['uses' => 'TagController@store', 'as' => 'tags.store']); + Route::post('/tags/update/{tag}', ['uses' => 'TagController@update', 'as' => 'tags.update']); + Route::post('/tags/destroy/{tag}', ['uses' => 'TagController@destroy', 'as' => 'tags.destroy']); + + Route::post('/tags/hideTagHelp/{state}', ['uses' => 'TagController@hideTagHelp', 'as' => 'tags.hideTagHelp']); + + /** * Transaction Controller */ diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 4b952c1258..fef1e0fe81 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -14,7 +14,7 @@ class PiggyBank extends Model use SoftDeletes; protected $fillable - = ['name', 'account_id', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me']; + = ['name', 'account_id','order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me']; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo diff --git a/app/Models/Tag.php b/app/Models/Tag.php new file mode 100644 index 0000000000..d965150c0a --- /dev/null +++ b/app/Models/Tag.php @@ -0,0 +1,128 @@ + 'required|min:1|uniqueObjectForUser:tags,tag,TRUE', + 'description' => 'min:1', + 'date' => 'date', + 'latitude' => 'numeric|min:-90|max:90', + 'longitude' => 'numeric|min:-90|max:90', + 'tagMode' => 'required|in:nothing,balancingAct,advancePayment' + ]; + + /** + * @param array $fields + * + * @return Tag|null + */ + public static function firstOrCreateEncrypted(array $fields) + { + // everything but the tag: + if (isset($fields['tagMode'])) { + unset($fields['tagMode']); + } + $query = Tag::orderBy('id'); + foreach ($fields as $name => $value) { + if ($name != 'tag') { + $query->where($name, $value); + } + } + $set = $query->get(['tags.*']); + /** @var Tag $tag */ + foreach ($set as $tag) { + if ($tag->tag == $fields['tag']) { + return $tag; + } + } + // create it! + $fields['tagMode'] = 'nothing'; + $fields['description'] = isset($fields['description']) && !is_null($fields['description']) ? $fields['description'] : ''; + $tag = Tag::create($fields); + if (is_null($tag->id)) { + // could not create account: + App::abort(500, 'Could not create new tag with data: ' . json_encode($fields) . ' because ' . json_encode($tag->getErrors())); + + + } + + return $tag; + + } + + /** + * @return array + */ + public function getDates() + { + return ['created_at', 'updated_at', 'date']; + } + + /** + * @param $value + * + * @return string + */ + public function getDescriptionAttribute($value) + { + return Crypt::decrypt($value); + } + + /** + * @param $value + * + * @return string + */ + public function getTagAttribute($value) + { + return Crypt::decrypt($value); + } + + /** + * @param $value + */ + public function setDescriptionAttribute($value) + { + $this->attributes['description'] = Crypt::encrypt($value); + } + + /** + * @param $value + */ + public function setTagAttribute($value) + { + $this->attributes['tag'] = Crypt::encrypt($value); + } + + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function transactionjournals() + { + return $this->belongsToMany('FireflyIII\Models\TransactionJournal'); + } + + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function user() + { + return $this->belongsTo('FireflyIII\User'); + } +} \ No newline at end of file diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index d9af19b51e..f0873c577b 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -68,6 +68,34 @@ class TransactionJournal extends Model } } + public function getAssetAccountAttribute() + { + $positive = true; // the asset account is in the transaction with the positive amount. + if ($this->transactionType->type === 'Withdrawal') { + $positive = false; + } + /** @var Transaction $transaction */ + foreach ($this->transactions()->get() as $transaction) { + if (floatval($transaction->amount) > 0 && $positive === true) { + return $transaction->account; + } + if (floatval($transaction->amount) < 0 && $positive === false) { + return $transaction->account; + } + + } + + return $this->transactions()->first(); + } + + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function transactions() + { + return $this->hasMany('FireflyIII\Models\Transaction'); + } + /** * @return array */ @@ -201,6 +229,14 @@ class TransactionJournal extends Model $this->attributes['encrypted'] = true; } + /** + * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany + */ + public function tags() + { + return $this->belongsToMany('FireflyIII\Models\Tag'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ @@ -225,14 +261,6 @@ class TransactionJournal extends Model return $this->belongsToMany('FireflyIII\Models\TransactionGroup'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function transactions() - { - return $this->hasMany('FireflyIII\Models\Transaction'); - } - /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index bfff79a9f2..af0a5a5b8e 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -35,6 +35,7 @@ class AppServiceProvider extends ServiceProvider 'Illuminate\Contracts\Auth\Registrar', 'FireflyIII\Services\Registrar' ); + } } diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php index 94d9ee03fd..bd01842727 100644 --- a/app/Providers/ConfigServiceProvider.php +++ b/app/Providers/ConfigServiceProvider.php @@ -23,7 +23,227 @@ class ConfigServiceProvider extends ServiceProvider { config( [ - // + 'twigbridge' => [ + + 'twig' => [ + /* + |-------------------------------------------------------------------------- + | Extension + |-------------------------------------------------------------------------- + | + | File extension for Twig view files. + | + */ + 'extension' => 'twig', + + /* + |-------------------------------------------------------------------------- + | Accepts all Twig environment configuration options + |-------------------------------------------------------------------------- + | + | http://twig.sensiolabs.org/doc/api.html#environment-options + | + */ + 'environment' => [ + + // When set to true, the generated templates have a __toString() method + // that you can use to display the generated nodes. + // default: false + 'debug' => config('app.debug', false), + + // The charset used by the templates. + // default: utf-8 + 'charset' => 'utf-8', + + // The base template class to use for generated templates. + // default: TwigBridge\Twig\Template + 'base_template_class' => 'TwigBridge\Twig\Template', + + // An absolute path where to store the compiled templates, or false to disable caching. If null + // then the cache file path is used. + // default: cache file storage path + 'cache' => null, + + // When developing with Twig, it's useful to recompile the template + // whenever the source code changes. If you don't provide a value + // for the auto_reload option, it will be determined automatically based on the debug value. + 'auto_reload' => true, + + // If set to false, Twig will silently ignore invalid variables + // (variables and or attributes/methods that do not exist) and + // replace them with a null value. When set to true, Twig throws an exception instead. + // default: false + 'strict_variables' => false, + + // If set to true, auto-escaping will be enabled by default for all templates. + // default: true + 'autoescape' => true, + + // A flag that indicates which optimizations to apply + // (default to -1 -- all optimizations are enabled; set it to 0 to disable) + 'optimizations' => -1, + ], + + /* + |-------------------------------------------------------------------------- + | Global variables + |-------------------------------------------------------------------------- + | + | These will always be passed in and can be accessed as Twig variables. + | NOTE: these will be overwritten if you pass data into the view with the same key. + | + */ + 'globals' => [], + ], + + 'extensions' => [ + + /* + |-------------------------------------------------------------------------- + | Extensions + |-------------------------------------------------------------------------- + | + | Enabled extensions. + | + | `Twig_Extension_Debug` is enabled automatically if twig.debug is TRUE. + | + */ + 'enabled' => [ + 'TwigBridge\Extension\Loader\Facades', + 'TwigBridge\Extension\Loader\Filters', + 'TwigBridge\Extension\Loader\Functions', + + 'TwigBridge\Extension\Laravel\Auth', + 'TwigBridge\Extension\Laravel\Config', + 'TwigBridge\Extension\Laravel\Dump', + 'TwigBridge\Extension\Laravel\Input', + 'TwigBridge\Extension\Laravel\Session', + 'TwigBridge\Extension\Laravel\String', + 'TwigBridge\Extension\Laravel\Translator', + 'TwigBridge\Extension\Laravel\Url', + + // 'TwigBridge\Extension\Laravel\Form', + // 'TwigBridge\Extension\Laravel\Html', + // 'TwigBridge\Extension\Laravel\Legacy\Facades', + ], + + /* + |-------------------------------------------------------------------------- + | Facades + |-------------------------------------------------------------------------- + | + | Available facades. Access like `{{ Config.get('foo.bar') }}`. + | + | Each facade can take an optional array of options. To mark the whole facade + | as safe you can set the option `'is_safe' => true`. Setting the facade as + | safe means that any HTML returned will not be escaped. + | + | It is advisable to not set the whole facade as safe and instead mark the + | each appropriate method as safe for security reasons. You can do that with + | the following syntax: + | + | + | 'Form' => [ + | 'is_safe' => [ + | 'open' + | ] + | ] + | + | + | The values of the `is_safe` array must match the called method on the facade + | in order to be marked as safe. + | + */ + 'facades' => [ + 'Breadcrumbs' => [ + 'is_safe' => [ + 'renderIfExists' + ] + ], + 'Session', + 'Route', + 'Auth', + 'URL', + 'Config', + 'ExpandedForm' => [ + 'is_safe' => [ + 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location', + 'multiRadio' + ] + ], + 'Form' => [ + 'is_safe' => [ + 'input', 'select', 'checkbox', 'model', 'open','radio','textarea' + ] + ], + ], + + /* + |-------------------------------------------------------------------------- + | Functions + |-------------------------------------------------------------------------- + | + | Available functions. Access like `{{ secure_url(...) }}`. + | + | Each function can take an optional array of options. These options are + | passed directly to `Twig_SimpleFunction`. + | + | So for example, to mark a function as safe you can do the following: + | + | + | 'link_to' => [ + | 'is_safe' => ['html'] + | ] + | + | + | The options array also takes a `callback` that allows you to name the + | function differently in your Twig templates than what it's actually called. + | + | + | 'link' => [ + | 'callback' => 'link_to' + | ] + | + | + */ + 'functions' => [ + 'elixir', + 'head', + 'last', + 'old' + ], + + /* + |-------------------------------------------------------------------------- + | Filters + |-------------------------------------------------------------------------- + | + | Available filters. Access like `{{ variable|filter }}`. + | + | Each filter can take an optional array of options. These options are + | passed directly to `Twig_SimpleFilter`. + | + | So for example, to mark a filter as safe you can do the following: + | + | + | 'studly_case' => [ + | 'is_safe' => ['html'] + | ] + | + | + | The options array also takes a `callback` that allows you to name the + | filter differently in your Twig templates than what is actually called. + | + | + | 'snake' => [ + | 'callback' => 'snake_case' + | ] + | + | + */ + 'filters' => [], + ], + ] ] ); } diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index a00ffc289e..eaecd56528 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -2,13 +2,21 @@ namespace FireflyIII\Providers; +use App; +use FireflyIII\Models\Account; use FireflyIII\Support\Amount; use FireflyIII\Support\ExpandedForm; use FireflyIII\Support\Navigation; use FireflyIII\Support\Preferences; use FireflyIII\Support\Steam; +use FireflyIII\Support\Twig\Budget; +use FireflyIII\Support\Twig\General; +use FireflyIII\Support\Twig\Journal; +use FireflyIII\Support\Twig\PiggyBank; use FireflyIII\Validation\FireflyValidator; use Illuminate\Support\ServiceProvider; +use Twig; +use TwigBridge\Extension\Loader\Functions; use Validator; /** @@ -25,10 +33,22 @@ class FireflyServiceProvider extends ServiceProvider return new FireflyValidator($translator, $data, $rules, $messages); } ); + /* + * Default Twig configuration: + */ + + $config = App::make('config'); + Twig::addExtension(new Functions($config)); + Twig::addExtension(new PiggyBank); + Twig::addExtension(new General); + Twig::addExtension(new Journal); + Twig::addExtension(new Budget); } public function register() { + + $this->app->bind( 'preferences', function () { return new Preferences; @@ -63,6 +83,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind('FireflyIII\Repositories\Bill\BillRepositoryInterface', 'FireflyIII\Repositories\Bill\BillRepository'); $this->app->bind('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface', 'FireflyIII\Repositories\PiggyBank\PiggyBankRepository'); $this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository'); + $this->app->bind('FireflyIII\Repositories\Tag\TagRepositoryInterface', 'FireflyIII\Repositories\Tag\TagRepository'); $this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search'); @@ -71,6 +92,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind('FireflyIII\Helpers\Report\ReportHelperInterface', 'FireflyIII\Helpers\Report\ReportHelper'); $this->app->bind('FireflyIII\Helpers\Report\ReportQueryInterface', 'FireflyIII\Helpers\Report\ReportQuery'); + } } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index f8732d7867..330ff2fe81 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -4,10 +4,12 @@ namespace FireflyIII\Repositories\Journal; use App; use Auth; +use DB; 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\TransactionJournal; use FireflyIII\Models\TransactionType; @@ -32,36 +34,6 @@ class JournalRepository implements JournalRepositoryInterface return Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); } - /** - * - * Get the account_id, which is the asset account that paid for the transaction. - * - * @param TransactionJournal $journal - * - * @return mixed - */ - public function getAssetAccount(TransactionJournal $journal) - { - $positive = true; // the asset account is in the transaction with the positive amount. - switch ($journal->transactionType->type) { - case 'Withdrawal': - $positive = false; - break; - } - /** @var Transaction $transaction */ - foreach ($journal->transactions()->get() as $transaction) { - if (floatval($transaction->amount) > 0 && $positive === true) { - return $transaction->account_id; - } - if (floatval($transaction->amount) < 0 && $positive === false) { - return $transaction->account_id; - } - - } - - return $journal->transactions()->first()->account_id; - } - /** * @param TransactionType $dbType * @@ -83,55 +55,26 @@ class JournalRepository implements JournalRepositoryInterface } /** - * @param string $query - * @param TransactionJournal $journal * - * @return Collection + * * Remember: a balancingAct takes at most one expense and one transfer. + * an advancePayment takes at most one expense, infinite deposits and NO transfers. + * + * @param TransactionJournal $journal + * @param array $array + * + * @return void */ - public function searchRelated($query, TransactionJournal $journal) + public function saveTags(TransactionJournal $journal, array $array) { - $start = clone $journal->date; - $end = clone $journal->date; - $start->startOfMonth(); - $end->endOfMonth(); + /** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */ + $tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface'); - // get already related transactions: - $exclude = [$journal->id]; - foreach ($journal->transactiongroups()->get() as $group) { - foreach ($group->transactionjournals()->get() as $current) { - $exclude[] = $current->id; + foreach ($array as $name) { + if (strlen(trim($name)) > 0) { + $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]); + $tagRepository->connect($journal, $tag); } } - $exclude = array_unique($exclude); - - /** @var Collection $collection */ - $collection = Auth::user()->transactionjournals() - ->withRelevantData() - ->before($end)->after($start)->where('encrypted', 0) - ->whereNotIn('id', $exclude) - ->where('description', 'LIKE', '%' . $query . '%') - ->get(); - - // manually search encrypted entries: - /** @var Collection $encryptedCollection */ - $encryptedCollection = Auth::user()->transactionjournals() - ->withRelevantData() - ->before($end)->after($start) - ->where('encrypted', 1) - ->whereNotIn('id', $exclude) - ->get(); - $encrypted = $encryptedCollection->filter( - function (TransactionJournal $journal) use ($query) { - $strPos = strpos(strtolower($journal->description), strtolower($query)); - if ($strPos !== false) { - return $journal; - } - - return null; - } - ); - - return $collection->merge($encrypted); } /** @@ -191,6 +134,11 @@ class JournalRepository implements JournalRepositoryInterface $journal->completed = 1; $journal->save(); + // store tags + if (isset($data['tags']) && is_array($data['tags'])) { + $this->saveTags($journal, $data['tags']); + } + return $journal; @@ -246,9 +194,54 @@ class JournalRepository implements JournalRepositoryInterface $journal->save(); + // update tags: + if (isset($data['tags']) && is_array($data['tags'])) { + $this->updateTags($journal, $data['tags']); + } + return $journal; } + /** + * @param TransactionJournal $journal + * @param array $array + * + * @return void + */ + public function updateTags(TransactionJournal $journal, array $array) + { + // create tag repository + /** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */ + $tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface'); + + + // find or create all tags: + $tags = []; + $ids = []; + foreach ($array as $name) { + if (strlen(trim($name)) > 0) { + $tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]); + $tags[] = $tag; + $ids[] = $tag->id; + } + } + + // delete all tags connected to journal not in this array: + if (count($ids) > 0) { + DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete(); + } + // if count is zero, delete them all: + if(count($ids) == 0) { + DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete(); + } + + // connect each tag to journal (if not yet connected): + /** @var Tag $tag */ + foreach ($tags as $tag) { + $tagRepository->connect($journal, $tag); + } + } + /** * @param TransactionType $type * @param array $data diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 02febb7b96..89e15791fb 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -21,16 +21,6 @@ interface JournalRepositoryInterface */ public function first(); - /** - * - * Get the account_id, which is the asset account that paid for the transaction. - * - * @param TransactionJournal $journal - * - * @return int - */ - public function getAssetAccount(TransactionJournal $journal); - /** * @param TransactionType $dbType * @@ -38,21 +28,28 @@ interface JournalRepositoryInterface */ public function getJournalsOfType(TransactionType $dbType); - /** - * @param string $query - * @param TransactionJournal $journal - * - * @return Collection - */ - public function searchRelated($query, TransactionJournal $journal); - - /** * @param $type * * @return TransactionType */ public function getTransactionType($type); + + /** + * @param TransactionJournal $journal + * @param array $array + * + * @return void + + /** + * + * @param TransactionJournal $journal + * @param array $array + * + * @return void + */ + public function saveTags(TransactionJournal $journal, array $array); + /** * @param array $data * @@ -67,4 +64,12 @@ interface JournalRepositoryInterface * @return mixed */ public function update(TransactionJournal $journal, array $data); + + /** + * @param TransactionJournal $journal + * @param array $array + * + * @return mixed + */ + public function updateTags(TransactionJournal $journal, array $array); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index de620494c8..612cfa043e 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -140,12 +140,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface /** @var Collection $set */ $set = Auth::user()->piggyBanks()->orderBy('order', 'ASC')->get(); - $set->sortBy( - function (PiggyBank $piggyBank) { - return $piggyBank->name; - } - ); - return $set; } diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php new file mode 100644 index 0000000000..301fedb267 --- /dev/null +++ b/app/Repositories/Tag/TagRepository.php @@ -0,0 +1,180 @@ +tags()->find($tag->id)) { + return false; + } + + if ($tag->tagMode == 'nothing') { + // save it, no problem: + $journal->tags()->save($tag); + + return true; + } + + /* + * get some withdrawal types: + */ + /** @var TransactionType $withdrawal */ + $withdrawal = TransactionType::whereType('Withdrawal')->first(); + /** @var TransactionType $deposit */ + $deposit = TransactionType::whereType('Deposit')->first(); + /** @var TransactionType $transfer */ + $transfer = TransactionType::whereType('Transfer')->first(); + + $withdrawals = $tag->transactionjournals()->where('transaction_type_id', $withdrawal->id)->count(); + $transfers = $tag->transactionjournals()->where('transaction_type_id', $transfer->id)->count(); + + if ($tag->tagMode == 'balancingAct') { + + // only if this is the only withdrawal. + if ($journal->transaction_type_id == $withdrawal->id && $withdrawals < 1) { + $journal->tags()->save($tag); + + return true; + } + // and only if this is the only transfer + if ($journal->transaction_type_id == $transfer->id && $transfers < 1) { + $journal->tags()->save($tag); + + return true; + } + + // ignore expense + return false; + } + if ($tag->tagMode == 'advancePayment') { + + + // only if this is the only withdrawal + if ($journal->transaction_type_id == $withdrawal->id && $withdrawals < 1) { + $journal->tags()->save($tag); + + return true; + } + + // only if this is a deposit. + if ($journal->transaction_type_id == $deposit->id) { + + // if this is a deposit, account must match the current only journal + // (if already present): + $currentWithdrawal = $tag->transactionjournals()->where('transaction_type_id', $withdrawal->id)->first(); + + if ($currentWithdrawal && $currentWithdrawal->assetAccount->id == $journal->assetAccount->id) { + $journal->tags()->save($tag); + + return true; + } else { + if (is_null($currentWithdrawal)) { + $journal->tags()->save($tag); + + return true; + } + } + } + + return false; + } + + return false; + } + + /** + * @param Tag $tag + * + * @return boolean + */ + public function destroy(Tag $tag) + { + $tag->delete(); + + return true; + } + + /** + * @return Collection + */ + public function get() + { + /** @var Collection $tags */ + $tags = Auth::user()->tags()->get(); + $tags->sortBy( + function (Tag $tag) { + return $tag->tag; + } + ); + + return $tags; + } + + /** + * @param array $data + * + * @return Tag + */ + public function store(array $data) + { + $tag = new Tag; + $tag->tag = $data['tag']; + $tag->date = $data['date']; + $tag->description = $data['description']; + $tag->latitude = $data['latitude']; + $tag->longitude = $data['longitude']; + $tag->zoomLevel = $data['zoomLevel']; + $tag->tagMode = $data['tagMode']; + $tag->user()->associate(Auth::user()); + $tag->save(); + + return $tag; + + + } + + /** + * @param Tag $tag + * @param array $data + * + * @return Tag + */ + public function update(Tag $tag, array $data) + { + $tag->tag = $data['tag']; + $tag->date = $data['date']; + $tag->description = $data['description']; + $tag->latitude = $data['latitude']; + $tag->longitude = $data['longitude']; + $tag->zoomLevel = $data['zoomLevel']; + $tag->tagMode = $data['tagMode']; + $tag->save(); + + return $tag; + } +} \ No newline at end of file diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php new file mode 100644 index 0000000000..4e0d31c102 --- /dev/null +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -0,0 +1,50 @@ +data)->first(); + if ($currency) { - \Cache::forever('FFCURRENCYCODE', $currency->code); + Cache::forever('FFCURRENCYCODE', $currency->code); + define('FFCURRENCYCODE', $currency->code); - define('FFCURRENCYCODE', $currency->code); + return $currency->code; + } - return $currency->code; + return 'EUR'; } public function getDefaultCurrency() diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index e0d93024c2..a99ee3c23c 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -62,7 +62,10 @@ class ExpandedForm 'account_id' => 'Asset account', 'budget_id' => 'Budget', 'openingBalance' => 'Opening balance', + 'tagMode' => 'Tag mode', + 'tagPosition' => 'Tag location', 'virtualBalance' => 'Virtual balance', + 'longitude_latitude' => 'Location', 'targetamount' => 'Target amount', 'accountRole' => 'Account role', 'openingBalanceDate' => 'Opening balance date', @@ -201,15 +204,17 @@ class ExpandedForm * * @return string */ - public function month($name, $value = null, array $options = []) + public function integer($name, $value = null, array $options = []) { - $label = $this->label($name, $options); - $options = $this->expandOptionArray($name, $label, $options); - $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); - $html = View::make('form.month', compact('classes', 'name', 'label', 'value', 'options'))->render(); + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $options['step'] = '1'; + $html = View::make('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; + } /** @@ -219,14 +224,13 @@ class ExpandedForm * * @return string */ - public function integer($name, $value = null, array $options = []) + public function location($name, $value = null, array $options = []) { - $label = $this->label($name, $options); - $options = $this->expandOptionArray($name, $label, $options); - $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); - $options['step'] = '1'; - $html = View::make('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render(); + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $html = View::make('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render(); return $html; @@ -265,6 +269,44 @@ class ExpandedForm return $selectList; } + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function month($name, $value = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $html = View::make('form.month', compact('classes', 'name', 'label', 'value', 'options'))->render(); + + return $html; + } + + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function multiRadio($name, array $list = [], $selected = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $selected = $this->fillFieldValue($name, $selected); + + unset($options['class']); + $html = View::make('form.multiRadio', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); + + return $html; + } + /** * @param $type * @param $name @@ -336,4 +378,24 @@ class ExpandedForm return $html; } + + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function textarea($name, $value = null, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $options['rows'] = 4; + $html = View::make('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render(); + + return $html; + + } } diff --git a/app/Support/Twig/Budget.php b/app/Support/Twig/Budget.php new file mode 100644 index 0000000000..39ec2a1e04 --- /dev/null +++ b/app/Support/Twig/Budget.php @@ -0,0 +1,53 @@ +leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') + ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id') + ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') + ->where('transaction_journals.date', '>=', $repetition->startdate->format('Y-m-d')) + ->where('transaction_journals.date', '<=', $repetition->enddate->format('Y-m-d')) + ->where('transaction_journals.user_id', Auth::user()->id) + ->whereNull('transactions.deleted_at') + ->where('transactions.amount', '>', 0) + ->where('limit_repetitions.id', '=', $repetition->id) + ->sum('transactions.amount'); + + return floatval($sum); + } + ); + + return $functions; + + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'FireflyIII\Support\Twig\Budget'; + } +} \ No newline at end of file diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php new file mode 100644 index 0000000000..f5faf71981 --- /dev/null +++ b/app/Support/Twig/General.php @@ -0,0 +1,146 @@ +format($string); + }, ['is_safe' => ['html']] + ); + + $filters[] = new Twig_SimpleFilter( + 'formatTransaction', function (Transaction $transaction) { + return App::make('amount')->formatTransaction($transaction); + }, ['is_safe' => ['html']] + ); + + $filters[] = new Twig_SimpleFilter( + 'formatAmountPlain', function ($string) { + return App::make('amount')->format($string, false); + } + ); + + $filters[] = new Twig_SimpleFilter( + 'formatJournal', function ($journal) { + return App::make('amount')->formatJournal($journal); + }, ['is_safe' => ['html']] + ); + + $filters[] = new Twig_SimpleFilter( + 'balance', function (Account $account = null) { + if (is_null($account)) { + return 'NULL'; + } + + return App::make('steam')->balance($account); + } + ); + + // should be a function but OK + $filters[] = new Twig_SimpleFilter( + 'getAccountRole', function ($name) { + return Config::get('firefly.accountRoles.' . $name); + } + ); + + return $filters; + } + + /** + * {@inheritDoc} + */ + public function getFunctions() + { + $functions = []; + + $functions[] = new Twig_SimpleFunction( + 'getCurrencyCode', function () { + return App::make('amount')->getCurrencyCode(); + } + ); + + $functions[] = new Twig_SimpleFunction( + 'getCurrencySymbol', function () { + return App::make('amount')->getCurrencySymbol(); + } + ); + + $functions[] = new Twig_SimpleFunction( + 'phpdate', function ($str) { + return date($str); + } + ); + + + $functions[] = new Twig_SimpleFunction( + 'env', function ($name, $default) { + return env($name, $default); + } + ); + + $functions[] = new Twig_SimpleFunction( + 'activeRoute', function ($context) { + $args = func_get_args(); + $route = $args[1]; + $what = isset($args[2]) ? $args[2] : false; + $strict = isset($args[3]) ? $args[3] : false; + $activeWhat = isset($context['what']) ? $context['what'] : false; + + // activeRoute + if (!($what === false)) { + if ($what == $activeWhat && Route::getCurrentRoute()->getName() == $route) { + return 'active because-active-what'; + } + } else { + if (!$strict && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { + return 'active because-route-matches-non-strict'; + } else { + if ($strict && Route::getCurrentRoute()->getName() == $route) { + return 'active because-route-matches-strict'; + } + } + } + + return 'not-xxx-at-all'; + }, ['needs_context' => true] + ); + + return $functions; + + + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'FireflyIII\Support\Twig\General'; + } + +} \ No newline at end of file diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php new file mode 100644 index 0000000000..52dd0d6620 --- /dev/null +++ b/app/Support/Twig/Journal.php @@ -0,0 +1,99 @@ +transactionType->type; + if ($type == 'Withdrawal') { + return ''; + } + if ($type == 'Deposit') { + return ''; + } + if ($type == 'Transfer') { + return ''; + } + if ($type == 'Opening balance') { + return ''; + } + + + }, ['is_safe' => ['html']] + ); + + return $filters; + } + + /** + * @return array + */ + public function getFunctions() + { + $functions = []; + + $functions[] = new Twig_SimpleFunction( + 'invalidJournal', function (TransactionJournal $journal) { + if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) { + return true; + } + + return false; + } + ); + + $functions[] = new Twig_SimpleFunction( + 'relevantTags', function (TransactionJournal $journal) { + if ($journal->tags->count() == 0) { + return App::make('amount')->formatJournal($journal); + } + foreach ($journal->tags as $tag) { + if ($tag->tagMode == 'balancingAct') { + // return tag formatted for a "balancing act". + $amount = App::make('amount')->formatJournal($journal, false); + + return ' ' . $tag->tag . ''; + } + } + + + return 'TODO: ' . $journal->amount; + } + ); + + return $functions; + } + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + public function getName() + { + return 'FireflyIII\Support\Twig\Journals'; + } +} \ No newline at end of file diff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.php new file mode 100644 index 0000000000..4d289a4b43 --- /dev/null +++ b/app/Support/Twig/PiggyBank.php @@ -0,0 +1,41 @@ +currentRelevantRep()->currentamount; + } + ); + return $functions; + } + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + public function getName() + { + return 'FireflyIII\Support\Twig\PiggyBank'; + } +} \ No newline at end of file diff --git a/app/User.php b/app/User.php index 1631995fd7..f649708cfb 100644 --- a/app/User.php +++ b/app/User.php @@ -43,6 +43,14 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon return $this->hasMany('FireflyIII\Models\Account'); } + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function tags() + { + return $this->hasMany('FireflyIII\Models\Tag'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 3dec04fa7e..b8cf753024 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -13,6 +13,7 @@ use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Validation\Validator; use Log; use Navigation; +use Symfony\Component\Translation\TranslatorInterface; /** * Class FireflyValidator @@ -22,6 +23,18 @@ use Navigation; class FireflyValidator extends Validator { + /** + * @param TranslatorInterface $translator + * @param array $data + * @param array $rules + * @param array $messages + * @param array $customAttributes + */ + public function __construct(TranslatorInterface $translator, array $data, array $rules, array $messages = [], array $customAttributes = []) + { + parent::__construct($translator, $data, $rules, $messages); + } + /** * @param $attribute * @param $value @@ -181,10 +194,14 @@ class FireflyValidator extends Validator */ public function validateUniqueObjectForUser($attribute, $value, $parameters) { - $table = $parameters[0]; - $field = $parameters[1]; - $encrypted = isset($parameters[2]) ? $parameters[2] : 'encrypted'; - $exclude = isset($parameters[3]) ? $parameters[3] : null; + $table = $parameters[0]; + $field = $parameters[1]; + $encrypted = isset($parameters[2]) ? $parameters[2] : 'encrypted'; + $exclude = isset($parameters[3]) ? $parameters[3] : null; + $alwaysEncrypted = false; + if ($encrypted == 'TRUE') { + $alwaysEncrypted = true; + } $query = DB::table($table)->where('user_id', Auth::user()->id); @@ -195,8 +212,12 @@ class FireflyValidator extends Validator $set = $query->get(); foreach ($set as $entry) { - $isEncrypted = intval($entry->$encrypted) == 1 ? true : false; - $checkValue = $isEncrypted ? Crypt::decrypt($entry->$field) : $entry->$field; + if (!$alwaysEncrypted) { + $isEncrypted = intval($entry->$encrypted) == 1 ? true : false; + } else { + $isEncrypted = true; + } + $checkValue = $isEncrypted ? Crypt::decrypt($entry->$field) : $entry->$field; if ($checkValue == $value) { return false; } diff --git a/bootstrap/app.php b/bootstrap/app.php index e3ec5b5519..5b299a9c83 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -11,6 +11,7 @@ | */ + $app = new Illuminate\Foundation\Application( realpath(__DIR__ . '/../') ); @@ -26,6 +27,8 @@ $app = new Illuminate\Foundation\Application( | */ + + $app->singleton( 'Illuminate\Contracts\Http\Kernel', 'FireflyIII\Http\Kernel' @@ -41,6 +44,9 @@ $app->singleton( 'FireflyIII\Exceptions\Handler' ); + + + /* |-------------------------------------------------------------------------- | Return The Application diff --git a/composer.json b/composer.json index c9459d4f3f..5bbf617f3b 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,9 @@ "watson/validating": "~1.0", "doctrine/dbal": "~2.5", "illuminate/html": "~5.0", - "league/commonmark": "0.7.*" + "league/commonmark": "0.7.*", + "rcrowe/twigbridge": "0.7.x@dev", + "twig/extensions": "~1.2" }, "require-dev": { "barryvdh/laravel-debugbar": "@stable", diff --git a/composer.lock b/composer.lock index f1bab601ca..bce1a9507c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0d43c4c85607c5cdc901cde2d18b75d5", + "hash": "e3e90dd365b74f4878cf3b5b4a1c4007", "packages": [ { "name": "classpreloader/classpreloader", @@ -943,16 +943,16 @@ }, { "name": "laravel/framework", - "version": "v5.0.27", + "version": "v5.0.28", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "4d6330118a295086ce9ff8eed2200d5b67f17688" + "reference": "06a09429322cf53e5bd4587db1060f02a291562e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/4d6330118a295086ce9ff8eed2200d5b67f17688", - "reference": "4d6330118a295086ce9ff8eed2200d5b67f17688", + "url": "https://api.github.com/repos/laravel/framework/zipball/06a09429322cf53e5bd4587db1060f02a291562e", + "reference": "06a09429322cf53e5bd4587db1060f02a291562e", "shasum": "" }, "require": { @@ -1022,7 +1022,7 @@ "predis/predis": "~1.0" }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver (~2.4).", + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~2.4).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0).", "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", @@ -1065,7 +1065,7 @@ "framework", "laravel" ], - "time": "2015-04-04 01:34:57" + "time": "2015-04-21 01:44:32" }, { "name": "league/commonmark", @@ -1527,6 +1527,70 @@ ], "time": "2015-03-26 18:43:54" }, + { + "name": "rcrowe/twigbridge", + "version": "0.7.x-dev", + "source": { + "type": "git", + "url": "https://github.com/rcrowe/TwigBridge.git", + "reference": "ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026", + "reference": "ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026", + "shasum": "" + }, + "require": { + "illuminate/support": "5.0.*", + "illuminate/view": "5.0.*", + "php": ">=5.4.0", + "twig/twig": "~1.15" + }, + "require-dev": { + "laravel/framework": "5.0.*", + "mockery/mockery": "0.9.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "~0.6", + "squizlabs/php_codesniffer": "~1.5" + }, + "suggest": { + "laravelcollective/html": "For bringing back html/form in Laravel 5.x", + "twig/extensions": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.7-dev" + } + }, + "autoload": { + "psr-4": { + "TwigBridge\\": "src", + "TwigBridge\\Tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + }, + { + "name": "Rob Crowe", + "email": "hello@vivalacrowe.com" + } + ], + "description": "Adds the power of Twig to Laravel", + "keywords": [ + "laravel", + "twig" + ], + "time": "2015-04-22 09:19:03" + }, { "name": "swiftmailer/swiftmailer", "version": "v5.4.0", @@ -2291,6 +2355,115 @@ ], "time": "2015-03-31 08:12:29" }, + { + "name": "twig/extensions", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig-extensions.git", + "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/8cf4b9fe04077bd54fc73f4fde83347040c3b8cd", + "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd", + "shasum": "" + }, + "require": { + "twig/twig": "~1.12" + }, + "require-dev": { + "symfony/translation": "~2.3" + }, + "suggest": { + "symfony/translation": "Allow the time_diff output to be translated" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_Extensions_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Common additional features for Twig that do not directly belong in core", + "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html", + "keywords": [ + "i18n", + "text" + ], + "time": "2014-10-30 14:30:03" + }, + { + "name": "twig/twig", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/9f70492f44398e276d1b81c1b43adfe6751c7b7f", + "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f", + "shasum": "" + }, + "require": { + "php": ">=5.2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2015-04-19 08:30:27" + }, { "name": "vlucas/phpdotenv", "version": "v1.1.0", @@ -3103,16 +3276,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.4.0", + "version": "v1.4.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5" + "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", - "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", + "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", "shasum": "" }, "require": { @@ -3159,7 +3332,7 @@ "spy", "stub" ], - "time": "2015-03-27 19:31:25" + "time": "2015-04-27 22:15:08" }, { "name": "phpunit/php-code-coverage", @@ -4179,6 +4352,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "rcrowe/twigbridge": 20, "barryvdh/laravel-debugbar": 0 }, "prefer-stable": false, diff --git a/config/app.php b/config/app.php index fe7ad89606..f0b8a7a614 100644 --- a/config/app.php +++ b/config/app.php @@ -136,7 +136,11 @@ return [ 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Illuminate\Html\HtmlServiceProvider', + 'TwigBridge\ServiceProvider', + 'DaveJamesMiller\Breadcrumbs\ServiceProvider', + 'Barryvdh\Debugbar\ServiceProvider', + 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', /* * Application Service Providers... @@ -149,6 +153,7 @@ return [ 'FireflyIII\Providers\FireflyServiceProvider', 'FireflyIII\Providers\TestingServiceProvider', + ], /* @@ -198,13 +203,14 @@ return [ 'View' => 'Illuminate\Support\Facades\View', 'Form' => 'Illuminate\Html\FormFacade', 'Html' => 'Illuminate\Html\HtmlFacade', - 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade', - + 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade', 'Preferences' => 'FireflyIII\Support\Facades\Preferences', 'Navigation' => 'FireflyIII\Support\Facades\Navigation', 'Amount' => 'FireflyIII\Support\Facades\Amount', 'Steam' => 'FireflyIII\Support\Facades\Steam', 'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm', + 'Twig' => 'TwigBridge\Facade\Twig', + ], diff --git a/config/view.php b/config/view.php index 88fc534aeb..6e1a698a10 100644 --- a/config/view.php +++ b/config/view.php @@ -14,7 +14,7 @@ return [ */ 'paths' => [ - realpath(base_path('resources/views')) + realpath(base_path('resources/twig')) ], /* diff --git a/database/migrations/2015_04_26_054507_changes_for_v3310.php b/database/migrations/2015_04_26_054507_changes_for_v3310.php new file mode 100644 index 0000000000..2c338242a1 --- /dev/null +++ b/database/migrations/2015_04_26_054507_changes_for_v3310.php @@ -0,0 +1,75 @@ +dropColumn('relation'); + } + ); + + /* + * New table! + */ + Schema::create( + 'tags', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->integer('user_id')->unsigned(); + $table->string('tag', 1024); + $table->string('tagMode', 1024); + $table->date('date')->nullable(); + $table->text('description')->nullable(); + $table->decimal('latitude', 18, 12)->nullable(); + $table->decimal('longitude', 18, 12)->nullable(); + $table->smallInteger('zoomLevel', false, true)->nullable(); + + // connect reminders to users + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } + ); + + + Schema::create('tag_transaction_journal',function (Blueprint $table) { + $table->increments('id'); + $table->integer('tag_id')->unsigned(); + $table->integer('transaction_journal_id')->unsigned(); + + // link to foreign tables. + $table->foreign('tag_id', 'tag_grp_id')->references('id')->on('tags')->onDelete('cascade'); + $table->foreign('transaction_journal_id', 'tag_trj_id')->references('id')->on('transaction_journals')->onDelete('cascade'); + + // add unique. + $table->unique(['tag_id', 'transaction_journal_id'], 'tag_t_joined'); + + }); + } + +} diff --git a/database/migrations/2015_04_28_075215_changes_for_v3310a.php b/database/migrations/2015_04_28_075215_changes_for_v3310a.php new file mode 100644 index 0000000000..9c0c1df3d6 --- /dev/null +++ b/database/migrations/2015_04_28_075215_changes_for_v3310a.php @@ -0,0 +1,40 @@ +string('relation', 50)->nullable(); + } + ); + // make new column "relation" + + } + +} diff --git a/database/migrations/2015_04_28_075317_changes_for_v3310b.php b/database/migrations/2015_04_28_075317_changes_for_v3310b.php new file mode 100644 index 0000000000..5ea3fcfb13 --- /dev/null +++ b/database/migrations/2015_04_28_075317_changes_for_v3310b.php @@ -0,0 +1,32 @@ +update(['relation' => 'balance']); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } + +} diff --git a/phpunit.xml b/phpunit.xml index 677b0226c7..bf13ff1240 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,7 +7,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" syntaxCheck="false"> @@ -24,6 +24,7 @@ + diff --git a/pu.sh b/pu.sh index 26c595cfb4..cbd5c6fbf3 100755 --- a/pu.sh +++ b/pu.sh @@ -1,8 +1,5 @@ #!/bin/bash -# backup .env file. -cp .env .env.backup - # set testing environment cp .env.testing .env diff --git a/public/css/firefly.css b/public/css/firefly.css index 422c9bed10..09359d29db 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -5,4 +5,9 @@ .ui-sortable-placeholder { display: inline-block; height: 1px; +} +#map-canvas { + height: 100%; + margin: 0px; + padding: 0px } \ No newline at end of file diff --git a/public/js/bootstrap-tagsinput.min.js.map b/public/js/bootstrap-tagsinput.min.js.map new file mode 100755 index 0000000000..a0d198d16b --- /dev/null +++ b/public/js/bootstrap-tagsinput.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dist/bootstrap-tagsinput-angular.min.js","sources":["src/bootstrap-tagsinput-angular.js"],"names":["angular","module","directive","getItemProperty","scope","property","isFunction","$parent","item","undefined","restrict","model","template","replace","link","element","attrs","$","isArray","select","typeaheadSourceArray","typeaheadSource","split","length","tagsinput","options","typeahead","source","itemValue","itemvalue","itemText","itemtext","confirmKeys","confirmkeys","JSON","parse","tagClass","tagclass","i","on","event","indexOf","push","idx","splice","prev","slice","$watch","added","filter","removed"],"mappings":";;;;;AAAAA,QAAQC,OAAO,0BACdC,UAAU,sBAAuB,WAEhC,QAASC,GAAgBC,EAAOC,GAC9B,MAAKA,GAGDL,QAAQM,WAAWF,EAAMG,QAAQF,IAC5BD,EAAMG,QAAQF,GAEhB,SAASG,GACd,MAAOA,GAAKH,IANLI,OAUX,OACEC,SAAU,KACVN,OACEO,MAAO,YAETC,SAAU,6BACVC,SAAS,EACTC,KAAM,SAASV,EAAOW,EAASC,GAC7BC,EAAE,WACKjB,QAAQkB,QAAQd,EAAMO,SACzBP,EAAMO,SAER,IAAIQ,GAASF,EAAE,SAAUF,GACrBK,EAAuBJ,EAAMK,gBAAkBL,EAAMK,gBAAgBC,MAAM,KAAO,KAClFD,EAAkBD,EACjBA,EAAqBG,OAAS,EAC3BnB,EAAMG,QAAQa,EAAqB,IAAIA,EAAqB,IAC1DhB,EAAMG,QAAQa,EAAqB,IACvC,IAEND,GAAOK,UAAUpB,EAAMG,QAAQS,EAAMS,SAAW,MAC9CC,WACEC,OAAW3B,QAAQM,WAAWe,GAAmBA,EAAkB,MAErEO,UAAWzB,EAAgBC,EAAOY,EAAMa,WACxCC,SAAW3B,EAAgBC,EAAOY,EAAMe,UACxCC,YAAc7B,EAAgBC,EAAOY,EAAMiB,aAAeC,KAAKC,MAAMnB,EAAMiB,cAAgB,IAC3FG,SAAWpC,QAAQM,WAAWF,EAAMG,QAAQS,EAAMqB,WAAajC,EAAMG,QAAQS,EAAMqB,UAAY,WAAiB,MAAOrB,GAAMqB,WAG/H,KAAK,GAAIC,GAAI,EAAGA,EAAIlC,EAAMO,MAAMY,OAAQe,IACtCnB,EAAOK,UAAU,MAAOpB,EAAMO,MAAM2B,GAGtCnB,GAAOoB,GAAG,YAAa,SAASC,GACU,KAApCpC,EAAMO,MAAM8B,QAAQD,EAAMhC,OAC5BJ,EAAMO,MAAM+B,KAAKF,EAAMhC,QAG3BW,EAAOoB,GAAG,cAAe,SAASC,GAChC,GAAIG,GAAMvC,EAAMO,MAAM8B,QAAQD,EAAMhC,KACxB,MAARmC,GACFvC,EAAMO,MAAMiC,OAAOD,EAAK,IAK5B,IAAIE,GAAOzC,EAAMO,MAAMmC,OACvB1C,GAAM2C,OAAO,QAAS,WACpB,GAEIT,GAFAU,EAAQ5C,EAAMO,MAAMsC,OAAO,SAASX,GAAI,MAA2B,KAApBO,EAAKJ,QAAQH,KAC5DY,EAAUL,EAAKI,OAAO,SAASX,GAAI,MAAkC,KAA3BlC,EAAMO,MAAM8B,QAAQH,IAMlE,KAHAO,EAAOzC,EAAMO,MAAMmC,QAGdR,EAAI,EAAGA,EAAIY,EAAQ3B,OAAQe,IAC9BnB,EAAOK,UAAU,SAAU0B,EAAQZ,GAOrC,KAHAnB,EAAOK,UAAU,WAGZc,EAAI,EAAGA,EAAIU,EAAMzB,OAAQe,IAC5BnB,EAAOK,UAAU,MAAOwB,EAAMV,MAE/B"} \ No newline at end of file diff --git a/public/js/index.js b/public/js/index.js index 89639a78ed..22a9081f06 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -3,7 +3,7 @@ google.setOnLoadCallback(drawChart); function drawChart() { googleLineChart('chart/home/account', 'accounts-chart'); - googleBarChart('chart/home/budgets', 'budgets-chart'); + googleColumnChart('chart/home/budgets', 'budgets-chart'); googleColumnChart('chart/home/categories', 'categories-chart'); googlePieChart('chart/home/bills', 'bills-chart'); getBoxAmounts(); diff --git a/public/js/piggy-banks.js b/public/js/piggy-banks.js index 7cef178001..39c4658b24 100644 --- a/public/js/piggy-banks.js +++ b/public/js/piggy-banks.js @@ -5,14 +5,43 @@ $(function () { if (typeof(googleLineChart) === 'function' && typeof(piggyBankID) !== 'undefined') { googleLineChart('chart/piggy-history/' + piggyBankID, 'piggy-bank-history'); } - $('#sortable').sortable( + + $('#sortable tbody').sortable( { + helper: fixHelper, stop: stopSorting, - handle: '.handle' + handle: '.handle', + start: function (event, ui) { + // Build a placeholder cell that spans all the cells in the row + var cellCount = 0; + $('td, th', ui.helper).each(function () { + // For each TD or TH try and get it's colspan attribute, and add that or 1 to the total + var colspan = 1; + var colspanAttr = $(this).attr('colspan'); + if (colspanAttr > 1) { + colspan = colspanAttr; + } + cellCount += colspan; + }); + + // Add the placeholder UI - note that this is the item's content, so TD rather than TR + ui.placeholder.html(' '); + } } ); }); +// Return a helper with preserved width of cells +var fixHelper = function(e, tr) { + var $originals = tr.children(); + var $helper = tr.clone(); + $helper.children().each(function (index) { + // Set helper cell sizes to match the original sizes + $(this).width($originals.eq(index).width()); + }); + return $helper; +} + function addMoney(e) { var pigID = parseInt($(e.target).data('id')); $('#moneyManagementModal').empty().load('piggy-banks/add/' + pigID, function () { @@ -33,7 +62,7 @@ function removeMoney(e) { function stopSorting() { $('.loadSpin').addClass('fa fa-refresh fa-spin'); var order = []; - $.each($('#sortable>div'), function(i,v) { + $.each($('#sortable>tbody>tr'), function(i,v) { var holder = $(v); var id = holder.data('id'); order.push(id); diff --git a/public/js/related-manager.js b/public/js/related-manager.js deleted file mode 100644 index 276532d77f..0000000000 --- a/public/js/related-manager.js +++ /dev/null @@ -1,112 +0,0 @@ -$(document).ready(function () { - $('.relateTransaction').click(relateTransactionDialog); - //$('.unrelate-checkbox').click(unrelateTransaction); - -}); - -function unrelateTransaction(e) { - var target = $(e.target); - var id = target.data('id'); - var parent = target.data('parent'); - - if(typeof id == "undefined" && typeof parent == "undefined") { - target = target.parent(); - id = target.data('id'); - parent = target.data('parent'); - } - console.log('unlink ' + id + ' from ' + parent); - - $.post('related/removeRelation/' + id + '/' + parent, {_token: token}).success(function (data) { - target.parent().parent().remove(); - }).fail(function () { - alert('Could not!'); - }); - - - return false; - - - //$.post('related/removeRelation/' + id + '/' + relatedTo, {_token: token}).success(function (data) { - // target.parent().parent().remove(); - //}).fail(function () { - // alert('Could not!'); - //}); - -} - -function relateTransactionDialog(e) { - var target = $(e.target); - var ID = target.data('id'); - - - $('#relationModal').empty().load('related/related/' + ID, function () { - - $('#relationModal').modal('show'); - getAlreadyRelatedTransactions(e, ID); - $('#searchRelated').submit(function (e) { - searchRelatedTransactions(e, ID); - - return false; - }); - }); - - - return false; -} - - -function searchRelatedTransactions(e, ID) { - var searchValue = $('#relatedSearchValue').val(); - if (searchValue != '') { - $.post('related/search/' + ID, {searchValue: searchValue, _token: token}).success(function (data) { - // post the results to some div. - $('#relatedSearchResultsTitle').show(); - $('#relatedSearchResults').empty().html(data); - // remove any clicks. - $('.relate').unbind('click').on('click', doRelateNewTransaction); - - }).fail(function () { - alert('Could not search. Sorry.'); - }); - } - - return false; -} - -function doRelateNewTransaction(e) { - // remove the row from the table: - var target = $(e.target); - var id = target.data('id'); - var parent = target.data('parent'); - - if (typeof id == "undefined" && typeof parent == "undefined") { - target = target.parent(); - console.log(target); - id = target.data('id'); - parent = target.data('parent'); - } - - console.log('Relate ' + id + ' to ' + parent); - $.post('related/relate/' + parent + '/' + id, {_token: token}).success(function (data) { - // success! remove entry: - target.parent().parent().remove(); - // get related stuff (again). - getAlreadyRelatedTransactions(null, parent); - }).fail(function () { - // could not relate. - alert('Could not relate this transaction to the intended target.'); - }); - return false; -} - -function getAlreadyRelatedTransactions(e, ID) { - //#alreadyRelated - $.get('related/alreadyRelated/' + ID).success(function (data) { - $('#alreadyRelated').empty().html(data); - // some event triggers. - $('.unrelate').unbind('click').on('click', unrelateTransaction); - - }).fail(function () { - alert('Cannot get related stuff.'); - }); -} \ No newline at end of file diff --git a/public/js/sb-admin-2.js b/public/js/sb-admin-2.js index 5be2c883ad..469460fd16 100755 --- a/public/js/sb-admin-2.js +++ b/public/js/sb-admin-2.js @@ -29,8 +29,8 @@ $(function() { var url = window.location; var element = $('ul.nav a').filter(function() { return this.href == url || url.href.indexOf(this.href) == 0; - }).addClass('active').parent().parent().addClass('in').parent(); + }).parent().parent().addClass('in').parent();/*addClass('active')*/ if (element.is('li')) { - element.addClass('active'); + //element.addClass('active'); } }); diff --git a/public/js/tags.js b/public/js/tags.js new file mode 100644 index 0000000000..f099ec1ee2 --- /dev/null +++ b/public/js/tags.js @@ -0,0 +1,115 @@ +$(function () { + + /* + Hide and show the tag index help. + */ + $('#tagHelp').on('show.bs.collapse', function () { + // set hideTagHelp = false + $.post('/tags/hideTagHelp/false', {_token: token}); + $('#tagHelpButton').text('Hide help'); + + }).on('hide.bs.collapse', function () { + // set hideTagHelp = true + $.post('/tags/hideTagHelp/true', {_token: token}); + $('#tagHelpButton').text('Show help'); + + }); + + $('#clearLocation').click(clearLocation); + +}); + +/* + Some vars as prep for the map: + */ +var map; +var markers = []; +var setTag = false; + +var mapOptions = { + zoom: zoomLevel, + center: new google.maps.LatLng(latitude, longitude), + disableDefaultUI: true +}; + +/* + Clear location and reset zoomLevel. + */ +function clearLocation() { + "use strict"; + deleteMarkers(); + $('input[name="latitude"]').val(""); + $('input[name="longitude"]').val(""); + $('input[name="zoomLevel"]').val("6"); + setTag = false; + $('input[name="setTag"]').val('false'); + return false; +} + +function initialize() { + + /* + Create new map: + */ + map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); + + /* + Respond to click event. + */ + google.maps.event.addListener(map, 'rightclick', function (event) { + placeMarker(event); + }); + + /* + Respond to zoom event. + */ + google.maps.event.addListener(map, 'zoom_changed', function () { + saveZoomLevel(event); + }); + /* + Maybe place marker? + */ + if(doPlaceMarker) { + var myLatlng = new google.maps.LatLng(latitude,longitude); + var fakeEvent = {}; + fakeEvent.latLng = myLatlng; + placeMarker(fakeEvent); + + } +} + +/** + * save zoom level of map into hidden input. + */ +function saveZoomLevel() { + "use strict"; + $('input[name="zoomLevel"]').val(map.getZoom()); +} + +/** + * Place marker on map. + * @param event + */ +function placeMarker(event) { + deleteMarkers(); + var marker = new google.maps.Marker({position: event.latLng, map: map}); + $('input[name="latitude"]').val(event.latLng.lat()); + $('input[name="longitude"]').val(event.latLng.lng()); + markers.push(marker); + setTag = true; + $('input[name="setTag"]').val('true'); +} + + +/** + * Deletes all markers in the array by removing references to them. + */ +function deleteMarkers() { + for (var i = 0; i < markers.length; i++) { + markers[i].setMap(null); + } + markers = []; +} + + +google.maps.event.addDomListener(window, 'load', initialize); \ No newline at end of file diff --git a/public/js/transactions.js b/public/js/transactions.js index 9d918bef90..20e7b6eaee 100644 --- a/public/js/transactions.js +++ b/public/js/transactions.js @@ -8,6 +8,20 @@ $(document).ready(function () { $('input[name="expense_account"]').typeahead({source: data}); }); } + + if ($('input[name="tags"]').length > 0) { + $.getJSON('json/tags').success(function (data) { + var opt = { + typeahead: { + source: data + } + }; + $('input[name="tags"]').tagsinput( + opt + ); + }); + } + if ($('input[name="revenue_account"]').length > 0) { $.getJSON('json/revenue-accounts').success(function (data) { $('input[name="revenue_account"]').typeahead({source: data}); diff --git a/resources/twig/accounts/create.twig b/resources/twig/accounts/create.twig new file mode 100644 index 0000000000..6ed1f2dfaf --- /dev/null +++ b/resources/twig/accounts/create.twig @@ -0,0 +1,61 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }} +
+ + + +
+
+
+
+ Mandatory fields +
+
+ {{ ExpandedForm.text('name') }} +
+
+
+ +
+ + {% if what == 'asset' %} +
+
+ Optional fields +
+
+ + {{ ExpandedForm.balance('openingBalance') }} + {{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }} + {{ ExpandedForm.select('accountRole', Config.get('firefly.accountRoles'),null,{'helpText' : 'Any extra options resulting from your choice can be set later.'}) }} + {{ ExpandedForm.balance('virtualBalance') }} + +
+
+ {% endif %} + + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('create','account') }} +
+
+ +
+
+
+
+

+ +

+
+
+ +
+{% endblock %} \ No newline at end of file diff --git a/resources/twig/accounts/delete.twig b/resources/twig/accounts/delete.twig new file mode 100644 index 0000000000..4608db3fdc --- /dev/null +++ b/resources/twig/accounts/delete.twig @@ -0,0 +1,36 @@ +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute().getName(), account) }} +{{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('accounts.destroy',account.id)}) }} +
+
+ +
+
+ + +{% endblock %} diff --git a/resources/twig/accounts/edit.twig b/resources/twig/accounts/edit.twig new file mode 100644 index 0000000000..19968766f8 --- /dev/null +++ b/resources/twig/accounts/edit.twig @@ -0,0 +1,71 @@ +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute().getName(), account) }} +{{ Form.model(account, {'class' : 'form-horizontal','id' : 'update','url' : route('accounts.update',account.id) } ) }} + + + +
+
+
+
+ Mandatory fields +
+
+ {{ ExpandedForm.text('name') }} +
+
+ +
+
+
+
+ Optional fields +
+
+ {% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %} + {{ ExpandedForm.balance('openingBalance',null, {'currency' : openingBalance ? openingBalance.transactionCurrency : null}) }} + {{ ExpandedForm.date('openingBalanceDate') }} + {{ ExpandedForm.select('accountRole',Config.get('firefly.accountRoles')) }} + {{ ExpandedForm.balance('virtualBalance',null) }} + + {% endif %} + {{ ExpandedForm.checkbox('active','1') }} +
+
+ + + {% if Session.get('preFilled').accountRole == 'ccAsset' %} +
+
+ Credit card options +
+
+ {{ ExpandedForm.select('ccType',Config.get('firefly.ccTypes')) }} + {{ ExpandedForm.date('ccMonthlyPaymentDate',null,{'helpText' : 'Select any year and any month, it will be ignored anway. Only the day of the month is relevant.'}) }} +
+
+ {% endif %} + + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('update','account') }} +
+
+
+
+
+
+

+ +

+
+
+ +{% endblock %} diff --git a/resources/views/accounts/index.blade.php b/resources/twig/accounts/index.twig similarity index 74% rename from resources/views/accounts/index.blade.php rename to resources/twig/accounts/index.twig index 8f52cbd9ca..a596dd3111 100644 --- a/resources/views/accounts/index.blade.php +++ b/resources/twig/accounts/index.twig @@ -1,11 +1,11 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) !!} +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
- {{{$subTitle}}} + {{ subTitle}}
- @include('list.accounts') + {% include 'list/accounts.twig' %}
-@stop +{% endblock %} -@section('styles') +{% block styles %} -@stop +{% endblock %} -@section('scripts') +{% block scripts %} @@ -44,4 +43,4 @@ -@stop +{% endblock %} diff --git a/resources/views/accounts/show.blade.php b/resources/twig/accounts/show.twig similarity index 73% rename from resources/views/accounts/show.blade.php rename to resources/twig/accounts/show.twig index 412014e342..59ea7654ae 100644 --- a/resources/views/accounts/show.blade.php +++ b/resources/twig/accounts/show.twig @@ -1,11 +1,11 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!} -
+{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, account) }} +
- {{{$account->name}}} + {{ account.name }} @@ -16,8 +16,8 @@
@@ -37,19 +37,18 @@ Transactions
- @include('list.journals-full',['sorting' => true]) + {% include 'list/journals.twig' with {sorting:true} %}
-@stop -@section('scripts') +{% endblock %} + +{% block scripts %} @@ -57,4 +56,5 @@ -@stop + +{% endblock %} \ No newline at end of file diff --git a/resources/views/auth/login.blade.php b/resources/twig/auth/login.twig similarity index 83% rename from resources/views/auth/login.blade.php rename to resources/twig/auth/login.twig index 96b65406ff..b8a75141db 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/twig/auth/login.twig @@ -1,16 +1,17 @@ -@extends('layouts.guest') -@section('content') +{% extends "./layout/guest.twig" %} -@if($errors->has('email')) +{% block content %} + +{% if errors.has('email') %}
-@endif +{% endif %}
@@ -42,9 +43,9 @@

- @if(Config::get('auth.allow_register') === true) - Register - @endif + {% if Config.get('auth.allow_register') %} + Register + {% endif %} Forgot your password?
@@ -52,4 +53,5 @@
-@stop +{% endblock %} + diff --git a/resources/views/auth/password.blade.php b/resources/twig/auth/password.twig similarity index 75% rename from resources/views/auth/password.blade.php rename to resources/twig/auth/password.twig index 49640fb999..720bce9a88 100644 --- a/resources/views/auth/password.blade.php +++ b/resources/twig/auth/password.twig @@ -1,6 +1,6 @@ -@extends('layouts.guest') +{% extends "./layout/guest.twig" %} -@section('content') +{% block content %}
- @if (session('status')) + {% if session.status %}
- {{ session('status') }} + {{ session.status }}
- @endif + {% endif %} - @if (count($errors) > 0) + {% if errors|length > 0 %}
Whoops! There were some problems with your input.

    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach + {% for error in errors.all %} +
  • {{ error }}
  • + {% endfor %}
- @endif + {% endif %}
- +

@@ -42,4 +42,4 @@

-@endsection +{% endblock %} \ No newline at end of file diff --git a/resources/views/auth/register.blade.php b/resources/twig/auth/register.twig similarity index 85% rename from resources/views/auth/register.blade.php rename to resources/twig/auth/register.twig index d2c2b743ea..d564378099 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/twig/auth/register.twig @@ -1,6 +1,6 @@ -@extends('layouts.guest') +{% extends "./layout/guest.twig" %} -@section('content') +{% block content %}
-
-@endsection +{% endblock %} diff --git a/resources/views/bills/create.blade.php b/resources/twig/bills/create.twig similarity index 56% rename from resources/views/bills/create.blade.php rename to resources/twig/bills/create.twig index f404cb4195..f7719b3214 100644 --- a/resources/views/bills/create.blade.php +++ b/resources/twig/bills/create.twig @@ -1,7 +1,7 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('bills.store')]) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('bills.store')}) }}
@@ -11,19 +11,15 @@ Mandatory fields
- {!! ExpandedForm::text('name') !!} - {!! ExpandedForm::tags('match') !!} - {!! ExpandedForm::amount('amount_min') !!} - {!! ExpandedForm::amount('amount_max') !!} - {!! ExpandedForm::date('date',Carbon\Carbon::now()->addDay()->format('Y-m-d')) !!} - {!! ExpandedForm::select('repeat_freq',$periods,'monthly') !!} + {{ ExpandedForm.text('name') }} + {{ ExpandedForm.tags('match') }} + {{ ExpandedForm.amount('amount_min') }} + {{ ExpandedForm.amount('amount_max') }} + {{ ExpandedForm.date('date',phpdate('Y-m-d')) }} + {{ ExpandedForm.select('repeat_freq',periods,'monthly') }}
-

- -

+
@@ -32,9 +28,9 @@ Optional fields
- {!! ExpandedForm::integer('skip',0) !!} - {!! ExpandedForm::checkbox('automatch',1,true) !!} - {!! ExpandedForm::checkbox('active',1,true) !!} + {{ ExpandedForm.integer('skip',0) }} + {{ ExpandedForm.checkbox('automatch',1,true) }} + {{ ExpandedForm.checkbox('active',1,true) }}
@@ -44,20 +40,30 @@ Options
- {!! ExpandedForm::optionsList('create','bill') !!} + {{ ExpandedForm.optionsList('create','bill') }}
+ + +
+
+

+ +

+
-{!! Form::close() !!} + +{% endblock %} -@stop -@section('styles') +{% block styles %} -@stop -@section('scripts') +{% endblock %} +{% block scripts %} -@stop +{% endblock %} diff --git a/resources/twig/bills/delete.twig b/resources/twig/bills/delete.twig new file mode 100644 index 0000000000..f58fd3db68 --- /dev/null +++ b/resources/twig/bills/delete.twig @@ -0,0 +1,32 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('bills.destroy',bill.id)}) }} +
+
+
+
+ Delete bill "{{ bill.name }}" +
+
+

+ Are you sure that you want to delete bill "{{ bill.name }}"? +

+ + {% if bill.transactionjournals|length > 0 %} +

+ Bill "{{ bill.name }}" still has {{ bill.transactionjournals|length }} transactions connected + to it. These will not be removed but will lose their connection to this bill. +

+ {% endif %} + +

+ + Cancel +

+
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/resources/views/bills/edit.blade.php b/resources/twig/bills/edit.twig similarity index 52% rename from resources/views/bills/edit.blade.php rename to resources/twig/bills/edit.twig index 823d826011..5fd7e02a0e 100644 --- a/resources/views/bills/edit.blade.php +++ b/resources/twig/bills/edit.twig @@ -1,43 +1,37 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) !!} -{!! Form::model($bill, ['class' => 'form-horizontal','id' => 'update','url' => route('bills.update', $bill->id)]) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }} + {{ Form.model(bill, {'class' : 'form-horizontal','id' : 'update','url' : route('bills.update', bill.id)}) }} - +
-
Mandatory fields
- {!! ExpandedForm::text('name') !!} - {!! ExpandedForm::tags('match') !!} - {!! ExpandedForm::amount('amount_min') !!} - {!! ExpandedForm::amount('amount_max') !!} - {!! ExpandedForm::date('date',$bill->date->format('Y-m-d')) !!} - {!! ExpandedForm::select('repeat_freq',$periods) !!} + {{ ExpandedForm.text('name') }} + {{ ExpandedForm.tags('match') }} + {{ ExpandedForm.amount('amount_min') }} + {{ ExpandedForm.amount('amount_max') }} + {{ ExpandedForm.date('date',bill.date.format('Y-m-d')) }} + {{ ExpandedForm.select('repeat_freq',periods) }}
-

- -

+
-
Optional fields
- {!! ExpandedForm::integer('skip') !!} - {!! ExpandedForm::checkbox('automatch',1) !!} - {!! ExpandedForm::checkbox('active',1) !!} + {{ ExpandedForm.integer('skip') }} + {{ ExpandedForm.checkbox('automatch',1) }} + {{ ExpandedForm.checkbox('active',1) }}
@@ -46,19 +40,27 @@ Options
- {!! ExpandedForm::optionsList('update','bill') !!} + {{ ExpandedForm.optionsList('update','bill') }}
-{!! Form::close() !!} +
+
+

+ +

+
+
+ - -@stop -@section('styles') +{% endblock %} +{% block styles %} -@stop -@section('scripts') +{% endblock %} +{% block scripts %} -@stop +{% endblock %} diff --git a/resources/twig/bills/index.twig b/resources/twig/bills/index.twig new file mode 100644 index 0000000000..ef488037a5 --- /dev/null +++ b/resources/twig/bills/index.twig @@ -0,0 +1,27 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }} +
+
+
+
+ {{ title }} + + +
+
+ + +
+
+
+ {% include 'list/bills.twig' %} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/resources/views/bills/show.blade.php b/resources/twig/bills/show.twig similarity index 65% rename from resources/views/bills/show.blade.php rename to resources/twig/bills/show.twig index 4e9b77431a..e6297668a7 100644 --- a/resources/views/bills/show.blade.php +++ b/resources/twig/bills/show.twig @@ -1,25 +1,24 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, bill) }}
- {{{$bill->name}}} + {{ bill.name }} - @if($bill->active) + {% if bill.active %} - @else + {% else %} - @endif + {% endif %} - @if($bill->automatch) + {% if bill.automatch %} - @else + {% else %} - @endif + {% endif %} -
@@ -39,21 +38,21 @@ Matching on - @foreach(explode(',',$bill->match) as $word) - {{{$word}}} - @endforeach - between {!! Amount::format($bill->amount_min) !!} and {!! Amount::format($bill->amount_max) !!}. - Repeats {!! $bill->repeat_freq !!}. + {% for word in bill.match|split(',') %} + {{ word }} + {% endfor %} + between {{ bill.amount_min|formatAmount }} and {{ bill.amount_max|formatAmount }}. + Repeats {{ bill.repeat_freq }}. Next expected match - @if($bill->nextExpectedMatch) - {{$bill->nextExpectedMatch->format('j F Y')}} - @else + {% if bill.nextExpectedMatch %} + {{bill.nextExpectedMatch.format('j F Y')}} + {% else %} Unknown - @endif + {% endif %} @@ -67,7 +66,7 @@
@@ -94,23 +93,21 @@ Connected transaction journals
- @include('list.journals-full',['sorting' => false]) + {% include 'list/journals' %}
-@stop +{% endblock %} -@section('scripts') +{% block scripts %} - -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/budgets/create.blade.php b/resources/twig/budgets/create.twig similarity index 65% rename from resources/views/budgets/create.blade.php rename to resources/twig/budgets/create.twig index a9722f5ac0..fc4d4a5429 100644 --- a/resources/views/budgets/create.blade.php +++ b/resources/twig/budgets/create.twig @@ -1,7 +1,7 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('budgets.store')]) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('budgets.store')}) }}
@@ -9,15 +9,9 @@ Mandatory fields
- {!! ExpandedForm::text('name') !!} + {{ ExpandedForm.text('name') }}
-

- -

-
@@ -26,17 +20,26 @@ Options
- {!! ExpandedForm::optionsList('create','budget') !!} + {{ ExpandedForm.optionsList('create','budget') }}
+
+
+

+ +

+
+
-{!! Form::close() !!} + -@stop +{% endblock %} diff --git a/resources/views/budgets/delete.blade.php b/resources/twig/budgets/delete.twig similarity index 51% rename from resources/views/budgets/delete.blade.php rename to resources/twig/budgets/delete.twig index c5f4870785..e1b7e5ef95 100644 --- a/resources/views/budgets/delete.blade.php +++ b/resources/twig/budgets/delete.twig @@ -1,28 +1,28 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('budgets.destroy',$budget->id)]) !!} -
+{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, budget) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('budgets.destroy',budget.id) }) }} +
- Delete budget "{{{$budget->name}}}" + Delete budget "{{ budget.name}}"

- Are you sure that you want to delete budget "{{{$budget->name}}}"? + Are you sure that you want to delete budget "{{ budget.name }}"?

- @if($budget->transactionjournals()->count() > 0) + {% if budget.transactionjournals|length > 0 %}

- Budget "{{{$budget->name}}}" still has {{$budget->transactionjournals()->count()}} transactions connected + Budget "{{ budget.name }}" still has {{ budget.transactionjournals|length }} transactions connected to it. These will not be removed but will lose their connection to this budget.

- @endif + {% endif %}

- Cancel + Cancel

@@ -39,6 +39,5 @@
- -{!! Form::close() !!} -@stop + +{% endblock %} \ No newline at end of file diff --git a/resources/views/budgets/edit.blade.php b/resources/twig/budgets/edit.twig similarity index 63% rename from resources/views/budgets/edit.blade.php rename to resources/twig/budgets/edit.twig index 51883f5319..edb967500f 100644 --- a/resources/views/budgets/edit.blade.php +++ b/resources/twig/budgets/edit.twig @@ -1,14 +1,14 @@ -@extends('layouts.default') -@section('content') - {!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget) !!} -
+{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, budget) }} +

Use budgets to organize and limit your expenses.

- {!! Form::model($budget, ['class' => 'form-horizontal','id' => 'update','url' => route('budgets.update',$budget->id)]) !!} - + {{ Form.model(budget, {'class' : 'form-horizontal','id' : 'update','url' : route('budgets.update',budget.id) } ) }} +
@@ -16,15 +16,11 @@ Mandatory fields
- {!! ExpandedForm::checkbox('active') !!} - {!! ExpandedForm::text('name') !!} + {{ ExpandedForm.checkbox('active') }} + {{ ExpandedForm.text('name') }}
-

- -

+
@@ -33,12 +29,21 @@ Options
- {!! ExpandedForm::optionsList('update','budget') !!} + {{ ExpandedForm.optionsList('update','budget') }}
- {!! Form::close() !!} +
+
+

+ +

+
+
+ -@stop +{% endblock %} diff --git a/resources/views/budgets/income.blade.php b/resources/twig/budgets/income.twig similarity index 75% rename from resources/views/budgets/income.blade.php rename to resources/twig/budgets/income.twig index f4573bda88..de8420042b 100644 --- a/resources/views/budgets/income.blade.php +++ b/resources/twig/budgets/income.twig @@ -1,16 +1,16 @@
+ +
+
+

+ +

+
+
-{!! Form::close() !!} +
+{% endblock %} -@stop diff --git a/resources/views/categories/delete.blade.php b/resources/twig/categories/delete.twig similarity index 51% rename from resources/views/categories/delete.blade.php rename to resources/twig/categories/delete.twig index 04bd21f0fd..bab3e41d0e 100644 --- a/resources/views/categories/delete.blade.php +++ b/resources/twig/categories/delete.twig @@ -1,34 +1,33 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('categories.destroy',$category->id)]) !!} +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category) }} +{{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('categories.destroy',category.id)}) }}
- Delete category "{{{$category->name}}}" + Delete category "{{ category.name }}"

- Are you sure that you want to delete category "{{$category->name}}"? + Are you sure that you want to delete category "{{ category.name }}"?

- @if($category->transactionjournals()->count() > 0) + {% if category.transactionjournals|length > 0 %}

- Category "{{{$category->name}}}" still has {{$category->transactionjournals()->count()}} transactions connected + Category "{{ category.name }}" still has {{ category.transactionjournals|length }} transactions connected to it. These will not be removed but will lose their connection to this category.

- @endif + {% endif %}

- Cancel + Cancel

- -{!! Form::close()!!} -@stop + +{% endblock %} diff --git a/resources/views/categories/edit.blade.php b/resources/twig/categories/edit.twig similarity index 58% rename from resources/views/categories/edit.blade.php rename to resources/twig/categories/edit.twig index 53d53d9c9e..b35cfbe9ff 100644 --- a/resources/views/categories/edit.blade.php +++ b/resources/twig/categories/edit.twig @@ -1,8 +1,8 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) !!} -{!! Form::model($category, ['class' => 'form-horizontal','id' => 'update','url' => route('categories.update',$category->id)]) !!} - +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category) }} +{{ Form.model(category, {'class' : 'form-horizontal','id' : 'update','url' : route('categories.update',category.id)}) }} +
@@ -10,14 +10,10 @@ Mandatory fields
- {!! ExpandedForm::text('name') !!} + {{ ExpandedForm.text('name') }}
-

- -

+
@@ -28,12 +24,21 @@ Options
- {!! ExpandedForm::optionsList('update','category') !!} + {{ ExpandedForm.optionsList('update','category') }}
+
+
+

+ +

+
+
-{!! Form::close() !!} -@stop + +{% endblock %} diff --git a/resources/views/categories/index.blade.php b/resources/twig/categories/index.twig similarity index 66% rename from resources/views/categories/index.blade.php rename to resources/twig/categories/index.twig index ca6dfff078..82e98ac0e1 100644 --- a/resources/views/categories/index.blade.php +++ b/resources/twig/categories/index.twig @@ -1,11 +1,11 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
- Categories + Categories
@@ -15,30 +15,26 @@
- @include('list.categories') + {% include 'list/categories.twig' %}
-@stop -@section('styles') +{% endblock %} +{% block styles %} -@stop +{% endblock %} -@section('scripts') - - +{% block scripts %} -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/budgets/noBudget.blade.php b/resources/twig/categories/noCategory.twig similarity index 50% rename from resources/views/budgets/noBudget.blade.php rename to resources/twig/categories/noCategory.twig index 0a4b964543..e85d86c942 100644 --- a/resources/views/budgets/noBudget.blade.php +++ b/resources/twig/categories/noCategory.twig @@ -1,18 +1,18 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, subTitle) }}
- {{{$subTitle}}} + {{ subTitle }}
- @include('list.journals-full',['journals' => $list,'sorting' => false]) + {% include 'list/journals.twig' with {'journals': list} %}
-@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/categories/show.blade.php b/resources/twig/categories/show.twig similarity index 81% rename from resources/views/categories/show.blade.php rename to resources/twig/categories/show.twig index fda326fa4a..b830ccacf0 100644 --- a/resources/views/categories/show.blade.php +++ b/resources/twig/categories/show.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $category) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category) }}
@@ -34,17 +34,16 @@ Transactions
- @include('list.journals-full',['sorting' => false]) + {% include 'list/journals' %}
-@stop -@section('scripts') +{% endblock %} +{% block scripts %} @@ -52,4 +51,4 @@ -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/currency/create.blade.php b/resources/twig/currency/create.twig similarity index 52% rename from resources/views/currency/create.blade.php rename to resources/twig/currency/create.twig index bd5249f03e..810826f79a 100644 --- a/resources/views/currency/create.blade.php +++ b/resources/twig/currency/create.twig @@ -1,24 +1,20 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'currency.store']) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'store','route' : 'currency.store'}) }}
- Mandatory fields + Mandatory fields
- {!! ExpandedForm::text('name',null,['maxlength' => 48]) !!} - {!! ExpandedForm::text('symbol',null,['maxlength' => 8]) !!} - {!! ExpandedForm::text('code',null,['maxlength' => 3]) !!} + {{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} + {{ ExpandedForm.text('symbol',null,{'maxlength': 8}) }} + {{ ExpandedForm.text('code',null,{'maxlength' : 3}) }}
-

- -

+
@@ -29,12 +25,20 @@ Options
- {!! ExpandedForm::optionsList('create','currency') !!} + {{ ExpandedForm.optionsList('create','currency') }}
- -{!! Form::close() !!} -@stop +
+
+

+ +

+
+
+ +{% endblock %} diff --git a/resources/views/currency/delete.blade.php b/resources/twig/currency/delete.twig similarity index 53% rename from resources/views/currency/delete.blade.php rename to resources/twig/currency/delete.twig index 3245be5894..b90be97c5c 100644 --- a/resources/views/currency/delete.blade.php +++ b/resources/twig/currency/delete.twig @@ -1,25 +1,26 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $currency) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('currency.destroy',$currency->id)]) !!} +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, currency) }} +{{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('currency.destroy',currency.id)}) }}
- Delete currency "{{{$currency->name}}}" + Delete currency "{{ currency.name }}"

- Are you sure that you want to delete currency "{{{$currency->name}}}"? + Are you sure that you want to delete currency "{{ currency.name }}"?

- Cancel + Cancel

-{!! Form::close() !!} -@stop + + +{% endblock %} \ No newline at end of file diff --git a/resources/twig/currency/edit.twig b/resources/twig/currency/edit.twig new file mode 100644 index 0000000000..8d356fcf4f --- /dev/null +++ b/resources/twig/currency/edit.twig @@ -0,0 +1,45 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, currency) }} + {{ Form.model(currency, {'class' : 'form-horizontal','id' : 'update','url' : route('currency.update',currency.id)}) }} + + +
+
+
+
+ Mandatory fields +
+
+ {{ ExpandedForm.text('name',null,{'maxlength' : 48}) }} + {{ ExpandedForm.text('symbol',null,{'maxlength' : 8}) }} + {{ ExpandedForm.text('code',null,{'maxlength' : 3}) }} +
+
+
+ +
+ + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('update','currency') }} +
+
+ +
+
+
+
+

+ +

+
+
+ +{% endblock %} \ No newline at end of file diff --git a/resources/views/currency/index.blade.php b/resources/twig/currency/index.twig similarity index 64% rename from resources/views/currency/index.blade.php rename to resources/twig/currency/index.twig index 0bb9a47136..77e928bee6 100644 --- a/resources/views/currency/index.blade.php +++ b/resources/twig/currency/index.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') - {!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
@@ -13,37 +13,37 @@ Firefly III supports various currencies which you can set and enable here.

-@stop +{% endblock %} \ No newline at end of file diff --git a/resources/twig/emails/password.twig b/resources/twig/emails/password.twig new file mode 100644 index 0000000000..2aba25c1fc --- /dev/null +++ b/resources/twig/emails/password.twig @@ -0,0 +1 @@ +Click here to reset your password: {{ url('password/reset/' . token) }} diff --git a/resources/views/emails/registered.blade.php b/resources/twig/emails/registered.twig similarity index 100% rename from resources/views/emails/registered.blade.php rename to resources/twig/emails/registered.twig diff --git a/resources/views/error.blade.php b/resources/twig/error.twig similarity index 66% rename from resources/views/error.blade.php rename to resources/twig/error.twig index 4140018572..edbee43c63 100644 --- a/resources/views/error.blade.php +++ b/resources/twig/error.twig @@ -1,5 +1,7 @@ -@extends('layouts.guest') -@section('content') +{% extends "./layout/guest.twig" %} + +{% block content %} +

Firefly
@@ -10,7 +12,7 @@
- {{$message or 'General unknown errror'}} + {{ message |default('General unknown errror') }}
-@stop +{% endblock %} diff --git a/resources/views/errors/503.blade.php b/resources/twig/errors/503.twig similarity index 100% rename from resources/views/errors/503.blade.php rename to resources/twig/errors/503.twig diff --git a/resources/twig/form/amount.twig b/resources/twig/form/amount.twig new file mode 100644 index 0000000000..cc0ff82ae1 --- /dev/null +++ b/resources/twig/form/amount.twig @@ -0,0 +1,23 @@ +
+ +
+
+
+ + +
+ {{ Form.input('number', name, value, options) }} + + +
+ + {% include 'form/feedback.twig' %} +
+ +
diff --git a/resources/twig/form/balance.twig b/resources/twig/form/balance.twig new file mode 100644 index 0000000000..882db8e808 --- /dev/null +++ b/resources/twig/form/balance.twig @@ -0,0 +1,22 @@ +
+ +
+
+
+ + +
+ {{ Form.input('number', name, value, options) }} + +
+ {% include 'form/feedback.twig' %} +
+ + +
diff --git a/resources/twig/form/checkbox.twig b/resources/twig/form/checkbox.twig new file mode 100644 index 0000000000..21d8e59177 --- /dev/null +++ b/resources/twig/form/checkbox.twig @@ -0,0 +1,11 @@ +
+ +
+
+ +
+ {% include 'form/feedback.twig' %} +
+
diff --git a/resources/twig/form/date.twig b/resources/twig/form/date.twig new file mode 100644 index 0000000000..33a300d057 --- /dev/null +++ b/resources/twig/form/date.twig @@ -0,0 +1,8 @@ +
+ +
+ {{ Form.input('date', name, value, options) }} + {% include 'form/help.twig' %} + {% include 'form/feedback.twig' %} +
+
diff --git a/resources/twig/form/feedback.twig b/resources/twig/form/feedback.twig new file mode 100644 index 0000000000..8cebea7222 --- /dev/null +++ b/resources/twig/form/feedback.twig @@ -0,0 +1,4 @@ +{% if errors.has(name) %} + +

{{ errors.first(name) }}

+{% endif %} diff --git a/resources/twig/form/help.twig b/resources/twig/form/help.twig new file mode 100644 index 0000000000..e1e2d011ea --- /dev/null +++ b/resources/twig/form/help.twig @@ -0,0 +1,3 @@ +{% if options.helpText %} +

{{ options.helpText }}

+{% endif %} diff --git a/resources/twig/form/integer.twig b/resources/twig/form/integer.twig new file mode 100644 index 0000000000..527a5b2fea --- /dev/null +++ b/resources/twig/form/integer.twig @@ -0,0 +1,9 @@ +
+ +
+
+ {{ Form.input('number', name, value, options) }} + {% include 'form/feedback.twig' %} +
+
+
diff --git a/resources/twig/form/location.twig b/resources/twig/form/location.twig new file mode 100644 index 0000000000..efb95bb6c3 --- /dev/null +++ b/resources/twig/form/location.twig @@ -0,0 +1,14 @@ +
+ +
+
+

Right-click to set the tag's location. + Clear location +

+ + + + + {% include 'form/feedback.twig' %} +
+
diff --git a/resources/twig/form/multiRadio.twig b/resources/twig/form/multiRadio.twig new file mode 100644 index 0000000000..b79ff1559c --- /dev/null +++ b/resources/twig/form/multiRadio.twig @@ -0,0 +1,16 @@ +
+ +
+ {% for value,description in list %} +
+ +
+ {% endfor %} + {% include 'form/help.twig' %} + {% include 'form/feedback.twig' %} + +
+
diff --git a/resources/twig/form/options.twig b/resources/twig/form/options.twig new file mode 100644 index 0000000000..9af8428ba2 --- /dev/null +++ b/resources/twig/form/options.twig @@ -0,0 +1,30 @@ +{% if type == 'create' %} +
+ +
+
+ +
+
+
+{% endif %} + +{% if type == 'update' %} +
+ +
+
+
+
+
+{% endif %} \ No newline at end of file diff --git a/resources/twig/form/select.twig b/resources/twig/form/select.twig new file mode 100644 index 0000000000..6956207700 --- /dev/null +++ b/resources/twig/form/select.twig @@ -0,0 +1,9 @@ +
+ +
+ {{ Form.select(name, list, selected , options ) }} + {% include 'form/help.twig' %} + {% include 'form/feedback.twig' %} + +
+
diff --git a/resources/twig/form/tags.twig b/resources/twig/form/tags.twig new file mode 100644 index 0000000000..9160512040 --- /dev/null +++ b/resources/twig/form/tags.twig @@ -0,0 +1,7 @@ +
+ +
+ {{ Form.input('text', name, value, options) }} + {% include 'form/feedback.twig' %} +
+
diff --git a/resources/twig/form/text.twig b/resources/twig/form/text.twig new file mode 100644 index 0000000000..428b238b70 --- /dev/null +++ b/resources/twig/form/text.twig @@ -0,0 +1,7 @@ +
+ +
+ {{ Form.input('text', name, value, options) }} + {% include 'form/feedback.twig' %} +
+
diff --git a/resources/twig/form/textarea.twig b/resources/twig/form/textarea.twig new file mode 100644 index 0000000000..6d1d950a04 --- /dev/null +++ b/resources/twig/form/textarea.twig @@ -0,0 +1,7 @@ +
+ +
+ {{ Form.textarea(name, value, options) }} + {% include 'form/feedback.twig' %} +
+
diff --git a/resources/views/index.blade.php b/resources/twig/index.twig similarity index 58% rename from resources/views/index.blade.php rename to resources/twig/index.twig index 013e4a4a15..31f6115a95 100644 --- a/resources/views/index.blade.php +++ b/resources/twig/index.twig @@ -1,7 +1,8 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists() !!} -@if($count == 0) +{% extends "./layout/default.twig" %} +{% block content %} +{{ Breadcrumbs.renderIfExists }} + +{% if count == 0 %}

Welcome to Firefly III.

@@ -15,13 +16,10 @@ - @else - - - @include('partials.boxes') - - +{% else %} + + {% include 'partials/boxes.twig' %}
@@ -57,57 +55,58 @@
Savings - {!! Amount::format($savingsTotal) !!} + {{ savingsTotal|formatAmount }}
- @if(count($savings) == 0) + {% if savings|length == 0 %}

Mark your asset accounts as "Savings account" to fill this panel.

- @else - @foreach($savings as $account) + {% else %} + {% for account in savings %}
-
{!! Amount::format($account->startBalance) !!}
+
{{ account.startBalance|formatAmount }}
- @if($account->difference < 0) + {% if account.difference < 0 %}
-
- @if($account->percentage <= 50) - {{Amount::format($account->difference,false)}} - @endif +
+ {% if account.percentage <= 50 %} + {{account.difference|formatAmount}} + {% endif %}
-
- @if($account->percentage > 50) - {{Amount::format($account->difference,false)}} - @endif +
+ {% if account.percentage > 50 %} + {{account.difference|formatAmount}} + {% endif %}
- @else + {% else %}
-
- @if($account->percentage > 50) - {{Amount::format($account->difference,false)}} - @endif +
+ {% if account.percentage <= 50 %} + {{account.difference|formatAmount}} + {{account.difference|formatAmount}} + {% endif %}
-
- @if($account->percentage <= 50) - {{Amount::format($account->difference,false)}} - @endif +
+ {% if account.percentage > 50 %} + {{account.difference|formatAmount}} + {% endif %}
- @endif + {% endif %}
-
{!! Amount::format($account->endBalance) !!}
+
{{ account.endBalance|formatAmount }}
- @endforeach - @endif + {% endfor %} + {% endif %}
@@ -117,37 +116,37 @@ Piggy banks
- @if($piggyBankAccounts->count() == 0) + {% if piggyBankAccounts|length == 0%}

Create piggy banks to fill this panel.

- @else - @foreach($piggyBankAccounts as $account) + {% else %} + {% for account in piggyBankAccounts %}
-
{!! Amount::format($account->startBalance) !!}
+
{{ account.startBalance|formatAmount }}
-
- @if($account->percentage <= 50) - {{Amount::format($account->piggyBalance,false)}} divided - @endif +
+ {% if account.percentage <= 50 %} + {{account.piggyBalance|formatAmount}} divided + {% endif %}
-
- @if($account->percentage > 50) - {{Amount::format($account->difference,false)}} left to divide - @endif +
+ {% if account.percentage > 50 %} + {{account.difference|formatAmount}} left to divide + {% endif %}
-
{!! Amount::format($account->piggyBalance) !!}
+
{{ account.piggyBalance|formatAmount }}
- @endforeach - @endif + {% endfor %} + {% endif %}
@@ -166,11 +165,11 @@
- @foreach($transactions as $data) + {% for data in transactions %}
- {{{$data[1]->name}}} ({!! Amount::format(Steam::balance($data[1])) !!}) + {{data[1].name}} ({{ (data[1]|balance)|formatAmount }}) @@ -181,9 +180,9 @@
@@ -192,29 +191,22 @@
- @include('list.journals-tiny',['transactions' => $data[0],'account' => $data[1]]) + + {% include 'list/journals-tiny.twig' with {'transactions': data[0],'account': data[1]} %}
- @endforeach + {% endfor %}
-@endif +{% endif %} -@stop -@section('scripts') - - - - - - - - - -@stop -@section('styles') -@stop +{% endblock %} +{% block scripts %} + + + + + +{% endblock %} \ No newline at end of file diff --git a/resources/views/layouts/default.blade.php b/resources/twig/layout/default.twig similarity index 62% rename from resources/views/layouts/default.blade.php rename to resources/twig/layout/default.twig index 6eafcace52..cfe1190903 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/twig/layout/default.twig @@ -4,28 +4,29 @@ - + Firefly - @if(isset($title) && $title != 'Firefly') - // {{{$title}}} - @endif - @if(isset($subTitle)) - // {{{$subTitle}}} - @endif + {% if title != "Firefly" %} + // {{ title }} + {% endif %} + + {% if subTitle %} + // {{ subTitle }} + {% endif %} - - - - - - + + + + + + - + - + - @yield('styles') + {% block styles %}{% endblock %} @@ -47,57 +48,61 @@ -
- @include('partials.menu') + {% include 'partials/menu.twig' %}

- @if(isset($mainTitleIcon)) - - @endif - {{$title or '(no title)'}} - @if(isset($subTitle)) + {% if mainTitleIcon %} + + {% endif %} + + {{ title }} + + {% if subTitle %} - @if(isset($subTitleIcon)) - - @endif - {{$subTitle}} + {% if subTitleIcon %} + + {% endif %} + {{ subTitle }} - @endif - + {% endif %} +

- @include('partials.flashes') - @yield('content') + {% include('partials/flashes.twig') %} + {% block content %}{% endblock %} +
+
@@ -121,35 +126,42 @@ -@yield('scripts') - +{% block scripts %}{% endblock %} diff --git a/resources/views/layouts/guest.blade.php b/resources/twig/layout/guest.twig similarity index 95% rename from resources/views/layouts/guest.blade.php rename to resources/twig/layout/guest.twig index 0f47c9dbf4..1d81e22141 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/twig/layout/guest.twig @@ -4,7 +4,7 @@ - + Firefly III @@ -42,12 +42,15 @@ -
- @include('partials.flashes') - @yield('content') + + + + + + {% block content %}{% endblock %}
diff --git a/resources/twig/list/accounts.twig b/resources/twig/list/accounts.twig new file mode 100644 index 0000000000..200f09eb04 --- /dev/null +++ b/resources/twig/list/accounts.twig @@ -0,0 +1,59 @@ + + + + + + {% if what == 'asset' %} + + {% endif %} + + + + + + + + {% for account in accounts %} + + + + {% if what == "asset" %} + + {% endif %} + + + {% if account.lastActivityDate %} + + {% else %} + + {% endif %} + + + + + {% endfor %} + +
 NameRoleCurrent balanceActiveLast activityBalance difference between {{ Session.get('start').format('jS F Y') }} and {{ Session.get('end').format('jS F Y') }}
+
+ + +
+
{{ account.name }} + {% for entry in account.accountmeta %} + {% if entry.name == 'accountRole' %} + {{ entry.data|getAccountRole }} + {% endif %} + {% endfor %} + {{ account|balance|formatAmount }} + {% if account.active %} + + {% else %} + + {% endif %} + + {{ account.lastActivityDate.format('j F Y') }} + + Never + + {{ (account.endBalance - account.startBalance)|formatAmount }} +
\ No newline at end of file diff --git a/resources/twig/list/bills.twig b/resources/twig/list/bills.twig new file mode 100644 index 0000000000..2432efaf88 --- /dev/null +++ b/resources/twig/list/bills.twig @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + {% for entry in bills %} + + + + + + + + + + + + + + + {% endfor %} +
 NameMatches onMatching amountLast seen matchNext expected matchIs activeWill be automatchedRepeats every 
+
+ + +
+
+ {{ entry.name }} + + {% for match in entry.match|split(',') %} + {{ match }} + {% endfor %} + + {{ entry.amount_min|formatAmount }} + + {{ entry.amount_max|formatAmount }} + + {% if entry.lastFoundMatch %} + {{entry.lastFoundMatch.format('j F Y')}} + {% else %} + Unknown + {% endif %} + + {% if entry.nextExpectedMatch%} + {{entry.nextExpectedMatch.format('j F Y')}} + {% else %} + Unknown + {% endif %} + + {% if entry.active %} + + {% else %} + + {% endif %} + + {% if entry.automatch %} + + {% else %} + + {% endif %} + + {{ entry.repeat_freq }} + {% if entry.skip > 0 %} + skips over {{entry.skip}} + {% endif %} + + {% if entry.active %} + + {% endif %} +
diff --git a/resources/twig/list/categories.twig b/resources/twig/list/categories.twig new file mode 100644 index 0000000000..605167cd17 --- /dev/null +++ b/resources/twig/list/categories.twig @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + {% for category in categories %} + + + + {% if category.lastActivity %} + + {% else %} + + {% endif %} + + {% endfor %} + +
 NameLast activity
 Without a category 
+
+ + +
+
+ {{ category.name }} + + {{category.lastActivity.format('jS F Y') }} + + Never +
diff --git a/resources/twig/list/journals-tiny.twig b/resources/twig/list/journals-tiny.twig new file mode 100644 index 0000000000..e4ca10fb72 --- /dev/null +++ b/resources/twig/list/journals-tiny.twig @@ -0,0 +1,37 @@ + diff --git a/resources/twig/list/journals.twig b/resources/twig/list/journals.twig new file mode 100644 index 0000000000..860917c836 --- /dev/null +++ b/resources/twig/list/journals.twig @@ -0,0 +1,113 @@ +{{ journals.render|raw }} + + + + + + + + + + + {% if not hideBudgets %} + + {% endif %} + + + {% if not hideCategories %} + + {% endif %} + + + {% if not hideBills %} + + {% endif %} + + {% for journal in journals %} + {% if invalidJournal(journal) %} + + + + + + + {% else %} + + + + + + + + + + + + {% if not hideBudgets %} + + {% endif %} + + + {% if not hideCategories %} + + {% endif %} + + + {% if not hideBills %} + + {% endif %} + + {% endif %} + + {% endfor %} +
 DescriptionAmountDateFromTo
+
+ +
+
 {{ journal.description }}Invalid journal: Found {{journal.transactions|length }} transaction(s)
+
+ {% if sorting %} + + {% endif %} + + +
+
+ {{ journal|typeIcon }} + + {{journal.description}} + + {% if not hideTags %} + {{ relevantTags(journal)|raw }} + {% else %} + {{ journal|formatJournal }} + {% endif %} + + {{journal.date.format('j F Y')}} + + {% if journal.transactions[0].account.accountType.type == 'Cash account' %} + (cash) + {% else %} + {{journal.transactions[0].account.name}} + {% endif %} + + {% if journal.transactions[1].account.accountType.type == 'Cash account' %} + (cash) + {% else %} + {{journal.transactions[1].account.name}} + {% endif %} + + {% if journal.budgets[0] %} + {{journal.budgets[0].name}} + {% endif %} + + {% if journal.categories[0] %} + {{journal.categories[0].name}} + {% endif %} + + {% if journal.bill %} + {{journal.bill.name}} + {% endif %} +
+ +{{ journals.render|raw }} \ No newline at end of file diff --git a/resources/twig/list/piggy-bank-events.twig b/resources/twig/list/piggy-bank-events.twig new file mode 100644 index 0000000000..d685e73612 --- /dev/null +++ b/resources/twig/list/piggy-bank-events.twig @@ -0,0 +1,33 @@ + + + {% if showPiggyBank %} + + {% endif %} + + + + {% for event in events %} + + {% if showPiggyBank %} + + {% endif %} + + + + + {% endfor %} +
Piggy bankDateAmount
+ {{ event.piggyBank.name }} + + {% if event.transaction_journal_id %} + {{ event.date.format('j F Y') }} + {% else %} + {{ event.date.format('j F Y') }} + {% endif %} + + {% if event.amount < 0 %} + Removed {{ event.amount*-1|formatAmountPlain }} + {% else %} + Added {{ event.amount|formatAmountPlain }} + {% endif %} +
diff --git a/resources/twig/list/piggy-banks.twig b/resources/twig/list/piggy-banks.twig new file mode 100644 index 0000000000..ef6cf6be63 --- /dev/null +++ b/resources/twig/list/piggy-banks.twig @@ -0,0 +1,56 @@ + + + {% for piggyBank in piggyBanks %} + + + + + + + + + + + + + +{% endfor %} + +
+ + + +
+ + +
+
+ {{ piggyBank.name }} + + {{piggyBank.savedSoFar|formatAmountPlain }} + + {% if piggyBank.savedSoFar > 0 %} + + {% endif %} + +
+
+ {{ piggyBank.percentage }}% +
+
+
+ {% if piggyBank.leftToSave > 0 %} + + {% endif %} + + {{ piggyBank.targetamount|formatAmount }} + {% if piggyBank.leftToSave > 0 %} + ({{ piggyBank.leftToSave|formatAmount }}) + {% endif %} +
\ No newline at end of file diff --git a/resources/twig/list/reminders.twig b/resources/twig/list/reminders.twig new file mode 100644 index 0000000000..991b8b37ee --- /dev/null +++ b/resources/twig/list/reminders.twig @@ -0,0 +1,45 @@ +
+ {% if reminders|length > 0 %} + {% for reminder in reminders %} +
+
+ +
+

+ This reminder is active between {{reminder.startdate.format('jS F Y')}} + and {{reminder.enddate.format('jS F Y')}}. +

+ {% if reminder.description %} +

{{ reminder.description|raw }}

+ {% endif %} +
+ +
+
+ {% endfor %} + {% else %} +
+

+ (No reminders) +

+
+ {% endif %} +
diff --git a/resources/views/partials/boxes.blade.php b/resources/twig/partials/boxes.twig similarity index 91% rename from resources/views/partials/boxes.blade.php rename to resources/twig/partials/boxes.twig index ab01a9b357..748e3cb960 100644 --- a/resources/views/partials/boxes.blade.php +++ b/resources/twig/partials/boxes.twig @@ -8,7 +8,7 @@
-
{{Amount::format(0,false)}}
+
Money out
@@ -30,7 +30,7 @@

-
{{Amount::format(0,false)}}
+
Money in
@@ -52,7 +52,7 @@
-
{{Amount::format(0,false)}}
+
Bills to pay
@@ -74,7 +74,7 @@
-
{{Amount::format(0,false)}}
+
Bills paid
diff --git a/resources/views/partials/flashes.blade.php b/resources/twig/partials/flashes.twig similarity index 68% rename from resources/views/partials/flashes.blade.php rename to resources/twig/partials/flashes.twig index e97d346de0..de601e38c7 100644 --- a/resources/views/partials/flashes.blade.php +++ b/resources/twig/partials/flashes.twig @@ -1,27 +1,27 @@ -@if(Session::has('success')) +{% if Session.has('success') %} -@endif +{% endif %} -@if(Session::has('info')) +{% if Session.has('info') %} -@endif +{% endif %} -@if(Session::has('warning')) +{% if Session.has('warning') %} -@endif +{% endif %} -@if(Session::has('error')) +{% if Session.has('error') %} -@endif +{% endif %} diff --git a/resources/twig/partials/menu.twig b/resources/twig/partials/menu.twig new file mode 100644 index 0000000000..03729c8a04 --- /dev/null +++ b/resources/twig/partials/menu.twig @@ -0,0 +1,182 @@ + + + diff --git a/resources/views/piggy-banks/add.blade.php b/resources/twig/piggy-banks/add.twig similarity index 63% rename from resources/views/piggy-banks/add.blade.php rename to resources/twig/piggy-banks/add.twig index 37ae0ff02e..85535a4297 100644 --- a/resources/views/piggy-banks/add.blade.php +++ b/resources/twig/piggy-banks/add.twig @@ -3,18 +3,18 @@ @@ -44,12 +38,20 @@ Options
- {!! ExpandedForm::optionsList('create','piggy bank') !!} + {{ ExpandedForm.optionsList('create','piggy bank') }}
- -{!! Form::close() !!} -@stop +
+
+

+ +

+
+
+ +{% endblock %} diff --git a/resources/twig/piggy-banks/delete.twig b/resources/twig/piggy-banks/delete.twig new file mode 100644 index 0000000000..bc369b1b38 --- /dev/null +++ b/resources/twig/piggy-banks/delete.twig @@ -0,0 +1,26 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('piggy-banks.destroy',piggyBank.id)}) }} +
+
+
+
+ Delete piggy bank "{{ piggyBank.name }}" +
+
+

+ Are you sure? +

+ +

+ + Cancel +

+
+
+
+
+ + +{% endblock %} diff --git a/resources/views/piggy-banks/edit.blade.php b/resources/twig/piggy-banks/edit.twig similarity index 50% rename from resources/views/piggy-banks/edit.blade.php rename to resources/twig/piggy-banks/edit.twig index 351679bb49..a14bd2112a 100644 --- a/resources/views/piggy-banks/edit.blade.php +++ b/resources/twig/piggy-banks/edit.twig @@ -1,10 +1,10 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) !!} -{!! Form::model($piggyBank, ['class' => 'form-horizontal','id' => 'update','url' => route('piggy-banks.update',$piggyBank->id)]) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }} + {{ Form.model(piggyBank, {'class' : 'form-horizontal','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }} - - + +
@@ -13,21 +13,14 @@ Mandatory fields
- @foreach($errors->all() as $err) - {{$err}} - @endforeach - {!! ExpandedForm::text('name') !!} - {!! ExpandedForm::select('account_id',$accounts,null,['label' => 'Save on account']) !!} - {!! ExpandedForm::amount('targetamount') !!} + {{ ExpandedForm.text('name') }} + {{ ExpandedForm.select('account_id',accounts,null,{'label' : 'Save on account'}) }} + {{ ExpandedForm.amount('targetamount') }}
-

- -

+
@@ -36,9 +29,9 @@ Optional fields
- {!! ExpandedForm::date('targetdate') !!} - {!! ExpandedForm::checkbox('remind_me','1',$preFilled['remind_me'],['label' => 'Remind me']) !!} - {!! ExpandedForm::select('reminder',$periods,$preFilled['reminder'],['label' => 'Remind every']) !!} + {{ ExpandedForm.date('targetdate') }} + {{ ExpandedForm.checkbox('remind_me','1',preFilled.remind_me,{'label' : 'Remind me'}) }} + {{ ExpandedForm.select('reminder',periods,preFilled.reminder,{'label' : 'Remind every'}) }}
@@ -48,12 +41,21 @@ Options
- {!! ExpandedForm::optionsList('update','piggy bank') !!} + {{ ExpandedForm.optionsList('update','piggy bank') }}
+
+
+

+ +

+
+
-{!! Form::close() !!} -@stop + +{% endblock %} diff --git a/resources/twig/piggy-banks/index.twig b/resources/twig/piggy-banks/index.twig new file mode 100644 index 0000000000..d0d2563fb6 --- /dev/null +++ b/resources/twig/piggy-banks/index.twig @@ -0,0 +1,62 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} +
+
+

+ Create new piggy bank +

+
+
+ +
+
+
+
Piggy banks
+ {% include 'list/piggy-banks.twig' %} +
+
+
+ +
+
+
+
+ Account status +
+ + + + + + + + + + {% for id,info in accounts %} + + + + + + + + + {% endfor %} +
AccountBalanceLeft for piggy banksSum of piggy banksSaved so farLeft to save
{{ info.name }}{{ info.balance|formatAmount }}{{ info.leftForPiggyBanks|formatAmount }}{{ info.sumOfTargets|formatAmount }}{{ info.sumOfSaved|formatAmount }}{{ info.leftToSave|formatAmount }}
+
+
+
+ + + + +{% endblock %} +{% block scripts %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/views/piggy-banks/remove.blade.php b/resources/twig/piggy-banks/remove.twig similarity index 59% rename from resources/views/piggy-banks/remove.blade.php rename to resources/twig/piggy-banks/remove.twig index 7de6bc0871..657ce02431 100644 --- a/resources/views/piggy-banks/remove.blade.php +++ b/resources/twig/piggy-banks/remove.twig @@ -1,26 +1,26 @@ - + + \ No newline at end of file diff --git a/resources/views/piggy-banks/show.blade.php b/resources/twig/piggy-banks/show.twig similarity index 60% rename from resources/views/piggy-banks/show.blade.php rename to resources/twig/piggy-banks/show.twig index c3c7c511cf..9c27bdc27c 100644 --- a/resources/views/piggy-banks/show.blade.php +++ b/resources/twig/piggy-banks/show.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }}
@@ -25,8 +25,8 @@
@@ -35,58 +35,57 @@ - + - + - + - + - @if(!is_null($piggyBank->reminder)) + {% if piggyBank.reminder %} - @endif + {% endif %} @@ -101,17 +100,16 @@
Table
- @include('list.piggy-bank-events') + {% include 'list/piggy-bank-events' %} -@stop +{% endblock %} -@section('scripts') +{% block scripts %} @@ -119,4 +117,4 @@ -@stop +{% endblock %} diff --git a/resources/views/preferences/index.blade.php b/resources/twig/preferences/index.twig similarity index 74% rename from resources/views/preferences/index.blade.php rename to resources/twig/preferences/index.twig index 828eb69402..c3fb13f655 100644 --- a/resources/views/preferences/index.blade.php +++ b/resources/twig/preferences/index.twig @@ -1,8 +1,8 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, piggyBank) }} -{!! Form::open(['class' => 'form-horizontal','id' => 'preferences']) !!} + {{ Form.open({'class' : 'form-horizontal','id' : 'preferences'}) }}
@@ -12,21 +12,21 @@

Which accounts should be displayed on the home page?

- @foreach($accounts as $account) + {% for account in accounts %}
- @endforeach + {% endfor %}
@@ -37,7 +37,7 @@

What's the maximum amount of money a budget envelope may contain?

- {!! ExpandedForm::amount('budgetMaximum',$budgetMaximum,['label' => 'Budget maximum']) !!} + {{ ExpandedForm.amount('budgetMaximum',budgetMaximum,{'label' : 'Budget maximum'}) }}
@@ -51,35 +51,35 @@

Some charts are automatically grouped in periods. What period would you prefer?

@@ -98,6 +98,5 @@ -{!! Form::close() !!} - -@stop + +{% endblock %} diff --git a/resources/views/profile/change-password.blade.php b/resources/twig/profile/change-password.twig similarity index 76% rename from resources/views/profile/change-password.blade.php rename to resources/twig/profile/change-password.twig index e78a9dce3c..16900564f3 100644 --- a/resources/views/profile/change-password.blade.php +++ b/resources/twig/profile/change-password.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
@@ -9,16 +9,19 @@
- @if($errors->count() > 0) + {% if errors|length > 0 %}
    - @foreach($errors->all() as $err) -
  • {{$err}}
  • - @endforeach +
      + {% for error in errors.all %} +
    • {{ error }}
    • + {% endfor %} +
- @endif + {% endif %} - {!! Form::open(['class' => 'form-horizontal','id' => 'change-password']) !!} + + {{ Form.open({'class' : 'form-horizontal','id' : 'change-password'}) }}
@@ -44,11 +47,9 @@
- {!! Form::close() !!} +
-@stop -@section('scripts') -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/profile/delete-account.blade.php b/resources/twig/profile/delete-account.twig similarity index 71% rename from resources/views/profile/delete-account.blade.php rename to resources/twig/profile/delete-account.twig index a181f16a68..f3e5f94e1c 100644 --- a/resources/views/profile/delete-account.blade.php +++ b/resources/twig/profile/delete-account.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
@@ -17,16 +17,18 @@ Enter your password to continue.

- @if($errors->count() > 0) + {% if errors|length > 0 %}
    - @foreach($errors->all() as $err) -
  • {{$err}}
  • - @endforeach +
      + {% for error in errors.all %} +
    • {{ error }}
    • + {% endfor %} +
- @endif + {% endif %} - {!! Form::open(['class' => 'form-horizontal','id' => 'change-password']) !!} + {{ Form.open({'class' : 'form-horizontal','id' : 'change-password'}) }}
@@ -39,11 +41,9 @@
- {!! Form::close() !!} +
-@stop -@section('scripts') -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/profile/index.blade.php b/resources/twig/profile/index.twig similarity index 74% rename from resources/views/profile/index.blade.php rename to resources/twig/profile/index.twig index 660cd54bcc..244a1a6e35 100644 --- a/resources/views/profile/index.blade.php +++ b/resources/twig/profile/index.twig @@ -1,7 +1,7 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -
+{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} +
@@ -16,6 +16,4 @@
-@stop -@section('scripts') -@stop +{% endblock %} \ No newline at end of file diff --git a/resources/views/reminders/index.blade.php b/resources/twig/reminders/index.twig similarity index 55% rename from resources/views/reminders/index.blade.php rename to resources/twig/reminders/index.twig index 1e36c8f907..d2fbedf270 100644 --- a/resources/views/reminders/index.blade.php +++ b/resources/twig/reminders/index.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
@@ -8,7 +8,7 @@
-@include('list.reminders',['reminders' => $active]) + {% include 'list/reminders.twig' with {'reminders': active} %}
@@ -16,7 +16,7 @@
-@include('list.reminders',['reminders' => $dismissed]) + {% include 'list/reminders.twig' with {'reminders': dismissed} %}
@@ -24,7 +24,7 @@
-@include('list.reminders',['reminders' => $expired]) + {% include 'list/reminders.twig' with {'reminders': expired} %}
@@ -32,9 +32,6 @@
-@include('list.reminders',['reminders' => $inactive]) + {% include 'list/reminders.twig' with {'reminders': inactive} %} - - - -@stop +{% endblock %} diff --git a/resources/twig/reminders/show.twig b/resources/twig/reminders/show.twig new file mode 100644 index 0000000000..b78eb138a0 --- /dev/null +++ b/resources/twig/reminders/show.twig @@ -0,0 +1,40 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, reminder) }} +
+
+
+ +
+

+ Active between {{reminder.startdate.format('jS F Y')}} + and {{reminder.enddate.format('jS F Y')}}. +

+ + {% if reminder.description %} +

{!! reminder.description !!}

+ {% endif %} +
+ +
+
+
+{% endblock %} \ No newline at end of file diff --git a/resources/twig/reports/budget.twig b/resources/twig/reports/budget.twig new file mode 100644 index 0000000000..11af7d0b90 --- /dev/null +++ b/resources/twig/reports/budget.twig @@ -0,0 +1,159 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date) }} + +
+
+
+
+ + Accounts +
+
Account{{{$piggyBank->account->name}}}{{ piggyBank.account.name }}
Target amount{!! Amount::format($piggyBank->targetamount) !!}{{ piggyBank.targetAmount|formatAmount }}
Saved so far{!! Amount::format($piggyBank->currentRelevantRep()->currentamount) !!}{{ currentRelevantRepAmount(piggyBank)|formatAmount }}
Left to save{!! Amount::format($piggyBank->targetamount-$piggyBank->currentRelevantRep()->currentamount) !!}{{ piggyBank.targetamount - currentRelevantRepAmount(piggyBank)|formatAmount }}
Start date - @if(is_null($piggyBank->startdate)) + {% if piggyBank.startdate %} + {{ piggyBank.startdate.format('jS F Y')}} + {% else %} No start date - @endif - @if(is_object($piggyBank->startdate)) - {{$piggyBank->startdate->format('jS F Y')}} - @endif + {% endif %}
Target date - @if(is_null($piggyBank->targetdate)) - No target date - @endif - @if(is_object($piggyBank->targetdate)) - {{$piggyBank->targetdate->format('jS F Y')}} - @endif + {% if piggyBank.targetdate %} + {{ piggyBank.targetdate.format('jS F Y') }} + {% else %} + No start date + {% endif %}
Reminder - @if(intval($piggyBank->remind_me) == 0) + {% if piggyBank.remind_me == 0 %} (no reminder) - @else + {% else %} Every - @if($piggyBank->reminder_skip != 0) - {{$piggyBank->reminder_skip}} - @endif - {{$piggyBank->reminder}}(s) - @endif + {% if piggyBank.reminder_skip != 0 %} + {{ piggyBank.reminder_skip }} + {% else %} + {{ piggyBank.reminder }}(s) + {% endif %} + {% endif %}
Reminders left (in progress...)
+ + + + + + + + + {% for account in accounts %} + + + + + + + + {% endfor %} +
AccountStart of monthCurrent balanceSpentEarned
{{ account.name }}{{ account.startBalance|formatAmount }}{{ account.endBalance|formatAmount }} + {% if account.startBalance - account.endBalance > 0 %} + {{ (account.startBalance - account.endBalance)|formatAmountPlain }} + {% endif %} + + {% if account.startBalance - account.endBalance < 0 %} + {{ ((account.startBalance - account.endBalance)*-1)|formatAmountPlain }} + {% endif %} +
+
+ + +
+
+
+
+ + Budgets +
+ + + + {% for account in accounts %} + {% if not account.hide %} + + {% endif %} + {% endfor %} + + + {% for id,budget in budgets %} + + + + {% set spent = 0 %} + {% for account in accounts %} + {% if not account.hide %} + {% if account.budgetInformation[id] %} + + {% set spent = spent + account.budgetInformation[id].queryAmount %} + {% else %} + + {% endif %} + {% endif %} + {% endfor %} + + + + {% endfor %} + + + {% for account in accounts %} + {% if not account.hide %} + + {% endif %} + {% endfor %} + + + + + {% for account in accounts %} + + {% if not account.hide %} + {% if account.budgetInformation[0] %} + + {% else %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + {% for account in accounts %} + {% if not account.hide %} + + {% endif %} + {% endfor %} + + + + + {% for account in accounts %} + {% if not account.hide %} + + {% endif %} + {% endfor %} + + + +
Budgets{{ account.name }} + Left in budget +
{{ budget.name }}{{ budget.queryAmount|formatAmount }} + {% if id == 0 %} + + {{ account.budgetInformation[id].queryAmount|formatAmount }} + + {% else %} + {{ account.budgetInformation[id].queryAmount|formatAmount }} + {% endif %} + {{ 0|formatAmount }}{{ (budget.queryAmount + budget.spent)|formatAmount }}{{ (budget.queryAmount + spent)|formatAmount }}
Balanced by transfers + {{ account.balancedAmount|formatAmount }} +  
Left unbalanced + {% if account.budgetInformation[0].queryAmount + account.balancedAmount != 0.0 %} + {{ (account.budgetInformation[0].queryAmount + account.balancedAmount)|formatAmount }} + {% else %} + {{ (account.budgetInformation[0].queryAmount + account.balancedAmount)|formatAmount }} + {% endif %} + {{ 0|formatAmount }} 
Sum{{ accountAmounts[account.id]|formatAmount }} 
Expected balance{{ (account.startBalance + accountAmounts[account.id])|formatAmount }} 
+
+
+
+ + + + +{% endblock %} +{% block scripts %} + +{% endblock %} diff --git a/resources/views/reports/index.blade.php b/resources/twig/reports/index.twig similarity index 62% rename from resources/views/reports/index.blade.php rename to resources/twig/reports/index.twig index 4ef2851baa..0768e23c4a 100644 --- a/resources/views/reports/index.blade.php +++ b/resources/twig/reports/index.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}

@@ -19,9 +19,9 @@

@@ -35,14 +35,14 @@
- @foreach($months as $year => $entries) -
{{$year}}
+ {% for year, entries in months %} +
{{ year }}
- @endforeach + {% endfor %}
@@ -55,19 +55,20 @@ Budget reports
- @foreach($months as $year => $entries) -
{{$year}}
- - @endforeach + {% for year, entries in months %} +
{{ year }}
+ + {% endfor %}
-@stop -@section('scripts') +{% endblock %} + +{% block scripts %} -@stop +{% endblock %} diff --git a/resources/twig/reports/month.twig b/resources/twig/reports/month.twig new file mode 100644 index 0000000000..62f1212e44 --- /dev/null +++ b/resources/twig/reports/month.twig @@ -0,0 +1,257 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date) }} +
+
+

+ +

+
+
+
+
+
+
+ + Income +
+ + {% set sum = 0 %} + {% for entry in income %} + {% set sum = sum + entry.queryAmount %} + + + + + + + {% endfor %} + {% if displaySum %} + + + + + {% endif %} +
+ {{ entry.description }} + + {% if entry.type == 'Withdrawal' %} + {{entry.queryAmount|formatAmountPlain}} + {% endif %} + {% if entry.type == 'Deposit' %} + {{entry.queryAmount|formatAmountPlain}} + {% endif %} + {% if entry.type == 'Transfer' %} + {{entry.queryAmount|formatAmountPlain}} + {% endif %} + + {{entry.date.format('j F Y')}} + + {{ entry.name }} +
Sum{{ sum|formatAmount }}
+
+
+
+
+
+ + Expenses (top 10) +
+ + {% set sum = 0 %} + + {% for id,expense in expenses %} + {% set sum = sum + expense.queryAmount %} + + {% if id > 0 %} + + {% else %} + + {% endif %} + + + {% endfor %} + + + + +
{{ expense.name }}{{ expense.name }}{{ expense.queryAmount|formatAmountPlain }}
Sum{{ sum|formatAmountPlain }}
+
+
+
+
+
+ + Sums +
+ {% set totalIn = 0 %} + {% for entry in income %} + {% set totalIn = totalIn + entry.queryAmount %} + {% endfor %} + + + + + + + + + + + + + +
In{{ totalIn|formatAmount }}
Out{{ sum|formatAmountPlain }}
Difference{{ (totalIn - sum)|formatAmount }}
+
+
+
+
+
+
+
+ + Budgets +
+ + + + + + + + {% set sumSpent = 0 %} + {% set sumEnvelope = 0 %} + {% set sumLeft = 0 %} + {% for id,budget in budgets %} + {% set sumSpent = sumSpent + budget.spent %} + {% set sumEnvelope = sumEnvelope + budget.queryAmount %} + {% set sumLeft = sumLeft + budget.queryAmount + budget.spent %} + + {% if budget.queryAmount != 0 or budget.spent != 0 %} + + + + + + + {% endif %} + {% endfor %} + + + + + + +
BudgetEnvelopeSpentLeft
+ {% if id > 0 %} + {{ budget.name }} + {% else %} + {{ budget.name }} + {% endif %} + {{ budget.queryAmount|formatAmount }}{{ (budget.spent*-1)|formatAmountPlain }}{{ (budget.queryAmount + budget.spent)|formatAmount }}
Sum{{ sumEnvelope|formatAmount }}{{ sumSpent|formatAmount }}{{ sumLeft|formatAmount }}
+
+
+
+
+
+ + Categories +
+ + + + + + {% set sum = 0 %} + {% for id,category in categories %} + {% set sum = sum + category.queryAmount %} + + + + + {% endfor %} + + + + +
CategorySpent
+ {% if id > 0 %} + {{ category.name }} + {% else %} + {{ category.name }} + {% endif %} + {{ (category.queryAmount * -1)|formatAmountPlain }}
Sum{{ (sum * -1)|formatAmountPlain }}
+
+
+
+
+
+
+
+ + Accounts +
+ + {% set sumStart = 0 %} + {% set sumEnd = 0 %} + {% set sumDiff = 0 %} + {% for id,account in accounts %} + + {% set sumStart = sumStart + account.startBalance %} + {% set sumEnd = sumEnd + account.endBalance %} + {% set sumDiff = sumDiff + account.difference %} + + + + + + + {% endfor %} + + + + + + +
{{ account.name }}{{ account.startBalance|formatAmount }}{{ account.endBalance|formatAmount }}{{ account.difference|formatAmount }}
Sum{{ sumStart|formatAmount }}{{ sumEnd|formatAmount }}{{ sumDiff|formatAmount }}
+
+
+
+
+
+
+
+ + Piggy banks +
+
Body
+
+
+
+
+
+
+
+ + Bills +
+
Body
+
+
+
+
+
+
+
+ + Outside of budgets +
+
Body
+
+
+
+{% endblock %} +{% block scripts %} + +{% endblock %} diff --git a/resources/views/reports/year.blade.php b/resources/twig/reports/year.twig similarity index 56% rename from resources/views/reports/year.blade.php rename to resources/twig/reports/year.twig index f29b2fa8be..d59c747791 100644 --- a/resources/views/reports/year.blade.php +++ b/resources/twig/reports/year.twig @@ -1,6 +1,6 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, date) }}

@@ -49,36 +49,32 @@ Balance at end of year Difference - - @foreach($balances as $balance) - - @if($balance['hide'] === false) - - - {{{$balance['account']->name}}} - @if($balance['shared']) - shared - @endif - - {!! Amount::format($balance['start']) !!} - {!! Amount::format($balance['end']) !!} - {!! Amount::format($balance['end']-$balance['start']) !!} - - @endif - @endforeach + {% set start = 0 %} + {% set end = 0 %} + {% set diff = 0 %} + {% for balance in balances %} + {% set start = start + balance.start %} + {% set end = end + balance.end %} + {% set diff = diff + (balance.end - balance.start) %} + {% if not balance.hide %} + + + {{ balance.account.name }} + {% if balance.shared %} + shared + {% endif %} + + {{ balance.start|formatAmount }} + {{ balance.end|formatAmount }} + {{ (balance.end - balance.start)|formatAmount }} + + {% endif %} + {% endfor %} Sum of sums - {!! Amount::format($start) !!} - {!! Amount::format($end) !!} - {!! Amount::format($diff) !!} + {{ start|formatAmount }} + {{ end|formatAmount }} + {{ diff|formatAmount }}

@@ -88,31 +84,28 @@ Income vs. expense
- queryAmount); - } - foreach($groupedExpenses as $exp) { - $expenseSum += floatval($exp['queryAmount']); - } - $incomeSum = floatval($incomeSum*-1); + {% set incomeSum = 0 %} + {% set expenseSum = 0 %} + {% for income in groupedIncomes %} + {% set incomeSum = incomeSum + (income.queryAmount*-1) %} + {% endfor %} - ?> + {% for expense in groupedExpenses %} + {% set expenseSum = expenseSum + expense.queryAmount %} + {% endfor %} - + - + - +
In{!! Amount::format($incomeSum) !!}{{ incomeSum|formatAmount }}
Out{!! Amount::format($expenseSum*-1) !!}{{ (expenseSum*-1)|formatAmount }}
Difference{!! Amount::format($incomeSum - $expenseSum) !!}{{ (incomeSum - expenseSum)|formatAmount }}
@@ -124,19 +117,17 @@ Income - - @foreach($groupedIncomes as $income) - queryAmount)*-1; - ?> - - - - - @endforeach + {% set sum = 0 %} + {% for income in groupedIncomes %} + {% set sum = sum + (income.queryAmount * -1) %} + + + + + {% endfor %} - +
{{{$income->name}}}{!! Amount::format(floatval($income->queryAmount)*-1) !!}
{{ income.name }}{{ (income.queryAmount * -1)|formatAmount }}
Sum{!! Amount::format($sum) !!}{{ sum|formatAmount }}
@@ -148,17 +139,17 @@ Expenses - - @foreach($groupedExpenses as $expense) + {% set sum =0 %} + {% for expense in groupedExpenses %} - - + + - - @endforeach + {% set sum = sum + (expense.queryAmount * -1) %} + {% endfor %} - +
{{{$expense['name']}}}{!! Amount::format(floatval($expense['queryAmount'])*-1) !!}{{ expense.name }}{{ (expense.queryAmount*-1)|formatAmount }}
Sum{!! Amount::format($sum) !!}{{ sum|formatAmount }}
@@ -178,19 +169,17 @@ - -@stop -@section('scripts') +{% endblock %} +{% block scripts %} -@stop +{% endblock %} diff --git a/resources/twig/search/index.twig b/resources/twig/search/index.twig new file mode 100644 index 0000000000..a4783911cc --- /dev/null +++ b/resources/twig/search/index.twig @@ -0,0 +1,106 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, query) }} +{% if query %} +
+ {% if result.transactions|length > 0 %} +
+
+
+ Transactions ({ result.transactions|length }}) +
+
+ {% include 'list/journals-tiny' with {'transactions' : result.transactions} %} +
+
+
+ {% endif %} + {% if result.categories|length > 0 %} +
+
+
+ Categories ({{result['categories'].count()}}) +
+
+
+ {% for category in result.categories %} + + {{ category.name }} + + {% endfor %} +
+
+
+
+ {% endif %} + {% if result.tags|length > 0 %} +
+
+
+ Tags ({{result['tags'].count()}}) +
+
+

Bla bla

+
+
+
+ {% endif %} + {% if result.accounts|length > 0 %} +
+
+
+ Accounts ({{result['accounts'].count()}}) +
+
+
+ {% for account in result.accounts %} + + {{ account.name }} + + {% endfor %} +
+
+
+
+ {% endif %} + {% if result.budgets|length > 0 %} +
+
+
+ Budgets ({{result['budgets'].count()}}) +
+
+
+ {% for budget in result.budgets %} + + {{ budget.name }} + + {% endfor %} +
+
+
+
+ {% endif %} + +
+{% endif %} + + + +{% endblock %} +{% block scripts %} + +{% endblock %} \ No newline at end of file diff --git a/resources/twig/tags/create.twig b/resources/twig/tags/create.twig new file mode 100644 index 0000000000..ab957ce3bf --- /dev/null +++ b/resources/twig/tags/create.twig @@ -0,0 +1,85 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'store','route' : 'tags.store'}) }} + +
+
+
+
+ Mandatory fields +
+
+ {{ ExpandedForm.text('tag') }} + {{ ExpandedForm.multiRadio('tagMode',tagOptions) }} +
+
+
+ +
+ +
+
+ Optional fields +
+
+ {{ ExpandedForm.date('date') }} + {{ ExpandedForm.textarea('description') }} + {{ ExpandedForm.location('tagPosition') }} +
+
+ + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('create','tag') }} +
+
+ +
+
+
+
+

+ +

+
+
+ + +{% endblock %} +{% block scripts %} + + + +{% endblock %} \ No newline at end of file diff --git a/resources/twig/tags/delete.twig b/resources/twig/tags/delete.twig new file mode 100644 index 0000000000..82ea36f45d --- /dev/null +++ b/resources/twig/tags/delete.twig @@ -0,0 +1,33 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('tags.destroy',tag.id)}) }} +
+
+
+
+ Delete tag "{{ tag.tag }}" +
+
+

+ Are you sure that you want to delete tag "{{ tag.tag }}"? +

+ + {% if tag.transactionjournals|length > 0 %} +

+ Tag "{{ tag.tag }}" still has {{ tag.transactionjournals|length }} transaction(s) connected + to it. These will not be removed but will lose their connection to this tag. +

+ {% endif %} + +

+ + Cancel +

+
+
+
+
+ + +{% endblock %} diff --git a/resources/twig/tags/edit.twig b/resources/twig/tags/edit.twig new file mode 100644 index 0000000000..85f5e3503f --- /dev/null +++ b/resources/twig/tags/edit.twig @@ -0,0 +1,87 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }} + {{ Form.model(tag, {'class' : 'form-horizontal','id' : 'update','url' : route('tags.update',tag.id)}) }} + + + +
+
+
+
+ Mandatory fields +
+
+ {{ ExpandedForm.text('tag') }} + {{ ExpandedForm.multiRadio('tagMode',tagOptions) }} +
+
+
+ +
+ +
+
+ Optional fields +
+
+ {{ ExpandedForm.date('date') }} + {{ ExpandedForm.textarea('description') }} + {{ ExpandedForm.location('tagPosition') }} +
+
+ + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('update','tag') }} +
+
+ +
+
+
+
+

+ +

+
+
+ + +{% endblock %} +{% block scripts %} + + + +{% endblock %} \ No newline at end of file diff --git a/resources/twig/tags/index.twig b/resources/twig/tags/index.twig new file mode 100644 index 0000000000..9b520969a5 --- /dev/null +++ b/resources/twig/tags/index.twig @@ -0,0 +1,75 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }} +
+
+
+
Tags
+
+
+

+ Usually tags are singular words, designed to quickly band items together + using things like expensive, + bill or + for-party. In Firefly III, tags can have more properties + such as a date, description and location. This allows you to join transactions together in a more meaningful + way. For example, you could make a tag called Christmas dinner with friends + and add information about the restaurant. Such tags are "singular", you would only use them for a single occasion, + perhaps with multiple transactions. +

+

+ Tags group transactions together, which makes it possible to store reimbursements + (in case you front money for others) and other "balancing acts" where expenses + are summed up (the payments on your new TV) or where expenses and deposits + are cancelling each other out (buying something with saved money). It's all up to you. + Using tags the old-fashioned way is of course always possible. +

+

+ Create a tag to get started or enter tags when creating new transactions. +

+
+

+ +

+

+ Create new tag +

+

+ {% if tags|length == 0 %} + No tags + {% else %} + {% for tag in tags %} + +

+ {% if tag.tagMode == 'nothing' %} + + {% endif %} + {% if tag.tagMode == 'balancingAct' %} + + {% endif %} + {% if tag.tagMode == 'advancePayment' %} + + {% endif %} + {{tag.tag}} +

+ {% endfor %} + {% endif %} +

+
+
+
+
+{% endblock %} +{% block scripts %} + +{% endblock %} \ No newline at end of file diff --git a/resources/twig/tags/show.twig b/resources/twig/tags/show.twig new file mode 100644 index 0000000000..ae61d5b587 --- /dev/null +++ b/resources/twig/tags/show.twig @@ -0,0 +1,77 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }} + + {% if tag.latitude and tag.longitude and tag.zoomLevel %} +
+
+
+
+ {{ tag.tag }} + {% if tag.date %} + on {{tag.date.format('jS F Y')}} + {% endif %} + +
+
+ + +
+
+
+
+ {% if tag.description %} +

+ {{tag.description}} +

+ {% endif %} + {% if tag.latitude and tag.longitude and tag.zoomLevel %} +

+ +

+ {% endif %} +
+
+
+
+ {% endif %} + +
+
+
+
+ Transactions + + {% if not (tag.latitude and tag.longitude and tag.zoomLevel) %} + +
+
+ + +
+
+ {% endif %} +
+ {% include 'list/journals.twig' with {'journals': tag.transactionjournals} %} +
+
+
+ +{% endblock %} +{% block scripts %} + +{% endblock %} diff --git a/resources/twig/transactions/create.twig b/resources/twig/transactions/create.twig new file mode 100644 index 0000000000..01ef307391 --- /dev/null +++ b/resources/twig/transactions/create.twig @@ -0,0 +1,107 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('transactions.store',what)}) }} + + +
+
+ +
+
+ Mandatory fields +
+
+ + {{ ExpandedForm.text('description') }} + {% if what == 'deposit' or what == 'withdrawal' %} + {{ ExpandedForm.select('account_id',accounts) }} + {% endif %} + + + + {% if what == 'withdrawal' %} + {{ ExpandedForm.text('expense_account') }} + {% endif %} + + + {% if what == 'deposit' %} + {{ ExpandedForm.text('revenue_account') }} + {% endif %} + + + + {% if what == 'transfer' %} + {{ ExpandedForm.select('account_from_id',accounts) }} + {{ ExpandedForm.select('account_to_id',accounts) }} + {% endif %} + + + + {{ ExpandedForm.amount('amount') }} + + + {{ ExpandedForm.date('date', phpdate('Y-m-d')) }} +
+
+
+
+ +
+
+ Optional fields +
+
+ + {% if what == 'withdrawal' %} + {{ ExpandedForm.select('budget_id',budgets,0) }} + {% endif %} + + {{ ExpandedForm.text('category') }} + + + {{ ExpandedForm.text('tags') }} + + + + {% if what == 'withdrawal' and piggies|length > 0 %} + {{ ExpandedForm.select('piggy_bank_id',piggies) }} + {% endif %} +
+
+ + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('create','transaction') }} +
+
+
+
+
+
+

+ +

+
+
+ + +{% endblock %} +{% block scripts %} + + + + +{% endblock %} + +{% block styles %} + +{% endblock %} diff --git a/resources/views/transactions/delete.blade.php b/resources/twig/transactions/delete.twig similarity index 67% rename from resources/views/transactions/delete.blade.php rename to resources/twig/transactions/delete.twig index bf62d775d4..b10a9a83a0 100644 --- a/resources/views/transactions/delete.blade.php +++ b/resources/twig/transactions/delete.twig @@ -1,14 +1,14 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('transactions.destroy',$journal->id)]) !!} +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('transactions.destroy',journal.id)}) }}
- Destroy "{{{$journal->description}}}" + Destroy "{{ journal.description }}"

@@ -23,21 +23,21 @@

- @if($journal->transactiontype->type == 'Withdrawal') + {% if journal.transactiontype.type == 'Withdrawal' %} Cancel - @endif - @if($journal->transactiontype->type == 'Deposit') + {% endif %} + {% if journal.transactiontype.type == 'Deposit' %} Cancel - @endif - @if($journal->transactiontype->type == 'Transfer') + {% endif %} + {% if journal.transactiontype.type == 'Transfer' %} Cancel - @endif + {% endif %}
-{!! Form::close() !!} + -@stop +{% endblock %} diff --git a/resources/twig/transactions/edit.twig b/resources/twig/transactions/edit.twig new file mode 100644 index 0000000000..5ac5f371bd --- /dev/null +++ b/resources/twig/transactions/edit.twig @@ -0,0 +1,111 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'update','url' : route('transactions.update',journal.id)}) }} + + + + +
+
+ +
+
+ Mandatory fields +
+
+ + {{ ExpandedForm.text('description',journal.description) }} + + + {% if what == 'deposit' or what == 'withdrawal' %} + {{ ExpandedForm.select('account_id',accounts,data['account_id']) }} + {% endif %} + + + {% if what == 'withdrawal' %} + {{ ExpandedForm.text('expense_account',data['expense_account']) }} + {% endif %} + + + {% if what == 'deposit' %} + {{ ExpandedForm.text('revenue_account',data['revenue_account']) }} + {% endif %} + + + {% if what == 'transfer' %} + {{ ExpandedForm.select('account_from_id',accounts,data['account_from_id']) }} + {{ ExpandedForm.select('account_to_id',accounts,data['account_to_id']) }} + {% endif %} + + + {{ ExpandedForm.amount('amount',data.amount,{'currency' : journal.transactionCurrency}) }} + + + {{ ExpandedForm.date('date',data['date']) }} +
+
+ +
+
+ +
+
+ Optional fields +
+
+ + {% if what == 'withdrawal' %} + {{ ExpandedForm.select('budget_id',budgets,data['budget_id']) }} + {% endif %} + + + {{ ExpandedForm.text('category',data['category']) }} + + + {{ ExpandedForm.text('tags') }} + + + {% if what == 'withdrawal' and piggies|length > 0 %} + {{ ExpandedForm.select('piggy_bank_id',piggies,data['piggy_bank_id']) }} + {% endif %} + +
+
+ + +
+
+ Options +
+
+ {{ ExpandedForm.optionsList('update','transaction') }} +
+
+
+
+ +
+
+

+ +

+
+
+ + + +{% endblock %} +{% block scripts %} + + + + +{% endblock %} +{% block styles %} + +{% endblock %} diff --git a/resources/twig/transactions/index.twig b/resources/twig/transactions/index.twig new file mode 100644 index 0000000000..25b11854a9 --- /dev/null +++ b/resources/twig/transactions/index.twig @@ -0,0 +1,19 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }} +
+
+
+
+ {{ subTitle }} +
+ {% include 'list.journals' %} +
+
+
+ +{% endblock %} +{% block scripts %} + + +{% endblock %} diff --git a/resources/twig/transactions/show.twig b/resources/twig/transactions/show.twig new file mode 100644 index 0000000000..7c58bed910 --- /dev/null +++ b/resources/twig/transactions/show.twig @@ -0,0 +1,133 @@ +{% extends "./layout/default.twig" %} +{% block content %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }} +
+
+
+
+ + Metadata +
+ + + + + + + + + + + + + + {% for budget in journal.budgets %} + + + + + {% endfor %} + {% for category in journal.categories %} + + + + + {% endfor %} + {% if journal.tags|length > 0 %} + + + + + {% endif %} +
Date{{ journal.date.format('jS F Y') }}
Type{{ journal.transactiontype.type }}
Completed + {% if journal.completed %} + Yes + {% else %} + No + {% endif %} +
Budget{{ budget.name }}
Category{{ category.name }}
Tags + {% for tag in journal.tags %} + +

+ {% if tag.tagMode == 'nothing' %} + + {% endif %} + {% if tag.tagMode == 'balancingAct' %} + + {% endif %} + {% if tag.tagMode == 'advancePayment' %} + + {% endif %} + {{tag.tag}} +

+ {% endfor %} +
+
+ + {% if journal.piggyBankEvents|length > 0 %} +
+
+ Piggy banks +
+
+ {% include 'list/piggy-bank-events' with {'events': journal.piggyBankEvents, 'showPiggyBank':true} %} +
+
+ {% endif %} +
+
+ + {% for t in journal.transactions %} +
+
+ {% if t.account.accounttype.type == 'Asset account' %} + + {% endif %} + {% if t.account.accounttype.type == 'Default account' %} + + {% endif %} + {% if t.account.accounttype.type == 'Expense account' %} + + {% endif %} + {% if t.account.accounttype.type == 'Beneficiary account' %} + + {% endif %} + + {% if t.account.accounttype.type == 'Revenue account' %} + + {% endif %} + {{ t.account.name }}
{{ t.account.accounttype.description }} +
+ + + + + + + + + + {% if t.description %} + + + + + {% endif %} +
Amount{{ t|formatTransaction }}
New balance{{ t.before|formatAmount }} → {{ t.after|formatAmount }}
Description{{ t.description }}
+
+ {% endfor %} +
+
+ +
+
+ +
+
+ +{% endblock %} +{% block scripts %} + +{% endblock %} diff --git a/resources/views/accounts/create.blade.php b/resources/views/accounts/create.blade.php deleted file mode 100644 index f8c9a2d403..0000000000 --- a/resources/views/accounts/create.blade.php +++ /dev/null @@ -1,60 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'accounts.store']) !!} -{!! Form::hidden('what',$what) !!} - -@foreach ($errors->all() as $error) -

{{ $error }}

-@endforeach - -
-
-
-
- Mandatory fields -
-
- {!! ExpandedForm::text('name') !!} -
-
-

- -

-
- -
- - @if($what == 'asset') -
-
- Optional fields -
-
- - {!! ExpandedForm::balance('openingBalance') !!} - {!! ExpandedForm::date('openingBalanceDate', date('Y-m-d')) !!} - {!! ExpandedForm::select('accountRole',Config::get('firefly.accountRoles'),null,['helpText' => 'Any extra options resulting from your choice can be set later.']) !!} - {!! ExpandedForm::balance('virtualBalance') !!} - -
-
- @endif - - -
-
- Options -
-
- {!! ExpandedForm::optionsList('create','account') !!} -
-
- -
-
- - -@stop diff --git a/resources/views/accounts/delete.blade.php b/resources/views/accounts/delete.blade.php deleted file mode 100644 index b45c9e86de..0000000000 --- a/resources/views/accounts/delete.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('accounts.destroy',$account->id)]) !!} -
-
-
-
- Delete account "{{{$account->name}}}" -
-
-

- Are you sure that you want to delete the {{strtolower($account->accountType->type)}} "{{$account->name}}"? -

- - @if($account->transactions()->count() > 0) -

- {{ucfirst($account->accountType->type)}} "{{{$account->name}}}" still has {{$account->transactions()->count()}} transaction(s) associated to it. These will be deleted as well. -

- @endif - @if($account->piggyBanks()->count() > 0) -

- {{ucfirst($account->accountType->type)}} "{{{$account->name}}}" still has {{$account->piggyBanks()->count()}} piggy bank(s) associated to it. These will be deleted as well. -

- @endif -

- - Cancel -

-
-
-
-
- -{!! Form::close() !!} -@stop diff --git a/resources/views/accounts/edit.blade.php b/resources/views/accounts/edit.blade.php deleted file mode 100644 index 166aab8f0f..0000000000 --- a/resources/views/accounts/edit.blade.php +++ /dev/null @@ -1,68 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!} -{!! Form::model($account, ['class' => 'form-horizontal','id' => 'update','url' => route('accounts.update',$account->id)]) !!} - - - -
-
-
-
- Mandatory fields -
-
- {!! ExpandedForm::text('name') !!} -
-
-

- -

-
-
-
-
- Optional fields -
-
- @if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account') - {!! ExpandedForm::balance('openingBalance',null, ['currency' => $openingBalance ? $openingBalance->transactionCurrency : null]) !!} - {!! ExpandedForm::date('openingBalanceDate') !!} - {!! ExpandedForm::select('accountRole',Config::get('firefly.accountRoles')) !!} - {!! ExpandedForm::balance('virtualBalance',null) !!} - {!! Form::hidden('id',$account->id) !!} - @endif - {!! ExpandedForm::checkbox('active','1') !!} -
-
- - - @if(Session::get('preFilled')['accountRole'] == 'ccAsset') -
-
- Credit card options -
-
- {!! ExpandedForm::select('ccType',Config::get('firefly.ccTypes')) !!} - {!! ExpandedForm::date('ccMonthlyPaymentDate',null,['helpText' => 'Select any year and any month, it will be ignored anway. Only the day of the month is relevant.']) !!} -
-
- @endif - - -
-
- Options -
-
- {!! ExpandedForm::optionsList('update','account') !!} -
-
- -
-
- -{!! Form::close() !!} -@stop diff --git a/resources/views/auth/reset.blade.php b/resources/views/auth/reset.blade.php deleted file mode 100644 index fd6785041e..0000000000 --- a/resources/views/auth/reset.blade.php +++ /dev/null @@ -1,51 +0,0 @@ -@extends('layouts.guest') -@section('content') -
-
- -
-
- -@endsection diff --git a/resources/views/bills/delete.blade.php b/resources/views/bills/delete.blade.php deleted file mode 100644 index b78505c8ee..0000000000 --- a/resources/views/bills/delete.blade.php +++ /dev/null @@ -1,44 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $bill) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('bills.destroy',$bill->id)]) !!} -
-
-
-
- Delete bill "{{{$bill->name}}}" -
-
-

- Are you sure that you want to delete bill "{{{$bill->name}}}"? -

- - @if($bill->transactionjournals()->count() > 0) -

- Bill "{{{$bill->name}}}" still has {{$bill->transactionjournals()->count()}} transactions connected - to it. These will not be removed but will lose their connection to this bill. -

- @endif - -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{!! Form::close() !!} -@stop diff --git a/resources/views/bills/index.blade.php b/resources/views/bills/index.blade.php deleted file mode 100644 index 98f0e96cd3..0000000000 --- a/resources/views/bills/index.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -
-
-
-
- {{{$title}}} - - -
-
- - -
-
-
- @include('list.bills') -
-
-
-@stop -@section('scripts') - -@stop diff --git a/resources/views/budgets/index.blade.php b/resources/views/budgets/index.blade.php deleted file mode 100644 index e9dc51d410..0000000000 --- a/resources/views/budgets/index.blade.php +++ /dev/null @@ -1,183 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -
-
-
-
- - {{Session::get('start', \Carbon\Carbon::now()->startOfMonth())->format('F Y')}} -
-
-
-
- Budgeted: -
-
- Available in {{Session::get('start', \Carbon\Carbon::now()->startOfMonth())->format('F Y')}}: - {!! Amount::format($amount) !!} -
-
- -
-
-
-
-
-
-
-
-
-
-
- Spent: {!! Amount::format($spent) !!} -
-
-
-
-
- @if($overspent) -
-
- @else -
- @endif -
-
-
- -
-
-
-
- - -
- -
- -
-@foreach($budgets as $budget) -
-
-
- - @if(isset($budget->currentRep)) - {{{$budget->name}}} - @else - {{{$budget->name}}} - @endif - - - -
-
- - -
-
- -
-
- -

- @if($budget->currentRep) - - @else - - @endif -

- -

- - - @if($budget->currentRep) - - Budgeted: - - - @if($budget->currentRep->amount > $budget->spent) - {{Amount::getCurrencySymbol()}} - @else - {{Amount::getCurrencySymbol()}} - @endif - - @else - No budget - - - - @endif - -

-

- Spent: {!! Amount::format($budget->spent) !!} -

-
-
-
-@endforeach -
-
-
- - Create budget -
- -
-
- @if($inactive->count() > 0) -
-
-
- - Inactive budgets -
-
- @foreach($inactive as $index => $budget) - @if($index != count($inactive)-1) - {{$budget->name}}, - @else - {{$budget->name}} - @endif - @endforeach -
-
-
- @endif -
- - - - - - - -@stop -@section('scripts') - - - -@stop diff --git a/resources/views/budgets/show.blade.php b/resources/views/budgets/show.blade.php deleted file mode 100644 index b3554aa66f..0000000000 --- a/resources/views/budgets/show.blade.php +++ /dev/null @@ -1,115 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $budget, $repetition) !!} -
-
-
-
- Overview - - - -
-
- - -
-
-
-
-
-
-
- -
-
- Transactions -
- @include('list.journals-full',['sorting' => false]) -
-
-
- @if(count($limits) == 1) -

Show everything

- @endif - - @foreach($limits as $limit) - @foreach($limit->limitrepetitions as $rep) -
- -
-
-
- Amount: {!! Amount::format($rep->amount) !!} -
-
- Spent: {!! Amount::format($rep->spentInRepetition()) !!} -
-
-
-
- spentInRepetition() > $rep->amount; - ?> - @if($overspent) - spentInRepetition()); - $pct = $spent != 0 ? ($rep->amount / $spent)*100 : 0; - ?> -
-
-
-
- @else - amount); - $pct = $amount != 0 ? ($rep->spentInRepetition() / $amount)*100 : 0; - ?> -
-
-
-
- @endif -
-
-
-
- @endforeach - @endforeach - - @if(count($limits) == 1) -

Show everything

- @endif - -
-
- -@stop -@section('scripts') - - - - - - - - -@stop diff --git a/resources/views/currency/edit.blade.php b/resources/views/currency/edit.blade.php deleted file mode 100644 index e4f4349e40..0000000000 --- a/resources/views/currency/edit.blade.php +++ /dev/null @@ -1,42 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -{!! Form::model($currency, ['class' => 'form-horizontal','id' => 'update','url' => route('currency.update',$currency->id)]) !!} - - -
-
-
-
- Mandatory fields -
-
- {!! ExpandedForm::text('name',null,['maxlength' => 48]) !!} - {!! ExpandedForm::text('symbol',null,['maxlength' => 8]) !!} - {!! ExpandedForm::text('code',null,['maxlength' => 3]) !!} -
-
-

- -

-
- -
- - -
-
- Options -
-
- {!! ExpandedForm::optionsList('update','currency') !!} -
-
- -
-
- -{!! Form::close() !!} -@stop diff --git a/resources/views/emails/password.blade.php b/resources/views/emails/password.blade.php deleted file mode 100644 index 2030539369..0000000000 --- a/resources/views/emails/password.blade.php +++ /dev/null @@ -1 +0,0 @@ -Click here to reset your password: {{ url('password/reset/'.$token) }} diff --git a/resources/views/form/amount.blade.php b/resources/views/form/amount.blade.php deleted file mode 100644 index 6f0beb7316..0000000000 --- a/resources/views/form/amount.blade.php +++ /dev/null @@ -1,22 +0,0 @@ -
- -
-
-
- - -
- {!! Form::input('number', $name, $value, $options) !!} - - -
- @include('form.feedback') -
- {!! Form::input('hidden','amount_currency_id',$defaultCurrency->id) !!} -
diff --git a/resources/views/form/balance.blade.php b/resources/views/form/balance.blade.php deleted file mode 100644 index 34294152a8..0000000000 --- a/resources/views/form/balance.blade.php +++ /dev/null @@ -1,22 +0,0 @@ -
- -
-
-
- - -
- {!! Form::input('number', $name, $value, $options) !!} - -
- @include('form.feedback') -
- - {!! Form::input('hidden','balance_currency_id',$defaultCurrency->id) !!} -
diff --git a/resources/views/form/checkbox.blade.php b/resources/views/form/checkbox.blade.php deleted file mode 100644 index cfe415d73d..0000000000 --- a/resources/views/form/checkbox.blade.php +++ /dev/null @@ -1,11 +0,0 @@ -
- -
-
- -
- @include('form.feedback') -
-
diff --git a/resources/views/form/date.blade.php b/resources/views/form/date.blade.php deleted file mode 100644 index 2eb2c909c5..0000000000 --- a/resources/views/form/date.blade.php +++ /dev/null @@ -1,8 +0,0 @@ -
- -
- {!! Form::input('date', $name, $value, $options) !!} - @include('form.help') - @include('form.feedback') -
-
diff --git a/resources/views/form/feedback.blade.php b/resources/views/form/feedback.blade.php deleted file mode 100644 index 5b26fa2fb7..0000000000 --- a/resources/views/form/feedback.blade.php +++ /dev/null @@ -1,4 +0,0 @@ -@if($errors->has($name)) - -

{{{$errors->first($name)}}}

-@endif diff --git a/resources/views/form/help.blade.php b/resources/views/form/help.blade.php deleted file mode 100644 index 9b6375c241..0000000000 --- a/resources/views/form/help.blade.php +++ /dev/null @@ -1,3 +0,0 @@ -@if(isset($options['helpText'])) -

{{$options['helpText']}}

-@endif diff --git a/resources/views/form/integer.blade.php b/resources/views/form/integer.blade.php deleted file mode 100644 index 9b84d9626f..0000000000 --- a/resources/views/form/integer.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -
- -
-
- {!! Form::input('number', $name, $value, $options) !!} - @include('form.feedback') -
-
-
diff --git a/resources/views/form/month.blade.php b/resources/views/form/month.blade.php deleted file mode 100644 index 587ce62ff6..0000000000 --- a/resources/views/form/month.blade.php +++ /dev/null @@ -1,8 +0,0 @@ -
- -
- {!! Form::input('month', $name, $value, $options) !!} - @include('form.help') - @include('form.feedback') -
-
diff --git a/resources/views/form/options.blade.php b/resources/views/form/options.blade.php deleted file mode 100644 index b20edda43d..0000000000 --- a/resources/views/form/options.blade.php +++ /dev/null @@ -1,73 +0,0 @@ -@if($type == 'create') - -@endif -@if($type == 'update') - -@endif - -@if($type == 'create') -
- -
-
- -
-
-
-@endif - -@if($type == 'update') -
- -
-
-
-
-
-@endif diff --git a/resources/views/form/select.blade.php b/resources/views/form/select.blade.php deleted file mode 100644 index 4fc6016e8f..0000000000 --- a/resources/views/form/select.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -
- -
- {!! Form::select($name, $list, $selected , $options ) !!} - @include('form.help') - @include('form.feedback') - -
-
diff --git a/resources/views/form/tags.blade.php b/resources/views/form/tags.blade.php deleted file mode 100644 index ba7b06c800..0000000000 --- a/resources/views/form/tags.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- {!! Form::input('text', $name, $value, $options) !!} - @include('form.feedback') -
-
diff --git a/resources/views/form/text.blade.php b/resources/views/form/text.blade.php deleted file mode 100644 index ba7b06c800..0000000000 --- a/resources/views/form/text.blade.php +++ /dev/null @@ -1,7 +0,0 @@ -
- -
- {!! Form::input('text', $name, $value, $options) !!} - @include('form.feedback') -
-
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php deleted file mode 100644 index 8f5e705858..0000000000 --- a/resources/views/home.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -@extends('app') - -@section('content') -
-
-
-
-
Home
- -
- You are logged in! -
-
-
-
-
-@endsection diff --git a/resources/views/list/accounts.blade.php b/resources/views/list/accounts.blade.php deleted file mode 100644 index 12431be966..0000000000 --- a/resources/views/list/accounts.blade.php +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - @if(isset($what) && $what == 'asset') - - @endif - - - - - - - - @foreach($accounts as $account) - - - - @if(isset($what) && $what == 'asset') - - @endif - - - - @if($account->lastActivityDate) - - @else - - @endif - - - - - @endforeach - -
 NameRoleCurrent balanceActiveLast activityBalance difference between {{Session::get('start')->format('jS F Y')}} and {{Session::get('end')->format('jS F Y')}}
-
- - -
-
{{{$account->name}}} - @foreach($account->accountmeta as $entry) - @if($entry->name == 'accountRole') - {{Config::get('firefly.accountRoles.'.$entry->data)}} - @endif - @endforeach - {!! Amount::format($balance) !!} - @if($account->active) - - @else - - @endif - - {{{$account->lastActivityDate->format('j F Y')}}} - - Never - - {!! Amount::format($account->endBalance - $account->startBalance) !!} -
\ No newline at end of file diff --git a/resources/views/list/bills.blade.php b/resources/views/list/bills.blade.php deleted file mode 100644 index c0e4c4f724..0000000000 --- a/resources/views/list/bills.blade.php +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - @foreach($bills as $entry) - - - - - - - - - - - - - - - @endforeach -
 NameMatches onMatching amountLast seen matchNext expected matchIs activeWill be automatchedRepeats every 
-
- - -
-
- {{{$entry->name}}} - - @foreach(explode(',',$entry->match) as $match) - {{{$match}}} - @endforeach - - {!! Amount::format($entry->amount_min) !!} - - {!! Amount::format($entry->amount_max) !!} - - @if($entry->lastFoundMatch) - {{$entry->lastFoundMatch->format('j F Y')}} - @else - Unknown - @endif - - @if($entry->nextExpectedMatch) - {{$entry->nextExpectedMatch->format('j F Y')}} - @else - Unknown - @endif - - @if($entry->active) - - @else - - @endif - - @if($entry->automatch) - - @else - - @endif - - {{{$entry->repeat_freq}}} - @if($entry->skip > 0) - skips over {{$entry->skip}} - @endif - - @if($entry->active) - - @endif -
diff --git a/resources/views/list/categories.blade.php b/resources/views/list/categories.blade.php deleted file mode 100644 index 2c5b166c43..0000000000 --- a/resources/views/list/categories.blade.php +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - @foreach($categories as $category) - - - - @if($category->lastActivity) - - @else - - @endif - - @endforeach - -
 NameLast activity
 Without a category 
-
- - -
-
- {{{$category->name}}} - - {{$category->lastActivity->format('jS F Y')}} - - Never -
diff --git a/resources/views/list/journals-full.blade.php b/resources/views/list/journals-full.blade.php deleted file mode 100644 index 2584d8c8f0..0000000000 --- a/resources/views/list/journals-full.blade.php +++ /dev/null @@ -1,123 +0,0 @@ -@if(is_object($journals) && method_exists($journals, 'render')) -{!! $journals->render() !!} -@endif - - - - - - - - - @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false)) - - @endif - @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false)) - - @endif - @if(!isset($hideBill) || (isset($hideBill) && $hideBill=== false)) - - @endif - - @foreach($journals as $journal) - @if(!isset($journal->transactions[1]) || !isset($journal->transactions[0])) - - - - - - - @else - - - - - - - - - @if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false)) - - @endif - @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false)) - - @endif - @if(!isset($hideBill) || (isset($hideBill) && $hideBill=== false)) - - @endif - - - - @endif - - @endforeach -
 DescriptionAmountDateFromTo
-
- -
-
 {{{$journal->description}}}Invalid journal: Found {{$journal->transactions()->count()}} transaction(s)
-
- @if($sorting === true) - - @endif - - -
-
- @if($journal->transactiontype->type == 'Withdrawal') - - @endif - @if($journal->transactiontype->type == 'Deposit') - - @endif - @if($journal->transactiontype->type == 'Transfer') - - @endif - @if($journal->transactiontype->type == 'Opening balance') - - @endif - - {{{$journal->description}}} - - @if($journal->transactiontype->type == 'Withdrawal') - {{Amount::formatTransaction($journal->transactions[0],false)}} - @endif - @if($journal->transactiontype->type == 'Deposit') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Transfer') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - - {{$journal->date->format('j F Y')}} - - @if($journal->transactions[0]->account->accounttype->type == 'Cash account') - (cash) - @else - {{{$journal->transactions[0]->account->name}}} - @endif - - @if($journal->transactions[1]->account->accounttype->type == 'Cash account') - (cash) - @else - {{{$journal->transactions[1]->account->name}}} - @endif - - budgets[0]) ? $journal->budgets[0] : null; ?> - @if($budget) - {{{$budget->name}}} - @endif - - categories[0]) ? $journal->categories[0] : null; ?> - @if($category) - {{{$category->name}}} - @endif - - @if($journal->bill) - {{{$journal->bill->name}}} - @endif -
- -@if(is_object($journals) && method_exists($journals, 'render')) -{!! $journals->render() !!} -@endif diff --git a/resources/views/list/journals-tiny.blade.php b/resources/views/list/journals-tiny.blade.php deleted file mode 100644 index 27a06b5256..0000000000 --- a/resources/views/list/journals-tiny.blade.php +++ /dev/null @@ -1,35 +0,0 @@ -
-@foreach($transactions as $journal) - - - @if(is_null($journal->type)) - @if($journal->transactiontype->type == 'Withdrawal') - - @endif - @if($journal->transactiontype->type == 'Deposit') - - @endif - @if($journal->transactiontype->type == 'Transfer') - - @endif - @else - @if($journal->type == 'Withdrawal') - - @endif - @if($journal->type == 'Deposit') - - @endif - @if($journal->type == 'Transfer') - - @endif - @endif - - {{{$journal->description}}} - - - {!! Amount::formatJournal($journal) !!} - - - -@endforeach -
diff --git a/resources/views/list/piggy-bank-events.blade.php b/resources/views/list/piggy-bank-events.blade.php deleted file mode 100644 index e7527ed54e..0000000000 --- a/resources/views/list/piggy-bank-events.blade.php +++ /dev/null @@ -1,33 +0,0 @@ - - - @if(isset($showPiggyBank) && $showPiggyBank === true) - - @endif - - - - @foreach($events as $event) - - @if(isset($showPiggyBank) && $showPiggyBank === true) - - @endif - - - - - @endforeach -
Piggy bankDateAmount
- {{{$event->piggyBank->name}}} - - @if(!is_null($event->transaction_journal_id)) - {{$event->date->format('j F Y')}} - @else - {{$event->date->format('j F Y')}} - @endif - - @if($event->amount < 0) - Removed {{Amount::format($event->amount*-1,false)}} - @else - Added {{Amount::format($event->amount,false)}} - @endif -
diff --git a/resources/views/list/reminders.blade.php b/resources/views/list/reminders.blade.php deleted file mode 100644 index f8e1510aae..0000000000 --- a/resources/views/list/reminders.blade.php +++ /dev/null @@ -1,45 +0,0 @@ -
- @if($reminders->count() > 0) - @foreach($reminders as $reminder) -
-
- -
-

- This reminder is active between {{$reminder->startdate->format('jS F Y')}} - and {{$reminder->enddate->format('jS F Y')}}. -

- @if(isset($reminder->description)) -

{!! $reminder->description !!}

- @endif -
- -
-
- @endforeach - @else -
-

- (No reminders) -

-
- @endif -
diff --git a/resources/views/partials/date_nav.blade.php b/resources/views/partials/date_nav.blade.php deleted file mode 100644 index 28c2838b25..0000000000 --- a/resources/views/partials/date_nav.blade.php +++ /dev/null @@ -1,31 +0,0 @@ -{{-- - -
-
- - {{{Session::get('period')}}} - - -
-
- - -
-
- -
-
- -
-
---}} diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php deleted file mode 100644 index 29a371045d..0000000000 --- a/resources/views/partials/menu.blade.php +++ /dev/null @@ -1,198 +0,0 @@ - -getName();?> - - diff --git a/resources/views/piggy-banks/delete.blade.php b/resources/views/piggy-banks/delete.blade.php deleted file mode 100644 index 47c761c9b0..0000000000 --- a/resources/views/piggy-banks/delete.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $piggyBank) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'destroy','url' => route('piggy-banks.destroy',$piggyBank->id)]) !!} -
-
-
-
- Delete piggy bank "{{{$piggyBank->name}}}" -
-
-

- Are you sure? -

- -

- - Cancel -

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -{!! Form::close() !!} -@stop diff --git a/resources/views/piggy-banks/index.blade.php b/resources/views/piggy-banks/index.blade.php deleted file mode 100644 index 1451021b67..0000000000 --- a/resources/views/piggy-banks/index.blade.php +++ /dev/null @@ -1,138 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName()) !!} -
-
-

- Create new piggy bank -

-
-
-
-@foreach($piggyBanks as $piggyBank) -
-
-
- - {{{$piggyBank->name}}} - - -
-
- - -
-
- -
-
-
- -
- @if($piggyBank->savedSoFar > 0) - - @endif -
- -
-
-
percentage == 100) - class="progress-bar progress-bar-success" - @else - class="progress-bar progress-bar-info" - @endif - role="progressbar" aria-valuenow="{{$piggyBank->percentage}}" aria-valuemin="0" aria-valuemax="100" style="min-width: 40px;width: {{$piggyBank->percentage}}%;"> - {{$piggyBank->percentage}}% -
-
-
- - - -
- @if($piggyBank->leftToSave > 0) - - @endif - -
- -
-
-
- {!! Amount::format($piggyBank->savedSoFar,true) !!} -
-
- {!! Amount::format($piggyBank->targetamount,true) !!} -
-
- @if($piggyBank->leftToSave > 0) - {!! Amount::format($piggyBank->leftToSave) !!} - @endif -
-
-
-
-
-@endforeach -
- -
-
-

- Create new piggy bank -

-
-
- -
-
-
-
- Account status -
- - - - - - - - - - @foreach($accounts as $id => $info) - - - - - - - - - @endforeach -
AccountBalanceLeft for piggy banksSum of piggy banksSaved so farLeft to save
{{{$info['name']}}}{!! Amount::format($info['balance']) !!}{!! Amount::format($info['leftForPiggyBanks']) !!}{!! Amount::format($info['sumOfTargets']) !!}{!! Amount::format($info['sumOfSaved']) !!}{!! Amount::format($info['leftToSave']) !!}
-
-
-
- - - - -@stop -@section('scripts') - - - -@stop diff --git a/resources/views/related/alreadyRelated.blade.php b/resources/views/related/alreadyRelated.blade.php deleted file mode 100644 index 0940d7a770..0000000000 --- a/resources/views/related/alreadyRelated.blade.php +++ /dev/null @@ -1,63 +0,0 @@ -@if($journals->count() > 0) - - @foreach($journals as $journal) - - - - - - - - -{{-- - - - - - - -@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 - - - - --}} - @endforeach -
- - @if($journal->transactiontype->type == 'Withdrawal') - - @endif - @if($journal->transactiontype->type == 'Deposit') - - @endif - @if($journal->transactiontype->type == 'Transfer') - - @endif - {{$journal->date->format('jS M Y')}} - {{{$journal->description}}} - - @if($journal->transactiontype->type == 'Withdrawal') - {{Amount::formatTransaction($journal->transactions[0],false)}} - @endif - @if($journal->transactiontype->type == 'Deposit') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Transfer') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif -
-@else -

No related transactions

-@endif diff --git a/resources/views/related/relate.blade.php b/resources/views/related/relate.blade.php deleted file mode 100644 index 194b4d74a8..0000000000 --- a/resources/views/related/relate.blade.php +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/resources/views/related/searchResult.blade.php b/resources/views/related/searchResult.blade.php deleted file mode 100644 index 4d267a9e38..0000000000 --- a/resources/views/related/searchResult.blade.php +++ /dev/null @@ -1,39 +0,0 @@ - -@if($journals->count() > 0) - - @foreach($journals as $journal) - - - - - - - - - @endforeach -
- @if($journal->transactiontype->type == 'Withdrawal') - - @endif - @if($journal->transactiontype->type == 'Deposit') - - @endif - @if($journal->transactiontype->type == 'Transfer') - - @endif - {{$journal->date->format('jS M Y')}} - {{{$journal->description}}} - - @if($journal->transactiontype->type == 'Withdrawal') - {{Amount::formatTransaction($journal->transactions[0],false)}} - @endif - @if($journal->transactiontype->type == 'Deposit') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif - @if($journal->transactiontype->type == 'Transfer') - {{Amount::formatTransaction($journal->transactions[1],false)}} - @endif -
-@else -

No results

-@endif diff --git a/resources/views/reminders/show.blade.php b/resources/views/reminders/show.blade.php deleted file mode 100644 index 8ab199dc59..0000000000 --- a/resources/views/reminders/show.blade.php +++ /dev/null @@ -1,38 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $reminder) !!} -
-
-
- -
-

- Active between {{$reminder->startdate->format('jS F Y')}} - and {{$reminder->enddate->format('jS F Y')}}. -

- - @if(isset($reminder->description)) -

{!! $reminder->description !!}

- @endif -
- -
-
-
-@stop diff --git a/resources/views/reports/budget.blade.php b/resources/views/reports/budget.blade.php deleted file mode 100644 index c986e47c20..0000000000 --- a/resources/views/reports/budget.blade.php +++ /dev/null @@ -1,170 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!} -
-
-

- -

-
-
-
-
-
-
- - Accounts -
- - - - - - - - - @foreach($accounts as $account) - - - - - - - - @endforeach -
AccountStart of monthCurrent balanceSpentEarned
{{{$account->name}}}{!! Amount::format($account->startBalance) !!}{!! Amount::format($account->endBalance) !!} - @if($account->startBalance - $account->endBalance >= 0) - {!! Amount::format($account->startBalance - $account->endBalance) !!} - @endif - - @if($account->startBalance - $account->endBalance < 0) - {!! Amount::format(($account->startBalance - $account->endBalance)*-1) !!} - @endif -
-
-
-
-
-
-
-
- - Budgets -
- - - - - @foreach($accounts as $account) - @if($account->hide === false) - - @endif - id] = 0; - ?> - - @endforeach - - - @foreach($budgets as $id => $budget) - - - - - @foreach($accounts as $account) - @if($account->hide === false) - @if(isset($account->budgetInformation[$id])) - - budgetInformation[$id]['queryAmount']); - $accountSums[$account->id] += floatval($account->budgetInformation[$id]['queryAmount']); - ?> - @else - - @endif - @endif - @endforeach - - - - @endforeach - - - @foreach($accounts as $account) - @if($account->hide === false) - - @endif - @endforeach - - - - - @foreach($accounts as $account) - id] += $account->balancedAmount; - ?> - @if($account->hide === false) - @if(isset($account->budgetInformation[0])) - - @else - - @endif - @endif - @endforeach - - - - - @foreach($accounts as $account) - @if($account->hide === false) - - @endif - @endforeach - - - - - @foreach($accounts as $account) - @if($account->hide === false) - - @endif - @endforeach - - - -
Budgets{{{$account->name}}} - Left in budget -
{{{$budget['name']}}}{!! Amount::format($budget['queryAmount']) !!} - @if($id == 0) - - {!! Amount::format($account->budgetInformation[$id]['queryAmount']) !!} - - @else - {!! Amount::format($account->budgetInformation[$id]['queryAmount']) !!} - @endif - {!! Amount::format(0) !!}{!! Amount::format($budget['queryAmount'] + $budget['spent']) !!}{!! Amount::format($budget['queryAmount'] + $spent) !!}
Balanced by transfers - {!! Amount::format($account->balancedAmount) !!} -  
Left unbalanced - @if($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount != 0.0) - {!! Amount::format($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount) !!} - @else - {!! Amount::format($account->budgetInformation[0]['queryAmount'] + $account->balancedAmount) !!} - @endif - {!! Amount::format(0) !!} 
Sum{!! Amount::format($accountSums[$account->id]) !!} 
Expected balance{!! Amount::format($account->startBalance + $accountSums[$account->id]) !!} 
-
-
-
- - - - -@stop -@section('scripts') - -@stop diff --git a/resources/views/reports/modal-journal-list.blade.php b/resources/views/reports/modal-journal-list.blade.php deleted file mode 100644 index eb91340660..0000000000 --- a/resources/views/reports/modal-journal-list.blade.php +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/resources/views/reports/month.blade.php b/resources/views/reports/month.blade.php deleted file mode 100644 index a906fd2019..0000000000 --- a/resources/views/reports/month.blade.php +++ /dev/null @@ -1,269 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $date) !!} -
-
-

- -

-
-
-
-
-
-
- - Income -
- - - @foreach($income as $entry) - - - - - - - @endforeach - @if(isset($displaySum) && $displaySum === true) - - - - - - @endif -
- {{{$entry->description}}} - - queryAmount);?> - @if($entry->type == 'Withdrawal') - {{Amount::format($entry->queryAmount,false)}} - @endif - @if($entry->type == 'Deposit') - {{Amount::format($entry->queryAmount,false)}} - @endif - @if($entry->type == 'Transfer') - {{Amount::format($entry->queryAmount,false)}} - @endif - - {{$entry->date->format('j F Y')}} - - {{{$entry->name}}} -
Sum{!! Amount::format($tableSum) !!}
-
-
-
-
-
- - Expenses (top 10) -
- - - @foreach($expenses as $id => $expense) - - - @if($id > 0) - - @else - - @endif - - - @endforeach - - - - -
{{{$expense['name']}}}{{{$expense['name']}}}{!! Amount::format($expense['queryAmount']) !!}
Sum{!! Amount::format($sum) !!}
-
-
-
-
-
- - Sums -
- transactions[1]->amount); - } - ?> - - - - - - - - - - - - - -
In{!! Amount::format($in) !!}
Out{!! Amount::format($sum) !!}
Difference{!! Amount::format($in - $sum) !!}
-
-
-
-
-
-
-
- - Budgets -
- - - - - - - - - @foreach($budgets as $id => $budget) - - - @if($budget['queryAmount'] != 0 || $budget['spent'] != 0) - - - - - - - @endif - @endforeach - - - - - - -
BudgetEnvelopeSpentLeft
- @if($id > 0) - {{{$budget['name']}}} - @else - {{{$budget['name']}}} - @endif - {!! Amount::format($budget['queryAmount']) !!}{!! Amount::format($budget['spent'],false) !!}{!! Amount::format($budget['queryAmount'] + $budget['spent']) !!}
Sum{!! Amount::format($sumEnvelope) !!}{!! Amount::format($sumSpent) !!}{!! Amount::format($sumLeft) !!}
-
-
-
-
-
- - Categories -
- - - - - - - @foreach($categories as $id => $category) - - - - - - @endforeach - - - - -
CategorySpent
- @if($id > 0) - {{{$category['name']}}} - @else - {{{$category['name']}}} - @endif - {!! Amount::format($category['queryAmount'],false) !!}
Sum{!! Amount::format($sum) !!}
-
-
-
-
-
-
-
- - Accounts -
- - - @foreach($accounts as $id => $account) - - - - - - - - @endforeach - - - - - - -
{{{$account['name']}}}{!! Amount::format($account['startBalance']) !!}{!! Amount::format($account['endBalance']) !!}{!! Amount::format($account['difference']) !!}
Sum{!! Amount::format($sumStart) !!}{!! Amount::format($sumEnd) !!}{!! Amount::format($sumDiff) !!}
-
-
-
-
-
-
-
- - Piggy banks -
-
Body
-
-
-
-
-
-
-
- - Bills -
-
Body
-
-
-
-
-
-
-
- - Outside of budgets -
-
Body
-
-
-
-@stop -@section('scripts') - -@stop diff --git a/resources/views/search/index.blade.php b/resources/views/search/index.blade.php deleted file mode 100644 index d70e500012..0000000000 --- a/resources/views/search/index.blade.php +++ /dev/null @@ -1,106 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $query) !!} -@if(!is_null($query)) -
- @if(isset($result['transactions']) && $result['transactions']->count() > 0) -
-
-
- Transactions ({{$result['transactions']->count()}}) -
-
- @include('list.journals-tiny',['transactions' => $result['transactions']]) -
-
-
- @endif - @if(isset($result['categories']) && $result['categories']->count() > 0) -
-
-
- Categories ({{$result['categories']->count()}}) -
-
-
- @foreach($result['categories'] as $category) - - {{{$category->name}}} - - @endforeach -
-
-
-
- @endif - @if(isset($result['tags']) && $result['tags']->count() > 0) -
-
-
- Tags ({{$result['tags']->count()}}) -
-
-

Bla bla

-
-
-
- @endif - @if(isset($result['accounts']) && $result['accounts']->count() > 0) -
-
-
- Accounts ({{$result['accounts']->count()}}) -
-
-
- @foreach($result['accounts'] as $account) - - {{{$account->name}}} - - @endforeach -
-
-
-
- @endif - @if(isset($result['budgets']) && $result['budgets']->count() > 0) -
-
-
- Budgets ({{$result['budgets']->count()}}) -
-
-
- @foreach($result['budgets'] as $budget) - - {{{$budget->name}}} - - @endforeach -
-
-
-
- @endif - -
-@endif - - - -@stop -@section('scripts') - -@stop diff --git a/resources/views/transactions/create.blade.php b/resources/views/transactions/create.blade.php deleted file mode 100644 index d56f5b2cd3..0000000000 --- a/resources/views/transactions/create.blade.php +++ /dev/null @@ -1,100 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'store','url' => route('transactions.store',$what)]) !!} -{!! Form::hidden('reminder_id',Input::get('reminder_id')) !!} -{!! Form::hidden('what',$what) !!} - -
-
- -
-
- Mandatory fields -
-
- - {!! ExpandedForm::text('description') !!} - @if($what == 'deposit' || $what == 'withdrawal') - {!! ExpandedForm::select('account_id',$accounts) !!} - @endif - - - - @if($what == 'withdrawal') - {!! ExpandedForm::text('expense_account') !!} - @endif - - - @if($what == 'deposit') - {!! ExpandedForm::text('revenue_account') !!} - @endif - - - - @if($what == 'transfer') - {!! ExpandedForm::select('account_from_id',$accounts) !!} - {!! ExpandedForm::select('account_to_id',$accounts) !!} - @endif - - - - {!! ExpandedForm::amount('amount') !!} - - - {!! ExpandedForm::date('date', date('Y-m-d')) !!} -
-
-

- -

- -
-
- -
-
- Optional fields -
-
- - @if($what == 'withdrawal') - {!! ExpandedForm::select('budget_id',$budgets,0) !!} - @endif - - {!! ExpandedForm::text('category') !!} - - - - - - @if($what == 'transfer' && count($piggies) > 0) - {!! ExpandedForm::select('piggy_bank_id',$piggies) !!} - @endif -
-
- -
-
- Options -
-
- {!! ExpandedForm::optionsList('create','transaction') !!} -
-
-
-
- - -{!! Form::close() !!} - -@stop -@section('scripts') - - - -@stop diff --git a/resources/views/transactions/edit.blade.php b/resources/views/transactions/edit.blade.php deleted file mode 100644 index e955d470f2..0000000000 --- a/resources/views/transactions/edit.blade.php +++ /dev/null @@ -1,99 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) !!} -{!! Form::open(['class' => 'form-horizontal','id' => 'update','url' => route('transactions.update',$journal->id)]) !!} - - - - -
-
- -
-
- Mandatory fields -
-
- - {!! ExpandedForm::text('description',$journal->description) !!} - - - @if($what == 'deposit' || $what == 'withdrawal') - {!! ExpandedForm::select('account_id',$accounts,$data['account_id']) !!} - @endif - - - @if($what == 'withdrawal') - {!! ExpandedForm::text('expense_account',$data['expense_account']) !!} - @endif - - @if($what == 'deposit') - {!! ExpandedForm::text('revenue_account',$data['revenue_account']) !!} - @endif - - - @if($what == 'transfer') - {!! ExpandedForm::select('account_from_id',$accounts,$data['account_from_id']) !!} - {!! ExpandedForm::select('account_to_id',$accounts,$data['account_to_id']) !!} - @endif - - - {!! ExpandedForm::amount('amount',$data['amount'],['currency' => $journal->transactionCurrency]) !!} - - - {!! ExpandedForm::date('date',$data['date']) !!} -
-
- -

- -

- -
-
- -
-
- Optional fields -
-
- - @if($what == 'withdrawal') - {!! ExpandedForm::select('budget_id',$budgets,$data['budget_id']) !!} - @endif - - {!! ExpandedForm::text('category',$data['category']) !!} - - - - - @if($what == 'transfer' && count($piggies) > 0) - {!! ExpandedForm::select('piggy_bank_id',$piggies,$data['piggy_bank_id']) !!} - @endif -
-
- - -
-
- Options -
-
- {!! ExpandedForm::optionsList('update','transaction') !!} -
-
-
-
-{!! Form::close() !!} - - -@stop -@section('scripts') - - - -@stop diff --git a/resources/views/transactions/index.blade.php b/resources/views/transactions/index.blade.php deleted file mode 100644 index 98bdb293c6..0000000000 --- a/resources/views/transactions/index.blade.php +++ /dev/null @@ -1,24 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) !!} -
-
-
-
- {{{$subTitle}}} -
- @include('list.journals-full',['sorting' => false]) -
-
-
- - -@stop -@section('scripts') - - - - -@stop diff --git a/resources/views/transactions/show.blade.php b/resources/views/transactions/show.blade.php deleted file mode 100644 index 6c3e671dd3..0000000000 --- a/resources/views/transactions/show.blade.php +++ /dev/null @@ -1,157 +0,0 @@ -@extends('layouts.default') -@section('content') -{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $journal) !!} -
-
-
-
- - Metadata -
- - - - - - - - - - - - - - @foreach($journal->budgets()->get() as $budget) - - - - - @endforeach - @foreach($journal->categories()->get() as $category) - - - - - @endforeach - -
Date{{{$journal->date->format('jS F Y')}}}
Type{{{$journal->transactiontype->type}}}
Completed - @if($journal->completed == 1) - Yes - @else - No - @endif -
Budget{{{$budget->name}}}
Category{{{$category->name}}}
-
- - @if(count($journal->piggyBankEvents) > 0) -
-
- Piggy banks -
-
- @include('list.piggy-bank-events',['events' => $journal->piggyBankEvents,'showPiggyBank' => true]) -
-
- @endif -
-
- - Related transactions -
- @if($journal->transactiongroups()->count() == 0) -
-

- No related transactions -

-
- @else - - @foreach($journal->transactiongroups()->get() as $group) - - - - @foreach($group->transactionjournals()->where('transaction_journals.id','!=',$journal->id)->get() as $jrnl) - - - - - - @endforeach - - @endforeach -
Group #{{$group->id}} ({{$group->relation}})
- - - {{{$jrnl->description}}} - - @foreach($jrnl->transactions()->get() as $t) - @if($t->amount > 0) - {!! Amount::formatTransaction($t) !!} - @endif - @endforeach -
- @endif - -
-
-
- - @foreach($journal->transactions as $t) -
-
- @if($t->account->accounttype->type == 'Asset account') - - @endif - @if($t->account->accounttype->type == 'Default account') - - @endif - @if($t->account->accounttype->type == 'Expense account') - - @endif - @if($t->account->accounttype->type == 'Beneficiary account') - - @endif - - @if($t->account->accounttype->type == 'Revenue account') - - @endif - {{{$t->account->name}}}
{{{$t->account->accounttype->description}}} -
- - - - - - - - - - @if(!is_null($t->description)) - - - - - @endif -
Amount{!! Amount::formatTransaction($t) !!}
New balance{!! Amount::format($t->before) !!} → {!! Amount::format($t->after) !!}
Description{{{$t->description}}}
-
- @endforeach -
-
- -
-
- -
-
- -@stop -@section('scripts') - - -@stop diff --git a/resources/views/vendor/.gitkeep b/resources/views/vendor/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php deleted file mode 100644 index 7b2750cc6a..0000000000 --- a/resources/views/welcome.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -
-
-
Laravel 5
-
{{ Inspiring::quote() }}
-
-
- - diff --git a/tests/TestCase.php b/tests/TestCase.php index cc436f7446..9c2541fa8f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,7 @@ code = 'EUR'; + $currency->save(); + Log::debug('Created new EUR currency.'); } else { if (file_exists($copy)) { copy($copy, $original); @@ -45,7 +57,16 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase } // if the database copy does exists, copy back as original. - FactoryMuffin::loadFactories(__DIR__ . '/factories'); + $this->session( + [ + 'start' => Carbon::now()->startOfMonth(), + 'end' => Carbon::now()->endOfMonth(), + 'first' => Carbon::now()->startOfYear() + ] + ); + + + } diff --git a/tests/controllers/AccountControllerTest.php b/tests/controllers/AccountControllerTest.php index 58b908c640..d89449d252 100644 --- a/tests/controllers/AccountControllerTest.php +++ b/tests/controllers/AccountControllerTest.php @@ -69,6 +69,7 @@ class AccountControllerTest extends TestCase $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency); Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/accounts/create/asset'); $this->assertResponseOk(); @@ -127,6 +128,7 @@ class AccountControllerTest extends TestCase $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency); Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); // get edit page: $this->call('GET', '/accounts/edit/' . $this->account->id); @@ -153,7 +155,7 @@ class AccountControllerTest extends TestCase $repository->shouldReceive('getLastActivity')->andReturn(null); Amount::shouldReceive('format')->andReturn(''); - Amount::shouldReceive('getCurrencyCode')->once()->andReturn('A'); + Amount::shouldReceive('getCurrencyCode')->andReturn('A'); // put stuff in session: @@ -172,7 +174,7 @@ class AccountControllerTest extends TestCase $this->be($this->account->user); // mock! - Amount::shouldReceive('getCurrencyCode')->once()->andReturn('A'); + Amount::shouldReceive('getCurrencyCode')->andReturn('A'); $repository = $this->mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); $repository->shouldReceive('getJournals')->andReturn(new LengthAwarePaginator([], 0, 10)); diff --git a/tests/controllers/BillControllerTest.php b/tests/controllers/BillControllerTest.php index eab8b1c0f6..e664a5929a 100644 --- a/tests/controllers/BillControllerTest.php +++ b/tests/controllers/BillControllerTest.php @@ -72,6 +72,7 @@ class BillControllerTest extends TestCase $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency); Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/bills/create'); $this->assertViewHas('subTitle', 'Create new'); @@ -111,6 +112,7 @@ class BillControllerTest extends TestCase $currency = FactoryMuffin::create('FireflyIII\Models\TransactionCurrency'); Amount::shouldReceive('getDefaultCurrency')->once()->andReturn($currency); Amount::shouldReceive('getAllCurrencies')->once()->andReturn([$currency]); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/bills/edit/' . $bill->id); $this->assertViewHas('subTitle', 'Edit "' . e($bill->name) . '"'); @@ -126,6 +128,7 @@ class BillControllerTest extends TestCase $collection->push($bill); Amount::shouldReceive('format')->andReturn('XX'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $repository = $this->mock('FireflyIII\Repositories\Bill\BillRepositoryInterface'); $repository->shouldReceive('getBills')->once()->andReturn($collection); @@ -187,6 +190,8 @@ class BillControllerTest extends TestCase Amount::shouldReceive('format')->andReturn('XX'); Amount::shouldReceive('getCurrencyCode')->andReturn('XX'); + + $this->call('GET', '/bills/show/' . $bill->id); } diff --git a/tests/controllers/BudgetControllerTest.php b/tests/controllers/BudgetControllerTest.php index 50ea295ca7..edacbcd133 100644 --- a/tests/controllers/BudgetControllerTest.php +++ b/tests/controllers/BudgetControllerTest.php @@ -1,5 +1,6 @@ shouldReceive('getCurrentRepetition')->once(); Amount::shouldReceive('getCurrencySymbol')->andReturn('x'); Amount::shouldReceive('format')->andReturn('x'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/budgets'); $this->assertResponseOk(); @@ -155,9 +157,11 @@ class BudgetControllerTest extends TestCase $repository = $this->mock('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); $this->be($budget->user); + $paginator = new LengthAwarePaginator(new Collection, 0, 20, 1); + Amount::shouldReceive('getCurrencyCode')->andReturn('x'); Amount::shouldReceive('format')->andReturn('x'); - $repository->shouldReceive('getJournals')->andReturn(new Collection); + $repository->shouldReceive('getJournals')->andReturn($paginator); $repository->shouldReceive('getBudgetLimits')->andReturn(new Collection); @@ -304,6 +308,9 @@ class BudgetControllerTest extends TestCase $pref = FactoryMuffin::create('FireflyIII\Models\Preference'); Preferences::shouldReceive('get')->withArgs(['budgetIncomeTotal' . $date, 1000])->andReturn($pref); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); + Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); + $this->call('GET', '/budgets/income'); $this->assertResponseOk(); diff --git a/tests/controllers/CategoryControllerTest.php b/tests/controllers/CategoryControllerTest.php index 0a13d671d6..c4ca304ce6 100644 --- a/tests/controllers/CategoryControllerTest.php +++ b/tests/controllers/CategoryControllerTest.php @@ -57,7 +57,7 @@ class CategoryControllerTest extends TestCase $this->call('GET', '/categories/delete/' . $category->id); $this->assertResponseOk(); - $this->assertViewHas('subTitle', 'Delete category' . e($category->name) . '"'); + $this->assertViewHas('subTitle', 'Delete category "' . e($category->name) . '"'); } public function testDestroy() diff --git a/tests/controllers/JsonControllerTest.php b/tests/controllers/JsonControllerTest.php index 0f8390d6cc..e8dd10ae38 100644 --- a/tests/controllers/JsonControllerTest.php +++ b/tests/controllers/JsonControllerTest.php @@ -56,6 +56,7 @@ class JsonControllerTest extends TestCase $accounts->shouldReceive('getCreditCards')->andReturn($ccs); $accounts->shouldReceive('getTransfersInRange')->andReturn(new Collection); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); Steam::shouldReceive('balance')->andReturn(0); @@ -83,6 +84,7 @@ class JsonControllerTest extends TestCase $bills->shouldReceive('createFakeBill')->andReturn($bill); $accounts->shouldReceive('getCreditCards')->andReturn($ccs); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); Steam::shouldReceive('balance')->andReturn(-1); $this->call('GET', '/json/box/bills-unpaid'); @@ -97,6 +99,7 @@ class JsonControllerTest extends TestCase $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface'); $repository->shouldReceive('incomeByPeriod')->andReturn(new Collection); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/json/box/in'); $this->assertResponseOk(); @@ -110,6 +113,7 @@ class JsonControllerTest extends TestCase $repository = $this->mock('FireflyIII\Helpers\Report\ReportQueryInterface'); $repository->shouldReceive('journalsByExpenseAccount')->andReturn(new Collection); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/json/box/out'); $this->assertResponseOk(); @@ -128,6 +132,24 @@ class JsonControllerTest extends TestCase $this->assertResponseOk(); } + public function testTags() + { + $user = FactoryMuffin::create('FireflyIII\User'); + $this->be($user); + $tag = FactoryMuffin::create('FireflyIII\Models\Tag'); + $tag->user()->associate($user); + + $tag->save(); + $this->be($tag->user); + $tags = new Collection([$tag]); + + $repository = $this->mock('FireflyIII\Repositories\Tag\TagRepositoryInterface'); + $repository->shouldReceive('get')->andReturn($tags); + + $this->call('GET', '/json/tags'); + $this->assertResponseOk(); + } + public function testExpenseAccounts() { $account = FactoryMuffin::create('FireflyIII\Models\Account'); diff --git a/tests/controllers/PiggyBankControllerTest.php b/tests/controllers/PiggyBankControllerTest.php index 63964eb163..ce88e952c2 100644 --- a/tests/controllers/PiggyBankControllerTest.php +++ b/tests/controllers/PiggyBankControllerTest.php @@ -1,4 +1,5 @@ mock('FireflyIII\Repositories\Account\AccountRepositoryInterface'); $repository->shouldReceive('leftOnAccount')->withAnyArgs()->andReturn(12); Amount::shouldReceive('format')->andReturn('XXxx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); + Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); $this->call('GET', '/piggy-banks/add/' . $piggyBank->id); $this->assertResponseOk(); @@ -93,8 +96,7 @@ class PiggyBankControllerTest extends TestCase public function testDestroy() { $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); - $user = FactoryMuffin::create('FireflyIII\User'); - $this->be($user); + $this->be($piggyBank->account->user); $repository = $this->mock('FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface'); $repository->shouldReceive('destroy')->once()->withAnyArgs()->andReturn(true); @@ -109,8 +111,9 @@ class PiggyBankControllerTest extends TestCase public function testEdit() { $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); - $user = FactoryMuffin::create('FireflyIII\User'); - $this->be($user); + $piggyBank->targetdate = Carbon::now()->addYear(); + $piggyBank->save(); + $this->be($piggyBank->account->user); $account = FactoryMuffin::create('FireflyIII\Models\Account'); $collection = new Collection([$account]); @@ -135,8 +138,7 @@ class PiggyBankControllerTest extends TestCase public function testEditNullDate() { $piggyBank = FactoryMuffin::create('FireflyIII\Models\PiggyBank'); - $user = FactoryMuffin::create('FireflyIII\User'); - $this->be($user); + $this->be($piggyBank->account->user); $piggyBank->targetdate = null; $piggyBank->save(); $account = FactoryMuffin::create('FireflyIII\Models\Account'); @@ -182,6 +184,7 @@ class PiggyBankControllerTest extends TestCase Steam::shouldReceive('balance')->andReturn(20); $accounts->shouldReceive('leftOnAccount')->andReturn(12); Amount::shouldReceive('format')->andReturn('123'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('GET', '/piggy-banks'); @@ -221,6 +224,7 @@ class PiggyBankControllerTest extends TestCase $piggyBanks->shouldReceive('createEvent')->once(); Amount::shouldReceive('format')->andReturn('something'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe']); $this->assertResponseStatus(302); @@ -238,6 +242,7 @@ class PiggyBankControllerTest extends TestCase $piggyBanks->shouldReceive('createEvent')->once(); Amount::shouldReceive('format')->andReturn('something'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); $this->call('POST', '/piggy-banks/add/' . $piggyBank->id, ['_token' => 'replaceMe', 'amount' => '10000']); $this->assertResponseStatus(302); @@ -286,6 +291,8 @@ class PiggyBankControllerTest extends TestCase $this->be($piggyBank->account->user); Amount::shouldReceive('format')->andReturn('something'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); + Amount::shouldReceive('getCurrencySymbol')->andReturn('X'); $this->call('GET', '/piggy-banks/remove/' . $piggyBank->id); $this->assertResponseOk(); diff --git a/tests/controllers/PreferencesControllerTest.php b/tests/controllers/PreferencesControllerTest.php index 02f61910d6..af27739081 100644 --- a/tests/controllers/PreferencesControllerTest.php +++ b/tests/controllers/PreferencesControllerTest.php @@ -55,6 +55,7 @@ class PreferencesControllerTest extends TestCase Preferences::shouldReceive('get')->once()->withArgs(['budgetMaximum', 1000])->andReturn($pref); Preferences::shouldReceive('get')->once()->withArgs(['currencyPreference', 'EUR'])->andReturn($pref); Amount::shouldReceive('format')->andReturn('xx'); + Amount::shouldReceive('getCurrencyCode')->andReturn('X'); Amount::shouldReceive('getAllCurrencies')->andReturn(new Collection); Amount::shouldReceive('getDefaultCurrency')->andReturn($currency); diff --git a/tests/factories/all.php b/tests/factories/all.php index 0a6d507a1a..85e4683a13 100644 --- a/tests/factories/all.php +++ b/tests/factories/all.php @@ -66,6 +66,21 @@ FactoryMuffin::define( ] ); +FactoryMuffin::define( + 'FireflyIII\Models\Tag', + [ + 'description' => 'sentence', + 'user_id' => 'factory|FireflyIII\User', + 'tag' => function () { + return RandomString::generateRandomString(20); + }, + 'tagMode' => 'nothing', + 'date' => 'date', + 'latitude' => 12, + 'longitude' => 13, + ] +); + FactoryMuffin::define( 'FireflyIII\Models\Budget', [