Tag progetto, @menzioni, appuntamenti da conversazioni

- Modello Tag con nome e colore, M2M su Conversazione
- Modello Appuntamento con luogo, note, partecipanti, link a Conversazione
- @menzioni nei commenti e aggiornamenti: @username → link al profilo
- Autocomplete JS per @menzioni nelle textarea
- Auto-data conversazioni (default=now)
- CRUD completo appuntamenti con permessi autore
- Appuntamenti in agenda, dashboard, dettaglio conversazione
- Crea riunione direttamente da una conversazione (pre-compila titolo e partecipanti)
- Admin: Tag, Appuntamento registrati
This commit is contained in:
automationkriz
2026-04-07 14:28:47 +00:00
parent 006bb24215
commit 09f51b1227
19 changed files with 828 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
{% extends "diario/base.html" %}
{% load custom_filters %}
{% block title %}{{ conv.titolo }}{% endblock %}
{% block content %}
@@ -31,6 +32,17 @@
<div style="white-space:pre-wrap;line-height:1.8;font-size:.93rem;">{{ conv.contenuto }}</div>
{% if conv.tags.all %}
<div class="d-flex flex-wrap gap-2 mt-3">
{% for tag in conv.tags.all %}
<span class="tag-pill" style="border-color:{{ tag.colore }};color:{{ tag.colore }};">
<span class="tag-dot" style="background:{{ tag.colore }};"></span>
{{ tag.nome }}
</span>
{% endfor %}
</div>
{% endif %}
{% if conv.partecipanti.all %}
<hr class="soft mt-4 mb-3">
<div>
@@ -47,8 +59,35 @@
{% endif %}
</div>
<!-- Documenti allegati -->
<!-- Appuntamenti collegati -->
<div class="d-flex justify-content-between align-items-center mb-3 fade-in">
<p class="section-title mb-0"><i class="bi bi-calendar-check me-1"></i>Appuntamenti ({{ appuntamenti|length }})</p>
<a href="{% url 'appuntamento_nuovo' %}?conversazione={{ conv.pk }}" class="btn btn-sm btn-outline-warning">
<i class="bi bi-plus-lg me-1"></i>Crea riunione
</a>
</div>
{% for app in appuntamenti %}
<div class="card mb-2 p-3 fade-in appuntamento-card">
<div class="d-flex align-items-center gap-3">
<i class="bi bi-calendar-check" style="font-size:1.3rem;color:#d97706;"></i>
<div class="flex-grow-1">
<a href="{% url 'appuntamento_dettaglio' app.pk %}" class="text-decoration-none text-dark fw-semibold small d-block">
{{ app.titolo }}
</a>
<small class="text-muted">
{{ app.data_ora|date:"d/m/Y H:i" }}
{% if app.luogo %} · {{ app.luogo }}{% endif %}
</small>
</div>
</div>
</div>
{% empty %}
<p class="text-muted small text-center py-2 fade-in">Nessun appuntamento collegato.</p>
{% endfor %}
<!-- Documenti allegati -->
<div class="d-flex justify-content-between align-items-center mb-3 mt-4 fade-in">
<p class="section-title mb-0"><i class="bi bi-paperclip me-1"></i>Allegati ({{ documenti|length }})</p>
<a href="{% url 'documento_nuovo' %}?conversazione={{ conv.pk }}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-upload me-1"></i>Allega PDF
@@ -111,7 +150,7 @@
{% endif %}
</div>
</div>
<p class="mb-0 mt-2 small" style="white-space:pre-wrap;line-height:1.65;padding-left:40px;">{{ c.testo }}</p>
<p class="mb-0 mt-2 small" style="white-space:pre-wrap;line-height:1.65;padding-left:40px;">{{ c.testo|render_mentions }}</p>
</div>
{% empty %}
<p class="text-muted small text-center py-3">Nessun commento ancora. Sii il primo!</p>

View File

@@ -42,6 +42,22 @@
{% endfor %}
</div>
</div>
{% if form.tags.field.queryset.count > 0 %}
<div class="mb-4">
<label class="form-label fw-semibold">{{ form.tags.label }}</label>
<div class="d-flex flex-wrap gap-2 mt-1">
{% for checkbox in form.tags %}
<div class="form-check">
{{ checkbox.tag }}
<label class="form-check-label" for="{{ checkbox.id_for_label }}">
{{ checkbox.choice_label }}
</label>
</div>
{% endfor %}
</div>
<div class="form-text">Seleziona i tag progetto da associare.</div>
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Salva</button>
{% if conv %}

View File

@@ -27,6 +27,16 @@
{% endif %}
</div>
<p class="mb-0 text-muted small mt-2">{{ conv.contenuto|truncatewords:30 }}</p>
{% if conv.tags.all %}
<div class="d-flex flex-wrap gap-1 mt-2">
{% for tag in conv.tags.all %}
<span class="tag-pill" style="border-color:{{ tag.colore }};color:{{ tag.colore }};font-size:.62rem;">
<span class="tag-dot" style="background:{{ tag.colore }};"></span>
{{ tag.nome }}
</span>
{% endfor %}
</div>
{% endif %}
</div>
{% if user == conv.registrato_da or user.is_superuser %}
<a href="{% url 'conversazione_modifica' conv.pk %}" class="btn btn-icon btn-outline-secondary flex-shrink-0">