aboutsummaryrefslogtreecommitdiff
path: root/templates/mail/htmx/users.htmx.django
blob: e2a9113fc8f38b036a5931cfc85cd00786d9a26c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<div class="slide-up space-y-6">
    <div class="glass rounded-xl glow-border">
        <div class="flex items-center justify-between px-5 py-4 border-b border-white/[0.04]">
            <h2 class="text-sm font-medium text-zinc-200">All Users</h2>
            <div class="flex items-center gap-3">
                <span class="text-xs text-zinc-600">{{ total }} total</span>
                {% url "mail.users.new" as new_user_path %}
                <a href="{{ new_user_path }}" hx-get="{{ new_user_path }}" hx-target="#content" hx-swap="innerHTML" hx-push-url="true" class="btn-small">New User</a>
            </div>
        </div>
        {% if items %}
        <div class="divide-y divide-white/[0.04]">
            {% for user in items %}
            <div class="flex items-center justify-between px-5 py-3">
                <div class="flex items-center gap-3">
                    <div class="flex items-center justify-center w-8 h-8 rounded-lg bg-accent-500/10">
                        <svg class="w-4 h-4 text-accent-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z" />
                        </svg>
                    </div>
                    <div>
                        <p class="text-sm text-zinc-200">{{ user.DisplayName }}</p>
                        <p class="text-xs text-zinc-600">{{ user.Username }}</p>
                    </div>
                </div>
                <div class="flex items-center gap-4">
                    <span class="text-xs text-zinc-600">{{ user.Mailboxes|length }} mailbox{{ user.Mailboxes|length|pluralize:"es" }}</span>
                    {% url "mail.users.edit" id=user.ID as edit_user_path %}
                    <a href="{{ edit_user_path }}" hx-get="{{ edit_user_path }}" hx-target="#content" hx-swap="innerHTML" hx-push-url="true" class="text-xs text-zinc-600 hover:text-zinc-300 transition-colors duration-150">Edit</a>
                    {% url "mail.users.delete" id=user.ID as delete_user_path %}
                    <button data-confirm-trigger data-confirm-title="Delete {{ user.DisplayName }}" data-confirm-message="This user and all associated data will be permanently removed. This action cannot be undone." data-confirm-action="{{ delete_user_path }}" class="text-xs text-zinc-600 hover:text-red-400 transition-colors duration-150">Delete</button>
                </div>
            </div>
            {% endfor %}
        </div>
        {% else %}
        <div class="flex flex-col items-center justify-center py-16 text-center">
            <div class="flex items-center justify-center w-12 h-12 rounded-2xl bg-surface-800 mb-4">
                <svg class="w-6 h-6 text-zinc-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
                    <path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" />
                </svg>
            </div>
            <p class="text-sm text-zinc-400">No users yet</p>
            <p class="mt-1 text-xs text-zinc-600">Create a user to get started</p>
        </div>
        {% endif %}
    </div>

    <div id="confirm-modal" class="fixed inset-0 z-50 hidden">
        <div class="absolute inset-0 bg-black/60 backdrop-blur-sm" data-confirm-backdrop></div>
        <div class="flex items-center justify-center min-h-screen p-4">
            <div class="relative glass rounded-xl glow-border w-full max-w-sm p-6 space-y-4">
                <div class="flex items-center gap-3">
                    <div class="flex items-center justify-center w-10 h-10 rounded-xl bg-red-500/10">
                        <svg class="w-5 h-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
                        </svg>
                    </div>
                    <h3 id="confirm-title" class="text-sm font-medium text-zinc-100"></h3>
                </div>
                <p id="confirm-message" class="text-xs text-zinc-400 leading-relaxed"></p>
                <div class="flex items-center justify-end gap-3 pt-2">
                    <button data-confirm-cancel class="px-4 py-2 text-xs text-zinc-400 hover:text-zinc-200 rounded-lg bg-surface-800 border border-white/[0.06] hover:border-white/[0.1] transition-all duration-150">Cancel</button>
                    <button id="confirm-action" class="px-4 py-2 text-xs text-white rounded-lg bg-red-500/80 hover:bg-red-500 border border-red-400/20 transition-all duration-150">Delete</button>
                </div>
            </div>
        </div>
    </div>
</div>