|
|
@ -10,7 +10,8 @@ class TableOrder { |
|
|
final double? total; // Optionnel pour les commandes en cours |
|
|
final double? total; // Optionnel pour les commandes en cours |
|
|
final bool isEncashed; |
|
|
final bool isEncashed; |
|
|
final String? time; // Heure de la commande si applicable |
|
|
final String? time; // Heure de la commande si applicable |
|
|
final String? date; // Date de la commande si applicable |
|
|
final DateTime? date; // Date de la commande si applicable |
|
|
|
|
|
final String? tablename; // Date de la commande si applicable |
|
|
// final int? persons; // Nombre de personnes si applicable |
|
|
// final int? persons; // Nombre de personnes si applicable |
|
|
|
|
|
|
|
|
TableOrder({ |
|
|
TableOrder({ |
|
|
@ -25,31 +26,34 @@ class TableOrder { |
|
|
this.isEncashed = false, |
|
|
this.isEncashed = false, |
|
|
this.time, |
|
|
this.time, |
|
|
this.date, |
|
|
this.date, |
|
|
|
|
|
this.tablename, |
|
|
// this.persons, |
|
|
// this.persons, |
|
|
}); |
|
|
}); |
|
|
|
|
|
factory TableOrder.fromJson(Map<String, dynamic> json) { |
|
|
factory TableOrder.fromJson(Map<String, dynamic> json) { |
|
|
|
|
|
return TableOrder( |
|
|
return TableOrder( |
|
|
id: json['id'] ?? 0, |
|
|
id: json['id'] ?? 0, |
|
|
nom: json['nom'] ?? '', |
|
|
nom: json['nom'] ?? '', |
|
|
capacity: json['capacity'] ?? 1, |
|
|
capacity: json['capacity'] ?? 1, |
|
|
status: json['status'] ?? 'available', |
|
|
status: json['statut'] ?? 'available', |
|
|
location: json['location'] ?? '', |
|
|
location: json['location'] ?? '', |
|
|
createdAt: |
|
|
tablename: json['tablename'] ?? '', |
|
|
json['created_at'] != null |
|
|
createdAt: json['created_at'] != null |
|
|
? DateTime.parse(json['created_at']) |
|
|
? DateTime.parse(json['created_at']) |
|
|
: DateTime.now(), |
|
|
: DateTime.now(), |
|
|
updatedAt: |
|
|
updatedAt: json['updated_at'] != null |
|
|
json['updated_at'] != null |
|
|
|
|
|
? DateTime.parse(json['updated_at']) |
|
|
? DateTime.parse(json['updated_at']) |
|
|
: DateTime.now(), |
|
|
: DateTime.now(), |
|
|
total: json['total'] != null ? (json['total'] as num).toDouble() : null, |
|
|
total: json['total_ht'] != null |
|
|
|
|
|
? double.tryParse(json['total_ht'].toString()) |
|
|
|
|
|
: null, |
|
|
isEncashed: json['is_encashed'] ?? false, |
|
|
isEncashed: json['is_encashed'] ?? false, |
|
|
time: json['time'], |
|
|
time: json['time'], |
|
|
date: json['date'], |
|
|
date: json['date_commande'] != null |
|
|
// persons: json['persons'], |
|
|
? DateTime.parse(json['date_commande']) // tu avais mis updated_at ici par erreur |
|
|
|
|
|
: null, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() { |
|
|
Map<String, dynamic> toJson() { |
|
|
return { |
|
|
return { |
|
|
@ -58,6 +62,7 @@ class TableOrder { |
|
|
'capacity': capacity, |
|
|
'capacity': capacity, |
|
|
'status': status, |
|
|
'status': status, |
|
|
'location': location, |
|
|
'location': location, |
|
|
|
|
|
'tablename': tablename, |
|
|
'created_at': createdAt.toIso8601String(), |
|
|
'created_at': createdAt.toIso8601String(), |
|
|
'updated_at': updatedAt.toIso8601String(), |
|
|
'updated_at': updatedAt.toIso8601String(), |
|
|
if (total != null) 'total': total, |
|
|
if (total != null) 'total': total, |
|
|
@ -122,7 +127,7 @@ class TableOrder { |
|
|
double? total, |
|
|
double? total, |
|
|
bool? isEncashed, |
|
|
bool? isEncashed, |
|
|
String? time, |
|
|
String? time, |
|
|
String? date, |
|
|
DateTime? date, |
|
|
int? persons, |
|
|
int? persons, |
|
|
}) { |
|
|
}) { |
|
|
return TableOrder( |
|
|
return TableOrder( |
|
|
@ -153,6 +158,10 @@ class TableOrder { |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
int get hashCode => id.hashCode; |
|
|
int get hashCode => id.hashCode; |
|
|
|
|
|
|
|
|
|
|
|
get items => null; |
|
|
|
|
|
|
|
|
|
|
|
where(bool Function(dynamic commande) param0) {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Énumération pour les statuts (optionnel, pour plus de type safety) |
|
|
// Énumération pour les statuts (optionnel, pour plus de type safety) |
|
|
|