|
|
@ -4,12 +4,14 @@ import 'package:itrimobe/models/tables_order.dart'; |
|
|
|
|
|
|
|
|
class CommandeCard extends StatelessWidget { |
|
|
class CommandeCard extends StatelessWidget { |
|
|
final TableOrder commande; |
|
|
final TableOrder commande; |
|
|
final VoidCallback onAllerCaisse; |
|
|
final Future<void> Function() onAllerCaisse; // Changé en Future<void> Function() |
|
|
|
|
|
final VoidCallback? onRefresh; |
|
|
|
|
|
|
|
|
const CommandeCard({ |
|
|
const CommandeCard({ |
|
|
super.key, |
|
|
super.key, |
|
|
required this.commande, |
|
|
required this.commande, |
|
|
required this.onAllerCaisse, |
|
|
required this.onAllerCaisse, |
|
|
|
|
|
this.onRefresh, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
String _formatTime(DateTime dateTime) { |
|
|
String _formatTime(DateTime dateTime) { |
|
|
@ -18,7 +20,6 @@ class CommandeCard extends StatelessWidget { |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
|
|
|
|
|
|
return Container( |
|
|
return Container( |
|
|
margin: EdgeInsets.only(bottom: 16), |
|
|
margin: EdgeInsets.only(bottom: 16), |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
@ -38,7 +39,6 @@ class CommandeCard extends StatelessWidget { |
|
|
child: Column( |
|
|
child: Column( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
// Header avec numéro de table et badge |
|
|
|
|
|
Row( |
|
|
Row( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
children: [ |
|
|
children: [ |
|
|
@ -62,7 +62,7 @@ class CommandeCard extends StatelessWidget { |
|
|
Icon(Icons.check_circle, color: Colors.white, size: 16), |
|
|
Icon(Icons.check_circle, color: Colors.white, size: 16), |
|
|
SizedBox(width: 4), |
|
|
SizedBox(width: 4), |
|
|
Text( |
|
|
Text( |
|
|
'Près à encaisser', |
|
|
'Prêt à encaisser', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
color: Colors.white, |
|
|
color: Colors.white, |
|
|
fontSize: 12, |
|
|
fontSize: 12, |
|
|
@ -77,13 +77,11 @@ class CommandeCard extends StatelessWidget { |
|
|
|
|
|
|
|
|
SizedBox(height: 12), |
|
|
SizedBox(height: 12), |
|
|
|
|
|
|
|
|
// Informations détaillées |
|
|
|
|
|
Row( |
|
|
Row( |
|
|
children: [ |
|
|
children: [ |
|
|
Icon(Icons.access_time, size: 16, color: Colors.grey[600]), |
|
|
Icon(Icons.access_time, size: 16, color: Colors.grey[600]), |
|
|
SizedBox(width: 6), |
|
|
SizedBox(width: 6), |
|
|
Text( |
|
|
Text( |
|
|
// Fixed: Pass DateTime directly, not as string |
|
|
|
|
|
commande.date != null ? _formatTime(commande.date!) : 'Date non disponible', |
|
|
commande.date != null ? _formatTime(commande.date!) : 'Date non disponible', |
|
|
style: TextStyle(color: Colors.grey[600], fontSize: 14), |
|
|
style: TextStyle(color: Colors.grey[600], fontSize: 14), |
|
|
), |
|
|
), |
|
|
@ -92,10 +90,8 @@ class CommandeCard extends StatelessWidget { |
|
|
|
|
|
|
|
|
SizedBox(height: 16), |
|
|
SizedBox(height: 16), |
|
|
|
|
|
|
|
|
// Total et bouton |
|
|
|
|
|
Row( |
|
|
Row( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
// alignItems: MainAxisAlignment.center, |
|
|
|
|
|
children: [ |
|
|
children: [ |
|
|
Column( |
|
|
Column( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
@ -115,7 +111,15 @@ class CommandeCard extends StatelessWidget { |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
ElevatedButton.icon( |
|
|
ElevatedButton.icon( |
|
|
onPressed: onAllerCaisse, |
|
|
onPressed: () async { |
|
|
|
|
|
// Attendre que la navigation soit terminée |
|
|
|
|
|
await onAllerCaisse(); |
|
|
|
|
|
|
|
|
|
|
|
// Rafraîchir la page |
|
|
|
|
|
if (onRefresh != null) { |
|
|
|
|
|
onRefresh!(); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
icon: Icon(Icons.point_of_sale, size: 18), |
|
|
icon: Icon(Icons.point_of_sale, size: 18), |
|
|
label: Text('Aller à la caisse'), |
|
|
label: Text('Aller à la caisse'), |
|
|
style: ElevatedButton.styleFrom( |
|
|
style: ElevatedButton.styleFrom( |
|
|
|