Commit 75c4ab3
committed
Fix: Gallery tab filters now populate from database
PROBLÈME UTILISATEUR:
- Filtres Galerie: Seul le filtre nom fonctionnait
- Département/Compagnie dropdowns: Vides (pas d'options)
- Utilisateur ne pouvait pas filtrer par bataillon
ROOT CAUSE:
- loadTabData('gallery') appelait seulement refreshGallery()
- Aucun appel pour charger les départements dans les dropdowns
- Comparaison: Reports tab appelle loadReportDepartments() ✅
FIX IMPLÉMENTÉ:
✅ Nouvelle fonction: loadGalleryDepartments()
✅ Fetch /api/departments (même endpoint que Reports)
✅ Populate filterDepartment dropdown avec bataillons
✅ Store sub_departments data globalement (cascade)
✅ Appelée quand Gallery tab se charge
LOGIQUE DROPDOWN CASCADE:
1. User selects battalion → filterDepartment
2. JavaScript popule filterSubDepartment avec compagnies de ce bataillon
3. User peut affiner par compagnie/section
4. applyGalleryFilters() envoie les 2 filtres à l'API
RÉSULTAT:
✅ filterDepartment: Affiche tous les bataillons (10BPAG, 1BCAS, etc.)
✅ filterSubDepartment: Affiche compagnies selon bataillon sélectionné
✅ Filtres fonctionnent correctement avec nouvelle architecture metadata
✅ API /api/images/gallery reçoit: name, department, sub_department, status
TEST UTILISATEUR:
1. Gallery tab → Dropdown "Bataillon / Unité" → Options visibles
2. Sélectionner bataillon → Dropdown "Compagnie / Section" → Cascade
3. Filtrer → Images filtrées correctement
dashboard-service/src/static/js/dashboard.js:115,871-898,1030
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 710a19e commit 75c4ab3
1 file changed
+31
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
867 | 868 | | |
868 | 869 | | |
869 | 870 | | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
870 | 900 | | |
871 | 901 | | |
872 | 902 | | |
| |||
997 | 1027 | | |
998 | 1028 | | |
999 | 1029 | | |
1000 | | - | |
| 1030 | + | |
1001 | 1031 | | |
1002 | 1032 | | |
1003 | 1033 | | |
| |||
0 commit comments