224 lines
4.7 KiB
Dart
224 lines
4.7 KiB
Dart
/// Événements pour le BLoC des cotisations
|
|
library cotisations_event;
|
|
|
|
import 'package:equatable/equatable.dart';
|
|
import '../data/models/cotisation_model.dart';
|
|
|
|
/// Classe de base pour tous les événements de cotisations
|
|
abstract class CotisationsEvent extends Equatable {
|
|
const CotisationsEvent();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// Charger la liste des cotisations
|
|
class LoadCotisations extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
|
|
const LoadCotisations({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size];
|
|
}
|
|
|
|
/// Charger une cotisation par ID
|
|
class LoadCotisationById extends CotisationsEvent {
|
|
final String id;
|
|
|
|
const LoadCotisationById({required this.id});
|
|
|
|
@override
|
|
List<Object?> get props => [id];
|
|
}
|
|
|
|
/// Créer une nouvelle cotisation
|
|
class CreateCotisation extends CotisationsEvent {
|
|
final CotisationModel cotisation;
|
|
|
|
const CreateCotisation({required this.cotisation});
|
|
|
|
@override
|
|
List<Object?> get props => [cotisation];
|
|
}
|
|
|
|
/// Mettre à jour une cotisation
|
|
class UpdateCotisation extends CotisationsEvent {
|
|
final String id;
|
|
final CotisationModel cotisation;
|
|
|
|
const UpdateCotisation({
|
|
required this.id,
|
|
required this.cotisation,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [id, cotisation];
|
|
}
|
|
|
|
/// Supprimer une cotisation
|
|
class DeleteCotisation extends CotisationsEvent {
|
|
final String id;
|
|
|
|
const DeleteCotisation({required this.id});
|
|
|
|
@override
|
|
List<Object?> get props => [id];
|
|
}
|
|
|
|
/// Rechercher des cotisations
|
|
class SearchCotisations extends CotisationsEvent {
|
|
final String? membreId;
|
|
final StatutCotisation? statut;
|
|
final TypeCotisation? type;
|
|
final int? annee;
|
|
final int page;
|
|
final int size;
|
|
|
|
const SearchCotisations({
|
|
this.membreId,
|
|
this.statut,
|
|
this.type,
|
|
this.annee,
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [membreId, statut, type, annee, page, size];
|
|
}
|
|
|
|
/// Charger les cotisations d'un membre
|
|
class LoadCotisationsByMembre extends CotisationsEvent {
|
|
final String membreId;
|
|
final int page;
|
|
final int size;
|
|
|
|
const LoadCotisationsByMembre({
|
|
required this.membreId,
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [membreId, page, size];
|
|
}
|
|
|
|
/// Charger les cotisations payées
|
|
class LoadCotisationsPayees extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
|
|
const LoadCotisationsPayees({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size];
|
|
}
|
|
|
|
/// Charger les cotisations non payées
|
|
class LoadCotisationsNonPayees extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
|
|
const LoadCotisationsNonPayees({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size];
|
|
}
|
|
|
|
/// Charger les cotisations en retard
|
|
class LoadCotisationsEnRetard extends CotisationsEvent {
|
|
final int page;
|
|
final int size;
|
|
|
|
const LoadCotisationsEnRetard({
|
|
this.page = 0,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [page, size];
|
|
}
|
|
|
|
/// Enregistrer un paiement
|
|
class EnregistrerPaiement extends CotisationsEvent {
|
|
final String cotisationId;
|
|
final double montant;
|
|
final MethodePaiement methodePaiement;
|
|
final String? numeroPaiement;
|
|
final String? referencePaiement;
|
|
final DateTime datePaiement;
|
|
final String? notes;
|
|
final String? reference;
|
|
|
|
const EnregistrerPaiement({
|
|
required this.cotisationId,
|
|
required this.montant,
|
|
required this.methodePaiement,
|
|
this.numeroPaiement,
|
|
this.referencePaiement,
|
|
required this.datePaiement,
|
|
this.notes,
|
|
this.reference,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
cotisationId,
|
|
montant,
|
|
methodePaiement,
|
|
numeroPaiement,
|
|
referencePaiement,
|
|
datePaiement,
|
|
notes,
|
|
reference,
|
|
];
|
|
}
|
|
|
|
/// Charger les statistiques des cotisations
|
|
class LoadCotisationsStats extends CotisationsEvent {
|
|
final int? annee;
|
|
|
|
const LoadCotisationsStats({this.annee});
|
|
|
|
@override
|
|
List<Object?> get props => [annee];
|
|
}
|
|
|
|
/// Générer les cotisations annuelles
|
|
class GenererCotisationsAnnuelles extends CotisationsEvent {
|
|
final int annee;
|
|
final double montant;
|
|
final DateTime dateEcheance;
|
|
|
|
const GenererCotisationsAnnuelles({
|
|
required this.annee,
|
|
required this.montant,
|
|
required this.dateEcheance,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [annee, montant, dateEcheance];
|
|
}
|
|
|
|
/// Envoyer un rappel de paiement
|
|
class EnvoyerRappelPaiement extends CotisationsEvent {
|
|
final String cotisationId;
|
|
|
|
const EnvoyerRappelPaiement({required this.cotisationId});
|
|
|
|
@override
|
|
List<Object?> get props => [cotisationId];
|
|
}
|
|
|