Initial commit — app fidélité magasin (tablette)
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>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/// 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user