Choix du nombre d'exemplaires a l'impression

- Boutons +/- pour choisir le nombre d'exemplaires (1 a copies_max)
- copies_max configurable dans le backoffice (defaut: 5)
- Backend limite les copies au max configure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 23:15:10 +01:00
parent f9c600c026
commit bffdf52c56
6 changed files with 95 additions and 10 deletions

View File

@@ -208,13 +208,18 @@ async def api_imprimantes():
@app.post("/api/imprimer")
async def api_imprimer(donnees: dict):
nom = donnees.get("photo", "")
copies = donnees.get("copies", 1)
# Limiter au max configure
config = charger_config()
copies_max = config.get("impression", {}).get("copies_max", 5)
copies = max(1, min(copies, copies_max))
# Chercher dans exports d'abord, puis photos
chemin = DOSSIER_EXPORTS / nom
if not chemin.exists():
chemin = DOSSIER_PHOTOS / nom
if not chemin.exists():
return JSONResponse({"erreur": "Photo introuvable"}, status_code=404)
ok = imprimer(chemin)
ok = imprimer(chemin, copies=copies)
if ok:
distribuer_photo(chemin, imprimee=True)
return {"succes": ok}