firefly-iii/resources/views/preferences/index.twig
2024-04-02 06:59:40 +02:00

364 lines
23 KiB
Twig

{% extends './layout/default' %}
{% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
{% endblock %}
{% block content %}
<form method="POST" action="{{ route('preferences.update') }}" accept-charset="UTF-8" class="form-horizontal"
id="preferences">
<input name="_token" type="hidden" value="{{ csrf_token() }}">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
{# start of preferences tabs #}
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#general" data-toggle="tab"
aria-expanded="true">{{ 'preferences_general'|_ }}</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>
<div class="tab-content">
<div class="tab-pane active" id="general">
{# general settings here #}
<div class="row">
{# general settings column A #}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
{# language #}
<div class="preferences-box">
<h3>{{ 'pref_languages'|_ }}</h3>
<p class="text-info">{{ 'pref_languages_help'|_ }}</p>
<div class="form-group">
<div class="col-sm-12">
<select class="form-control" id="lang_holder" name="language">
{% for key, lang in languages %}
<option {% if language == key %}
selected
{% endif %} value="{{ key }}">{{ lang.name_locale }}
({{ lang.name_english }})
</option>
{% endfor %}
</select>
</div>
</div>
<p class="text-info">
<br/>
{{ 'pref_languages_locale'|_ }}
</p>
</div>
{# locale #}
{% if not isDocker %}
<div class="preferences-box">
<h3>{{ 'pref_locale'|_ }}</h3>
<p class="text-info">{{ 'pref_locale_help'|_ }}</p>
<div class="form-group">
<div class="col-sm-12">
<select class="form-control" id="locale_holder" name="locale">
{% for key, loc in locales %}
<option {% if locale == key %}
selected
{% endif %} value="{{ key }}">
{% if key == 'equal' %}
{{ 'equal_to_language'|_ }}
{% else %}
{{ loc }}
{% endif %}</option>
{% endfor %}
</select>
</div>
</div>
<ul class="text-warning">
{% if IS_DEMO_SITE %}
<li class="text-danger">{{ 'pref_locale_no_demo'|_ }}</li>{% endif %}
</ul>
</div>
{% else %}
<input type="hidden" name="locale" value="equal"/>
{% endif %}
{# fiscal year #}
<div class="preferences-box">
<h3>{{ 'pref_custom_fiscal_year'|_ }}</h3>
<p class="text-info">
{{ 'pref_custom_fiscal_year_help'|_ }}
</p>
{% set isCustomFiscalYear = customFiscalYear == 1 ? true : false %}
{{ ExpandedForm.checkbox('customFiscalYear','1',isCustomFiscalYear,{ 'label' : 'pref_custom_fiscal_year_label'|_ }) }}
{{ ExpandedForm.date('fiscalYearStart',fiscalYearStart,{ 'label' : 'pref_fiscal_year_start_label'|_ }) }}
</div>
</div>
{# general settings column B #}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
{# transaction preferences #}
<div class="preferences-box">
<h3>{{ 'pref_optional_fields_transaction'|_ }}</h3>
<p class="text-info">
{{ 'pref_optional_fields_transaction_help'|_ }}
</p>
<h4>{{ 'optional_tj_date_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[interest_date]','1', tjOptionalFields.interest_date,{ 'label' : 'pref_optional_tj_interest_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[book_date]','1', tjOptionalFields.book_date,{ 'label' : 'pref_optional_tj_book_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[process_date]','1', tjOptionalFields.process_date,{ 'label' : 'pref_optional_tj_process_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[due_date]','1', tjOptionalFields.due_date,{ 'label' : 'pref_optional_tj_due_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[payment_date]','1', tjOptionalFields.payment_date,{ 'label' : 'pref_optional_tj_payment_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[invoice_date]','1', tjOptionalFields.invoice_date,{ 'label' : 'pref_optional_tj_invoice_date'|_ }) }}
<h4>{{ 'optional_tj_other_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[internal_reference]','1', tjOptionalFields.internal_reference,{ 'label' : 'pref_optional_tj_internal_reference'|_ }) }}
{{ ExpandedForm.checkbox('tj[external_url]','1', tjOptionalFields.external_url,{ 'label' : 'pref_optional_tj_external_url'|_ }) }}
{{ ExpandedForm.checkbox('tj[notes]','1', tjOptionalFields.notes,{ 'label' : 'pref_optional_tj_notes'|_ }) }}
{{ ExpandedForm.checkbox('tj[location]','1', tjOptionalFields.location,{ 'label' : 'pref_optional_tj_location'|_ }) }}
{{ ExpandedForm.checkbox('tj[links]','1', tjOptionalFields.links,{ 'label' : 'pref_optional_tj_links'|_ }) }}
<h4>{{ 'optional_tj_attachment_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[attachments]','1', tjOptionalFields.attachments,{ 'label' : 'pref_optional_tj_attachments'|_ }) }}
</div>
</div>
</div>
</div>
<div class="tab-pane" id="frontpage">
{# frontpage settings here #}
<div class="row">
{# frontpage settings column a #}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="preferences-box">
<h3>{{ 'pref_home_screen_accounts'|_ }}</h3>
<p class="text-info">{{ 'pref_home_screen_accounts_help'|_ }}</p>
{% for type, accounts in groupedAccounts %}
<strong>{{ type }}</strong>
{% for id, name in accounts %}
<div class="form-group">
<div class="col-sm-10">
<div class="checkbox">
<label>
{% if id in frontpageAccounts or frontpageAccounts|length == 0 %}
<input type="checkbox" name="frontpageAccounts[]"
value="{{ id }}"
checked> {{ name }}
{% else %}
<input type="checkbox" name="frontpageAccounts[]"
value="{{ id }}"> {{ name }}
{% endif %}
</label>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{# frontpage settings column b #}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
</div>
</div>
</div>
<div class="tab-pane" id="layout">
{# 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_view_range'|_ }}</h3>
<p class="text-info">{{ 'pref_view_range_help'|_ }}</p>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="1D" {% if viewRange == '1D' %} checked {% endif %}>
{{ 'pref_1D'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="1W" {% if viewRange == '1W' %} checked {% endif %}>
{{ 'pref_1W'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="last7" {% if viewRange == 'last7' %} checked {% endif %}>
{{ 'pref_last7'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="1M" {% if viewRange == '1M' %} checked {% endif %}>
{{ 'pref_1M'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="last30" {% if viewRange == 'last30' %} checked {% endif %}>
{{ 'pref_last30'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="MTD" {% if viewRange == 'MTD' %} checked {% endif %}>
{{ 'pref_MTD'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="3M" {% if viewRange == '3M' %} checked {% endif %}>
{{ 'pref_3M'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="last90" {% if viewRange == 'last90' %} checked {% endif %}>
{{ 'pref_last90'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="QTD" {% if viewRange == 'QTD' %} checked {% endif %}>
{{ 'pref_QTD'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="6M" {% if viewRange == '6M' %} checked {% endif %}>
{{ 'pref_6M'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="1Y" {% if viewRange == '1Y' %} checked {% endif %}>
{{ 'pref_1Y'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="YTD" {% if viewRange == 'YTD' %} checked {% endif %}>
{{ 'pref_YTD'|_ }}
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="viewRange"
value="last365" {% if viewRange == 'last365' %} checked {% endif %}>
{{ 'pref_last365'|_ }}
</label>
</div>
</div>
</div>
{# layout settings column B #}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="preferences-box">
<h3>{{ 'list_page_size_title'|_ }}</h3>
<p class="text-info">{{ 'list_page_size_help'|_ }}</p>
{{ ExpandedForm.integer('listPageSize',listPageSize,{'label' : 'list_page_size_label'|_}) }}
</div>
<div class="preferences-box">
<h3>{{ 'dark_mode_preference'|_ }}</h3>
<p class="text-info">{{ 'dark_mode_preference_help'|_ }}</p>
{% for mode in availableDarkModes %}
<div class="radio">
<label>
<input type="radio" name="darkMode"
value="{{ mode }}" {% if darkMode == mode %} checked {% endif %}>
{{ ('dark_mode_option_'~mode)|_ }}
</label>
</div>
{% endfor %}
</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 class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="preferences-box">
<h3>{{ 'slack_webhook_url'|_ }}</h3>
<p class="text-info">{{ 'slack_webhook_url_help'|_ }}</p>
{{ ExpandedForm.text('slackUrl',slackUrl,{'label' : 'slack_url_label'|_}) }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-success btn-lg">{{ 'pref_save_settings'|_ }}</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
{% 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/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>
{% endblock %}
{% 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.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet"
media="all" nonce="{{ JS_NONCE }}">
{% endblock %}