refactoring
This commit is contained in:
@@ -7,26 +7,6 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'organization_model.g.dart';
|
||||
|
||||
/// Énumération des types d'organisation
|
||||
enum TypeOrganization {
|
||||
@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 StatutOrganization {
|
||||
@JsonValue('ACTIVE')
|
||||
@@ -41,51 +21,6 @@ enum StatutOrganization {
|
||||
enCreation,
|
||||
}
|
||||
|
||||
/// Extension pour les types d'organisation
|
||||
extension TypeOrganizationExtension on TypeOrganization {
|
||||
String get displayName {
|
||||
switch (this) {
|
||||
case TypeOrganization.association:
|
||||
return 'Association';
|
||||
case TypeOrganization.cooperative:
|
||||
return 'Coopérative';
|
||||
case TypeOrganization.lionsClub:
|
||||
return 'Lions Club';
|
||||
case TypeOrganization.entreprise:
|
||||
return 'Entreprise';
|
||||
case TypeOrganization.ong:
|
||||
return 'ONG';
|
||||
case TypeOrganization.fondation:
|
||||
return 'Fondation';
|
||||
case TypeOrganization.syndicat:
|
||||
return 'Syndicat';
|
||||
case TypeOrganization.autre:
|
||||
return 'Autre';
|
||||
}
|
||||
}
|
||||
|
||||
String get icon {
|
||||
switch (this) {
|
||||
case TypeOrganization.association:
|
||||
return '🏛️';
|
||||
case TypeOrganization.cooperative:
|
||||
return '🤝';
|
||||
case TypeOrganization.lionsClub:
|
||||
return '🦁';
|
||||
case TypeOrganization.entreprise:
|
||||
return '🏢';
|
||||
case TypeOrganization.ong:
|
||||
return '🌍';
|
||||
case TypeOrganization.fondation:
|
||||
return '🏛️';
|
||||
case TypeOrganization.syndicat:
|
||||
return '⚖️';
|
||||
case TypeOrganization.autre:
|
||||
return '📋';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension pour les statuts d'organisation
|
||||
extension StatutOrganizationExtension on StatutOrganization {
|
||||
String get displayName {
|
||||
@@ -158,9 +93,9 @@ class OrganizationModel extends Equatable {
|
||||
/// Nom court ou sigle
|
||||
final String? nomCourt;
|
||||
|
||||
/// Type d'organisation
|
||||
/// Type d'organisation (code dynamique depuis /api/references/types-organisation)
|
||||
@JsonKey(name: 'typeOrganisation')
|
||||
final TypeOrganization typeOrganisation;
|
||||
final String typeOrganisation;
|
||||
|
||||
/// Statut de l'organisation
|
||||
final StatutOrganization statut;
|
||||
@@ -182,10 +117,22 @@ class OrganizationModel extends Equatable {
|
||||
/// Téléphone
|
||||
final String? telephone;
|
||||
|
||||
/// Téléphone secondaire
|
||||
@JsonKey(name: 'telephoneSecondaire')
|
||||
final String? telephoneSecondaire;
|
||||
|
||||
/// Email secondaire
|
||||
@JsonKey(name: 'emailSecondaire')
|
||||
final String? emailSecondaire;
|
||||
|
||||
/// Site web
|
||||
@JsonKey(name: 'siteWeb')
|
||||
final String? siteWeb;
|
||||
|
||||
/// Réseaux sociaux (JSON string)
|
||||
@JsonKey(name: 'reseauxSociaux')
|
||||
final String? reseauxSociaux;
|
||||
|
||||
/// Adresse complète
|
||||
final String? adresse;
|
||||
|
||||
@@ -245,6 +192,17 @@ class OrganizationModel extends Equatable {
|
||||
/// Partenaires
|
||||
final String? partenaires;
|
||||
|
||||
/// Notes internes
|
||||
final String? notes;
|
||||
|
||||
/// Libellé résolu du type d'organisation (lecture seule, depuis la réponse API)
|
||||
@JsonKey(name: 'typeOrganisationLibelle')
|
||||
final String? typeOrganisationLibelle;
|
||||
|
||||
/// Libellé résolu du statut (lecture seule, depuis la réponse API)
|
||||
@JsonKey(name: 'statutLibelle')
|
||||
final String? statutLibelle;
|
||||
|
||||
/// Organisation publique
|
||||
@JsonKey(name: 'organisationPublique')
|
||||
final bool organisationPublique;
|
||||
@@ -268,14 +226,17 @@ class OrganizationModel extends Equatable {
|
||||
this.id,
|
||||
required this.nom,
|
||||
this.nomCourt,
|
||||
this.typeOrganisation = TypeOrganization.association,
|
||||
this.typeOrganisation = 'ASSOCIATION',
|
||||
this.statut = StatutOrganization.active,
|
||||
this.description,
|
||||
this.dateFondation,
|
||||
this.numeroEnregistrement,
|
||||
this.email,
|
||||
this.telephone,
|
||||
this.telephoneSecondaire,
|
||||
this.emailSecondaire,
|
||||
this.siteWeb,
|
||||
this.reseauxSociaux,
|
||||
this.adresse,
|
||||
this.ville,
|
||||
this.codePostal,
|
||||
@@ -293,6 +254,9 @@ class OrganizationModel extends Equatable {
|
||||
this.activitesPrincipales,
|
||||
this.certifications,
|
||||
this.partenaires,
|
||||
this.notes,
|
||||
this.typeOrganisationLibelle,
|
||||
this.statutLibelle,
|
||||
this.organisationPublique = true,
|
||||
this.accepteNouveauxMembres = true,
|
||||
this.dateCreation,
|
||||
@@ -312,14 +276,17 @@ class OrganizationModel extends Equatable {
|
||||
String? id,
|
||||
String? nom,
|
||||
String? nomCourt,
|
||||
TypeOrganization? typeOrganisation,
|
||||
String? typeOrganisation,
|
||||
StatutOrganization? statut,
|
||||
String? description,
|
||||
DateTime? dateFondation,
|
||||
String? numeroEnregistrement,
|
||||
String? email,
|
||||
String? telephone,
|
||||
String? telephoneSecondaire,
|
||||
String? emailSecondaire,
|
||||
String? siteWeb,
|
||||
String? reseauxSociaux,
|
||||
String? adresse,
|
||||
String? ville,
|
||||
String? codePostal,
|
||||
@@ -337,6 +304,9 @@ class OrganizationModel extends Equatable {
|
||||
String? activitesPrincipales,
|
||||
String? certifications,
|
||||
String? partenaires,
|
||||
String? notes,
|
||||
String? typeOrganisationLibelle,
|
||||
String? statutLibelle,
|
||||
bool? organisationPublique,
|
||||
bool? accepteNouveauxMembres,
|
||||
DateTime? dateCreation,
|
||||
@@ -354,7 +324,10 @@ class OrganizationModel extends Equatable {
|
||||
numeroEnregistrement: numeroEnregistrement ?? this.numeroEnregistrement,
|
||||
email: email ?? this.email,
|
||||
telephone: telephone ?? this.telephone,
|
||||
telephoneSecondaire: telephoneSecondaire ?? this.telephoneSecondaire,
|
||||
emailSecondaire: emailSecondaire ?? this.emailSecondaire,
|
||||
siteWeb: siteWeb ?? this.siteWeb,
|
||||
reseauxSociaux: reseauxSociaux ?? this.reseauxSociaux,
|
||||
adresse: adresse ?? this.adresse,
|
||||
ville: ville ?? this.ville,
|
||||
codePostal: codePostal ?? this.codePostal,
|
||||
@@ -372,6 +345,9 @@ class OrganizationModel extends Equatable {
|
||||
activitesPrincipales: activitesPrincipales ?? this.activitesPrincipales,
|
||||
certifications: certifications ?? this.certifications,
|
||||
partenaires: partenaires ?? this.partenaires,
|
||||
notes: notes ?? this.notes,
|
||||
typeOrganisationLibelle: typeOrganisationLibelle ?? this.typeOrganisationLibelle,
|
||||
statutLibelle: statutLibelle ?? this.statutLibelle,
|
||||
organisationPublique: organisationPublique ?? this.organisationPublique,
|
||||
accepteNouveauxMembres: accepteNouveauxMembres ?? this.accepteNouveauxMembres,
|
||||
dateCreation: dateCreation ?? this.dateCreation,
|
||||
@@ -412,7 +388,10 @@ class OrganizationModel extends Equatable {
|
||||
numeroEnregistrement,
|
||||
email,
|
||||
telephone,
|
||||
telephoneSecondaire,
|
||||
emailSecondaire,
|
||||
siteWeb,
|
||||
reseauxSociaux,
|
||||
adresse,
|
||||
ville,
|
||||
codePostal,
|
||||
@@ -430,6 +409,9 @@ class OrganizationModel extends Equatable {
|
||||
activitesPrincipales,
|
||||
certifications,
|
||||
partenaires,
|
||||
notes,
|
||||
typeOrganisationLibelle,
|
||||
statutLibelle,
|
||||
organisationPublique,
|
||||
accepteNouveauxMembres,
|
||||
dateCreation,
|
||||
|
||||
Reference in New Issue
Block a user