{% extends 'admin.twig' %}

{% set title %}{{ 'CoreAdminHome_MenuGeneralSettings'|translate }}{% endset %}

{% block content %}

    {% import 'macros.twig' as piwik %}
    {% import 'ajaxMacros.twig' as ajax %}

    {{ ajax.errorDiv() }}
    {{ ajax.loadingDiv() }}

    <div class="card generalSettingsTOCCard">
        <div id="generalSettingsTOC" class="card-action">
            {{ 'General_GoTo2'|translate }}:
            {% if isGeneralSettingsAdminEnabled %}
            <a href="#/archivingSettings">{{ 'CoreAdminHome_ArchivingSettings'|translate  }}</a>
                {% if not isMultiServerEnvironment %}
                <a href="#/mailSettings">{{ 'CoreAdminHome_EmailServerSettings'|translate }}</a>
                {% endif %}
            {% endif %}
            {% if customLogoEnabled %}
            <a href="#/brandingSettings">{{ 'CoreAdminHome_BrandingSettings'|translate }}</a>
            {% endif %}
            {% if isDataPurgeSettingsEnabled %}
            <a href="#/deleteDataSettings">{{ 'PrivacyManager_DeleteDataSettings'|translate }}</a>
            {% endif %}
            {{ postEvent('Template.endGeneralSettingsPageTableOfContents') }}
        </div>
    </div>

{% if isGeneralSettingsAdminEnabled %}
    <div
        matomo-archiving-settings
        enable-browser-trigger-archiving="{{ (enableBrowserTriggerArchiving==1)|json_encode|e('html_attr') }}"
        show-segment-archive-trigger-info="{{ (not not showSegmentArchiveTriggerInfo)|json_encode|e('html_attr') }}"
        is-general-settings-admin-enabled="{{ (not not isGeneralSettingsAdminEnabled)|json_encode|e('html_attr') }}"
        show-warning-cron="{{ (not not showWarningCron)|json_encode|e('html_attr') }}"
        today-archive-time-to-live="{{ todayArchiveTimeToLive|e('html_attr') }}"
        today-archive-time-to-live-default="{{ todayArchiveTimeToLiveDefault|e('html_attr') }}"
    ></div>

    {% if not isMultiServerEnvironment %}
        <div
            matomo-smtp-settings
            mail="{{ mail|json_encode|e('html_attr') }}"
            mail-types="{{ mailTypes|json_encode|e('html_attr') }}"
            mail-encryptions="{{ mailEncryptions|json_encode|e('html_attr') }}"
        ></div>
    {% endif %}
{% endif %}

{% if customLogoEnabled %}
<div
    matomo-branding-settings
    file-upload-enabled="{{ fileUploadEnabled|json_encode|e('html_attr') }}"
    logos-writeable="{{ logosWriteable|json_encode|e('html_attr') }}"
    use-custom-logo="{{ branding.use_custom_logo|json_encode|e('html_attr') }}"
    path-user-logo-directory="{{ pathUserLogoDirectory|json_encode|e('html_attr') }}"
    path-user-logo="{{ pathUserLogo|json_encode|e('html_attr') }}"
    path-user-logo-small="{{ pathUserLogoSmall|json_encode|e('html_attr') }}"
    path-user-logo-svg="{{ pathUserLogoSVG|json_encode|e('html_attr') }}"
    has-user-logo="{{ hasUserLogo|json_encode|e('html_attr') }}"
    path-user-favicon="{{ pathUserFavicon|json_encode|e('html_attr') }}"
    has-user-favicon="{{ hasUserFavicon|json_encode|e('html_attr') }}"
    is-plugins-admin-enabled="{{ isPluginsAdminEnabled|json_encode|e('html_attr') }}"
></div>
{% endif %}

{% if isDataPurgeSettingsEnabled %}
    <div piwik-content-block content-title="{{ 'PrivacyManager_DeleteDataSettings'|translate|e('html_attr') }}"
         anchor="deleteDataSettings">
        <p>{{ 'PrivacyManager_DeleteDataDescription'|translate }}</p>
        <p>
            <a href='{{ linkTo({'module':"PrivacyManager", 'action':"privacySettings"}) }}#deleteLogsAnchor'>
                {{ 'PrivacyManager_ClickHereSettings'|translate("'" ~ 'PrivacyManager_DeleteDataSettings'|translate ~ "'") }}
            </a>
        </p>
    </div>
{% endif %}

<div piwik-plugin-settings mode="admin"></div>

{% endblock %}
