118 lines
5.7 KiB
HTML
118 lines
5.7 KiB
HTML
{% extends "dashboard/base.html" %}
|
|
|
|
{% block page_title %}Gestione Progetti{% endblock %}
|
|
|
|
{% block page_actions %}
|
|
<a href="{{ url_for('dashboard.new_project') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus"></i> Nuovo Progetto
|
|
</a>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="card">
|
|
<div class="card-body">
|
|
{% if projects %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Titolo</th>
|
|
<th>Stato</th>
|
|
<th>Featured</th>
|
|
<th>Creato</th>
|
|
<th>Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for project in projects %}
|
|
<tr>
|
|
<td>
|
|
<strong>{{ project.title }}</strong>
|
|
{% if project.description %}
|
|
<br><small class="text-muted">{{ project.description[:100] }}...</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if project.is_published %}
|
|
<span class="badge bg-success">Pubblicato</span>
|
|
{% else %}
|
|
<span class="badge bg-secondary">Bozza</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if project.is_featured %}
|
|
<span class="badge bg-warning">Featured</span>
|
|
{% else %}
|
|
<span class="text-muted">-</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>{{ project.created_at.strftime('%d/%m/%Y') if project.created_at else 'N/D' }}</td>
|
|
<td>
|
|
<div class="btn-group" role="group">
|
|
<a href="{{ url_for('dashboard.edit_project', project_id=project.id) }}"
|
|
class="btn btn-sm btn-outline-primary" title="Modifica">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<form method="POST" action="{{ url_for('dashboard.delete_project', project_id=project.id) }}"
|
|
style="display: inline;"
|
|
onsubmit="return confirm('Sei sicuro di voler eliminare questo progetto?')">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger" title="Elimina">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if pagination.total_pages > 1 %}
|
|
<nav aria-label="Pagination">
|
|
<ul class="pagination justify-content-center">
|
|
{% if pagination.has_prev %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ pagination.prev_page }}">Precedente</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for page_num in range(1, pagination.total_pages + 1) %}
|
|
{% if page_num == pagination.page %}
|
|
<li class="page-item active">
|
|
<span class="page-link">{{ page_num }}</span>
|
|
</li>
|
|
{% elif page_num <= 3 or page_num > pagination.total_pages - 3 or (page_num >= pagination.page - 1 and page_num <= pagination.page + 1) %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_num }}">{{ page_num }}</a>
|
|
</li>
|
|
{% elif page_num == 4 or page_num == pagination.total_pages - 3 %}
|
|
<li class="page-item disabled">
|
|
<span class="page-link">...</span>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if pagination.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ pagination.next_page }}">Successivo</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
{% else %}
|
|
<div class="text-center py-5">
|
|
<i class="bi bi-folder2-open display-1 text-muted"></i>
|
|
<h4 class="mt-3">Nessun progetto ancora</h4>
|
|
<p class="text-muted">Inizia creando il tuo primo progetto</p>
|
|
<a href="{{ url_for('dashboard.new_project') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus"></i> Crea Primo Progetto
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|