Option to show deposit accounts on the front page.

This commit is contained in:
James Cole 2016-10-14 19:52:30 +02:00
parent ec8cf2c459
commit 2acde5c72a
3 changed files with 520 additions and 494 deletions

View File

@ -76,26 +76,27 @@ class PreferencesController extends Controller
*/ */
public function index(AccountRepositoryInterface $repository) public function index(AccountRepositoryInterface $repository)
{ {
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$viewRangePref = Preferences::get('viewRange', '1M'); $viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data; $viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []); $frontPageAccounts = Preferences::get('frontPageAccounts', []);
$language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data; $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data;
$transactionPageSize = Preferences::get('transactionPageSize', 50)->data; $transactionPageSize = Preferences::get('transactionPageSize', 50)->data;
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data; $customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; $showDepositsFrontpage = Preferences::get('showDepositsFrontpage', false)->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr; $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; $fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret $is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true; $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true;
return view( return view(
'preferences.index', 'preferences.index',
compact( compact(
'language', 'accounts', 'frontPageAccounts', 'tjOptionalFields', 'language', 'accounts', 'frontPageAccounts', 'tjOptionalFields',
'viewRange', 'customFiscalYear', 'transactionPageSize', 'fiscalYearStart', 'is2faEnabled', 'viewRange', 'customFiscalYear', 'transactionPageSize', 'fiscalYearStart', 'is2faEnabled',
'has2faSecret', 'showIncomplete' 'has2faSecret', 'showIncomplete', 'showDepositsFrontpage'
) )
); );
} }
@ -145,6 +146,10 @@ class PreferencesController extends Controller
Preferences::set('customFiscalYear', $customFiscalYear); Preferences::set('customFiscalYear', $customFiscalYear);
Preferences::set('fiscalYearStart', $fiscalYearStart); Preferences::set('fiscalYearStart', $fiscalYearStart);
// show deposits frontpage:
$showDepositsFrontpage = intval($request->get('showDepositsFrontpage')) === 1;
Preferences::set('showDepositsFrontpage', $showDepositsFrontpage);
// save page size: // save page size:
$transactionPageSize = intval($request->get('transactionPageSize')); $transactionPageSize = intval($request->get('transactionPageSize'));
if ($transactionPageSize > 0 && $transactionPageSize < 1337) { if ($transactionPageSize > 0 && $transactionPageSize < 1337) {

File diff suppressed because it is too large Load Diff

View File

@ -115,7 +115,24 @@
</div> </div>
<!-- frontpage settings column b --> <!-- frontpage settings column b -->
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<!-- show deposit chart -->
<div class="preferences-box">
<h3>{{ 'pref_home_show_deposits'|_ }}</h3>
<p class="text-info">{{ 'pref_home_show_deposits_info'|_ }}</p>
<div class="form-group">
<div class="col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" name="showDepositsFrontpage[]" value="{{ showDepositsFrontpage }}"
{% if showDepositsFrontpage %}
checked
{% endif %}
> {{ 'pref_home_do_show_deposits'|_ }}
</label>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>