feat: Version 3.5.2 - Configuration Stripe et gestion des immeubles

- Configuration complète Stripe pour les 3 environnements (DEV/REC/PROD)
  * DEV: Clés TEST Pierre (mode test)
  * REC: Clés TEST Client (mode test)
  * PROD: Clés LIVE Client (mode live)
- Ajout de la gestion des bases de données immeubles/bâtiments
  * Configuration buildings_database pour DEV/REC/PROD
  * Service BuildingService pour enrichissement des adresses
- Optimisations pages et améliorations ergonomie
- Mises à jour des dépendances Composer
- Nettoyage des fichiers obsolètes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
pierre
2025-11-09 18:26:27 +01:00
parent 21657a3820
commit 2f5946a184
812 changed files with 142105 additions and 25992 deletions

View File

@@ -49,6 +49,9 @@ class AmicaleModel extends HiveObject {
@HiveField(14)
final String stripeId;
@HiveField(27)
final String? stripeLocationId;
@HiveField(15)
final bool chkDemo;
@@ -101,6 +104,7 @@ class AmicaleModel extends HiveObject {
this.gpsLat = '',
this.gpsLng = '',
this.stripeId = '',
this.stripeLocationId,
this.chkDemo = false,
this.chkCopieMailRecu = false,
this.chkAcceptSms = false,
@@ -194,6 +198,7 @@ class AmicaleModel extends HiveObject {
gpsLat: json['gps_lat'] ?? '',
gpsLng: json['gps_lng'] ?? '',
stripeId: json['stripe_id'] ?? '',
stripeLocationId: json['stripe_location_id'],
chkDemo: chkDemo,
chkCopieMailRecu: chkCopieMailRecu,
chkAcceptSms: chkAcceptSms,
@@ -227,6 +232,7 @@ class AmicaleModel extends HiveObject {
'gps_lat': gpsLat,
'gps_lng': gpsLng,
'stripe_id': stripeId,
'stripe_location_id': stripeLocationId,
'chk_demo': chkDemo ? 1 : 0,
'chk_copie_mail_recu': chkCopieMailRecu ? 1 : 0,
'chk_accept_sms': chkAcceptSms ? 1 : 0,
@@ -258,6 +264,7 @@ class AmicaleModel extends HiveObject {
String? gpsLat,
String? gpsLng,
String? stripeId,
String? stripeLocationId,
bool? chkDemo,
bool? chkCopieMailRecu,
bool? chkAcceptSms,
@@ -287,6 +294,7 @@ class AmicaleModel extends HiveObject {
gpsLat: gpsLat ?? this.gpsLat,
gpsLng: gpsLng ?? this.gpsLng,
stripeId: stripeId ?? this.stripeId,
stripeLocationId: stripeLocationId ?? this.stripeLocationId,
chkDemo: chkDemo ?? this.chkDemo,
chkCopieMailRecu: chkCopieMailRecu ?? this.chkCopieMailRecu,
chkAcceptSms: chkAcceptSms ?? this.chkAcceptSms,

View File

@@ -32,6 +32,7 @@ class AmicaleModelAdapter extends TypeAdapter<AmicaleModel> {
gpsLat: fields[12] as String,
gpsLng: fields[13] as String,
stripeId: fields[14] as String,
stripeLocationId: fields[27] as String?,
chkDemo: fields[15] as bool,
chkCopieMailRecu: fields[16] as bool,
chkAcceptSms: fields[17] as bool,
@@ -50,7 +51,7 @@ class AmicaleModelAdapter extends TypeAdapter<AmicaleModel> {
@override
void write(BinaryWriter writer, AmicaleModel obj) {
writer
..writeByte(27)
..writeByte(28)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@@ -81,6 +82,8 @@ class AmicaleModelAdapter extends TypeAdapter<AmicaleModel> {
..write(obj.gpsLng)
..writeByte(14)
..write(obj.stripeId)
..writeByte(27)
..write(obj.stripeLocationId)
..writeByte(15)
..write(obj.chkDemo)
..writeByte(16)

View File

@@ -5,20 +5,24 @@ import 'package:geosector_app/core/data/models/user_model.dart';
part 'membre_model.g.dart';
/// Modèle représentant un membre d'une amicale.
///
///
/// IMPORTANT : Ce modèle représente TOUS les membres d'une amicale,
/// pas seulement l'utilisateur connecté. Pour l'utilisateur connecté, voir UserModel.
///
///
/// La box Hive 'membres' contient plusieurs enregistrements (tous les membres de l'amicale).
///
///
/// Relations avec les autres modèles :
/// - UserModel : représente uniquement l'utilisateur connecté (current user)
/// - UserSectorModel : utilise MembreModel.id pour associer les membres aux secteurs
/// ATTENTION : UserSectorModel.id = MembreModel.id (pas UserModel.id)
///
///
/// ⚠️ IMPORTANT : Distinction des IDs
/// - id : ID de la table centrale `users` (pour gestion des membres)
/// - opeUserId : ID de la table `ope_users` (pour lier avec passages/secteurs de l'opération active)
///
/// Chaque membre a son propre ID unique qui est utilisé pour :
/// - L'attribution aux secteurs (via UserSectorModel)
/// - La gestion des passages
/// - La gestion des passages (via MembreModel.opeUserId == PassageModel.fkUser)
/// - Les statistiques par membre
@HiveType(typeId: 5) // Utilisation d'un typeId unique
class MembreModel extends HiveObject {
@@ -57,6 +61,9 @@ class MembreModel extends HiveObject {
@HiveField(14)
bool isActive;
@HiveField(15)
int? opeUserId; // ID dans ope_users pour l'opération active
MembreModel({
required this.id,
this.fkEntite,
@@ -73,6 +80,7 @@ class MembreModel extends HiveObject {
this.dateEmbauche,
required this.createdAt,
required this.isActive,
this.opeUserId,
});
// Factory pour convertir depuis JSON (API)
@@ -112,6 +120,13 @@ class MembreModel extends HiveObject {
}
}
// Convertir ope_user_id en int si présent
int? opeUserId;
if (json['ope_user_id'] != null) {
final dynamic rawOpeUserId = json['ope_user_id'];
opeUserId = rawOpeUserId is String ? int.parse(rawOpeUserId) : rawOpeUserId as int;
}
return MembreModel(
id: id,
fkEntite: fkEntite,
@@ -129,6 +144,7 @@ class MembreModel extends HiveObject {
createdAt: DateTime.now(), // ← Simplifié car created_at n'existe pas dans l'API
// Le champ JSON est 'chk_active' pas 'is_active'
isActive: json['chk_active'] == 1 || json['chk_active'] == true,
opeUserId: opeUserId,
);
} catch (e) {
debugPrint('❌ Erreur parsing MembreModel: $e');
@@ -141,6 +157,7 @@ class MembreModel extends HiveObject {
Map<String, dynamic> toJson() {
return {
'id': id,
'ope_user_id': opeUserId,
'fk_entite': fkEntite,
'fk_role': role, // Changé pour correspondre à l'API
'fk_titre': fkTitre,
@@ -174,6 +191,7 @@ class MembreModel extends HiveObject {
DateTime? dateEmbauche,
DateTime? createdAt,
bool? isActive,
int? opeUserId,
}) {
return MembreModel(
id: id,
@@ -191,6 +209,7 @@ class MembreModel extends HiveObject {
dateEmbauche: dateEmbauche ?? this.dateEmbauche,
createdAt: createdAt ?? this.createdAt,
isActive: isActive ?? this.isActive,
opeUserId: opeUserId ?? this.opeUserId,
);
}
@@ -214,6 +233,7 @@ class MembreModel extends HiveObject {
dateNaissance: dateNaissance,
dateEmbauche: dateEmbauche,
sectName: sectName,
opeUserId: opeUserId,
);
}
@@ -233,6 +253,7 @@ class MembreModel extends HiveObject {
dateNaissance: user.dateNaissance,
dateEmbauche: user.dateEmbauche,
isActive: user.isActive,
opeUserId: user.opeUserId,
);
}
}

View File

@@ -32,13 +32,14 @@ class MembreModelAdapter extends TypeAdapter<MembreModel> {
dateEmbauche: fields[12] as DateTime?,
createdAt: fields[13] as DateTime,
isActive: fields[14] as bool,
opeUserId: fields[15] as int?,
);
}
@override
void write(BinaryWriter writer, MembreModel obj) {
writer
..writeByte(15)
..writeByte(16)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@@ -68,7 +69,9 @@ class MembreModelAdapter extends TypeAdapter<MembreModel> {
..writeByte(13)
..write(obj.createdAt)
..writeByte(14)
..write(obj.isActive);
..write(obj.isActive)
..writeByte(15)
..write(obj.opeUserId);
}
@override

View File

@@ -95,6 +95,12 @@ class PassageModel extends HiveObject {
@HiveField(29)
String? stripePaymentId;
@HiveField(30)
String? stripePaymentLinkId;
@HiveField(31)
String? stripePaymentLinkUrl;
PassageModel({
required this.id,
required this.fkOperation,
@@ -126,6 +132,8 @@ class PassageModel extends HiveObject {
this.isActive = true,
this.isSynced = false,
this.stripePaymentId,
this.stripePaymentLinkId,
this.stripePaymentLinkUrl,
});
// Factory pour convertir depuis JSON (API)
@@ -197,6 +205,8 @@ class PassageModel extends HiveObject {
isActive: true,
isSynced: true,
stripePaymentId: json['stripe_payment_id']?.toString(),
stripePaymentLinkId: json['stripe_payment_link_id']?.toString(),
stripePaymentLinkUrl: json['stripe_payment_link_url']?.toString(),
);
} catch (e) {
debugPrint('❌ Erreur parsing PassageModel: $e');
@@ -235,6 +245,8 @@ class PassageModel extends HiveObject {
'email': email,
'phone': phone,
'stripe_payment_id': stripePaymentId,
'stripe_payment_link_id': stripePaymentLinkId,
'stripe_payment_link_url': stripePaymentLinkUrl,
};
}
@@ -270,6 +282,8 @@ class PassageModel extends HiveObject {
bool? isActive,
bool? isSynced,
String? stripePaymentId,
String? stripePaymentLinkId,
String? stripePaymentLinkUrl,
}) {
return PassageModel(
id: id ?? this.id,
@@ -302,6 +316,8 @@ class PassageModel extends HiveObject {
isActive: isActive ?? this.isActive,
isSynced: isSynced ?? this.isSynced,
stripePaymentId: stripePaymentId ?? this.stripePaymentId,
stripePaymentLinkId: stripePaymentLinkId ?? this.stripePaymentLinkId,
stripePaymentLinkUrl: stripePaymentLinkUrl ?? this.stripePaymentLinkUrl,
);
}

View File

@@ -47,13 +47,15 @@ class PassageModelAdapter extends TypeAdapter<PassageModel> {
isActive: fields[27] as bool,
isSynced: fields[28] as bool,
stripePaymentId: fields[29] as String?,
stripePaymentLinkId: fields[30] as String?,
stripePaymentLinkUrl: fields[31] as String?,
);
}
@override
void write(BinaryWriter writer, PassageModel obj) {
writer
..writeByte(30)
..writeByte(32)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@@ -113,7 +115,11 @@ class PassageModelAdapter extends TypeAdapter<PassageModel> {
..writeByte(28)
..write(obj.isSynced)
..writeByte(29)
..write(obj.stripePaymentId);
..write(obj.stripePaymentId)
..writeByte(30)
..write(obj.stripePaymentLinkId)
..writeByte(31)
..write(obj.stripePaymentLinkUrl);
}
@override

View File

@@ -0,0 +1,32 @@
/// Résultat de création d'un Payment Link Stripe
class PaymentLinkResult {
final String paymentLinkId;
final String url;
final int amount;
final int? passageId;
PaymentLinkResult({
required this.paymentLinkId,
required this.url,
required this.amount,
this.passageId,
});
factory PaymentLinkResult.fromJson(Map<String, dynamic> json) {
return PaymentLinkResult(
paymentLinkId: json['payment_link_id'] as String,
url: json['url'] as String,
amount: json['amount'] as int,
passageId: json['passage_id'] as int?,
);
}
Map<String, dynamic> toJson() {
return {
'payment_link_id': paymentLinkId,
'url': url,
'amount': amount,
'passage_id': passageId,
};
}
}

View File

@@ -74,6 +74,9 @@ class UserModel extends HiveObject {
@HiveField(19)
DateTime? dateEmbauche;
@HiveField(20)
int? opeUserId; // ID dans ope_users pour l'opération active
UserModel({
required this.id,
required this.email,
@@ -95,6 +98,7 @@ class UserModel extends HiveObject {
this.mobile,
this.dateNaissance,
this.dateEmbauche,
this.opeUserId,
});
// Factory pour convertir depuis JSON (API)
@@ -138,6 +142,12 @@ class UserModel extends HiveObject {
}
}
// Convertir ope_user_id en int si présent
final dynamic rawOpeUserId = json['ope_user_id'];
final int? opeUserId = rawOpeUserId != null
? (rawOpeUserId is String ? int.parse(rawOpeUserId) : rawOpeUserId as int)
: null;
return UserModel(
id: id,
email: json['email'] ?? '',
@@ -162,6 +172,7 @@ class UserModel extends HiveObject {
mobile: json['mobile'],
dateNaissance: dateNaissance,
dateEmbauche: dateEmbauche,
opeUserId: opeUserId,
);
}
@@ -186,6 +197,7 @@ class UserModel extends HiveObject {
'mobile': mobile,
'date_naissance': dateNaissance?.toIso8601String(),
'date_embauche': dateEmbauche?.toIso8601String(),
'ope_user_id': opeUserId,
};
}
@@ -209,6 +221,7 @@ class UserModel extends HiveObject {
String? mobile,
DateTime? dateNaissance,
DateTime? dateEmbauche,
int? opeUserId,
}) {
return UserModel(
id: id,
@@ -231,6 +244,7 @@ class UserModel extends HiveObject {
mobile: mobile ?? this.mobile,
dateNaissance: dateNaissance ?? this.dateNaissance,
dateEmbauche: dateEmbauche ?? this.dateEmbauche,
opeUserId: opeUserId ?? this.opeUserId,
);
}

View File

@@ -37,13 +37,14 @@ class UserModelAdapter extends TypeAdapter<UserModel> {
mobile: fields[17] as String?,
dateNaissance: fields[18] as DateTime?,
dateEmbauche: fields[19] as DateTime?,
opeUserId: fields[20] as int?,
);
}
@override
void write(BinaryWriter writer, UserModel obj) {
writer
..writeByte(20)
..writeByte(21)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@@ -83,7 +84,9 @@ class UserModelAdapter extends TypeAdapter<UserModel> {
..writeByte(18)
..write(obj.dateNaissance)
..writeByte(19)
..write(obj.dateEmbauche);
..write(obj.dateEmbauche)
..writeByte(20)
..write(obj.opeUserId);
}
@override

View File

@@ -6,10 +6,14 @@ part 'user_sector_model.g.dart';
///
/// Cette classe représente l'association entre un utilisateur et un secteur,
/// telle que reçue de l'API dans la réponse users_sectors.
///
/// ⚠️ IMPORTANT : Distinction des IDs
/// - userId : ID de la table centrale `users` (pour gestion des membres)
/// - opeUserId : ID de la table `ope_users` (pour lier avec passages/sectors)
@HiveType(typeId: 6)
class UserSectorModel extends HiveObject {
@HiveField(0)
final int id; // ID de l'utilisateur
final int userId; // ID de l'utilisateur (table centrale users)
@HiveField(1)
final String? firstName;
@@ -23,18 +27,23 @@ class UserSectorModel extends HiveObject {
@HiveField(4)
final String? name;
@HiveField(5)
final int opeUserId; // ID de l'utilisateur dans ope_users (pour lier avec passages)
UserSectorModel({
required this.id,
required this.userId,
this.firstName,
this.sectName,
required this.fkSector,
this.name,
required this.opeUserId,
});
/// Crée un modèle UserSectorModel à partir d'un objet JSON
factory UserSectorModel.fromJson(Map<String, dynamic> json) {
return UserSectorModel(
id: json['id'] is String ? int.parse(json['id']) : json['id'],
userId: json['user_id'] is String ? int.parse(json['user_id']) : json['user_id'],
opeUserId: json['ope_user_id'] is String ? int.parse(json['ope_user_id']) : json['ope_user_id'],
firstName: json['first_name'],
sectName: json['sect_name'],
fkSector: json['fk_sector'] is String ? int.parse(json['fk_sector']) : json['fk_sector'],
@@ -45,7 +54,8 @@ class UserSectorModel extends HiveObject {
/// Convertit le modèle en objet JSON
Map<String, dynamic> toJson() {
return {
'id': id,
'user_id': userId,
'ope_user_id': opeUserId,
'first_name': firstName,
'sect_name': sectName,
'fk_sector': fkSector,
@@ -55,14 +65,16 @@ class UserSectorModel extends HiveObject {
/// Crée une copie du modèle avec des valeurs potentiellement modifiées
UserSectorModel copyWith({
int? id,
int? userId,
int? opeUserId,
String? firstName,
String? sectName,
int? fkSector,
String? name,
}) {
return UserSectorModel(
id: id ?? this.id,
userId: userId ?? this.userId,
opeUserId: opeUserId ?? this.opeUserId,
firstName: firstName ?? this.firstName,
sectName: sectName ?? this.sectName,
fkSector: fkSector ?? this.fkSector,
@@ -72,6 +84,6 @@ class UserSectorModel extends HiveObject {
@override
String toString() {
return 'UserSectorModel(id: $id, firstName: $firstName, sectName: $sectName, fkSector: $fkSector, name: $name)';
return 'UserSectorModel(userId: $userId, opeUserId: $opeUserId, firstName: $firstName, sectName: $sectName, fkSector: $fkSector, name: $name)';
}
}

View File

@@ -17,20 +17,21 @@ class UserSectorModelAdapter extends TypeAdapter<UserSectorModel> {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return UserSectorModel(
id: fields[0] as int,
userId: fields[0] as int,
firstName: fields[1] as String?,
sectName: fields[2] as String?,
fkSector: fields[3] as int,
name: fields[4] as String?,
opeUserId: fields[5] as int,
);
}
@override
void write(BinaryWriter writer, UserSectorModel obj) {
writer
..writeByte(5)
..writeByte(6)
..writeByte(0)
..write(obj.id)
..write(obj.userId)
..writeByte(1)
..write(obj.firstName)
..writeByte(2)
@@ -38,7 +39,9 @@ class UserSectorModelAdapter extends TypeAdapter<UserSectorModel> {
..writeByte(3)
..write(obj.fkSector)
..writeByte(4)
..write(obj.name);
..write(obj.name)
..writeByte(5)
..write(obj.opeUserId);
}
@override