{% extends "base.html" %} {% block title %}Zarzadzanie wydarzeniami - Norda Biznes Hub{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Zarzadzanie wydarzeniami

Tworzenie i edycja wydarzen Norda Biznes

Dodaj wydarzenie
{% if events %} {% for event in events %} {% endfor %}
Tytul Data Typ Miejsce Uczestnicy Status Akcje
{{ event.title }} {{ event.event_date.strftime('%d.%m.%Y') }} {{ event.event_type }} {{ event.location or '-' }} {{ event.attendee_count }} {% if event.is_past %} Zakonczone {% else %} Nadchodzace {% endif %}
{% else %}

Brak wydarzen. Dodaj pierwsze wydarzenie!

Dodaj wydarzenie
{% endif %}
{% endblock %} {% block extra_js %} const csrfToken = '{{ csrf_token() }}'; let confirmResolve = null; function showConfirm(message, options = {}) { return new Promise(resolve => { confirmResolve = resolve; document.getElementById('confirmModalIcon').textContent = options.icon || '❓'; document.getElementById('confirmModalTitle').textContent = options.title || 'Potwierdzenie'; document.getElementById('confirmModalMessage').innerHTML = message; document.getElementById('confirmModalOk').textContent = options.okText || 'OK'; document.getElementById('confirmModalOk').className = 'btn ' + (options.okClass || 'btn-primary'); document.getElementById('confirmModal').classList.add('active'); }); } function closeConfirm(result) { document.getElementById('confirmModal').classList.remove('active'); if (confirmResolve) { confirmResolve(result); confirmResolve = null; } } document.getElementById('confirmModalOk').addEventListener('click', () => closeConfirm(true)); document.getElementById('confirmModalCancel').addEventListener('click', () => closeConfirm(false)); document.getElementById('confirmModal').addEventListener('click', e => { if (e.target.id === 'confirmModal') closeConfirm(false); }); 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 deleteEvent(eventId, title) { const confirmed = await showConfirm(`Czy na pewno chcesz usunąć wydarzenie "${title}"?`, { icon: '🗑️', title: 'Usuwanie wydarzenia', okText: 'Usuń', okClass: 'btn-danger' }); if (!confirmed) 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(); showToast('Wydarzenie zostało usunięte', 'success'); } else { showToast(data.error || 'Wystąpił błąd', 'error'); } } catch (error) { showToast('Błąd połączenia', 'error'); } } {% endblock %}