Implementation de la feature de gestion des fichiers sur les investissements

This commit is contained in:
ocroguennec committed 2026-08-29 18:49:01 +02:00
1 parent f6829dec9d
commit 8953d0bb35
21 files changed
+1729 -181

No files matched your search

+14 -1
View File
@@ -7,6 +7,7 @@ import ResultBanner from '../../components/ResultBanner.jsx';
import PasswordStrength from '../../components/PasswordStrength.jsx';
import PasswordInput from '../../components/PasswordInput.jsx';
import { fmt, Badge, UserStatusBadge } from './adminHelpers.jsx';
import { fmtOctets } from '../../utils/format.js';
// ── Helpers ────────────────────────────────────────────────────────────────
@@ -83,6 +84,10 @@ function toRows(users) {
Rôle: u.role === 'admin' ? 'Admin' : 'Utilisateur',
'2FA': u.totp_enabled ? 'Oui' : 'Non',
'Inscrit le': u.created_at ? u.created_at.replace('T', ' ').slice(0, 16) : '',
Plateformes: u.nb_plateformes ?? 0,
Investissements: u.nb_investissements ?? 0,
Documents: u.nb_documents ?? 0,
'Taille documents': fmtOctets(u.taille_documents ?? 0),
}));
}
@@ -95,7 +100,7 @@ function dlBlob(content, filename, type) {
}
function toCSV(users) {
const headers = ['ID', 'Nom', 'Email', 'Statut', 'Rôle', '2FA', 'Inscrit le'];
const headers = ['ID', 'Nom', 'Email', 'Statut', 'Rôle', '2FA', 'Inscrit le', 'Plateformes', 'Investissements', 'Documents', 'Taille documents'];
const rows = toRows(users).map(r => Object.values(r).map(v => `"${String(v).replace(/"/g,'""')}"`).join(','));
return '' + [headers.map(h => `"${h}"`).join(','), ...rows].join('\n');
}
@@ -612,6 +617,10 @@ export default function UsersSection({ currentUserId }) {
<th>Rôle</th>
<th>2FA</th>
<th>Inscrit le</th>
<th style={{ textAlign: 'right' }}>Nb de plateformes</th>
<th style={{ textAlign: 'right' }}>Nb d'investissements</th>
<th style={{ textAlign: 'right' }}>Nb de documents</th>
<th style={{ textAlign: 'right' }}>Taille des documents</th>
<th style={{ width: 48, paddingRight: 20 }}></th>
</tr>
</thead>
@@ -648,6 +657,10 @@ export default function UsersSection({ currentUserId }) {
}
</td>
<td style={{ color: 'var(--text-muted)', fontSize: 12 }}>{fmt(u.created_at)}</td>
<td style={{ textAlign: 'right' }}>{u.nb_plateformes ?? 0}</td>
<td style={{ textAlign: 'right' }}>{u.nb_investissements ?? 0}</td>
<td style={{ textAlign: 'right' }}>{u.nb_documents ?? 0}</td>
<td style={{ textAlign: 'right', color: 'var(--text-muted)', fontSize: 12 }}>{fmtOctets(u.taille_documents ?? 0)}</td>
<td style={{ paddingRight: 20 }}>
<button onClick={e => openMenuFor(e, u)} style={{ background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text-muted)', padding: '4px 6px', borderRadius: 4, display: 'flex', alignItems: 'center' }}
onMouseEnter={e => { e.currentTarget.style.background = 'var(--surface-2)'; e.currentTarget.style.color = 'var(--text)'; }}