feat: Ajout de l'exportation des événements au format CSV avec filtres personnalisables

This commit is contained in:
ElPoyo
2026-02-18 13:25:14 +01:00
parent 7cbb48e679
commit 5b9ca568f8
13 changed files with 806 additions and 38 deletions

View File

@@ -0,0 +1,29 @@
import 'dart:convert';
import 'dart:js_interop';
import 'dart:typed_data';
import 'package:web/web.dart' as web;
/// Implémentation web du téléchargement de fichier
void downloadFile(String content, String fileName) {
final bytes = Uint8List.fromList(utf8.encode(content));
// Créer un Blob avec les données
final blob = web.Blob(
[bytes.toJS].toJS,
web.BlobPropertyBag(type: 'text/csv;charset=utf-8'),
);
// Créer une URL pour le blob
final url = web.URL.createObjectURL(blob);
// Créer un lien de téléchargement et le cliquer
final anchor = web.document.createElement('a') as web.HTMLAnchorElement;
anchor.href = url;
anchor.download = fileName;
anchor.click();
// Nettoyer l'URL
web.URL.revokeObjectURL(url);
}