Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Search bar in inbox/sent: filters by subject, content, sender/recipient - Group chats: create named or ad-hoc groups with Norda members - Group roles: owner, moderator, member with permission hierarchy - Group management: add/remove members, change roles - Photo avatars in message list (fallback to initials) - Unread count API extended to include group messages - Migration 088: message_group, message_group_member, group_message tables Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
391 lines
12 KiB
HTML
Executable File
391 lines
12 KiB
HTML
Executable File
{% extends "base.html" %}
|
|
|
|
{% block title %}Wysłane wiadomości - Norda Biznes Partner{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.messages-page {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.messages-topbar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: var(--spacing-lg);
|
|
gap: var(--spacing-md);
|
|
}
|
|
|
|
.messages-topbar h1 {
|
|
font-size: var(--font-size-2xl);
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
}
|
|
|
|
.messages-tabs {
|
|
display: flex;
|
|
gap: 2px;
|
|
background: var(--border-color, #e5e7eb);
|
|
border-radius: var(--radius);
|
|
padding: 2px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tab-link {
|
|
padding: var(--spacing-xs) var(--spacing-lg);
|
|
border-radius: calc(var(--radius) - 2px);
|
|
text-decoration: none;
|
|
color: var(--text-secondary);
|
|
font-weight: 500;
|
|
font-size: var(--font-size-sm);
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.tab-link:hover {
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.tab-link.active {
|
|
background: var(--surface);
|
|
color: var(--text-primary);
|
|
box-shadow: 0 1px 2px rgba(0,0,0,0.06);
|
|
}
|
|
|
|
.messages-list {
|
|
background: var(--surface);
|
|
border-radius: var(--radius-lg);
|
|
border: 1px solid var(--border-color, #e5e7eb);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.message-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: var(--spacing-md) var(--spacing-lg);
|
|
border-bottom: 1px solid var(--border-color, #f3f4f6);
|
|
text-decoration: none;
|
|
color: inherit;
|
|
transition: background 0.15s;
|
|
gap: var(--spacing-md);
|
|
}
|
|
|
|
.message-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.message-item:hover {
|
|
background: rgba(0,0,0,0.02);
|
|
}
|
|
|
|
.message-avatar {
|
|
width: 42px;
|
|
height: 42px;
|
|
border-radius: 50%;
|
|
background: var(--secondary);
|
|
color: white;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-weight: 600;
|
|
font-size: var(--font-size-sm);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.message-body {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.message-top-row {
|
|
display: flex;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
gap: var(--spacing-sm);
|
|
margin-bottom: 2px;
|
|
}
|
|
|
|
.message-subject {
|
|
font-size: var(--font-size-base);
|
|
font-weight: 500;
|
|
color: var(--text-primary);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
min-width: 0;
|
|
}
|
|
|
|
.message-date {
|
|
font-size: var(--font-size-xs);
|
|
color: var(--text-secondary);
|
|
white-space: nowrap;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.message-bottom-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: var(--spacing-sm);
|
|
}
|
|
|
|
.message-preview {
|
|
font-size: var(--font-size-sm);
|
|
color: var(--text-secondary);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
min-width: 0;
|
|
}
|
|
|
|
.message-recipient {
|
|
font-size: var(--font-size-xs);
|
|
color: var(--text-secondary);
|
|
white-space: nowrap;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.message-recipient strong {
|
|
color: var(--text-primary);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.status-pill {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 3px;
|
|
padding: 1px 7px;
|
|
border-radius: 10px;
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
margin-top: 3px;
|
|
}
|
|
.status-pill svg {
|
|
width: 12px;
|
|
height: 12px;
|
|
}
|
|
.status-pill.read {
|
|
background: #dcfce7;
|
|
color: #15803d;
|
|
}
|
|
.status-pill.waiting {
|
|
background: #fef3c7;
|
|
color: #b45309;
|
|
}
|
|
|
|
.message-badges {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
margin-left: var(--spacing-xs);
|
|
}
|
|
|
|
.context-badge-small {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 3px;
|
|
padding: 1px 6px;
|
|
background: #eff6ff;
|
|
border-radius: var(--radius-sm);
|
|
font-size: 11px;
|
|
color: var(--primary);
|
|
}
|
|
|
|
.context-badge-small svg {
|
|
width: 11px;
|
|
height: 11px;
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: var(--spacing-2xl) var(--spacing-lg);
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.empty-state p {
|
|
margin: 0 0 var(--spacing-md);
|
|
}
|
|
|
|
.pagination {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: var(--spacing-xs);
|
|
margin-top: var(--spacing-lg);
|
|
}
|
|
|
|
.pagination a {
|
|
padding: var(--spacing-xs) var(--spacing-md);
|
|
border-radius: var(--radius);
|
|
text-decoration: none;
|
|
color: var(--text-secondary);
|
|
background: var(--surface);
|
|
border: 1px solid var(--border-color, #e5e7eb);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.pagination a:hover {
|
|
background: var(--background);
|
|
}
|
|
|
|
.pagination a.active {
|
|
background: var(--primary);
|
|
color: white;
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.messages-search {
|
|
position: relative;
|
|
margin-bottom: var(--spacing-md);
|
|
}
|
|
|
|
.messages-search input {
|
|
width: 100%;
|
|
padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 36px;
|
|
border: 1.5px solid var(--border-color, #e5e7eb);
|
|
border-radius: var(--radius);
|
|
font-size: var(--font-size-sm);
|
|
background: white;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.messages-search input:focus {
|
|
border-color: var(--primary);
|
|
outline: none;
|
|
box-shadow: 0 0 0 3px rgba(46, 72, 114, 0.1);
|
|
}
|
|
|
|
.messages-search-icon {
|
|
position: absolute;
|
|
left: 12px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
color: var(--text-muted);
|
|
font-size: 14px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.messages-search-clear {
|
|
position: absolute;
|
|
right: 8px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
background: none;
|
|
border: none;
|
|
color: var(--text-muted);
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
padding: 4px;
|
|
display: none;
|
|
}
|
|
|
|
.messages-search-clear.visible {
|
|
display: block;
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.messages-topbar {
|
|
flex-wrap: wrap;
|
|
}
|
|
.messages-topbar h1 {
|
|
font-size: var(--font-size-xl);
|
|
}
|
|
.message-item {
|
|
padding: var(--spacing-sm) var(--spacing-md);
|
|
}
|
|
.message-top-row {
|
|
flex-direction: column;
|
|
gap: 0;
|
|
}
|
|
.message-bottom-row {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 2px;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="messages-page">
|
|
<div class="messages-topbar">
|
|
<h1>Wiadomości</h1>
|
|
<div class="messages-tabs">
|
|
<a href="{{ url_for('messages_inbox') }}" class="tab-link">Odebrane</a>
|
|
<a href="{{ url_for('messages_sent') }}" class="tab-link active">Wysłane</a>
|
|
</div>
|
|
<a href="{{ url_for('messages_new') }}" class="btn btn-primary btn-sm">Nowa wiadomość</a>
|
|
</div>
|
|
|
|
<form class="messages-search" method="GET" action="{{ url_for('messages.messages_sent') }}">
|
|
<span class="messages-search-icon">🔍</span>
|
|
<input type="text" name="q" value="{{ search_query or '' }}" placeholder="Szukaj w wiadomościach..." autocomplete="off">
|
|
<button type="button" class="messages-search-clear {% if search_query %}visible{% endif %}" onclick="this.previousElementSibling.value=''; this.form.submit();">✕</button>
|
|
</form>
|
|
{% if search_query %}
|
|
<div style="margin-bottom: var(--spacing-md); color: var(--text-muted); font-size: var(--font-size-sm);">
|
|
Wyniki wyszukiwania dla: <strong>{{ search_query }}</strong>
|
|
<a href="{{ url_for('messages.messages_sent') }}" style="margin-left: var(--spacing-sm); color: var(--primary);">Wyczyść</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="messages-list">
|
|
{% if messages %}
|
|
{% for msg in messages %}
|
|
<a href="{{ url_for('messages_view', message_id=msg.id) }}" class="message-item">
|
|
<div class="message-avatar">
|
|
{{ (msg.recipient.name or msg.recipient.email)[0].upper() }}
|
|
</div>
|
|
<div class="message-body">
|
|
<div class="message-top-row">
|
|
<div class="message-subject">
|
|
{{ msg.subject or '(brak tematu)' }}
|
|
<span class="message-badges">
|
|
{% if msg.context_type == 'classified' %}
|
|
<span class="context-badge-small">
|
|
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>
|
|
B2B
|
|
</span>
|
|
{% endif %}
|
|
{% if msg.attachments %}
|
|
<span style="color: var(--text-secondary); font-size: 13px;" title="{{ msg.attachments|length }} załącznik{{ 'ów' if msg.attachments|length > 1 else '' }}">📎</span>
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
<span class="message-date">{{ msg.created_at.strftime('%d.%m.%Y %H:%M') }}</span>
|
|
</div>
|
|
<div class="message-bottom-row">
|
|
<span class="message-preview">{{ msg.content[:100] }}{% if msg.content|length > 100 %}…{% endif %}</span>
|
|
<span class="message-recipient">Do: <strong>{{ msg.recipient.name or msg.recipient.email.split('@')[0] }}</strong></span>
|
|
</div>
|
|
{% if msg.is_read %}
|
|
<span class="status-pill read" title="Przeczytana {{ msg.read_at.strftime('%d.%m.%Y %H:%M') if msg.read_at else '' }}">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 7l-8 8-4-4"/><path d="M22 7l-8 8-1.5-1.5" opacity="0.6"/></svg>
|
|
Przeczytana
|
|
</span>
|
|
{% else %}
|
|
<span class="status-pill waiting">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 7l-8 8-4-4"/></svg>
|
|
Nieprzeczytana
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</a>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<p>Nie wysłano jeszcze żadnych wiadomości</p>
|
|
<a href="{{ url_for('messages_new') }}" class="btn btn-primary btn-sm">Napisz wiadomość</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if total_pages > 1 %}
|
|
<div class="pagination">
|
|
{% for p in range(1, total_pages + 1) %}
|
|
<a href="{{ url_for('messages_sent', page=p) }}" class="{% if p == page %}active{% endif %}">{{ p }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|