{% extends "base.html" %} {% load i18n %} {% load account %} {% load crispy_forms_tags %} {% block title %}{% translate "Email Addresses" %}{% endblock %} {% block content %}

{% translate "Account Settings" %}

{% translate "Manage your personal details and security." %}

{# ------------------- LEFT COLUMN: ACCOUNT MENU (New Card Style) ------------------- #}
{# Assuming a main 'Profile' or 'Personal Information' page exists #} {% translate "Personal Information" %} {# Highlight the current page (Email) as active #} {% translate "Email Addresses" %} {% translate "Change Password" %} {% translate "Sign Out" %}
{# ------------------- RIGHT COLUMN: EMAIL MANAGEMENT ------------------- #}
{% translate "Email Addresses" %}

{% translate "These email addresses are linked to your account. You can set the primary address, resend verification, or remove an address." %}

{% if emailaddresses %} {% for emailaddress in emailaddresses %}

{{ emailaddress.email }} {# Status Badges: Using rounded-pill and appropriate colors #} {% if emailaddress.primary %} {% translate "Primary" %} {% endif %} {% if emailaddress.verified %} {% translate "Verified" %} {% else %} {% translate "Unverified" %} {% endif %}

{# 1. MAKE PRIMARY ACTION #} {% if not emailaddress.primary %}
{% csrf_token %}
{% endif %} {# 2. RESEND VERIFICATION ACTION #} {% if not emailaddress.verified %}
{% csrf_token %}
{% endif %} {# 3. REMOVE ACTION #} {% if not emailaddress.primary %}
{% csrf_token %}
{% endif %}
{% endfor %} {% else %}

{% translate "No email addresses found." %}

{% endif %}
{# ------------------- ADD EMAIL FORM ------------------- #}
{% translate "Add Email Address" %}
{% csrf_token %} {# 1. Explicitly render non-field errors first #} {% if form.non_field_errors %} {% endif %} {# 2. Render the fields using crispy #} {{ form|crispy }} {# 3. If there are any global errors (not common here, but safe to include) #} {% if messages %} {% for message in messages %}
{{ message }}
{% endfor %} {% endif %} {# Teal/Dark Green button consistent with "Save Changes" #}
{% endblock content %}