Show setting for default transaction type on preferences page
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -29,7 +29,8 @@ class SettingsController extends Controller
'password' => 'nullable|confirmed',
'language' => 'nullable|in:' . implode(',', array_keys(config('app.locales'))),
'theme' => 'nullable|in:light,dark',
- 'weekly_report' => 'nullable|in:true,false'
+ 'weekly_report' => 'nullable|in:true,false',
+ 'default_transaction_type' => 'nullable|in:earning,spending'
]);
$user = Auth::user();
@@ -74,6 +75,10 @@ class SettingsController extends Controller
$user->weekly_report = $request->input('weekly_report') == 'true' ? true : false;
}
+ if ($request->has('default_transaction_type')) {
+ $user->default_transaction_type = $request->input('default_transaction_type');
+ }
+
$user->save();
// Notify upon changing of password

MODIFY
resources/lang/de/fields.php
resources/lang/de/fields.php
<?php
return [
+ 'default_transaction_type' => 'Standard transaktiontyp',
+
'period' => 'Zeitraum'
];

MODIFY
resources/lang/dk/fields.php
resources/lang/dk/fields.php
@@ -10,6 +10,7 @@ return [
'theme' => 'Tema',
'currency' => 'Valuta',
'weekly_report' => 'Ugentlig Rapport',
+ 'default_transaction_type' => 'Standard transaktionstype',
'date' => 'Dato',
'description' => 'Beskrivelse',

MODIFY
resources/lang/en/fields.php
resources/lang/en/fields.php
@@ -10,6 +10,7 @@ return [
'theme' => 'Theme',
'currency' => 'Currency',
'weekly_report' => 'Weekly Report',
+ 'default_transaction_type' => 'Default transactiontype',
'date' => 'Date',
'description' => 'Description',

MODIFY
resources/lang/nl/fields.php
resources/lang/nl/fields.php
@@ -10,6 +10,7 @@ return [
'theme' => 'Thema',
'currency' => 'Valuta',
'weekly_report' => 'Wekelijks Verslag',
+ 'default_transaction_type' => 'Standaard transactietype',
'date' => 'Datum',
'description' => 'Omschrijving',

MODIFY
resources/views/settings/preferences.blade.php
resources/views/settings/preferences.blade.php
</div>
@include('partials.validation_error', ['payload' => 'weekly_report'])
</div>
+ <div class="input input--small">
+ <label>{{ __('fields.default_transaction_type') }}</label>
+ <div>
+ <input type="radio" name="default_transaction_type" value="earning" {{ Auth::user()->default_transaction_type === 'earning' ? 'checked' : '' }} /> {{ __('models.earning') }}
+ </div>
+ <div>
+ <input type="radio" name="default_transaction_type" value="spending" {{ Auth::user()->default_transaction_type === 'spending' ? 'checked' : '' }} /> {{ __('models.spending') }}
+ </div>
+ @include('partials.validation_error', ['payload' => 'default_transaction_type'])
+ </div>
<button class="button">{{ __('actions.save') }}</button>
</div>
</div>

Show setting for default transaction type on preferences page