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 @@ -
+
diff --git a/resources/twig/form/balance.twig b/resources/twig/form/balance.twig index 882db8e808..e8e8e05ae0 100644 --- a/resources/twig/form/balance.twig +++ b/resources/twig/form/balance.twig @@ -1,4 +1,4 @@ -
+
diff --git a/resources/twig/form/checkbox.twig b/resources/twig/form/checkbox.twig index 21d8e59177..448986aa03 100644 --- a/resources/twig/form/checkbox.twig +++ b/resources/twig/form/checkbox.twig @@ -1,4 +1,4 @@ -
+
diff --git a/resources/twig/form/date.twig b/resources/twig/form/date.twig index 33a300d057..918b5bc6fd 100644 --- a/resources/twig/form/date.twig +++ b/resources/twig/form/date.twig @@ -1,4 +1,4 @@ -
+
{{ Form.input('date', name, value, options) }} diff --git a/resources/twig/form/integer.twig b/resources/twig/form/integer.twig index 527a5b2fea..f8fc237bfc 100644 --- a/resources/twig/form/integer.twig +++ b/resources/twig/form/integer.twig @@ -1,4 +1,4 @@ -
+
diff --git a/resources/twig/form/location.twig b/resources/twig/form/location.twig index efb95bb6c3..582181e434 100644 --- a/resources/twig/form/location.twig +++ b/resources/twig/form/location.twig @@ -1,4 +1,4 @@ -
+
diff --git a/resources/twig/form/multiRadio.twig b/resources/twig/form/multiRadio.twig index b79ff1559c..b03b69be7e 100644 --- a/resources/twig/form/multiRadio.twig +++ b/resources/twig/form/multiRadio.twig @@ -1,4 +1,4 @@ -
+
{% for value,description in list %} diff --git a/resources/twig/form/select.twig b/resources/twig/form/select.twig index 6956207700..40ac6949f3 100644 --- a/resources/twig/form/select.twig +++ b/resources/twig/form/select.twig @@ -1,4 +1,4 @@ -
+
{{ Form.select(name, list, selected , options ) }} diff --git a/resources/twig/form/tags.twig b/resources/twig/form/tags.twig index 9160512040..3a00f1479c 100644 --- a/resources/twig/form/tags.twig +++ b/resources/twig/form/tags.twig @@ -1,4 +1,4 @@ -
+
{{ Form.input('text', name, value, options) }} diff --git a/resources/twig/form/text.twig b/resources/twig/form/text.twig index 428b238b70..d13baef62a 100644 --- a/resources/twig/form/text.twig +++ b/resources/twig/form/text.twig @@ -1,4 +1,4 @@ -
+
{{ Form.input('text', name, value, options) }} diff --git a/resources/twig/form/textarea.twig b/resources/twig/form/textarea.twig index 6d1d950a04..4eb913d919 100644 --- a/resources/twig/form/textarea.twig +++ b/resources/twig/form/textarea.twig @@ -1,4 +1,4 @@ -
+
{{ Form.textarea(name, value, options) }} diff --git a/resources/twig/layout/default.twig b/resources/twig/layout/default.twig index 044699368f..a5ef822a86 100644 --- a/resources/twig/layout/default.twig +++ b/resources/twig/layout/default.twig @@ -66,7 +66,7 @@ {{ title }} {% if subTitle %} - + {% if subTitleIcon %} {% endif %} diff --git a/resources/twig/transactions/create.twig b/resources/twig/transactions/create.twig index 8c6724b14e..b40817560c 100644 --- a/resources/twig/transactions/create.twig +++ b/resources/twig/transactions/create.twig @@ -11,29 +11,35 @@ {{ 'mandatoryFields'|_ }}
+ + + {{ ExpandedForm.text('description') }} - {% if what == 'deposit' or what == 'withdrawal' %} - {{ ExpandedForm.select('account_id',accounts) }} - {% endif %} + + + {{ ExpandedForm.select('account_id',accounts) }} - {% if what == 'withdrawal' %} - {{ ExpandedForm.text('expense_account') }} - {% endif %} + {{ ExpandedForm.text('expense_account') }} - {% if what == 'deposit' %} - {{ ExpandedForm.text('revenue_account') }} - {% endif %} + {{ ExpandedForm.text('revenue_account') }} - {% if what == 'transfer' %} - {{ ExpandedForm.select('account_from_id',accounts) }} - {{ ExpandedForm.select('account_to_id',accounts) }} - {% endif %} + {{ ExpandedForm.select('account_from_id',accounts) }} + {{ ExpandedForm.select('account_to_id',accounts) }} @@ -51,9 +57,7 @@
- {% if what == 'withdrawal' %} - {{ ExpandedForm.select('budget_id',budgets,0) }} - {% endif %} + {{ ExpandedForm.select('budget_id',budgets,0) }} {{ ExpandedForm.text('category') }} @@ -62,9 +66,7 @@ - {% if what == 'withdrawal' and piggies|length > 0 %} - {{ ExpandedForm.select('piggy_bank_id',piggies) }} - {% endif %} + {{ ExpandedForm.select('piggy_bank_id',piggies) }}
@@ -82,7 +84,7 @@

-

@@ -94,6 +96,26 @@ {% block scripts %}