206 lines
5.3 KiB
HTML
206 lines
5.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Zarzadzanie wydarzeniami - Norda Biznes Hub{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.admin-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: var(--spacing-xl);
|
|
}
|
|
|
|
.admin-header h1 {
|
|
font-size: var(--font-size-3xl);
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.events-table {
|
|
width: 100%;
|
|
background: var(--surface);
|
|
border-radius: var(--radius-lg);
|
|
box-shadow: var(--shadow);
|
|
border-collapse: collapse;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.events-table th,
|
|
.events-table td {
|
|
padding: var(--spacing-md);
|
|
text-align: left;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
|
|
.events-table th {
|
|
background: var(--background);
|
|
font-weight: 600;
|
|
color: var(--text-secondary);
|
|
font-size: var(--font-size-sm);
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.events-table tr:hover {
|
|
background: var(--background);
|
|
}
|
|
|
|
.event-title-cell {
|
|
font-weight: 500;
|
|
}
|
|
|
|
.event-title-cell a {
|
|
color: var(--text-primary);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.event-title-cell a:hover {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.badge {
|
|
display: inline-block;
|
|
padding: 2px 8px;
|
|
border-radius: var(--radius-sm);
|
|
font-size: var(--font-size-xs);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.badge-past {
|
|
background: var(--border);
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.badge-upcoming {
|
|
background: #dcfce7;
|
|
color: #166534;
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: var(--spacing-xs);
|
|
}
|
|
|
|
.btn-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
padding: 0;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: var(--radius);
|
|
border: 1px solid var(--border);
|
|
background: var(--surface);
|
|
cursor: pointer;
|
|
transition: var(--transition);
|
|
}
|
|
|
|
.btn-icon:hover {
|
|
background: var(--background);
|
|
}
|
|
|
|
.btn-icon.danger:hover {
|
|
background: var(--error);
|
|
border-color: var(--error);
|
|
color: white;
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: var(--spacing-2xl);
|
|
color: var(--text-secondary);
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="admin-header">
|
|
<div>
|
|
<h1>Zarzadzanie wydarzeniami</h1>
|
|
<p class="text-muted">Tworzenie i edycja wydarzen Norda Biznes</p>
|
|
</div>
|
|
<a href="{{ url_for('admin_calendar_new') }}" class="btn btn-primary">Dodaj wydarzenie</a>
|
|
</div>
|
|
|
|
{% if events %}
|
|
<table class="events-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Tytul</th>
|
|
<th>Data</th>
|
|
<th>Typ</th>
|
|
<th>Miejsce</th>
|
|
<th>Uczestnicy</th>
|
|
<th>Status</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for event in events %}
|
|
<tr data-event-id="{{ event.id }}">
|
|
<td class="event-title-cell">
|
|
<a href="{{ url_for('calendar_event', event_id=event.id) }}">{{ event.title }}</a>
|
|
</td>
|
|
<td>{{ event.event_date.strftime('%d.%m.%Y') }}</td>
|
|
<td>{{ event.event_type }}</td>
|
|
<td>{{ event.location or '-' }}</td>
|
|
<td>{{ event.attendee_count }}</td>
|
|
<td>
|
|
{% if event.is_past %}
|
|
<span class="badge badge-past">Zakonczone</span>
|
|
{% else %}
|
|
<span class="badge badge-upcoming">Nadchodzace</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<div class="action-buttons">
|
|
<button class="btn-icon danger" onclick="deleteEvent({{ event.id }}, '{{ event.title|e }}')" title="Usun">
|
|
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
<polyline points="3 6 5 6 21 6"></polyline>
|
|
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<p>Brak wydarzen. Dodaj pierwsze wydarzenie!</p>
|
|
<a href="{{ url_for('admin_calendar_new') }}" class="btn btn-primary mt-2">Dodaj wydarzenie</a>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
<script>
|
|
const csrfToken = '{{ csrf_token() }}';
|
|
|
|
async function deleteEvent(eventId, title) {
|
|
if (!confirm(`Czy na pewno chcesz usunac wydarzenie "${title}"?`)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch(`/admin/kalendarz/${eventId}/delete`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRFToken': csrfToken
|
|
}
|
|
});
|
|
|
|
const data = await response.json();
|
|
if (data.success) {
|
|
document.querySelector(`tr[data-event-id="${eventId}"]`).remove();
|
|
} else {
|
|
alert(data.error || 'Wystapil blad');
|
|
}
|
|
} catch (error) {
|
|
alert('Blad polaczenia');
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %}
|