<div {{ attributes }}>
    <div>
        <h2 class="text-base/7 font-semibold text-gray-900 dark:text-white">Systemeinstellungen</h2>
        <p class="mt-1 text-sm/6 text-gray-500 dark:text-gray-400">Konfigurieren Sie hier erweiterte Systemeinstellungen.</p>
    </div>

    <dl class="mt-6 divide-y divide-gray-100 border-t border-gray-200 text-sm/6 dark:divide-white/5 dark:border-white/5">
        {% set sm = this.systemSettingsManager %}

        {# friendsBooking #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Freunde-Anmeldung',
            field: 'friendsBooking',
            type: 'toggle',
            value: sm.isFriendsBooking,
            value_display: sm.isFriendsBooking ? 'Aktiviert' : 'Deaktiviert',
            is_locked: sm.isFriendsBookingFromConfig
        } %}

        {# preferredPostalCodes #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Bevorzugte Postleitzahlen',
            field: 'preferredPostalCodes',
            type: 'text',
            value_display: sm.preferredPostalCodes|default('Keine'),
            is_locked: sm.isPreferredPostalCodesFromConfig
        } %}

        {# requirePostalAddress #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Postanschrift erforderlich',
            field: 'requirePostalAddress',
            type: 'toggle',
            value: sm.isRequirePostalAddress,
            value_display: sm.isRequirePostalAddress ? 'Ja' : 'Nein',
            is_locked: sm.isRequirePostalAddressFromConfig
        } %}

        {# eraseDataPeriod #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Datenlöschung nach',
            field: 'eraseDataPeriod',
            type: 'text',
            value_display: sm.eraseDataPeriod,
            is_locked: sm.isEraseDataPeriodFromConfig
        } %}

        {# hostDataRetentionPeriod #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Veranstalter-Datenzugriff nach Angebotsende',
            field: 'hostDataRetentionPeriod',
            type: 'text',
            value_display: config.hostDataRetentionPeriod|default('6 months (Standard)'),
            is_locked: false
        } %}

        {# attendanceRemindPeriod #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Erinnerung vor Veranstaltung',
            field: 'attendanceRemindPeriod',
            type: 'text',
            value_display: sm.attendanceRemindPeriod,
            is_locked: sm.isAttendanceRemindPeriodFromConfig
        } %}

        {# paymentAllowSelect #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Zahlungsart wählbar',
            field: 'paymentAllowSelect',
            type: 'toggle',
            value: sm.isPaymentAllowSelect,
            value_display: sm.isPaymentAllowSelect ? 'Ja' : 'Nein',
            is_locked: sm.isPaymentAllowSelectFromConfig
        } %}

        {# ageTolerance #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Alterstoleranz',
            field: 'ageTolerance',
            type: 'select',
            options: { '': 'Deaktiviert', '90 days': '90 Tage' },
            value_display: sm.ageTolerance ? sm.ageTolerance : 'Deaktiviert',
            is_locked: sm.isAgeToleranceFromConfig
        } %}

        {# withdrawGracePeriod #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Abmeldefrist (Gnadenfrist)',
            field: 'withdrawGracePeriod',
            type: 'text',
            value_display: sm.withdrawGracePeriod|default('Nicht gesetzt'),
            is_locked: sm.isWithdrawGracePeriodFromConfig
        } %}

        {# noWithdrawAfterGracePeriod #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Keine Abmeldung nach Frist',
            field: 'noWithdrawAfterGracePeriod',
            type: 'toggle',
            value: sm.isNoWithdrawAfterGracePeriod,
            value_display: sm.isNoWithdrawAfterGracePeriod ? 'Ja' : 'Nein',
            is_locked: sm.isNoWithdrawAfterGracePeriodFromConfig
        } %}

        {# noWithdrawAfterApplicationDeadline #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Keine Abmeldung nach Anmeldeschluss',
            field: 'noWithdrawAfterApplicationDeadline',
            type: 'toggle',
            value: sm.isNoWithdrawAfterApplicationDeadline,
            value_display: sm.isNoWithdrawAfterApplicationDeadline ? 'Ja' : 'Nein',
            is_locked: sm.isNoWithdrawAfterApplicationDeadlineFromConfig
        } %}

        {# receiptNumberPrefix #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Belegnummer Präfix',
            field: 'receiptNumberPrefix',
            type: 'text',
            value_display: sm.receiptNumberPrefix|default('Kein'),
            is_locked: sm.isReceiptNumberPrefixFromConfig
        } %}

        {# remindAttendance #}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Erinnerungen versenden',
            field: 'remindAttendance',
            type: 'toggle',
            value: sm.isRemindAttendance,
            value_display: sm.isRemindAttendance ? 'Ja' : 'Nein',
            is_locked: sm.isRemindAttendanceFromConfig
        } %}
    </dl>

    <div class="mt-12">
        <h2 class="text-base/7 font-semibold text-gray-900 dark:text-white">Impressum / Verantwortliche Stelle</h2>
        <p class="mt-1 text-sm/6 text-gray-500 dark:text-gray-400">Diese Angaben werden auf der Seite „Datennutzung“ im Nutzerkonto als verantwortliche Stelle angezeigt.</p>
    </div>

    <dl class="mt-6 divide-y divide-gray-100 border-t border-gray-200 text-sm/6 dark:divide-white/5 dark:border-white/5">
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Name der Stelle',
            field: 'imprintName',
            type: 'text',
            value_display: config.imprintName|default('—'),
            is_locked: false
        } %}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Abteilung / Zusatz',
            field: 'imprintDepartment',
            type: 'text',
            value_display: config.imprintDepartment|default('—'),
            is_locked: false
        } %}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Straße und Hausnummer',
            field: 'imprintStreet',
            type: 'text',
            value_display: config.imprintStreet|default('—'),
            is_locked: false
        } %}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Postleitzahl',
            field: 'imprintPostalCode',
            type: 'text',
            value_display: config.imprintPostalCode|default('—'),
            is_locked: false
        } %}
        {% include '@FerienpassAdmin/components/Settings/_row.html.twig' with {
            label: 'Ort',
            field: 'imprintCity',
            type: 'text',
            value_display: config.imprintCity|default('—'),
            is_locked: false
        } %}
    </dl>

    {% if confirmation %}
        <twig:Turbo:Stream:Prepend target="#notifications">
            <twig:Admin:Notification type="success" title="Änderungen gespeichert" message="{{ confirmation }}"/>
        </twig:Turbo:Stream:Prepend>
    {% endif %}
</div>
