From d34cc65984217c7c435ee89745909815d29e2712 Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 12 Nov 2014 14:38:32 +0100 Subject: [PATCH] Start cleaning up transactions controller. --- app/controllers/GoogleChartController.php | 2 +- app/controllers/HomeController.php | 21 +- app/controllers/TransactionController.php | 90 ++--- app/lib/FireflyIII/Form/Form.php | 379 ++++++++++++++++++ .../Shared/SingleTableInheritanceEntity.php | 121 ++++++ app/models/Component.php | 2 +- app/models/LimitRepetition.php | 11 +- app/models/Reminder.php | 1 - app/models/Transaction.php | 26 +- app/start/global.php | 18 +- app/tests/TestCase.php | 1 - .../{list.blade.php => index.blade.php} | 12 +- app/views/user/register.blade.php | 2 +- .../assets/javascript/firefly/transactions.js | 103 ----- 14 files changed, 585 insertions(+), 204 deletions(-) create mode 100644 app/lib/FireflyIII/Form/Form.php create mode 100644 app/lib/FireflyIII/Shared/SingleTableInheritanceEntity.php rename app/views/transactions/{list.blade.php => index.blade.php} (66%) diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php index 0d5f79e7d3..281bc124db 100644 --- a/app/controllers/GoogleChartController.php +++ b/app/controllers/GoogleChartController.php @@ -371,7 +371,7 @@ class GoogleChartController extends BaseController /** * @return \Illuminate\Http\JsonResponse - * @throws \Firefly\Exception\FireflyException + * @throws \FireflyIII\Exception\FireflyException */ public function recurringTransactionsOverview() { diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index 56d61564ef..833ea0a044 100644 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -4,20 +4,9 @@ use FireflyIII\Shared\Preferences\PreferencesInterface as Prefs; /** * Class HomeController * - * @SuppressWarnings(PHPMD.CamelCasePropertyName) */ class HomeController extends BaseController { - protected $_preferences; - - /** - * @param Prefs $preferences - */ - public function __construct(Prefs $preferences) - { - $this->_preferences = $preferences; - } - /** * @return \Illuminate\Http\RedirectResponse */ @@ -52,8 +41,11 @@ class HomeController extends BaseController $valid = ['1D', '1W', '1M', '3M', '6M', '1Y',]; + /** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */ + $preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface'); + if (in_array($range, $valid)) { - $this->_preferences->set('viewRange', $range); + $preferences->set('viewRange', $range); Session::forget('range'); } return Redirect::back(); @@ -85,6 +77,9 @@ class HomeController extends BaseController /** @var \FireflyIII\Database\TransactionJournal $jrnls */ $jrnls = App::make('FireflyIII\Database\TransactionJournal'); + /** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */ + $preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface'); + $count = $acct->countAssetAccounts(); $start = Session::get('start'); @@ -92,7 +87,7 @@ class HomeController extends BaseController // get the preference for the home accounts to show: - $frontpage = $this->_preferences->get('frontpageAccounts', []); + $frontpage = $preferences->get('frontpageAccounts', []); if ($frontpage->data == []) { $accounts = $acct->getAssetAccounts(); } else { diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 0f9fe231c1..26154381ed 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -2,6 +2,7 @@ use FireflyIII\Exception\FireflyException; +use FireflyIII\Exception\NotImplementedException; use Illuminate\Support\MessageBag; /** @@ -30,31 +31,30 @@ class TransactionController extends BaseController */ public function create($what = 'deposit') { - throw new NotImplementedException; /* * The repositories we need: */ - /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ - $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); + /** @var \FireflyIII\Shared\Toolkit\Form $form */ + $form = App::make('FireflyIII\Shared\Toolkit\Form'); - /** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */ - $accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface'); + /** @var \FireflyIII\Database\Account $accountRepository */ + $accountRepository = App::make('FireflyIII\Database\Account'); - /** @var \Firefly\Storage\Budget\BudgetRepositoryInterface $budgetRepository */ - $budgetRepository = App::make('Firefly\Storage\Budget\BudgetRepositoryInterface'); + /** @var \FireflyIII\Database\Budget $budgetRepository */ + $budgetRepository = App::make('FireflyIII\Database\Budget'); - /** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */ - $piggyRepository = App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface'); + /** @var \FireflyIII\Database\Piggybank $piggyRepository */ + $piggyRepository = App::make('FireflyIII\Database\Piggybank'); // get asset accounts with names and id's. - $assetAccounts = $toolkit->makeSelectList($accountRepository->getActiveDefault()); + $assetAccounts = $form->makeSelectList($accountRepository->getAssetAccounts()); // get budgets as a select list. - $budgets = $toolkit->makeSelectList($budgetRepository->get()); + $budgets = $form->makeSelectList($budgetRepository->get()); $budgets[0] = '(no budget)'; // get the piggy banks. - $piggies = $toolkit->makeSelectList($piggyRepository->get()); + $piggies = $form->makeSelectList($piggyRepository->get()); $piggies[0] = '(no piggy bank)'; /* @@ -100,19 +100,21 @@ class TransactionController extends BaseController */ public function destroy(TransactionJournal $transactionJournal) { - throw new NotImplementedException; $type = $transactionJournal->transactionType->type; - $transactionJournal->delete(); + + /** @var \FireflyIII\Database\TransactionJournal $repository */ + $repository = App::make('FireflyIII\Database\TransactionJournal'); + $repository->destroy($transactionJournal); switch ($type) { case 'Withdrawal': - return Redirect::route('transactions.expenses'); + return Redirect::route('transactions.index', 'withdrawal'); break; case 'Deposit': - return Redirect::route('transactions.revenue'); + return Redirect::route('transactions.index', 'deposit'); break; case 'Transfer': - return Redirect::route('transactions.transfers'); + return Redirect::route('transactions.index', 'transfers'); break; } } @@ -126,30 +128,30 @@ class TransactionController extends BaseController */ public function edit(TransactionJournal $journal) { - throw new NotImplementedException; /* * All the repositories we need: */ - /** @var \Firefly\Helper\Toolkit\Toolkit $toolkit */ - $toolkit = App::make('Firefly\Helper\Toolkit\Toolkit'); + /** @var \FireflyIII\Shared\Toolkit\Form $form */ + $form = App::make('FireflyIII\Shared\Toolkit\Form'); - /** @var \Firefly\Storage\Account\AccountRepositoryInterface $accountRepository */ - $accountRepository = App::make('Firefly\Storage\Account\AccountRepositoryInterface'); + /** @var \FireflyIII\Database\Account $accountRepository */ + $accountRepository = App::make('FireflyIII\Database\Account'); - /** @var \Firefly\Storage\Budget\BudgetRepositoryInterface $budgetRepository */ - $budgetRepository = App::make('Firefly\Storage\Budget\BudgetRepositoryInterface'); + /** @var \FireflyIII\Database\Budget $budgetRepository */ + $budgetRepository = App::make('FireflyIII\Database\Budget'); + + /** @var \FireflyIII\Database\Piggybank $piggyRepository */ + $piggyRepository = App::make('FireflyIII\Database\Piggybank'); - /** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */ - $piggyRepository = App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface'); // type is useful for display: $what = strtolower($journal->transactiontype->type); // get asset accounts with names and id's. - $accounts = $toolkit->makeSelectList($accountRepository->getActiveDefault()); + $accounts = $form->makeSelectList($accountRepository->getAssetAccounts()); // get budgets as a select list. - $budgets = $toolkit->makeSelectList($budgetRepository->get()); + $budgets = $form->makeSelectList($budgetRepository->get()); $budgets[0] = '(no budget)'; /* @@ -157,8 +159,8 @@ class TransactionController extends BaseController * of the transactions in the journal has this field, it should all fill in nicely. */ // get the piggy banks. - $piggies = $toolkit->makeSelectList($piggyRepository->get()); - $piggies[0] = '(no piggy bank)'; + $piggies = $form->makeSelectList($piggyRepository->get()); + $piggies[0] = '(no piggy bank)'; $piggyBankId = 0; foreach ($journal->transactions as $t) { if (!is_null($t->piggybank_id)) { @@ -190,23 +192,23 @@ class TransactionController extends BaseController */ switch ($what) { case 'withdrawal': - $prefilled['account_id'] = $journal->transactions[0]->account->id; + $prefilled['account_id'] = $journal->transactions[0]->account->id; $prefilled['expense_account'] = $journal->transactions[1]->account->name; - $prefilled['amount'] = floatval($journal->transactions[1]->amount); - $budget = $journal->budgets()->first(); + $prefilled['amount'] = floatval($journal->transactions[1]->amount); + $budget = $journal->budgets()->first(); if (!is_null($budget)) { $prefilled['budget_id'] = $budget->id; } break; case 'deposit': - $prefilled['account_id'] = $journal->transactions[1]->account->id; + $prefilled['account_id'] = $journal->transactions[1]->account->id; $prefilled['revenue_account'] = $journal->transactions[0]->account->name; - $prefilled['amount'] = floatval($journal->transactions[1]->amount); + $prefilled['amount'] = floatval($journal->transactions[1]->amount); break; case 'transfer': $prefilled['account_from_id'] = $journal->transactions[1]->account->id; - $prefilled['account_to_id'] = $journal->transactions[0]->account->id; - $prefilled['amount'] = floatval($journal->transactions[1]->amount); + $prefilled['account_to_id'] = $journal->transactions[0]->account->id; + $prefilled['amount'] = floatval($journal->transactions[1]->amount); break; } @@ -264,7 +266,7 @@ class TransactionController extends BaseController /* * Collect data to process: */ - $data = Input::except(['_token']); + $data = Input::except(['_token']); $data['what'] = $what; switch (Input::get('post_submit_action')) { @@ -312,11 +314,9 @@ class TransactionController extends BaseController } } - public function transfers() + public function index($what) { - return View::make('transactions.list')->with('subTitle', 'Transfers')->with( - 'subTitleIcon', 'fa-arrows-h' - )->with('what', 'transfers'); + return View::make('transactions.index')->with('subTitle', 'Bla bla')->with('subTitleIcon', 'fa-arrows-h')->with('what', $what); } @@ -331,7 +331,7 @@ class TransactionController extends BaseController switch (Input::get('post_submit_action')) { case 'update': case 'return_to_edit': - $what = strtolower($journal->transactionType->type); + $what = strtolower($journal->transactionType->type); $messageBag = $this->_helper->update($journal, Input::all()); if ($messageBag->count() == 0) { // has been saved, return to index: @@ -353,9 +353,9 @@ class TransactionController extends BaseController break; case 'validate_only': - $data = Input::all(); + $data = Input::all(); $data['what'] = strtolower($journal->transactionType->type); - $messageBags = $this->_helper->validate($data); + $messageBags = $this->_helper->validate($data); Session::flash('warnings', $messageBags['warnings']); Session::flash('successes', $messageBags['successes']); diff --git a/app/lib/FireflyIII/Form/Form.php b/app/lib/FireflyIII/Form/Form.php new file mode 100644 index 0000000000..ad7483cc07 --- /dev/null +++ b/app/lib/FireflyIII/Form/Form.php @@ -0,0 +1,379 @@ + 'Amount (min)', + 'amount_max' => 'Amount (max)', + 'match' => 'Matches on', + 'repeat_freq' => 'Repetition', + 'account_from_id' => 'Account from', + 'account_to_id' => 'Account to', + 'account_id' => 'Asset account' + ]; + + return isset($labels[$name]) ? $labels[$name] : str_replace('_', ' ', ucfirst($name)); + + } + + /** + * Return buttons for update/validate/return. + * + * @param $type + * @param $name + */ + public static function ffOptionsList($type, $name) + { + $previousValue = \Input::old('post_submit_action'); + $previousValue = is_null($previousValue) ? 'store' : $previousValue; + /* + * Store. + */ + $store = ''; + switch ($type) { + case 'create': + $store = '
'; + $store .= '
'; + break; + case 'update': + $store = '
'; + $store .= '
'; + break; + default: + throw new FireflyException('Cannot create ffOptionsList for option (store) ' . $type); + break; + } + + /* + * validate is always the same: + */ + $validate = '
'; + + /* + * Store & return: + */ + switch ($type) { + case 'create': + $return = '
'; + break; + case 'update': + $return = '
'; + break; + default: + throw new FireflyException('Cannot create ffOptionsList for option (store+return) ' . $type); + break; + } + return $store . $validate . $return; + } + + /** + * @param $type + * @param $name + * @param null $value + * @param array $options + * @param array $list + * + * @return string + * @throws FireflyException + */ + public static function ffInput($type, $name, $value = null, array $options = array(), $list = []) + { + /* + * add some defaults to this method: + */ + $options['class'] = 'form-control'; + $options['id'] = 'ffInput_' . $name; + $options['autocomplete'] = 'off'; + $label = self::label($name, $options); + /* + * Make label and placeholder look nice. + */ + $options['placeholder'] = ucfirst($name); + + /* + * Get prefilled value: + */ + if (\Session::has('prefilled')) { + $prefilled = \Session::get('prefilled'); + $value = isset($prefilled[$name]) && is_null($value) ? $prefilled[$name] : $value; + } + + /* + * Get the value. + */ + if (!is_null(\Input::old($name))) { + /* + * Old value overrules $value. + */ + $value = \Input::old($name); + } + + /* + * Get errors, warnings and successes from session: + */ + /** @var MessageBag $errors */ + $errors = \Session::get('errors'); + + /** @var MessageBag $warnings */ + $warnings = \Session::get('warnings'); + + /** @var MessageBag $successes */ + $successes = \Session::get('successes'); + + + /* + * If errors, add some more classes. + */ + switch (true) { + case (!is_null($errors) && $errors->has($name)): + $classes = 'form-group has-error has-feedback'; + break; + case (!is_null($warnings) && $warnings->has($name)): + $classes = 'form-group has-warning has-feedback'; + break; + case (!is_null($successes) && $successes->has($name)): + $classes = 'form-group has-success has-feedback'; + break; + default: + $classes = 'form-group'; + break; + } + + /* + * Add some HTML. + */ + $html = '
'; + $html .= ''; + $html .= '
'; + + + /* + * Switch input type: + */ + unset($options['label']); + switch ($type) { + case 'text': + $html .= \Form::input('text', $name, $value, $options); + break; + case 'amount': + $html .= '
'; + $html .= \Form::input('number', $name, $value, $options); + $html .= '
'; + break; + case 'number': + $html .= \Form::input('number', $name, $value, $options); + break; + case 'checkbox': + $checked = $options['checked']; + unset($options['checked'], $options['placeholder'], $options['autocomplete'], $options['class']); + $html .= '
'; + + + break; + case 'date': + $html .= \Form::input('date', $name, $value, $options); + break; + case 'select': + $html .= \Form::select($name, $list, $value, $options); + break; + default: + throw new FireflyException('Cannot handle type "' . $type . '" in FFFormBuilder.'); + break; + } + + /* + * If errors, respond to them: + */ + + if (!is_null($errors)) { + if ($errors->has($name)) { + $html .= ''; + $html .= '

' . e($errors->first($name)) . '

'; + } + } + unset($errors); + /* + * If warnings, respond to them: + */ + + if (!is_null($warnings)) { + if ($warnings->has($name)) { + $html .= ''; + $html .= '

' . e($warnings->first($name)) . '

'; + } + } + unset($warnings); + + /* + * If successes, respond to them: + */ + + if (!is_null($successes)) { + if ($successes->has($name)) { + $html .= ''; + $html .= '

' . e($successes->first($name)) . '

'; + } + } + unset($successes); + + $html .= '
'; + $html .= '
'; + + return $html; + + } +} \ No newline at end of file diff --git a/app/lib/FireflyIII/Shared/SingleTableInheritanceEntity.php b/app/lib/FireflyIII/Shared/SingleTableInheritanceEntity.php new file mode 100644 index 0000000000..9787e02e40 --- /dev/null +++ b/app/lib/FireflyIII/Shared/SingleTableInheritanceEntity.php @@ -0,0 +1,121 @@ +mapData((array)$attributes)->newInstance([], true); + $instance->setRawAttributes((array)$attributes, true); + + return $instance; + } + + + /** + * if no subclass is defined, function as normal + * + * @param array $attributes + * + * @return \Illuminate\Database\Eloquent\Model|static + */ + public function mapData(array $attributes) + { + if (!$this->subclassField) { + return $this->newInstance(); + } + + return new $attributes[$this->subclassField]; + } + + + /** + * + * instead of using $this->newInstance(), call + * newInstance() on the object from mapData + * + * @param bool $excludeDeleted + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newQuery($excludeDeleted = true) + { + // If using Laravel 4.0.x then use the following commented version of this command + // $builder = new Builder($this->newBaseQueryBuilder()); + // newEloquentBuilder() was added in 4.1 + $builder = $this->newEloquentBuilder($this->newBaseQueryBuilder()); + + // Once Firefly has the query builders, it will set the model instances so the + // builder can easily access any information it may need from the model + // while it is constructing and executing various queries against it. + $builder->setModel($this)->with($this->with); + + if ($excludeDeleted && $this->softDelete) { + $builder->whereNull($this->getQualifiedDeletedAtColumn()); + } + + if ($this->subclassField && $this->isSubclass()) { + $builder->where($this->subclassField, '=', get_class($this)); + } + + return $builder; + } + + /** + * @return bool + */ + public function isSubclass() + { + return $this->isSubclass; + } + + /** + * ensure that the subclass field is assigned on save + * + * @param array $rules + * @param array $customMessages + * @param array $options + * @param callable $beforeSave + * @param callable $afterSave + * + * @return bool + */ + public function save( + array $rules = [], + array $customMessages = [], + array $options = [], + \Closure $beforeSave = null, + \Closure $afterSave = null + ) { + if ($this->subclassField) { + $this->attributes[$this->subclassField] = get_class($this); + } + + return parent::save($rules, $customMessages, $options, $beforeSave, $afterSave); + } +} \ No newline at end of file diff --git a/app/models/Component.php b/app/models/Component.php index 9337fcced7..f0905fcb84 100644 --- a/app/models/Component.php +++ b/app/models/Component.php @@ -1,5 +1,5 @@ repeat_freq) { default: - throw new \Firefly\Exception\FireflyException( - 'No date formats for frequency "' . $this->repeat_freq - . '"!' - ); + throw new FireflyException('No date formats for frequency "' . $this->repeat_freq . '"!'); break; case 'daily': return $this->startdate->format('Ymd') . '-5'; @@ -119,10 +117,7 @@ class LimitRepetition extends Ardent } switch ($this->repeat_freq) { default: - throw new \Firefly\Exception\FireflyException( - 'No date formats for frequency "' . $this->repeat_freq - . '"!' - ); + throw new FireflyException('No date formats for frequency "' . $this->repeat_freq . '"!'); break; case 'daily': return $this->startdate->format('j F Y'); diff --git a/app/models/Reminder.php b/app/models/Reminder.php index c2fb74936c..0d11a174f5 100644 --- a/app/models/Reminder.php +++ b/app/models/Reminder.php @@ -1,7 +1,6 @@ account_id == $piggybank->account_id) { - $this->piggybank()->associate($piggybank); - $this->save(); - \Event::fire('piggybanks.createRelatedTransfer', [$piggybank, $this->transactionJournal, $this]); - return true; - } - return false; + throw new NotImplementedException; +// if (is_null($piggybank)) { +// return true; +// } +// /** @var \Firefly\Storage\Piggybank\PiggybankRepositoryInterface $piggyRepository */ +// $piggyRepository = \App::make('Firefly\Storage\Piggybank\PiggybankRepositoryInterface'); +// if ($this->account_id == $piggybank->account_id) { +// $this->piggybank()->associate($piggybank); +// $this->save(); +// \Event::fire('piggybanks.createRelatedTransfer', [$piggybank, $this->transactionJournal, $this]); +// return true; +// } +// return false; } /** diff --git a/app/start/global.php b/app/start/global.php index 10109df498..6968b4dfba 100644 --- a/app/start/global.php +++ b/app/start/global.php @@ -74,47 +74,47 @@ App::down( // forms: \Form::macro( 'ffText', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffText($name, $value, $options); + return \FireflyIII\Form\Form::ffText($name, $value, $options); } ); \Form::macro( 'ffSelect', function ($name, array $list = [], $selected = null, array $options = []) { - return \Firefly\Form\Form::ffSelect($name, $list, $selected, $options); + return \FireflyIII\Form\Form::ffSelect($name, $list, $selected, $options); } ); \Form::macro( 'ffInteger', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffInteger($name, $value, $options); + return \FireflyIII\Form\Form::ffInteger($name, $value, $options); } ); \Form::macro( 'ffAmount', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffAmount($name, $value, $options); + return \FireflyIII\Form\Form::ffAmount($name, $value, $options); } ); \Form::macro( 'ffBalance', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffBalance($name, $value, $options); + return \FireflyIII\Form\Form::ffBalance($name, $value, $options); } ); \Form::macro( 'ffDate', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffDate($name, $value, $options); + return \FireflyIII\Form\Form::ffDate($name, $value, $options); } ); \Form::macro( 'ffTags', function ($name, $value = null, array $options = []) { - return \Firefly\Form\Form::ffTags($name, $value, $options); + return \FireflyIII\Form\Form::ffTags($name, $value, $options); } ); \Form::macro( 'ffCheckbox', function ($name, $value = 1, $checked = null, $options = []) { - return \Firefly\Form\Form::ffCheckbox($name, $value, $checked, $options); + return \FireflyIII\Form\Form::ffCheckbox($name, $value, $checked, $options); } ); \Form::macro( 'ffOptionsList', function ($type, $name) { - return \Firefly\Form\Form::ffOptionsList($type, $name); + return \FireflyIII\Form\Form::ffOptionsList($type, $name); } ); diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php index f6230dd2ef..872cc48bcc 100644 --- a/app/tests/TestCase.php +++ b/app/tests/TestCase.php @@ -11,7 +11,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase * Creates the application. * * @return \Symfony\Component\HttpKernel\HttpKernelInterface - * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function createApplication() { diff --git a/app/views/transactions/list.blade.php b/app/views/transactions/index.blade.php similarity index 66% rename from app/views/transactions/list.blade.php rename to app/views/transactions/index.blade.php index 729a7d2263..f96f23b171 100644 --- a/app/views/transactions/list.blade.php +++ b/app/views/transactions/index.blade.php @@ -7,7 +7,8 @@ {{{$subTitle}}}
- +
+ @@ -29,14 +30,7 @@ @stop @section('scripts') -{{HTML::script('assets/javascript/typeahead/bootstrap3-typeahead.min.js')}} -{{HTML::script('assets/javascript/datatables/jquery.dataTables.min.js')}} -{{HTML::script('assets/javascript/datatables/dataTables.bootstrap.js')}} {{HTML::script('assets/javascript/firefly/transactions.js')}} -@stop -@section('styles') -{{HTML::style('assets/stylesheets/datatables/dataTables.bootstrap.css')}} @stop \ No newline at end of file diff --git a/app/views/user/register.blade.php b/app/views/user/register.blade.php index c067e57389..0b012cb628 100644 --- a/app/views/user/register.blade.php +++ b/app/views/user/register.blade.php @@ -11,7 +11,7 @@ Registering an account on Firefly requires an e-mail address. All instructions will be sent to you.

- {{Form::open()}} + {{Form::open(['id' => 'register'])}}
diff --git a/public/assets/javascript/firefly/transactions.js b/public/assets/javascript/firefly/transactions.js index 98ca8a33ed..39bb0507ec 100644 --- a/public/assets/javascript/firefly/transactions.js +++ b/public/assets/javascript/firefly/transactions.js @@ -15,108 +15,5 @@ if ($('input[name="category"]').length > 0) { } $(document).ready(function () { - $('#transactionTable').DataTable( - { - serverSide: true, - ajax: URL, - paging: true, - processing: true, - order: [], - "lengthMenu": [[50, 100, 250, -1], [50, 100, 250, "All"]], - columns: [ - { - name: 'date', - data: 'date', - searchable: false - }, - { - name: 'description', - data: 'description', - render: function (data, type, full, meta) { - var icon = ''; - if (display == 'expenses') { - icon = 'glyphicon-arrow-left'; - } - if (display == 'revenue') { - icon = 'glyphicon-arrow-right'; - } - if (display == 'transfers') { - icon = 'glyphicon-resize-full'; - } - return ' ' + - '' + data.description + ''; - } - }, - { - name: 'amount', - data: 'amount', - 'title': 'Amount (\u20AC)', - searchable: false, - render: function (data, type, full, meta) { - if (display == 'expenses') { - return '\u20AC ' + data.toFixed(2) + ''; - } - if (display == 'revenue') { - return '\u20AC ' + data.toFixed(2) + ''; - } - if (display == 'transfers') { - return '\u20AC ' + data.toFixed(2) + ''; - } - } - }, - { - name: 'from', - data: 'from', - searchable: false, - render: function (data, type, full, meta) { - return '' + data.name + ''; - } - }, - { - name: 'to', - data: 'to', - searchable: false, - render: function (data, type, full, meta) { - return '' + data.name + ''; - } - }, - { - name: 'components', - data: 'components', - searchable: true, - sortable: false, - title: '', - render: function (data, type, full, meta) { - var html = ''; - if (data.budget_id > 0) { - html += ' '; - } - if (data.category_id > 0) { - html += ' '; - } - if(data.recurring_id > 0) { - html += ' '; - } - return html; - } - }, - { - name: 'id', - data: 'id', - searchable: false, - sortable: false, - title: '', - render: function (data, type, full, meta) { - return ''; - } - } - ] - } - ); }); \ No newline at end of file