{% extends "admin_base.html" %}
{% block extra_head %}{{ super() }}
<link rel="stylesheet" href="{{ static_url('/static/css/profile.css') }}">
{% endblock %}
{% block admin_content %}
<div class="admin-toolbar">
    <h2>Notification defaults</h2>
</div>
<div class="notif-prefs" data-admin-notif>
    <div class="notif-prefs-intro">
        <p>These are the platform-wide defaults applied to every user who has not customized a notification on their own profile. Changing a default does not override a user's explicit choice. Telegram delivery only reaches users who paired their Telegram account.</p>
    </div>
    <div class="notif-prefs-scroll">
    <table class="notif-prefs-table">
        <caption class="sr-only">Platform-wide default notification channels per notification type</caption>
        <thead>
            <tr>
                <th scope="col">Notification</th>
                <th scope="col" class="notif-prefs-col">In-app</th>
                <th scope="col" class="notif-prefs-col">Push</th>
                <th scope="col" class="notif-prefs-col">Telegram</th>
            </tr>
        </thead>
        <tbody>
            {% for pref in notification_defaults %}
            <tr>
                <td>
                    <span class="notif-prefs-label">{{ pref.label }}</span>
                    <span class="notif-prefs-desc">{{ pref.description }}</span>
                </td>
                <td class="notif-prefs-col">
                    <label class="notif-switch">
                        <input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="in_app" {% if pref.in_app %}checked{% endif %} aria-label="In-app default for {{ pref.label }}">
                        <span class="notif-switch-track"></span>
                    </label>
                </td>
                <td class="notif-prefs-col">
                    <label class="notif-switch">
                        <input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="push" {% if pref.push %}checked{% endif %} aria-label="Push default for {{ pref.label }}">
                        <span class="notif-switch-track"></span>
                    </label>
                </td>
                <td class="notif-prefs-col">
                    <label class="notif-switch">
                        <input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="telegram" {% if pref.telegram %}checked{% endif %} aria-label="Telegram default for {{ pref.label }}">
                        <span class="notif-switch-track"></span>
                    </label>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    </div>
</div>
{% endblock %}
