Initial commit: app Fideliter client (Flutter)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/// Le compte fidélité du client connecté. Le [code] est encodé dans son QR.
|
||||
class Client {
|
||||
final String id; // uuid Supabase
|
||||
final String code; // ex : « FID-3F9K2A »
|
||||
final String nom;
|
||||
final String? prenom;
|
||||
final String? telephone;
|
||||
final double points;
|
||||
|
||||
const Client({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.nom,
|
||||
this.prenom,
|
||||
this.telephone,
|
||||
this.points = 0,
|
||||
});
|
||||
|
||||
/// Nom complet affiché : « Prénom Nom » (ou juste le nom si pas de prénom).
|
||||
String get nomComplet {
|
||||
final p = (prenom ?? '').trim();
|
||||
return p.isEmpty ? nom : '$p $nom';
|
||||
}
|
||||
|
||||
factory Client.fromMap(Map<String, dynamic> map) {
|
||||
return Client(
|
||||
id: map['id'].toString(),
|
||||
code: (map['code'] as String?) ?? '',
|
||||
nom: (map['nom'] as String?) ?? '',
|
||||
prenom: map['prenom'] as String?,
|
||||
telephone: map['telephone'] as String?,
|
||||
points: (map['points'] as num?)?.toDouble() ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user