Files
AdventCalendar/templates/admin_projects.html
2025-12-02 14:07:54 +01:00

119 lines
4.7 KiB
HTML

<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>Administration des projets</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container py-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Gestion des projets</h1>
<a href="{{ url_for('dashboard') }}" class="btn btn-outline-primary">
<i class="fas fa-arrow-left me-2"></i>Tableau de bord
</a>
</div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="alert alert-info alert-dismissible fade show">
{% for m in messages %}
<div><i class="fas fa-info-circle me-2"></i>{{ m }}</div>
{% endfor %}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endif %}
{% endwith %}
<div class="card mb-5">
<div class="card-header bg-primary text-white">
<h3 class="mb-0"><i class="fas fa-plus me-2"></i>Ajouter un projet</h3>
</div>
<div class="card-body">
<form method="post" enctype="multipart/form-data" class="row g-3">
<input type="hidden" name="action" value="add" />
<div class="col-md-2">
<input type="text" name="name" class="form-control" placeholder="Nom du projet" required />
</div>
<div class="col-md-3">
<input type="text" name="description" class="form-control" placeholder="Description" />
</div>
<div class="col-md-3">
<input type="file" name="image_file" accept="image/*" class="form-control" />
<small class="text-muted">PNG, JPG, GIF (max 5 Mo)</small>
</div>
<div class="col-md-2">
<input type="number" name="total_days" class="form-control" value="24" min="1" max="365" required />
</div>
<div class="col-md-2">
<button class="btn btn-primary w-100" type="submit">
<i class="fas fa-plus"></i> Ajouter
</button>
</div>
</form>
</div>
</div>
<h3>Projets existants ({{ projects|length }})</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Illustration</th>
<th>Nom</th>
<th>Description</th>
<th>Jours</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for proj in projects %}
<tr>
<form method="post" enctype="multipart/form-data" class="row gx-2 gy-0 align-items-center">
<input type="hidden" name="project_id" value="{{ proj.id }}" />
<td>{{ proj.id }}</td>
<td>
{% if proj.image_url %}
<img src="{{ proj.image_url }}" alt="Illustration" style="width:50px; height:50px; object-fit:cover; border-radius:5px;">
{% else %}
<span class="text-muted"></span>
{% endif %}
</td>
<td class="col-md-3">
<input type="text" name="name" value="{{ proj.name }}" class="form-control form-control-sm mb-1" required />
</td>
<td class="col-md-3">
<input type="text" name="description" value="{{ proj.description or '' }}" class="form-control form-control-sm mb-1" placeholder="Description" />
<input type="file" name="image_file" accept="image/*" class="form-control form-control-sm" />
</td>
<td class="col-md-1">
<input type="number" name="total_days" value="{{ proj.total_days }}" class="form-control form-control-sm" min="1" max="365" required />
</td>
<td class="col-md-2">
<button name="action" value="update" class="btn btn-sm btn-success me-2" type="submit">
<i class="fas fa-save"></i> Sauvegarder
</button>
<button name="action" value="delete" class="btn btn-sm btn-danger me-2" type="submit"
onclick="return confirm('Supprimer ce projet ?');">
<i class="fas fa-trash"></i> Supprimer
</button>
<a href="{{ url_for('admin_project_people', project_id=proj.id) }}" class="btn btn-sm btn-primary" title="Gérer utilisateurs">
<i class="fas fa-users"></i>
</a>
</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a href="{{ url_for('dashboard') }}" class="btn btn-link mt-3">Retour au tableau de bord</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>