207 lines
4.6 KiB
Dart
207 lines
4.6 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
import '../../../../core/models/cotisation_model.dart';
|
|
|
|
/// Événements du BLoC des cotisations
|
|
abstract class CotisationsEvent extends Equatable {
|
|
const CotisationsEvent();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// Événement pour charger la liste des cotisations
|
|
class LoadCotisations extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
final bool refresh;
|
|
|
|
const LoadCotisations({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
this.refresh = false,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size, refresh];
|
|
}
|
|
|
|
/// Événement pour charger une cotisation par ID
|
|
class LoadCotisationById extends CotisationsEvent {
|
|
final String id;
|
|
|
|
const LoadCotisationById(this.id);
|
|
|
|
@override
|
|
List<Object?> get props => [id];
|
|
}
|
|
|
|
/// Événement pour charger une cotisation par référence
|
|
class LoadCotisationByReference extends CotisationsEvent {
|
|
final String numeroReference;
|
|
|
|
const LoadCotisationByReference(this.numeroReference);
|
|
|
|
@override
|
|
List<Object?> get props => [numeroReference];
|
|
}
|
|
|
|
/// Événement pour créer une nouvelle cotisation
|
|
class CreateCotisation extends CotisationsEvent {
|
|
final CotisationModel cotisation;
|
|
|
|
const CreateCotisation(this.cotisation);
|
|
|
|
@override
|
|
List<Object?> get props => [cotisation];
|
|
}
|
|
|
|
/// Événement pour mettre à jour une cotisation
|
|
class UpdateCotisation extends CotisationsEvent {
|
|
final String id;
|
|
final CotisationModel cotisation;
|
|
|
|
const UpdateCotisation(this.id, this.cotisation);
|
|
|
|
@override
|
|
List<Object?> get props => [id, cotisation];
|
|
}
|
|
|
|
/// Événement pour supprimer une cotisation
|
|
class DeleteCotisation extends CotisationsEvent {
|
|
final String id;
|
|
|
|
const DeleteCotisation(this.id);
|
|
|
|
@override
|
|
List<Object?> get props => [id];
|
|
}
|
|
|
|
/// Événement pour charger les cotisations d'un membre
|
|
class LoadCotisationsByMembre extends CotisationsEvent {
|
|
final String membreId;
|
|
final int page;
|
|
final int size;
|
|
final bool refresh;
|
|
|
|
const LoadCotisationsByMembre(
|
|
this.membreId, {
|
|
this.page = 0,
|
|
this.size = 20,
|
|
this.refresh = false,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [membreId, page, size, refresh];
|
|
}
|
|
|
|
/// Événement pour charger les cotisations par statut
|
|
class LoadCotisationsByStatut extends CotisationsEvent {
|
|
final String statut;
|
|
final int page;
|
|
final int size;
|
|
final bool refresh;
|
|
|
|
const LoadCotisationsByStatut(
|
|
this.statut, {
|
|
this.page = 0,
|
|
this.size = 20,
|
|
this.refresh = false,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [statut, page, size, refresh];
|
|
}
|
|
|
|
/// Événement pour charger les cotisations en retard
|
|
class LoadCotisationsEnRetard extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
final bool refresh;
|
|
|
|
const LoadCotisationsEnRetard({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
this.refresh = false,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size, refresh];
|
|
}
|
|
|
|
/// Événement pour rechercher des cotisations
|
|
class SearchCotisations extends CotisationsEvent {
|
|
final String? membreId;
|
|
final String? statut;
|
|
final String? typeCotisation;
|
|
final int? annee;
|
|
final int? mois;
|
|
final int page;
|
|
final int size;
|
|
final bool refresh;
|
|
|
|
const SearchCotisations({
|
|
this.membreId,
|
|
this.statut,
|
|
this.typeCotisation,
|
|
this.annee,
|
|
this.mois,
|
|
this.page = 0,
|
|
this.size = 20,
|
|
this.refresh = false,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
membreId,
|
|
statut,
|
|
typeCotisation,
|
|
annee,
|
|
mois,
|
|
page,
|
|
size,
|
|
refresh,
|
|
];
|
|
}
|
|
|
|
/// Événement pour charger les statistiques
|
|
class LoadCotisationsStats extends CotisationsEvent {
|
|
const LoadCotisationsStats();
|
|
}
|
|
|
|
/// Événement pour rafraîchir les données
|
|
class RefreshCotisations extends CotisationsEvent {
|
|
const RefreshCotisations();
|
|
}
|
|
|
|
/// Événement pour réinitialiser l'état
|
|
class ResetCotisationsState extends CotisationsEvent {
|
|
const ResetCotisationsState();
|
|
}
|
|
|
|
/// Événement pour filtrer les cotisations localement
|
|
class FilterCotisations extends CotisationsEvent {
|
|
final String? searchQuery;
|
|
final String? statutFilter;
|
|
final String? typeFilter;
|
|
|
|
const FilterCotisations({
|
|
this.searchQuery,
|
|
this.statutFilter,
|
|
this.typeFilter,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [searchQuery, statutFilter, typeFilter];
|
|
}
|
|
|
|
/// Événement pour trier les cotisations
|
|
class SortCotisations extends CotisationsEvent {
|
|
final String sortBy; // 'dateEcheance', 'montantDu', 'statut', etc.
|
|
final bool ascending;
|
|
|
|
const SortCotisations(this.sortBy, {this.ascending = true});
|
|
|
|
@override
|
|
List<Object?> get props => [sortBy, ascending];
|
|
}
|