1d3ee69c6d
App Flutter de programme de fidélité : login staff, clients (nom/prénom), scan QR, factures (€→points), récompenses, réglages. Backend Supabase (schéma SQL + RLS anti-triche dans supabase/). Icône incluse. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
43 lines
1.0 KiB
Dart
43 lines
1.0 KiB
Dart
/// Une récompense du catalogue : ce qu'un client peut obtenir en échange de
|
|
/// ses points (ex : « Café offert » = 10 pts).
|
|
class Recompense {
|
|
final String id;
|
|
final String nom;
|
|
|
|
/// Coût en points pour obtenir la récompense.
|
|
final double coutPoints;
|
|
|
|
/// Récompense proposée (true) ou masquée sans être supprimée (false).
|
|
final bool actif;
|
|
|
|
const Recompense({
|
|
required this.id,
|
|
required this.nom,
|
|
required this.coutPoints,
|
|
this.actif = true,
|
|
});
|
|
|
|
Recompense copyWith({
|
|
String? id,
|
|
String? nom,
|
|
double? coutPoints,
|
|
bool? actif,
|
|
}) {
|
|
return Recompense(
|
|
id: id ?? this.id,
|
|
nom: nom ?? this.nom,
|
|
coutPoints: coutPoints ?? this.coutPoints,
|
|
actif: actif ?? this.actif,
|
|
);
|
|
}
|
|
|
|
factory Recompense.fromMap(Map<String, dynamic> map) {
|
|
return Recompense(
|
|
id: map['id'].toString(),
|
|
nom: (map['nom'] as String?) ?? '',
|
|
coutPoints: (map['cout_points'] as num?)?.toDouble() ?? 0,
|
|
actif: (map['actif'] as bool?) ?? true,
|
|
);
|
|
}
|
|
}
|