{% extends "base.html" %} {% block title %}{{ classified.title }} - Norda Biznes Hub{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
Powrot do tablicy
{{ 'Szukam' if classified.listing_type == 'szukam' else 'Oferuje' }} {{ classified.category|replace('uslugi', 'Usługi')|replace('produkty', 'Produkty')|replace('wspolpraca', 'Współpraca')|replace('praca', 'Praca')|replace('inne', 'Inne')|replace('nieruchomosci', 'Nieruchomości') }}
{% if classified.author_id == current_user.id %} {% endif %}

{{ classified.title }}

{{ classified.description }}
{% if classified.budget_info or classified.location_info %}
{% if classified.budget_info %}
Budzet / Cena
{{ classified.budget_info }}
{% endif %} {% if classified.location_info %}
Lokalizacja
{{ classified.location_info }}
{% endif %}
{% endif %}
{{ (classified.author.name or classified.author.email)[0].upper() }}
{{ classified.author.name or classified.author.email.split('@')[0] }}
{% if classified.company %}
{{ classified.company.name }}
{% endif %}
{% if classified.author_id != current_user.id %} Skontaktuj sie {% endif %}
{{ classified.views_count }} wyswietlen Dodano: {{ classified.created_at.strftime('%d.%m.%Y %H:%M') }} {% if classified.expires_at %} Wygasa: {{ classified.expires_at.strftime('%d.%m.%Y') }} {% 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 closeClassified() { const confirmed = await showConfirm('Czy na pewno chcesz zamknąć to ogłoszenie?', { icon: '🔒', title: 'Zamykanie ogłoszenia', okText: 'Zamknij', okClass: 'btn-warning' }); if (!confirmed) return; try { const response = await fetch('{{ url_for("classifieds_close", classified_id=classified.id) }}', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { showToast('Ogłoszenie zostało zamknięte', 'success'); setTimeout(() => window.location.href = '{{ url_for("classifieds_index") }}', 1500); } else { showToast(data.error || 'Wystąpił błąd', 'error'); } } catch (error) { showToast('Błąd połączenia', 'error'); } } {% endblock %}