111 lines
2.1 KiB
Dart
111 lines
2.1 KiB
Dart
/// Événements pour le BLoC des budgets
|
|
library budget_event;
|
|
|
|
import 'package:equatable/equatable.dart';
|
|
import '../../domain/entities/budget.dart';
|
|
|
|
abstract class BudgetEvent extends Equatable {
|
|
const BudgetEvent();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// Charger les budgets
|
|
class LoadBudgets extends BudgetEvent {
|
|
final String? organizationId;
|
|
final BudgetStatus? status;
|
|
final int? year;
|
|
|
|
const LoadBudgets({
|
|
this.organizationId,
|
|
this.status,
|
|
this.year,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [organizationId, status, year];
|
|
}
|
|
|
|
/// Charger un budget spécifique
|
|
class LoadBudgetById extends BudgetEvent {
|
|
final String budgetId;
|
|
|
|
const LoadBudgetById(this.budgetId);
|
|
|
|
@override
|
|
List<Object?> get props => [budgetId];
|
|
}
|
|
|
|
/// Créer un budget
|
|
class CreateBudgetEvent extends BudgetEvent {
|
|
final String name;
|
|
final String? description;
|
|
final String organizationId;
|
|
final BudgetPeriod period;
|
|
final int year;
|
|
final int? month;
|
|
final List<BudgetLine> lines;
|
|
|
|
const CreateBudgetEvent({
|
|
required this.name,
|
|
this.description,
|
|
required this.organizationId,
|
|
required this.period,
|
|
required this.year,
|
|
this.month,
|
|
required this.lines,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
name,
|
|
description,
|
|
organizationId,
|
|
period,
|
|
year,
|
|
month,
|
|
lines,
|
|
];
|
|
}
|
|
|
|
/// Charger le suivi budgétaire
|
|
class LoadBudgetTracking extends BudgetEvent {
|
|
final String budgetId;
|
|
|
|
const LoadBudgetTracking(this.budgetId);
|
|
|
|
@override
|
|
List<Object?> get props => [budgetId];
|
|
}
|
|
|
|
/// Rafraîchir les budgets
|
|
class RefreshBudgets extends BudgetEvent {
|
|
final String? organizationId;
|
|
final BudgetStatus? status;
|
|
final int? year;
|
|
|
|
const RefreshBudgets({
|
|
this.organizationId,
|
|
this.status,
|
|
this.year,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [organizationId, status, year];
|
|
}
|
|
|
|
/// Filtrer les budgets
|
|
class FilterBudgets extends BudgetEvent {
|
|
final BudgetStatus? status;
|
|
final int? year;
|
|
|
|
const FilterBudgets({
|
|
this.status,
|
|
this.year,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [status, year];
|
|
}
|