Init project

This commit is contained in:
seb
2026-02-21 23:26:50 +01:00
parent df61e93871
commit b7046b125c
29 changed files with 2553 additions and 0 deletions

62
templates/auth/login.html Normal file
View File

@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Connexion — Facturation</title>
<link rel="stylesheet" href="/static/css/style.css">
<style>
body { display: flex; align-items: center; justify-content: center;
min-height: 100vh; background: var(--bg); }
.login-card {
background: white;
border-radius: 10px;
padding: 2.5rem 2rem;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
width: 100%;
max-width: 380px;
}
.login-card h1 { font-size: 1.4rem; color: var(--primary);
margin-bottom: 0.25rem; text-align: center; }
.login-card .subtitle { text-align: center; color: var(--muted);
font-size: 0.85rem; margin-bottom: 2rem; }
.erreur { background: #fee2e2; color: #991b1b; padding: 0.7em 1em;
border-radius: 5px; font-size: 0.875rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
label { font-size: 0.82rem; font-weight: 600; color: var(--muted);
text-transform: uppercase; letter-spacing: 0.3px; }
input { padding: 0.6em 0.75em; border: 1px solid var(--border);
border-radius: 5px; font-size: 0.95rem; width: 100%; }
input:focus { outline: none; border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(52,152,219,0.15); }
.btn-login { width: 100%; padding: 0.7em; background: var(--accent);
color: white; border: none; border-radius: 5px;
font-size: 1rem; cursor: pointer; margin-top: 0.5rem; }
.btn-login:hover { background: #2980b9; }
.logo { text-align: center; font-size: 2.5rem; margin-bottom: 1rem; }
</style>
</head>
<body>
<div class="login-card">
<div class="logo">🧾</div>
<h1>Facturation</h1>
<p class="subtitle">Connectez-vous pour continuer</p>
{% if erreur %}
<div class="erreur">{{ erreur }}</div>
{% endif %}
<form method="post" action="/login">
<div class="form-group">
<label>Nom d'utilisateur</label>
<input type="text" name="username" autofocus autocomplete="username" required>
</div>
<div class="form-group">
<label>Mot de passe</label>
<input type="password" name="password" autocomplete="current-password" required>
</div>
<button type="submit" class="btn-login">Se connecter</button>
</form>
</div>
</body>
</html>

View File

@@ -0,0 +1,40 @@
{% extends "base.html" %}
{% block title %}{{ titre }}{% endblock %}
{% block content %}
<div class="page-header">
<h1>{{ titre }}</h1>
<a href="/admin/utilisateurs" class="btn">← Retour</a>
</div>
<form method="post" class="form-card">
<div class="form-grid">
<div class="form-group">
<label>Nom d'utilisateur *</label>
<input type="text" name="username" required
value="{{ user.username if user else '' }}" autocomplete="off">
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="email"
value="{{ user.email if user else '' }}">
</div>
<div class="form-group">
<label>Mot de passe {% if user %}(laisser vide = inchangé){% else %}*{% endif %}</label>
<input type="password" name="password"
{% if not user %}required{% endif %} autocomplete="new-password">
</div>
<div class="form-group" style="justify-content: flex-end; padding-top: 1.5rem;">
<label style="display:flex; align-items:center; gap:0.5rem; cursor:pointer;">
<input type="checkbox" name="is_admin" value="true"
{% if user and user.is_admin %}checked{% endif %}
style="width:auto;">
Administrateur
</label>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Enregistrer</button>
<a href="/admin/utilisateurs" class="btn">Annuler</a>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,57 @@
{% extends "base.html" %}
{% block title %}Utilisateurs{% endblock %}
{% block content %}
<div class="page-header">
<h1>Utilisateurs</h1>
<a href="/admin/utilisateurs/nouveau" class="btn btn-primary">+ Nouvel utilisateur</a>
</div>
<table>
<thead>
<tr>
<th>Nom d'utilisateur</th>
<th>Email</th>
<th>Rôle</th>
<th>Statut</th>
<th>Créé le</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>
<strong>{{ u.username }}</strong>
{% if u.id == current_user.id %}<em>(vous)</em>{% endif %}
</td>
<td>{{ u.email or "—" }}</td>
<td>
{% if u.is_admin %}
<span class="badge badge-accepte">Admin</span>
{% else %}
<span class="badge badge-brouillon">Utilisateur</span>
{% endif %}
</td>
<td>
{% if u.actif %}
<span class="badge badge-payee">Actif</span>
{% else %}
<span class="badge badge-annulee">Inactif</span>
{% endif %}
</td>
<td>{{ u.created_at | date_fr }}</td>
<td>
<a href="/admin/utilisateurs/{{ u.id }}/modifier" class="btn btn-sm">Modifier</a>
{% if u.id != current_user.id %}
<form method="post" action="/admin/utilisateurs/{{ u.id }}/desactiver" style="display:inline">
<button type="submit" class="btn btn-sm {% if u.actif %}btn-danger{% endif %}">
{{ "Désactiver" if u.actif else "Réactiver" }}
</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}