diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index a28ad3acfe..2c2d9a8789 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,6 +2,7 @@ use Carbon\Carbon; use Config; +use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Input; use Preferences; @@ -40,6 +41,16 @@ class HomeController extends Controller { Session::clear(); + // encrypt transaction journal description + $set = TransactionJournal::where('encrypted', 0)->take(100)->get(); + /** @var TransactionJournal $entry */ + foreach ($set as $entry) { + $description = $entry->description; + $entry->description = $description; + $entry->save(); + } + unset($set, $entry, $description); + return Redirect::route('index'); } diff --git a/config/app.php b/config/app.php index 7c8c30c9c3..c23a78eb01 100644 --- a/config/app.php +++ b/config/app.php @@ -115,7 +115,7 @@ return [ */ 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', - 'Illuminate\Bus\BusServiceProvider', + //'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', @@ -139,16 +139,16 @@ return [ 'TwigBridge\ServiceProvider', 'DaveJamesMiller\Breadcrumbs\ServiceProvider', -// 'Barryvdh\Debugbar\ServiceProvider', -// 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', + //'Barryvdh\Debugbar\ServiceProvider', + //'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', 'Zizaco\Entrust\EntrustServiceProvider', /* * Application Service Providers... */ 'FireflyIII\Providers\AppServiceProvider', - 'FireflyIII\Providers\BusServiceProvider', - 'FireflyIII\Providers\ConfigServiceProvider', + //'FireflyIII\Providers\BusServiceProvider', + //'FireflyIII\Providers\ConfigServiceProvider', 'FireflyIII\Providers\EventServiceProvider', 'FireflyIII\Providers\RouteServiceProvider', 'FireflyIII\Providers\FireflyServiceProvider', diff --git a/public/js/transactions.js b/public/js/transactions.js index b9cee1ded4..bb70ee82c8 100644 --- a/public/js/transactions.js +++ b/public/js/transactions.js @@ -1,4 +1,4 @@ -/* globals what, $ */ +/* globals what:true, $, doSwitch, txt, middleCrumbName, title,button, middleCrumbUrl, piggiesLength, breadcrumbs */ $(document).ready(function () { "use strict"; if ($('input[name="expense_account"]').length > 0) { @@ -38,4 +38,104 @@ $(document).ready(function () { }); } -}); \ No newline at end of file + // respond to switch buttons: + if (doSwitch) { + updateButtons(); + updateForm(); + updateLayout(); + } + + +}); + +function updateLayout() { + "use strict"; + $('#subTitle').text(title[what]); + $('.breadcrumb .active').text(breadcrumbs[what]); + $('.breadcrumb li:nth-child(2)').html('' + middleCrumbName[what] + ''); + $('#transaction-btn').html(' ' + button[what]); +} + +function updateForm() { + "use strict"; + + $('input[name="what"]').val(what); + + switch (what) { + case 'withdrawal': + $('#account_id_holder').show(); + $('#expense_account_holder').show(); + $('#revenue_account_holder').hide(); + $('#account_from_id_holder').hide(); + $('#account_to_id_holder').hide(); + $('#budget_id_holder').show(); + $('#piggy_bank_id_holder').hide(); + + + if ($('#ffInput_revenue_account').val().length > 0) { + $('#ffInput_expense_account').val($('#ffInput_revenue_account').val()); + } + + break; + case 'deposit': + $('#account_id_holder').show(); + $('#expense_account_holder').hide(); + $('#revenue_account_holder').show(); + $('#account_from_id_holder').hide(); + $('#account_to_id_holder').hide(); + $('#budget_id_holder').hide(); + $('#piggy_bank_id_holder').hide(); + + if ($('#ffInput_expense_account').val().length > 0) { + $('#ffInput_revenue_account').val($('#ffInput_expense_account').val()); + } + + break; + case 'transfer': + $('#account_id_holder').hide(); + $('#expense_account_holder').hide(); + $('#revenue_account_holder').hide(); + $('#account_from_id_holder').show(); + $('#account_to_id_holder').show(); + $('#budget_id_holder').hide(); + if (piggiesLength === 0) { + $('#piggy_bank_id_holder').hide(); + } else { + $('#piggy_bank_id_holder').show(); + } + break; + } +} + + +function updateButtons() { + "use strict"; + $('.switch').each(function (i, v) { + var button = $(v); + + // remove click event: + button.unbind('click'); + // new click event: + button.bind('click', clickButton); + + if (button.data('what') == what) { + button.removeClass('btn-default').addClass('btn-info').html(' ' + txt[button.data('what')]); + console.log('Now displaying form for ' + what); + } else { + button.removeClass('btn-info').addClass('btn-default').text(txt[button.data('what')]); + } + }); +} + +function clickButton(e) { + "use strict"; + var button = $(e.target); + var newWhat = button.data('what'); + if (newWhat != what) { + what = newWhat; + updateButtons(); + updateForm(); + updateLayout(); + } + return false; +} \ No newline at end of file diff --git a/resources/twig/form/amount.twig b/resources/twig/form/amount.twig index cc0ff82ae1..765b200feb 100644 --- a/resources/twig/form/amount.twig +++ b/resources/twig/form/amount.twig @@ -1,4 +1,4 @@ -
-
@@ -94,6 +96,26 @@ {% block scripts %}