- Mise à jour de la version de l'application à `1.1.17` dans `app_version.dart` et `version.json`. - Création d'un module complet de statistiques (`EventStatisticsPage`, `EventStatisticsService`, `EventStatisticsTab`) permettant de filtrer et visualiser les KPI d'événements (montants HT/TTC, panier moyen, répartition par type, top options). - Ajout d'une entrée "Statistiques événements" dans le menu latéral (`MainDrawer`) protégée par la permission `generate_reports`. - Migration exclusive vers Google Cloud TTS dans `SmartTextToSpeechService` et suppression de `TextToSpeechService` (Web Speech API native) pour garantir une compatibilité maximale sur tous les navigateurs. - Mise à jour des dépendances dans `pubspec.yaml` (`google_fonts`, `flutter_secure_storage`, `mobile_scanner`, `flutter_local_notifications`). - Migration du code d'export ICS vers `package:web` pour remplacer l'utilisation de `dart:html` obsolète. - Mise à jour du `CHANGELOG.md` documentant les statistiques et l'évolution du service de synthèse vocale.
133 lines
3.4 KiB
Dart
133 lines
3.4 KiB
Dart
import 'package:em2rp/models/event_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class EventStatisticsFilter {
|
|
final DateTimeRange period;
|
|
final Set<String> eventTypeIds;
|
|
final bool includeCanceled;
|
|
final Set<EventStatus> selectedStatuses;
|
|
|
|
const EventStatisticsFilter({
|
|
required this.period,
|
|
this.eventTypeIds = const {},
|
|
this.includeCanceled = false,
|
|
this.selectedStatuses = const {
|
|
EventStatus.confirmed,
|
|
EventStatus.waitingForApproval,
|
|
},
|
|
});
|
|
|
|
EventStatisticsFilter copyWith({
|
|
DateTimeRange? period,
|
|
Set<String>? eventTypeIds,
|
|
bool? includeCanceled,
|
|
Set<EventStatus>? selectedStatuses,
|
|
}) {
|
|
return EventStatisticsFilter(
|
|
period: period ?? this.period,
|
|
eventTypeIds: eventTypeIds ?? this.eventTypeIds,
|
|
includeCanceled: includeCanceled ?? this.includeCanceled,
|
|
selectedStatuses: selectedStatuses ?? this.selectedStatuses,
|
|
);
|
|
}
|
|
}
|
|
|
|
class EventTypeStatistics {
|
|
final String eventTypeId;
|
|
final String eventTypeName;
|
|
final int totalEvents;
|
|
final double totalAmount;
|
|
final double validatedAmount;
|
|
final double pendingAmount;
|
|
final double canceledAmount;
|
|
|
|
const EventTypeStatistics({
|
|
required this.eventTypeId,
|
|
required this.eventTypeName,
|
|
required this.totalEvents,
|
|
required this.totalAmount,
|
|
required this.validatedAmount,
|
|
required this.pendingAmount,
|
|
required this.canceledAmount,
|
|
});
|
|
}
|
|
|
|
class OptionStatistics {
|
|
final String optionKey;
|
|
final String optionLabel;
|
|
final int usageCount;
|
|
final int validatedUsageCount;
|
|
final int quantity;
|
|
final double totalAmount;
|
|
|
|
const OptionStatistics({
|
|
required this.optionKey,
|
|
required this.optionLabel,
|
|
required this.usageCount,
|
|
required this.validatedUsageCount,
|
|
required this.quantity,
|
|
required this.totalAmount,
|
|
});
|
|
}
|
|
|
|
class EventStatisticsSummary {
|
|
final int totalEvents;
|
|
final int validatedEvents;
|
|
final int pendingEvents;
|
|
final int canceledEvents;
|
|
|
|
final double totalAmount;
|
|
final double validatedAmount;
|
|
final double pendingAmount;
|
|
final double canceledAmount;
|
|
|
|
final double baseAmount;
|
|
final double optionsAmount;
|
|
final double medianAmount;
|
|
final List<EventTypeStatistics> byEventType;
|
|
final List<OptionStatistics> topOptions;
|
|
|
|
const EventStatisticsSummary({
|
|
required this.totalEvents,
|
|
required this.validatedEvents,
|
|
required this.pendingEvents,
|
|
required this.canceledEvents,
|
|
required this.totalAmount,
|
|
required this.validatedAmount,
|
|
required this.pendingAmount,
|
|
required this.canceledAmount,
|
|
required this.baseAmount,
|
|
required this.optionsAmount,
|
|
required this.medianAmount,
|
|
required this.byEventType,
|
|
required this.topOptions,
|
|
});
|
|
|
|
static const empty = EventStatisticsSummary(
|
|
totalEvents: 0,
|
|
validatedEvents: 0,
|
|
pendingEvents: 0,
|
|
canceledEvents: 0,
|
|
totalAmount: 0,
|
|
validatedAmount: 0,
|
|
pendingAmount: 0,
|
|
canceledAmount: 0,
|
|
baseAmount: 0,
|
|
optionsAmount: 0,
|
|
medianAmount: 0,
|
|
byEventType: [],
|
|
topOptions: [],
|
|
);
|
|
|
|
double get averageAmount => totalEvents == 0 ? 0 : totalAmount / totalEvents;
|
|
|
|
double get validationRate =>
|
|
totalEvents == 0 ? 0 : validatedEvents / totalEvents;
|
|
|
|
double get baseContributionRate =>
|
|
totalAmount == 0 ? 0 : baseAmount / totalAmount;
|
|
|
|
double get optionsContributionRate =>
|
|
totalAmount == 0 ? 0 : optionsAmount / totalAmount;
|
|
}
|