{% extends "_layouts/cp" %}
{% import "_includes/forms" as forms %}
{% set title = "General Settings"|t('app') %}
{% set fullPageForm = true %}

{% set crumbs = [
    { label: "Settings"|t('app'), url: url('settings') }
] %}


{% macro configWarning(setting, file) -%}
    {{ "This is being overridden by the {setting} config setting."|t('app', {
        setting: '<a href="https://docs.craftcms.com/api/v3/craft-config-generalconfig.html#property-'~setting|lower~'" rel="noopener" target="_blank">'~setting~'</a>'
    })|raw }}
{%- endmacro %}

{% from _self import configWarning %}


{% block content %}
    <input type="hidden" name="action" value="system-settings/save-general-settings">
    {{ redirectInput('settings') }}

    {{ forms.textField({
        first: true,
        label: "System Name"|t('app'),
        id: 'name',
        name: 'name',
        value: info.name
    }) }}

    {{ forms.lightswitchField({
        first: true,
        label: "System Status"|t('app'),
        warning: (craft.app.config.general.isSystemOn is same as(true) or craft.app.config.general.isSystemOn is same as(false) ? configWarning('isSystemOn')),
        id: 'on',
        name: 'on',
        on: info.on
    }) }}

    {{ forms.selectField({
        label: "Timezone"|t('app'),
        warning: (craft.app.config.general.timezone ? configWarning('timezone')),
        id: 'timezone',
        name: 'timezone',
        value: info.timezone,
        options: timezoneOptions
    }) }}

    {% if CraftEdition == CraftPro %}
        <hr>

        {% do view.registerTranslations('app', [
            "Are you sure you want to delete the logo?",
        ]) %}

        {% do view.registerAssetBundle("craft\\web\\assets\\fileupload\\FileUploadAsset") %}

        {{ forms.field({
            label: "Login Page Logo"|t('app'),
            instructions: "SVG file recommended. The logo will be displayed at {size} wide."|t('app', { size: '300px' })
        }, include('settings/general/_images/logo')) }}

        {{ forms.field({
            label: "Site Icon"|t('app'),
            instructions: "Square SVG file recommended. The logo will be displayed at {size} by {size}."|t('app', { size: '32px' })
        }, include('settings/general/_images/icon')) }}

        <div class="clear"></div>
    {% endif %}
{% endblock %}
