104 lines
2.4 KiB
Dart
104 lines
2.4 KiB
Dart
part of 'dashboard_bloc.dart';
|
|
|
|
abstract class DashboardEvent extends Equatable {
|
|
const DashboardEvent();
|
|
|
|
@override
|
|
List<Object> get props => [];
|
|
}
|
|
|
|
class LoadDashboardData extends DashboardEvent {
|
|
final String organizationId;
|
|
final String userId;
|
|
/// Si true, utilise le dashboard global (stats toutes orgs) même quand organizationId est vide.
|
|
/// Utilisé pour SUPER_ADMIN qui n'appartient pas à une org.
|
|
final bool useGlobalDashboard;
|
|
|
|
const LoadDashboardData({
|
|
required this.organizationId,
|
|
required this.userId,
|
|
this.useGlobalDashboard = false,
|
|
});
|
|
|
|
@override
|
|
List<Object> get props => [organizationId, userId, useGlobalDashboard];
|
|
}
|
|
|
|
class RefreshDashboardData extends DashboardEvent {
|
|
final String organizationId;
|
|
final String userId;
|
|
final bool useGlobalDashboard;
|
|
|
|
const RefreshDashboardData({
|
|
required this.organizationId,
|
|
required this.userId,
|
|
this.useGlobalDashboard = false,
|
|
});
|
|
|
|
@override
|
|
List<Object> get props => [organizationId, userId, useGlobalDashboard];
|
|
}
|
|
|
|
class LoadDashboardStats extends DashboardEvent {
|
|
final String organizationId;
|
|
final String userId;
|
|
|
|
const LoadDashboardStats({
|
|
required this.organizationId,
|
|
required this.userId,
|
|
});
|
|
|
|
@override
|
|
List<Object> get props => [organizationId, userId];
|
|
}
|
|
|
|
class LoadRecentActivities extends DashboardEvent {
|
|
final String organizationId;
|
|
final String userId;
|
|
final int limit;
|
|
|
|
const LoadRecentActivities({
|
|
required this.organizationId,
|
|
required this.userId,
|
|
this.limit = 10,
|
|
});
|
|
|
|
@override
|
|
List<Object> get props => [organizationId, userId, limit];
|
|
}
|
|
|
|
class LoadUpcomingEvents extends DashboardEvent {
|
|
final String organizationId;
|
|
final String userId;
|
|
final int limit;
|
|
|
|
const LoadUpcomingEvents({
|
|
required this.organizationId,
|
|
required this.userId,
|
|
this.limit = 5,
|
|
});
|
|
|
|
@override
|
|
List<Object> get props => [organizationId, userId, limit];
|
|
}
|
|
|
|
/// Event déclenché par WebSocket pour rafraîchir le dashboard
|
|
class RefreshDashboardFromWebSocket extends DashboardEvent {
|
|
final Map<String, dynamic> data;
|
|
|
|
const RefreshDashboardFromWebSocket(this.data);
|
|
|
|
@override
|
|
List<Object> get props => [data];
|
|
}
|
|
|
|
/// Event pour gérer les changements de statut WebSocket
|
|
class WebSocketConnectionChanged extends DashboardEvent {
|
|
final bool isConnected;
|
|
|
|
const WebSocketConnectionChanged(this.isConnected);
|
|
|
|
@override
|
|
List<Object> get props => [isConnected];
|
|
}
|