add public view
This commit is contained in:
54
.gitignore
vendored
Normal file
54
.gitignore
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# Environnement virtuel
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# Base de données
|
||||||
|
*.db
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Static uploads (optionnel - garder les images uploadées)
|
||||||
|
# static/uploads/
|
||||||
|
|
||||||
22
README.md
Normal file
22
README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# 🎄 Calendrier de l'Avent - Tirage Aléatoire Multi-Projets
|
||||||
|
|
||||||
|
Application web Flask + SQLite pour organiser des calendriers de l'Avent avec tirage aléatoire équitable.
|
||||||
|
|
||||||
|
[](https://hub.docker.com/)
|
||||||
|
[](https://python.org/)
|
||||||
|
[](https://flask.palletsprojects.com/)
|
||||||
|
|
||||||
|
## ✨ Fonctionnalités
|
||||||
|
|
||||||
|
- **Multi-projets** : Créez plusieurs calendriers indépendants
|
||||||
|
- **Tirage équitable** : Calcul automatique des quotas par participant
|
||||||
|
- **Rattrapage magique** : Bouton "Rattraper X jours manquants"
|
||||||
|
- **Upload images** : Illustration personnalisée par projet
|
||||||
|
- **Import CSV** : Chargez vos participants en masse
|
||||||
|
- **Admin complet** : Gestion utilisateurs/projets
|
||||||
|
- **Thème Noël** : Interface festive et responsive
|
||||||
|
- **Docker** : Déploiement 1-clic
|
||||||
|
|
||||||
|
## 🚀 Installation rapide (Docker)
|
||||||
|
|
||||||
|
|
||||||
145
templates/public_project_view.html
Normal file
145
templates/public_project_view.html
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{{ project.name }} - Calendrier public</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" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.winner {
|
||||||
|
color: gold;
|
||||||
|
text-shadow: 0 0 10px #ffd700;
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
{% if project.image_url %}
|
||||||
|
<img src="{{ project.image_url }}" alt="Illustration" class="mb-4 rounded shadow-lg" style="max-height: 200px; object-fit: cover;" />
|
||||||
|
{% endif %}
|
||||||
|
<h1 class="display-4 fw-bold mb-2">{{ project.name }}</h1>
|
||||||
|
{% if project.description %}
|
||||||
|
<p class="lead text-light">{{ project.description }}</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card mb-5 text-center p-5 bg-dark bg-opacity-75 border-0 shadow-lg">
|
||||||
|
<h2 class="display-5 mb-4">🎁 Jour {{ today_day }} 🎁</h2>
|
||||||
|
{% if today_draw %}
|
||||||
|
<div class="mb-4">
|
||||||
|
<i class="fas fa-crown fa-4x text-warning mb-4"></i>
|
||||||
|
<div class="winner">{{ today_draw.name }}</div>
|
||||||
|
<small class="text-light">{{ today_draw.draw_time }}</small>
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<i class="fas fa-check-circle me-2"></i>Tirage effectué
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="mb-4">
|
||||||
|
<i class="fas fa-question-circle fa-5x text-muted mb-4"></i>
|
||||||
|
<h3 class="text-light">Pas encore tiré aujourd'hui</h3>
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<i class="fas fa-clock me-2"></i>Attente du tirage du jour...
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-5">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card bg-dark bg-opacity-75 border-0 shadow-lg text-center">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5><i class="fas fa-chart-line me-2"></i>Progression</h5>
|
||||||
|
<h2>{{ all_draws|length }} / {{ project.total_days }} jours</h2>
|
||||||
|
<div class="progress" style="height: 30px;">
|
||||||
|
<div class="progress-bar bg-success" style="width: {{ (all_draws|length / project.total_days * 100) | round(0) }}%">
|
||||||
|
{{ (all_draws|length / project.total_days * 100) | round(0) }}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card bg-dark bg-opacity-75 border-0 shadow-lg">
|
||||||
|
<div class="card-header text-white">
|
||||||
|
<h5><i class="fas fa-history me-2"></i>Derniers tirages</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
{% if all_draws %}
|
||||||
|
<div class="list-group list-group-flush">
|
||||||
|
{% for draw in all_draws[-10:] %}
|
||||||
|
<div class="list-group-item bg-transparent border-0 px-4 py-3">
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<span class="badge bg-primary rounded-pill me-2">Jour {{ draw.day }}</span>
|
||||||
|
<strong>{{ draw.name }}</strong>
|
||||||
|
</div>
|
||||||
|
<small class="text-light">{{ draw.draw_time[:10] }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="text-center py-5 text-light">
|
||||||
|
<i class="fas fa-calendar-times fa-3x mb-3 opacity-75"></i>
|
||||||
|
<p>Aucun tirage effectué</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card bg-dark bg-opacity-75 border-0 shadow-lg">
|
||||||
|
<div class="card-header text-white">
|
||||||
|
<h5><i class="fas fa-users me-2"></i>Participants ({{ stats|length }})</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-dark table-sm mb-0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Participant</th>
|
||||||
|
<th>Tirages</th>
|
||||||
|
<th>Restant</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for stat in stats %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ stat.name }}</td>
|
||||||
|
<td><span class="badge bg-info">{{ stat.draws }}</span></td>
|
||||||
|
<td>{{ stat.max_draws - stat.draws }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<a href="{{ url_for('public_dashboard') }}" class="btn btn-outline-light btn-lg me-3">
|
||||||
|
<i class="fas fa-arrow-left me-2"></i>Tous les calendriers
|
||||||
|
</a>
|
||||||
|
<a href="{{ url_for('login') }}" class="btn btn-outline-light btn-lg">
|
||||||
|
<i class="fas fa-cog me-2"></i>Administration
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
76
templates/public_projects.html
Normal file
76
templates/public_projects.html
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Calendriers de l'Avent Publics</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" />
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h1 class="display-3 fw-bold mb-3">🎄 Calendriers de l'Avent publics 🎄</h1>
|
||||||
|
<p class="lead">Découvrez tous les calendriers disponibles</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
{% for project in projects %}
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="card h-100 text-center text-white bg-dark bg-opacity-75 border-0 shadow-lg">
|
||||||
|
<div class="card-body p-4">
|
||||||
|
{% if project.image_url %}
|
||||||
|
<img src="{{ project.image_url }}" alt="{{ project.name }}" class="card-img-top rounded mb-3" style="max-height: 200px; object-fit: cover;" />
|
||||||
|
{% else %}
|
||||||
|
<div class="bg-secondary rounded-circle mx-auto mb-3 d-flex align-items-center justify-content-center" style="width: 120px; height: 120px;">
|
||||||
|
<i class="fas fa-gift fa-3x"></i>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h3 class="card-title mb-2">{{ project.name }}</h3>
|
||||||
|
{% if project.description %}
|
||||||
|
<p class="card-text text-light mb-3">{{ project.description }}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-3">
|
||||||
|
<span class="badge bg-success fs-6 px-3 py-2">
|
||||||
|
<i class="fas fa-calendar-days me-1"></i>{{ project.total_days }} jours
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="{{ url_for('public_project_view', project_id=project.id) }}" class="btn btn-warning btn-lg w-100">
|
||||||
|
<i class="fas fa-eye me-2"></i> Voir le calendrier
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="col-12 text-center py-5">
|
||||||
|
<i class="fas fa-calendar-times fa-5x text-muted mb-4"></i>
|
||||||
|
<h3 class="text-muted">Aucun calendrier disponible</h3>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<a href="{{ url_for('login') }}" class="btn btn-outline-light btn-lg">
|
||||||
|
<i class="fas fa-cog me-2"></i>Administration (connexion)
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
Reference in New Issue
Block a user