Initial commit: unionflow-mobile-apps

Application Flutter complète (sans build artifacts).

Signed-off-by: lions dev Team
This commit is contained in:
dahoud
2026-03-15 16:30:08 +00:00
commit d094d6db9c
1790 changed files with 507435 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
/// Modèle de données pour les adhésions (demandes d'adhésion à une organisation)
/// Correspond à l'API AdhesionResource / AdhesionDTO
library adhesion_model;
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'adhesion_model.g.dart';
/// Statut d'une demande d'adhésion
enum StatutAdhesion {
@JsonValue('EN_ATTENTE')
enAttente,
@JsonValue('APPROUVEE')
approuvee,
@JsonValue('REJETEE')
rejetee,
@JsonValue('ANNULEE')
annulee,
@JsonValue('EN_PAIEMENT')
enPaiement,
@JsonValue('PAYEE')
payee,
}
/// Modèle d'une adhésion
@JsonSerializable(explicitToJson: true)
class AdhesionModel extends Equatable {
final String? id;
final String? numeroReference;
final String? membreId;
final String? numeroMembre;
final String? nomMembre;
final String? emailMembre;
final String? organisationId;
final String? nomOrganisation;
final DateTime? dateDemande;
final double? fraisAdhesion;
final double? montantPaye;
final String? codeDevise;
final String? statut;
final DateTime? dateApprobation;
final DateTime? datePaiement;
final String? methodePaiement;
final String? referencePaiement;
final String? motifRejet;
final String? observations;
final String? approuvePar;
final DateTime? dateCreation;
final DateTime? dateModification;
const AdhesionModel({
this.id,
this.numeroReference,
this.membreId,
this.numeroMembre,
this.nomMembre,
this.emailMembre,
this.organisationId,
this.nomOrganisation,
this.dateDemande,
this.fraisAdhesion,
this.montantPaye,
this.codeDevise,
this.statut,
this.dateApprobation,
this.datePaiement,
this.methodePaiement,
this.referencePaiement,
this.motifRejet,
this.observations,
this.approuvePar,
this.dateCreation,
this.dateModification,
});
factory AdhesionModel.fromJson(Map<String, dynamic> json) =>
_$AdhesionModelFromJson(json);
Map<String, dynamic> toJson() => _$AdhesionModelToJson(this);
/// Montant restant à payer
double get montantRestant {
if (fraisAdhesion == null) return 0;
final paye = montantPaye ?? 0;
final restant = fraisAdhesion! - paye;
return restant > 0 ? restant : 0;
}
/// Pourcentage payé
int get pourcentagePaiement {
if (fraisAdhesion == null || fraisAdhesion! == 0) return 0;
if (montantPaye == null) return 0;
return ((montantPaye! / fraisAdhesion!) * 100).round();
}
bool get estPayeeIntegralement =>
fraisAdhesion != null &&
montantPaye != null &&
montantPaye! >= fraisAdhesion!;
bool get estEnAttentePaiement =>
statut == 'APPROUVEE' && !estPayeeIntegralement;
String get statutLibelle {
switch (statut) {
case 'EN_ATTENTE':
return 'En attente';
case 'APPROUVEE':
return 'Approuvée';
case 'REJETEE':
return 'Rejetée';
case 'ANNULEE':
return 'Annulée';
case 'EN_PAIEMENT':
return 'En paiement';
case 'PAYEE':
return 'Payée';
default:
return statut ?? 'Non défini';
}
}
String get nomMembreComplet =>
[nomMembre, numeroMembre].where((e) => e != null && e.isNotEmpty).join(' ').trim().isEmpty
? (emailMembre ?? 'Membre')
: [nomMembre, numeroMembre].where((e) => e != null && e.isNotEmpty).join(' ').trim();
@override
List<Object?> get props => [
id,
numeroReference,
membreId,
organisationId,
statut,
dateDemande,
fraisAdhesion,
montantPaye,
];
}

View File

@@ -0,0 +1,69 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'adhesion_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
AdhesionModel _$AdhesionModelFromJson(Map<String, dynamic> json) =>
AdhesionModel(
id: json['id'] as String?,
numeroReference: json['numeroReference'] as String?,
membreId: json['membreId'] as String?,
numeroMembre: json['numeroMembre'] as String?,
nomMembre: json['nomMembre'] as String?,
emailMembre: json['emailMembre'] as String?,
organisationId: json['organisationId'] as String?,
nomOrganisation: json['nomOrganisation'] as String?,
dateDemande: json['dateDemande'] == null
? null
: DateTime.parse(json['dateDemande'] as String),
fraisAdhesion: (json['fraisAdhesion'] as num?)?.toDouble(),
montantPaye: (json['montantPaye'] as num?)?.toDouble(),
codeDevise: json['codeDevise'] as String?,
statut: json['statut'] as String?,
dateApprobation: json['dateApprobation'] == null
? null
: DateTime.parse(json['dateApprobation'] as String),
datePaiement: json['datePaiement'] == null
? null
: DateTime.parse(json['datePaiement'] as String),
methodePaiement: json['methodePaiement'] as String?,
referencePaiement: json['referencePaiement'] as String?,
motifRejet: json['motifRejet'] as String?,
observations: json['observations'] as String?,
approuvePar: json['approuvePar'] as String?,
dateCreation: json['dateCreation'] == null
? null
: DateTime.parse(json['dateCreation'] as String),
dateModification: json['dateModification'] == null
? null
: DateTime.parse(json['dateModification'] as String),
);
Map<String, dynamic> _$AdhesionModelToJson(AdhesionModel instance) =>
<String, dynamic>{
'id': instance.id,
'numeroReference': instance.numeroReference,
'membreId': instance.membreId,
'numeroMembre': instance.numeroMembre,
'nomMembre': instance.nomMembre,
'emailMembre': instance.emailMembre,
'organisationId': instance.organisationId,
'nomOrganisation': instance.nomOrganisation,
'dateDemande': instance.dateDemande?.toIso8601String(),
'fraisAdhesion': instance.fraisAdhesion,
'montantPaye': instance.montantPaye,
'codeDevise': instance.codeDevise,
'statut': instance.statut,
'dateApprobation': instance.dateApprobation?.toIso8601String(),
'datePaiement': instance.datePaiement?.toIso8601String(),
'methodePaiement': instance.methodePaiement,
'referencePaiement': instance.referencePaiement,
'motifRejet': instance.motifRejet,
'observations': instance.observations,
'approuvePar': instance.approuvePar,
'dateCreation': instance.dateCreation?.toIso8601String(),
'dateModification': instance.dateModification?.toIso8601String(),
};