ATS/templates/account/email.html
2026-01-29 14:19:03 +03:00

162 lines
8.6 KiB
HTML

{% load i18n %}
{% load account %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{LANGUAGE_CODE}}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% trans "Email Addresses" %}</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
'temple-red': '#9d2235',
'temple-dark': '#1a1a1a',
'temple-cream': '#f8f7f2',
}
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
body { font-family: 'Inter', sans-serif; }
</style>
</head>
<body class="bg-temple-cream min-h-screen py-8 px-4">
<div class="max-w-2xl mx-auto">
<div class="bg-white rounded-2xl shadow-xl border border-gray-100 p-8">
<div class="text-center mb-8">
<div class="inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-temple-red/10 mb-4">
<i data-lucide="mail" class="w-8 h-8 text-temple-red"></i>
</div>
<h1 class="text-2xl font-bold text-gray-900 mb-2">{% trans "Email Addresses" %}</h1>
<p class="text-sm text-gray-500">
{% trans "These email addresses are linked to your account. You can set primary address, resend verification, or remove an address." %}
</p>
</div>
<!-- Django Messages -->
{% if messages %}
{% for message in messages %}
<div class="mb-4 p-4 rounded-xl {% if message.tags == 'error' %}bg-red-50 text-red-700{% else %}bg-green-50 text-green-700{% endif %}" role="alert">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% if emailaddresses %}
<div class="space-y-4">
{% for emailaddress in emailaddresses %}
<div class="flex flex-col sm:flex-row sm:items-center justify-between py-4 {% if not forloop.last %}border-b border-gray-200{% endif %} gap-4">
<div class="flex-1">
<span class="font-semibold text-temple-dark">{{ emailaddress.email }}</span>
<!-- Status Badges -->
{% if emailaddress.primary %}
<span class="inline-block ml-2 px-3 py-1 text-xs font-medium bg-blue-100 text-blue-700 rounded-full">{% trans "Primary" %}</span>
{% endif %}
{% if emailaddress.verified %}
<span class="inline-block ml-2 px-3 py-1 text-xs font-medium bg-green-100 text-green-700 rounded-full">{% trans "Verified" %}</span>
{% else %}
<span class="inline-block ml-2 px-3 py-1 text-xs font-medium bg-yellow-100 text-yellow-700 rounded-full">{% trans "Unverified" %}</span>
{% endif %}
</div>
<div class="flex flex-wrap gap-2">
<!-- Make Primary -->
{% if not emailaddress.primary %}
<form method="post" action="{% url 'account_email' %}" class="inline">
{% csrf_token %}
<input type="hidden" name="email" value="{{ emailaddress.email }}" />
<button type="submit" name="action_primary"
class="px-4 py-2 text-sm font-medium text-temple-red border border-temple-red rounded-lg hover:bg-red-50 transition">
{% trans "Make Primary" %}
</button>
</form>
{% endif %}
<!-- Resend Verification -->
{% if not emailaddress.verified %}
<form method="post" action="{% url 'account_email' %}" class="inline">
{% csrf_token %}
<input type="hidden" name="email" value="{{ emailaddress.email }}" />
<button type="submit" name="action_send"
class="px-4 py-2 text-sm font-medium text-yellow-600 border border-yellow-600 rounded-lg hover:bg-yellow-50 transition">
{% trans "Re-send Verification" %}
</button>
</form>
{% endif %}
<!-- Remove -->
{% if not emailaddress.primary %}
<form method="post" action="{% url 'account_email' %}" class="inline">
{% csrf_token %}
<input type="hidden" name="email" value="{{ emailaddress.email }}" />
<button type="submit" name="action_remove"
class="px-4 py-2 text-sm font-medium text-red-600 border border-red-600 rounded-lg hover:bg-red-50 transition">
{% trans "Remove" %}
</button>
</form>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<p class="mb-6 p-4 bg-blue-50 text-blue-700 rounded-xl">{% trans "No email addresses found." %}</p>
{% endif %}
<div class="my-8 border-t border-gray-200"></div>
<!-- Add Email Form -->
{% if can_add_email %}
<h2 class="text-lg font-bold text-temple-dark mb-4">{% trans "Add Email Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="space-y-4">
{% csrf_token %}
{% if form.non_field_errors %}
<div class="p-4 bg-red-50 text-red-700 rounded-xl" role="alert">
{{ form.non_field_errors }}
</div>
{% endif %}
<div>
<label for="id_email" class="block text-sm font-semibold text-gray-700 mb-2">
{% trans "Email Address" %}
</label>
<input type="email"
name="email"
id="id_email"
class="w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:ring-2 focus:ring-temple-red/20 focus:border-temple-red outline-none transition"
placeholder="{% trans 'Enter your email' %}"
required>
</div>
<button type="submit" name="action_add"
class="w-full bg-temple-red hover:bg-[#7a1a29] text-white font-semibold py-4 rounded-xl text-sm transition shadow-md hover:shadow-lg flex items-center justify-center gap-2">
<i data-lucide="plus" class="w-5 h-5"></i>
{% trans "Add Email" %}
</button>
</form>
{% endif %}
</div>
</div>
<script>
lucide.createIcons();
</script>
</body>
</html>