Clean project: remove test files, debug logs, and add documentation
This commit is contained in:
@@ -0,0 +1,407 @@
|
||||
/// Modèle de données pour les organisations
|
||||
/// Correspond au OrganisationDTO du backend
|
||||
library organisation_model;
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'organisation_model.g.dart';
|
||||
|
||||
/// Énumération des types d'organisation
|
||||
enum TypeOrganisation {
|
||||
@JsonValue('ASSOCIATION')
|
||||
association,
|
||||
@JsonValue('COOPERATIVE')
|
||||
cooperative,
|
||||
@JsonValue('LIONS_CLUB')
|
||||
lionsClub,
|
||||
@JsonValue('ENTREPRISE')
|
||||
entreprise,
|
||||
@JsonValue('ONG')
|
||||
ong,
|
||||
@JsonValue('FONDATION')
|
||||
fondation,
|
||||
@JsonValue('SYNDICAT')
|
||||
syndicat,
|
||||
@JsonValue('AUTRE')
|
||||
autre,
|
||||
}
|
||||
|
||||
/// Énumération des statuts d'organisation
|
||||
enum StatutOrganisation {
|
||||
@JsonValue('ACTIVE')
|
||||
active,
|
||||
@JsonValue('INACTIVE')
|
||||
inactive,
|
||||
@JsonValue('SUSPENDUE')
|
||||
suspendue,
|
||||
@JsonValue('DISSOUTE')
|
||||
dissoute,
|
||||
@JsonValue('EN_CREATION')
|
||||
enCreation,
|
||||
}
|
||||
|
||||
/// Extension pour les types d'organisation
|
||||
extension TypeOrganisationExtension on TypeOrganisation {
|
||||
String get displayName {
|
||||
switch (this) {
|
||||
case TypeOrganisation.association:
|
||||
return 'Association';
|
||||
case TypeOrganisation.cooperative:
|
||||
return 'Coopérative';
|
||||
case TypeOrganisation.lionsClub:
|
||||
return 'Lions Club';
|
||||
case TypeOrganisation.entreprise:
|
||||
return 'Entreprise';
|
||||
case TypeOrganisation.ong:
|
||||
return 'ONG';
|
||||
case TypeOrganisation.fondation:
|
||||
return 'Fondation';
|
||||
case TypeOrganisation.syndicat:
|
||||
return 'Syndicat';
|
||||
case TypeOrganisation.autre:
|
||||
return 'Autre';
|
||||
}
|
||||
}
|
||||
|
||||
String get icon {
|
||||
switch (this) {
|
||||
case TypeOrganisation.association:
|
||||
return '🏛️';
|
||||
case TypeOrganisation.cooperative:
|
||||
return '🤝';
|
||||
case TypeOrganisation.lionsClub:
|
||||
return '🦁';
|
||||
case TypeOrganisation.entreprise:
|
||||
return '🏢';
|
||||
case TypeOrganisation.ong:
|
||||
return '🌍';
|
||||
case TypeOrganisation.fondation:
|
||||
return '🏛️';
|
||||
case TypeOrganisation.syndicat:
|
||||
return '⚖️';
|
||||
case TypeOrganisation.autre:
|
||||
return '📋';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension pour les statuts d'organisation
|
||||
extension StatutOrganisationExtension on StatutOrganisation {
|
||||
String get displayName {
|
||||
switch (this) {
|
||||
case StatutOrganisation.active:
|
||||
return 'Active';
|
||||
case StatutOrganisation.inactive:
|
||||
return 'Inactive';
|
||||
case StatutOrganisation.suspendue:
|
||||
return 'Suspendue';
|
||||
case StatutOrganisation.dissoute:
|
||||
return 'Dissoute';
|
||||
case StatutOrganisation.enCreation:
|
||||
return 'En création';
|
||||
}
|
||||
}
|
||||
|
||||
String get color {
|
||||
switch (this) {
|
||||
case StatutOrganisation.active:
|
||||
return '#10B981'; // Vert
|
||||
case StatutOrganisation.inactive:
|
||||
return '#6B7280'; // Gris
|
||||
case StatutOrganisation.suspendue:
|
||||
return '#F59E0B'; // Orange
|
||||
case StatutOrganisation.dissoute:
|
||||
return '#EF4444'; // Rouge
|
||||
case StatutOrganisation.enCreation:
|
||||
return '#3B82F6'; // Bleu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Modèle d'organisation mobile
|
||||
@JsonSerializable()
|
||||
class OrganisationModel extends Equatable {
|
||||
/// Identifiant unique
|
||||
final String? id;
|
||||
|
||||
/// Nom de l'organisation
|
||||
final String nom;
|
||||
|
||||
/// Nom court ou sigle
|
||||
final String? nomCourt;
|
||||
|
||||
/// Type d'organisation
|
||||
@JsonKey(name: 'typeOrganisation')
|
||||
final TypeOrganisation typeOrganisation;
|
||||
|
||||
/// Statut de l'organisation
|
||||
final StatutOrganisation statut;
|
||||
|
||||
/// Description
|
||||
final String? description;
|
||||
|
||||
/// Date de fondation
|
||||
@JsonKey(name: 'dateFondation')
|
||||
final DateTime? dateFondation;
|
||||
|
||||
/// Numéro d'enregistrement officiel
|
||||
@JsonKey(name: 'numeroEnregistrement')
|
||||
final String? numeroEnregistrement;
|
||||
|
||||
/// Email de contact
|
||||
final String? email;
|
||||
|
||||
/// Téléphone
|
||||
final String? telephone;
|
||||
|
||||
/// Site web
|
||||
@JsonKey(name: 'siteWeb')
|
||||
final String? siteWeb;
|
||||
|
||||
/// Adresse complète
|
||||
final String? adresse;
|
||||
|
||||
/// Ville
|
||||
final String? ville;
|
||||
|
||||
/// Code postal
|
||||
@JsonKey(name: 'codePostal')
|
||||
final String? codePostal;
|
||||
|
||||
/// Région
|
||||
final String? region;
|
||||
|
||||
/// Pays
|
||||
final String? pays;
|
||||
|
||||
/// Logo URL
|
||||
final String? logo;
|
||||
|
||||
/// Nombre de membres
|
||||
@JsonKey(name: 'nombreMembres')
|
||||
final int nombreMembres;
|
||||
|
||||
/// Nombre d'administrateurs
|
||||
@JsonKey(name: 'nombreAdministrateurs')
|
||||
final int nombreAdministrateurs;
|
||||
|
||||
/// Budget annuel
|
||||
@JsonKey(name: 'budgetAnnuel')
|
||||
final double? budgetAnnuel;
|
||||
|
||||
/// Devise
|
||||
final String devise;
|
||||
|
||||
/// Cotisation obligatoire
|
||||
@JsonKey(name: 'cotisationObligatoire')
|
||||
final bool cotisationObligatoire;
|
||||
|
||||
/// Montant cotisation annuelle
|
||||
@JsonKey(name: 'montantCotisationAnnuelle')
|
||||
final double? montantCotisationAnnuelle;
|
||||
|
||||
/// Objectifs
|
||||
final String? objectifs;
|
||||
|
||||
/// Activités principales
|
||||
@JsonKey(name: 'activitesPrincipales')
|
||||
final String? activitesPrincipales;
|
||||
|
||||
/// Certifications
|
||||
final String? certifications;
|
||||
|
||||
/// Partenaires
|
||||
final String? partenaires;
|
||||
|
||||
/// Organisation publique
|
||||
@JsonKey(name: 'organisationPublique')
|
||||
final bool organisationPublique;
|
||||
|
||||
/// Accepte nouveaux membres
|
||||
@JsonKey(name: 'accepteNouveauxMembres')
|
||||
final bool accepteNouveauxMembres;
|
||||
|
||||
/// Date de création
|
||||
@JsonKey(name: 'dateCreation')
|
||||
final DateTime? dateCreation;
|
||||
|
||||
/// Date de modification
|
||||
@JsonKey(name: 'dateModification')
|
||||
final DateTime? dateModification;
|
||||
|
||||
/// Actif
|
||||
final bool actif;
|
||||
|
||||
const OrganisationModel({
|
||||
this.id,
|
||||
required this.nom,
|
||||
this.nomCourt,
|
||||
this.typeOrganisation = TypeOrganisation.association,
|
||||
this.statut = StatutOrganisation.active,
|
||||
this.description,
|
||||
this.dateFondation,
|
||||
this.numeroEnregistrement,
|
||||
this.email,
|
||||
this.telephone,
|
||||
this.siteWeb,
|
||||
this.adresse,
|
||||
this.ville,
|
||||
this.codePostal,
|
||||
this.region,
|
||||
this.pays,
|
||||
this.logo,
|
||||
this.nombreMembres = 0,
|
||||
this.nombreAdministrateurs = 0,
|
||||
this.budgetAnnuel,
|
||||
this.devise = 'XOF',
|
||||
this.cotisationObligatoire = false,
|
||||
this.montantCotisationAnnuelle,
|
||||
this.objectifs,
|
||||
this.activitesPrincipales,
|
||||
this.certifications,
|
||||
this.partenaires,
|
||||
this.organisationPublique = true,
|
||||
this.accepteNouveauxMembres = true,
|
||||
this.dateCreation,
|
||||
this.dateModification,
|
||||
this.actif = true,
|
||||
});
|
||||
|
||||
/// Factory depuis JSON
|
||||
factory OrganisationModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$OrganisationModelFromJson(json);
|
||||
|
||||
/// Conversion vers JSON
|
||||
Map<String, dynamic> toJson() => _$OrganisationModelToJson(this);
|
||||
|
||||
/// Copie avec modifications
|
||||
OrganisationModel copyWith({
|
||||
String? id,
|
||||
String? nom,
|
||||
String? nomCourt,
|
||||
TypeOrganisation? typeOrganisation,
|
||||
StatutOrganisation? statut,
|
||||
String? description,
|
||||
DateTime? dateFondation,
|
||||
String? numeroEnregistrement,
|
||||
String? email,
|
||||
String? telephone,
|
||||
String? siteWeb,
|
||||
String? adresse,
|
||||
String? ville,
|
||||
String? codePostal,
|
||||
String? region,
|
||||
String? pays,
|
||||
String? logo,
|
||||
int? nombreMembres,
|
||||
int? nombreAdministrateurs,
|
||||
double? budgetAnnuel,
|
||||
String? devise,
|
||||
bool? cotisationObligatoire,
|
||||
double? montantCotisationAnnuelle,
|
||||
String? objectifs,
|
||||
String? activitesPrincipales,
|
||||
String? certifications,
|
||||
String? partenaires,
|
||||
bool? organisationPublique,
|
||||
bool? accepteNouveauxMembres,
|
||||
DateTime? dateCreation,
|
||||
DateTime? dateModification,
|
||||
bool? actif,
|
||||
}) {
|
||||
return OrganisationModel(
|
||||
id: id ?? this.id,
|
||||
nom: nom ?? this.nom,
|
||||
nomCourt: nomCourt ?? this.nomCourt,
|
||||
typeOrganisation: typeOrganisation ?? this.typeOrganisation,
|
||||
statut: statut ?? this.statut,
|
||||
description: description ?? this.description,
|
||||
dateFondation: dateFondation ?? this.dateFondation,
|
||||
numeroEnregistrement: numeroEnregistrement ?? this.numeroEnregistrement,
|
||||
email: email ?? this.email,
|
||||
telephone: telephone ?? this.telephone,
|
||||
siteWeb: siteWeb ?? this.siteWeb,
|
||||
adresse: adresse ?? this.adresse,
|
||||
ville: ville ?? this.ville,
|
||||
codePostal: codePostal ?? this.codePostal,
|
||||
region: region ?? this.region,
|
||||
pays: pays ?? this.pays,
|
||||
logo: logo ?? this.logo,
|
||||
nombreMembres: nombreMembres ?? this.nombreMembres,
|
||||
nombreAdministrateurs: nombreAdministrateurs ?? this.nombreAdministrateurs,
|
||||
budgetAnnuel: budgetAnnuel ?? this.budgetAnnuel,
|
||||
devise: devise ?? this.devise,
|
||||
cotisationObligatoire: cotisationObligatoire ?? this.cotisationObligatoire,
|
||||
montantCotisationAnnuelle: montantCotisationAnnuelle ?? this.montantCotisationAnnuelle,
|
||||
objectifs: objectifs ?? this.objectifs,
|
||||
activitesPrincipales: activitesPrincipales ?? this.activitesPrincipales,
|
||||
certifications: certifications ?? this.certifications,
|
||||
partenaires: partenaires ?? this.partenaires,
|
||||
organisationPublique: organisationPublique ?? this.organisationPublique,
|
||||
accepteNouveauxMembres: accepteNouveauxMembres ?? this.accepteNouveauxMembres,
|
||||
dateCreation: dateCreation ?? this.dateCreation,
|
||||
dateModification: dateModification ?? this.dateModification,
|
||||
actif: actif ?? this.actif,
|
||||
);
|
||||
}
|
||||
|
||||
/// Ancienneté en années
|
||||
int get ancienneteAnnees {
|
||||
if (dateFondation == null) return 0;
|
||||
return DateTime.now().difference(dateFondation!).inDays ~/ 365;
|
||||
}
|
||||
|
||||
/// Adresse complète formatée
|
||||
String get adresseComplete {
|
||||
final parts = <String>[];
|
||||
if (adresse?.isNotEmpty == true) parts.add(adresse!);
|
||||
if (ville?.isNotEmpty == true) parts.add(ville!);
|
||||
if (codePostal?.isNotEmpty == true) parts.add(codePostal!);
|
||||
if (region?.isNotEmpty == true) parts.add(region!);
|
||||
if (pays?.isNotEmpty == true) parts.add(pays!);
|
||||
return parts.join(', ');
|
||||
}
|
||||
|
||||
/// Nom d'affichage
|
||||
String get nomAffichage => nomCourt?.isNotEmpty == true ? '$nomCourt ($nom)' : nom;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
nom,
|
||||
nomCourt,
|
||||
typeOrganisation,
|
||||
statut,
|
||||
description,
|
||||
dateFondation,
|
||||
numeroEnregistrement,
|
||||
email,
|
||||
telephone,
|
||||
siteWeb,
|
||||
adresse,
|
||||
ville,
|
||||
codePostal,
|
||||
region,
|
||||
pays,
|
||||
logo,
|
||||
nombreMembres,
|
||||
nombreAdministrateurs,
|
||||
budgetAnnuel,
|
||||
devise,
|
||||
cotisationObligatoire,
|
||||
montantCotisationAnnuelle,
|
||||
objectifs,
|
||||
activitesPrincipales,
|
||||
certifications,
|
||||
partenaires,
|
||||
organisationPublique,
|
||||
accepteNouveauxMembres,
|
||||
dateCreation,
|
||||
dateModification,
|
||||
actif,
|
||||
];
|
||||
|
||||
@override
|
||||
String toString() => 'OrganisationModel(id: $id, nom: $nom, type: $typeOrganisation, statut: $statut)';
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'organisation_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
OrganisationModel _$OrganisationModelFromJson(Map<String, dynamic> json) =>
|
||||
OrganisationModel(
|
||||
id: json['id'] as String?,
|
||||
nom: json['nom'] as String,
|
||||
nomCourt: json['nomCourt'] as String?,
|
||||
typeOrganisation: $enumDecodeNullable(
|
||||
_$TypeOrganisationEnumMap, json['typeOrganisation']) ??
|
||||
TypeOrganisation.association,
|
||||
statut:
|
||||
$enumDecodeNullable(_$StatutOrganisationEnumMap, json['statut']) ??
|
||||
StatutOrganisation.active,
|
||||
description: json['description'] as String?,
|
||||
dateFondation: json['dateFondation'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateFondation'] as String),
|
||||
numeroEnregistrement: json['numeroEnregistrement'] as String?,
|
||||
email: json['email'] as String?,
|
||||
telephone: json['telephone'] as String?,
|
||||
siteWeb: json['siteWeb'] as String?,
|
||||
adresse: json['adresse'] as String?,
|
||||
ville: json['ville'] as String?,
|
||||
codePostal: json['codePostal'] as String?,
|
||||
region: json['region'] as String?,
|
||||
pays: json['pays'] as String?,
|
||||
logo: json['logo'] as String?,
|
||||
nombreMembres: (json['nombreMembres'] as num?)?.toInt() ?? 0,
|
||||
nombreAdministrateurs:
|
||||
(json['nombreAdministrateurs'] as num?)?.toInt() ?? 0,
|
||||
budgetAnnuel: (json['budgetAnnuel'] as num?)?.toDouble(),
|
||||
devise: json['devise'] as String? ?? 'XOF',
|
||||
cotisationObligatoire: json['cotisationObligatoire'] as bool? ?? false,
|
||||
montantCotisationAnnuelle:
|
||||
(json['montantCotisationAnnuelle'] as num?)?.toDouble(),
|
||||
objectifs: json['objectifs'] as String?,
|
||||
activitesPrincipales: json['activitesPrincipales'] as String?,
|
||||
certifications: json['certifications'] as String?,
|
||||
partenaires: json['partenaires'] as String?,
|
||||
organisationPublique: json['organisationPublique'] as bool? ?? true,
|
||||
accepteNouveauxMembres: json['accepteNouveauxMembres'] as bool? ?? true,
|
||||
dateCreation: json['dateCreation'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateCreation'] as String),
|
||||
dateModification: json['dateModification'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateModification'] as String),
|
||||
actif: json['actif'] as bool? ?? true,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$OrganisationModelToJson(OrganisationModel instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'nom': instance.nom,
|
||||
'nomCourt': instance.nomCourt,
|
||||
'typeOrganisation': _$TypeOrganisationEnumMap[instance.typeOrganisation]!,
|
||||
'statut': _$StatutOrganisationEnumMap[instance.statut]!,
|
||||
'description': instance.description,
|
||||
'dateFondation': instance.dateFondation?.toIso8601String(),
|
||||
'numeroEnregistrement': instance.numeroEnregistrement,
|
||||
'email': instance.email,
|
||||
'telephone': instance.telephone,
|
||||
'siteWeb': instance.siteWeb,
|
||||
'adresse': instance.adresse,
|
||||
'ville': instance.ville,
|
||||
'codePostal': instance.codePostal,
|
||||
'region': instance.region,
|
||||
'pays': instance.pays,
|
||||
'logo': instance.logo,
|
||||
'nombreMembres': instance.nombreMembres,
|
||||
'nombreAdministrateurs': instance.nombreAdministrateurs,
|
||||
'budgetAnnuel': instance.budgetAnnuel,
|
||||
'devise': instance.devise,
|
||||
'cotisationObligatoire': instance.cotisationObligatoire,
|
||||
'montantCotisationAnnuelle': instance.montantCotisationAnnuelle,
|
||||
'objectifs': instance.objectifs,
|
||||
'activitesPrincipales': instance.activitesPrincipales,
|
||||
'certifications': instance.certifications,
|
||||
'partenaires': instance.partenaires,
|
||||
'organisationPublique': instance.organisationPublique,
|
||||
'accepteNouveauxMembres': instance.accepteNouveauxMembres,
|
||||
'dateCreation': instance.dateCreation?.toIso8601String(),
|
||||
'dateModification': instance.dateModification?.toIso8601String(),
|
||||
'actif': instance.actif,
|
||||
};
|
||||
|
||||
const _$TypeOrganisationEnumMap = {
|
||||
TypeOrganisation.association: 'ASSOCIATION',
|
||||
TypeOrganisation.cooperative: 'COOPERATIVE',
|
||||
TypeOrganisation.lionsClub: 'LIONS_CLUB',
|
||||
TypeOrganisation.entreprise: 'ENTREPRISE',
|
||||
TypeOrganisation.ong: 'ONG',
|
||||
TypeOrganisation.fondation: 'FONDATION',
|
||||
TypeOrganisation.syndicat: 'SYNDICAT',
|
||||
TypeOrganisation.autre: 'AUTRE',
|
||||
};
|
||||
|
||||
const _$StatutOrganisationEnumMap = {
|
||||
StatutOrganisation.active: 'ACTIVE',
|
||||
StatutOrganisation.inactive: 'INACTIVE',
|
||||
StatutOrganisation.suspendue: 'SUSPENDUE',
|
||||
StatutOrganisation.dissoute: 'DISSOUTE',
|
||||
StatutOrganisation.enCreation: 'EN_CREATION',
|
||||
};
|
||||
Reference in New Issue
Block a user