mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 04:46:44 +00:00
Allow setting of notifications.
This commit is contained in:
@@ -106,6 +106,13 @@ class PreferencesController extends Controller
|
|||||||
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
|
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
|
||||||
$tjOptionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
|
$tjOptionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
|
||||||
|
|
||||||
|
// notification preferences (single value for each):
|
||||||
|
|
||||||
|
$notifications = [];
|
||||||
|
foreach (config('firefly.available_notifications') as $notification) {
|
||||||
|
$notifications[$notification] = app('preferences')->get(sprintf('notification_%s', $notification), true)->data;
|
||||||
|
}
|
||||||
|
|
||||||
ksort($languages);
|
ksort($languages);
|
||||||
|
|
||||||
// list of locales also has "equal" which makes it equal to whatever the language is.
|
// list of locales also has "equal" which makes it equal to whatever the language is.
|
||||||
@@ -131,6 +138,7 @@ class PreferencesController extends Controller
|
|||||||
'isDocker',
|
'isDocker',
|
||||||
'frontPageAccounts',
|
'frontPageAccounts',
|
||||||
'languages',
|
'languages',
|
||||||
|
'notifications',
|
||||||
'locales',
|
'locales',
|
||||||
'locale',
|
'locale',
|
||||||
'tjOptionalFields',
|
'tjOptionalFields',
|
||||||
@@ -163,6 +171,18 @@ class PreferencesController extends Controller
|
|||||||
app('preferences')->set('frontPageAccounts', $frontPageAccounts);
|
app('preferences')->set('frontPageAccounts', $frontPageAccounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extract notifications:
|
||||||
|
$all = $request->all();
|
||||||
|
foreach(config('firefly.available_notifications') as $option) {
|
||||||
|
$key = sprintf('notification_%s', $option);
|
||||||
|
if(array_key_exists($key, $all)) {
|
||||||
|
app('preferences')->set($key, true);
|
||||||
|
}
|
||||||
|
if(!array_key_exists($key, $all)) {
|
||||||
|
app('preferences')->set($key, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// view range:
|
// view range:
|
||||||
app('preferences')->set('viewRange', $request->get('viewRange'));
|
app('preferences')->set('viewRange', $request->get('viewRange'));
|
||||||
// forget session values:
|
// forget session values:
|
||||||
|
@@ -144,6 +144,9 @@ return [
|
|||||||
'update_endpoint' => 'https://version.firefly-iii.org/index.json',
|
'update_endpoint' => 'https://version.firefly-iii.org/index.json',
|
||||||
'update_minimum_age' => 7,
|
'update_minimum_age' => 7,
|
||||||
|
|
||||||
|
// notifications
|
||||||
|
'available_notifications' => ['bill_reminder', 'new_access_token', 'transaction_creation', 'user_login'],
|
||||||
|
|
||||||
// enabled languages
|
// enabled languages
|
||||||
'languages' => [
|
'languages' => [
|
||||||
// currently enabled languages
|
// currently enabled languages
|
||||||
|
@@ -1014,6 +1014,7 @@ return [
|
|||||||
'preferences_frontpage' => 'Home screen',
|
'preferences_frontpage' => 'Home screen',
|
||||||
'preferences_security' => 'Security',
|
'preferences_security' => 'Security',
|
||||||
'preferences_layout' => 'Layout',
|
'preferences_layout' => 'Layout',
|
||||||
|
'preferences_notifications' => 'Notifications',
|
||||||
'pref_home_show_deposits' => 'Show deposits on the home screen',
|
'pref_home_show_deposits' => 'Show deposits on the home screen',
|
||||||
'pref_home_show_deposits_info' => 'The home screen already shows your expense accounts. Should it also show your revenue accounts?',
|
'pref_home_show_deposits_info' => 'The home screen already shows your expense accounts. Should it also show your revenue accounts?',
|
||||||
'pref_home_do_show_deposits' => 'Yes, show them',
|
'pref_home_do_show_deposits' => 'Yes, show them',
|
||||||
@@ -1044,7 +1045,12 @@ return [
|
|||||||
'optional_field_attachments' => 'Attachments',
|
'optional_field_attachments' => 'Attachments',
|
||||||
'optional_field_meta_data' => 'Optional meta data',
|
'optional_field_meta_data' => 'Optional meta data',
|
||||||
'external_url' => 'External URL',
|
'external_url' => 'External URL',
|
||||||
|
'pref_notification_bill_reminder' => 'Reminder about expiring bills',
|
||||||
|
'pref_notification_new_access_token' => 'Alert when a new API access token is created',
|
||||||
|
'pref_notification_transaction_creation' => 'Alert when a transaction is created automatically',
|
||||||
|
'pref_notification_user_login' => 'Alert when you login from a new location',
|
||||||
|
'pref_notifications' => 'Notifications',
|
||||||
|
'pref_notifications_help' => 'Indicate if these are notifications you would like to get. Some notifications may contain sensitive financial information.',
|
||||||
// profile:
|
// profile:
|
||||||
'delete_stuff_header' => 'Delete data',
|
'delete_stuff_header' => 'Delete data',
|
||||||
'permanent_delete_stuff' => 'Be careful with these buttons. Deleting stuff is permanent.',
|
'permanent_delete_stuff' => 'Be careful with these buttons. Deleting stuff is permanent.',
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="POST" action="{{ route('preferences.update') }}" accept-charset="UTF-8" class="form-horizontal" id="preferences">
|
<form method="POST" action="{{ route('preferences.update') }}" accept-charset="UTF-8" class="form-horizontal"
|
||||||
|
id="preferences">
|
||||||
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -13,9 +14,14 @@
|
|||||||
{# start of preferences tabs #}
|
{# start of preferences tabs #}
|
||||||
<div class="nav-tabs-custom">
|
<div class="nav-tabs-custom">
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a href="#general" data-toggle="tab" aria-expanded="true">{{ 'preferences_general'|_ }}</a></li>
|
<li class="active"><a href="#general" data-toggle="tab"
|
||||||
<li class=""><a href="#frontpage" data-toggle="tab" aria-expanded="false">{{ 'preferences_frontpage'|_ }}</a></li>
|
aria-expanded="true">{{ 'preferences_general'|_ }}</a></li>
|
||||||
<li class=""><a href="#layout" data-toggle="tab" aria-expanded="false">{{ 'preferences_layout'|_ }}</a></li>
|
<li class=""><a href="#frontpage" data-toggle="tab"
|
||||||
|
aria-expanded="false">{{ 'preferences_frontpage'|_ }}</a></li>
|
||||||
|
<li class=""><a href="#layout" data-toggle="tab"
|
||||||
|
aria-expanded="false">{{ 'preferences_layout'|_ }}</a></li>
|
||||||
|
<li class=""><a href="#notifications" data-toggle="tab"
|
||||||
|
aria-expanded="false">{{ 'preferences_notifications'|_ }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="general">
|
<div class="tab-pane active" id="general">
|
||||||
@@ -31,15 +37,18 @@
|
|||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<select class="form-control" id="lang_holder" name="language">
|
<select class="form-control" id="lang_holder" name="language">
|
||||||
{% for key, lang in languages %}
|
{% for key, lang in languages %}
|
||||||
<option {% if language == key %}
|
<option {% if language == key %}
|
||||||
selected
|
selected
|
||||||
{% endif %} value="{{ key }}">{{ lang.name_locale }} ({{ lang.name_english }})</option>
|
{% endif %} value="{{ key }}">{{ lang.name_locale }}
|
||||||
|
({{ lang.name_english }})
|
||||||
|
</option>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</div></div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p class="text-info">
|
<p class="text-info">
|
||||||
@@ -50,32 +59,34 @@
|
|||||||
|
|
||||||
{# locale #}
|
{# locale #}
|
||||||
{% if not isDocker %}
|
{% if not isDocker %}
|
||||||
<div class="preferences-box">
|
<div class="preferences-box">
|
||||||
<h3>{{ 'pref_locale'|_ }}</h3>
|
<h3>{{ 'pref_locale'|_ }}</h3>
|
||||||
<p class="text-info">{{ 'pref_locale_help'|_ }}</p>
|
<p class="text-info">{{ 'pref_locale_help'|_ }}</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<select class="form-control" id="locale_holder" name="locale">
|
<select class="form-control" id="locale_holder" name="locale">
|
||||||
{% for key, loc in locales %}
|
{% for key, loc in locales %}
|
||||||
<option {% if locale == key %}
|
<option {% if locale == key %}
|
||||||
selected
|
selected
|
||||||
{% endif %} value="{{ key }}">
|
{% endif %} value="{{ key }}">
|
||||||
{% if key == 'equal' %}
|
{% if key == 'equal' %}
|
||||||
{{ 'equal_to_language'|_ }}
|
{{ 'equal_to_language'|_ }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ loc }}
|
{{ loc }}
|
||||||
{% endif %}</option>
|
{% endif %}</option>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div></div>
|
</div>
|
||||||
<ul class="text-warning">
|
</div>
|
||||||
|
<ul class="text-warning">
|
||||||
|
|
||||||
{% if IS_DEMO_SITE %}<li class="text-danger">{{ 'pref_locale_no_demo'|_ }}</li>{% endif %}
|
{% if IS_DEMO_SITE %}
|
||||||
</ul>
|
<li class="text-danger">{{ 'pref_locale_no_demo'|_ }}</li>{% endif %}
|
||||||
</div>
|
</ul>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="hidden" name="locale" value="equal" />
|
<input type="hidden" name="locale" value="equal"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# fiscal year #}
|
{# fiscal year #}
|
||||||
@@ -131,22 +142,23 @@
|
|||||||
{% for type, accounts in groupedAccounts %}
|
{% for type, accounts in groupedAccounts %}
|
||||||
<strong>{{ type }}</strong>
|
<strong>{{ type }}</strong>
|
||||||
{% for id, name in accounts %}
|
{% for id, name in accounts %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
{% if id in frontPageAccounts.data or frontPageAccounts.data|length == 0 %}
|
{% if id in frontPageAccounts.data or frontPageAccounts.data|length == 0 %}
|
||||||
<input type="checkbox" name="frontPageAccounts[]" value="{{ id }}"
|
<input type="checkbox" name="frontPageAccounts[]"
|
||||||
checked> {{ name }}
|
value="{{ id }}"
|
||||||
{% else %}
|
checked> {{ name }}
|
||||||
<input type="checkbox" name="frontPageAccounts[]"
|
{% else %}
|
||||||
value="{{ id }}"> {{ name }}
|
<input type="checkbox" name="frontPageAccounts[]"
|
||||||
{% endif %}
|
value="{{ id }}"> {{ name }}
|
||||||
</label>
|
{% endif %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -224,6 +236,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane" id="notifications">
|
||||||
|
{# layout settings here #}
|
||||||
|
<div class="row">
|
||||||
|
{# layout settings column A #}
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||||
|
{# view range #}
|
||||||
|
<div class="preferences-box">
|
||||||
|
<h3>{{ 'pref_notifications'|_ }}</h3>
|
||||||
|
<p class="text-info">{{ 'pref_notifications_help'|_ }}</p>
|
||||||
|
{% for id, enabled in notifications %}
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="notification_{{ id }}" {{ enabled == true ? 'checked' : '' }} value="1">
|
||||||
|
{{ trans('firefly.pref_notification_' ~ id) }}
|
||||||
|
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -240,12 +278,16 @@
|
|||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
|
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"
|
||||||
|
nonce="{{ JS_NONCE }}"></script>
|
||||||
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
|
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
|
||||||
<script type="text/javascript" src="v1/js/ff/preferences/index.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>
|
<script type="text/javascript" src="v1/js/ff/preferences/index.js?v={{ FF_VERSION }}"
|
||||||
|
nonce="{{ JS_NONCE }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">
|
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"
|
||||||
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all" nonce="{{ JS_NONCE }}">
|
media="all" nonce="{{ JS_NONCE }}">
|
||||||
|
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"
|
||||||
|
media="all" nonce="{{ JS_NONCE }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user