aboutsummaryrefslogtreecommitdiff
path: root/templates/mail/htmx/newmailbox.htmx.django
blob: 6c0e9253557e2747d484dc83c8585f7ef5c38185 (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
70
71
72
73
74
75
76
77
78
<div class="slide-up flex items-start justify-center pt-12">
    <div class="glass rounded-xl glow-border w-full max-w-lg">
        <div class="px-5 py-4 border-b border-white/[0.04]">
            <h2 class="text-sm font-medium text-zinc-200">Create Mailbox</h2>
        </div>
        <div class="p-5">
            {% url "mail.mailboxes.create" as create_path %}
            <form hx-post="{{ create_path }}" hx-swap="none" class="space-y-4">
                <div>
                    <label class="block text-xs font-medium text-zinc-400 mb-1.5 ml-1">Address</label>
                    <div class="flex items-center gap-2">
                        <input type="text" name="local_part" required autocomplete="off" placeholder="info" class="input-field flex-1">
                        <span class="text-sm text-zinc-500">@</span>
                        <div class="dropdown flex-1" data-dropdown>
                            <input type="hidden" name="domain_id" data-dropdown-value>
                            <button type="button" class="input-field text-left flex items-center justify-between" data-dropdown-trigger>
                                <span class="truncate" data-dropdown-label>Select a domain</span>
                                <svg class="w-4 h-4 text-zinc-500 shrink-0 ml-2 transition-transform duration-150" data-dropdown-chevron fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
                                </svg>
                            </button>
                            <div class="dropdown-menu" data-dropdown-menu>
                                <div class="p-2 border-b border-white/[0.04]">
                                    <input type="text" placeholder="Search domains..." class="dropdown-search" data-dropdown-search>
                                </div>
                                <div class="dropdown-options" data-dropdown-options>
                                    {% for domain in domains %}
                                    <button type="button" class="dropdown-option" data-dropdown-option data-value="{{ domain.ID }}" data-label="{{ domain.Name }}.{{ domain.TLD.Name }}">
                                        <p class="text-sm text-zinc-200">{{ domain.Name }}.{{ domain.TLD.Name }}</p>
                                    </button>
                                    {% endfor %}
                                </div>
                                <div class="dropdown-empty hidden" data-dropdown-empty>
                                    <p class="text-xs text-zinc-500 text-center py-3">No domains found</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <label class="block text-xs font-medium text-zinc-400 mb-1.5 ml-1">Owner</label>
                    <div class="dropdown" data-dropdown>
                        <input type="hidden" name="user_id" data-dropdown-value>
                        <button type="button" class="input-field text-left flex items-center justify-between" data-dropdown-trigger>
                            <span class="truncate" data-dropdown-label>Select a user</span>
                            <svg class="w-4 h-4 text-zinc-500 shrink-0 ml-2 transition-transform duration-150" data-dropdown-chevron fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
                                <path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
                            </svg>
                        </button>
                        <div class="dropdown-menu" data-dropdown-menu>
                            <div class="p-2 border-b border-white/[0.04]">
                                <input type="text" placeholder="Search users..." class="dropdown-search" data-dropdown-search>
                            </div>
                            <div class="dropdown-options" data-dropdown-options>
                                {% for user in users %}
                                <button type="button" class="dropdown-option" data-dropdown-option data-value="{{ user.ID }}" data-label="{{ user.DisplayName }} ({{ user.Username }})">
                                    <div>
                                        <p class="text-sm text-zinc-200">{{ user.DisplayName }}</p>
                                        <p class="text-xs text-zinc-500">{{ user.Username }}</p>
                                    </div>
                                </button>
                                {% endfor %}
                            </div>
                            <div class="dropdown-empty hidden" data-dropdown-empty>
                                <p class="text-xs text-zinc-500 text-center py-3">No users found</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="flex items-center gap-3 pt-2">
                    <button type="submit" class="btn-primary">Create Mailbox</button>
                    {% url "mail.mailboxes" as mailboxes_path %}
                    <a href="{{ mailboxes_path }}" hx-get="{{ mailboxes_path }}" hx-target="#content" hx-swap="innerHTML" hx-push-url="true" class="text-xs text-zinc-500 hover:text-zinc-300 transition-colors duration-150">Cancel</a>
                </div>
            </form>
        </div>
    </div>
</div>