{% 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.autosuggestField({
        first: true,
        label: "System Name"|t('app'),
        id: 'name',
        suggestEnvVars: true,
        name: 'name',
        value: system.name
    }) }}

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

    {{ forms.selectField({
        label: "Time Zone"|t('app'),
        warning: (craft.app.config.general.timezone ? configWarning('timezone')),
        id: 'time-zone',
        name: 'timeZone',
        value: system.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 %}
