{% extends "base.html" %} {% block title %}{{ event.title }} - Norda Biznes Hub{% endblock %} {% block extra_css %} {% endblock %} {% block content %} Powrót do kalendarza

{{ event.title }}

Data
{{ event.event_date.strftime('%d.%m.%Y') }}
{% if event.time_start %}
Godzina
{{ event.time_start.strftime('%H:%M') }}{% if event.time_end %} - {{ event.time_end.strftime('%H:%M') }}{% endif %}
{% endif %} {% if event.location %}
Miejsce
{% if event.location_url %} {{ event.location }} {% else %} {{ event.location }} {% endif %}
{% endif %} {% if event.speaker_name %}
Prelegent
{{ event.speaker_name }}
{% endif %}
{% if event.description %}
{{ event.description|safe }}
{% endif %} {% if not event.is_past %}
Chcesz wziąć udział?

{{ event.attendee_count }} osób już się zapisało{% if event.max_attendees %} (limit: {{ event.max_attendees }}){% endif %}

{% else %}

To wydarzenie już się odbyło. {{ event.attendee_count }} osób brało udział.

{% endif %}
{% if event.attendees %}

Uczestnicy ({{ event.attendee_count }})

{% for attendee in event.attendees|sort(attribute='user.name') %}
{# Person badge - green if verified (has person_id), blue if not #} {% if attendee.user.person_id %} {{ attendee.user.name or attendee.user.email.split('@')[0] }} {% else %} {{ attendee.user.name or attendee.user.email.split('@')[0] }} {% endif %} {# Company badge - always link to company profile #} {% if attendee.user.company %} {{ attendee.user.company.name }} {% endif %}
{% endfor %}
{% endif %}
{% endblock %} {% block extra_js %} const csrfToken = '{{ csrf_token() }}'; function showToast(message, type = 'info', duration = 4000) { const container = document.getElementById('toastContainer'); const icons = { success: '✓', error: '✕', warning: '⚠', info: 'ℹ' }; const toast = document.createElement('div'); toast.className = `toast ${type}`; toast.innerHTML = `${icons[type]||'ℹ'}${message}`; container.appendChild(toast); setTimeout(() => { toast.style.animation = 'toastOut 0.3s ease forwards'; setTimeout(() => toast.remove(), 300); }, duration); } async function toggleRSVP() { const btn = document.getElementById('rsvp-btn'); btn.disabled = true; try { const response = await fetch('{{ url_for("calendar.calendar_rsvp", event_id=event.id) }}', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { if (data.action === 'added') { btn.textContent = 'Wypisz się'; btn.classList.remove('btn-primary'); btn.classList.add('btn-secondary', 'attending'); showToast('Zapisano na wydarzenie!', 'success'); } else { btn.textContent = 'Wezmę udział'; btn.classList.remove('btn-secondary', 'attending'); btn.classList.add('btn-primary'); showToast('Wypisano z wydarzenia', 'info'); } // Refresh page to update attendees list setTimeout(() => location.reload(), 1000); } else { showToast(data.error || 'Wystąpił błąd', 'error'); } } catch (error) { showToast('Błąd połączenia', 'error'); } btn.disabled = false; } {% endblock %}