|
|
@ -404,12 +404,7 @@ class _CartPageState extends State<CartPage> { |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
// 3. Succès |
|
|
// 3. Succès |
|
|
Navigator.of(context).pushAndRemoveUntil( |
|
|
_showPaymentSuccessDialog(commandeData, total); |
|
|
MaterialPageRoute( |
|
|
|
|
|
builder: (context) => const MainLayout(child: TablesScreen()), |
|
|
|
|
|
), |
|
|
|
|
|
(route) => false, |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
throw Exception('Erreur lors du paiement'); |
|
|
throw Exception('Erreur lors du paiement'); |
|
|
} |
|
|
} |
|
|
@ -446,9 +441,9 @@ class _CartPageState extends State<CartPage> { |
|
|
content: Column( |
|
|
content: Column( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
children: [ |
|
|
children: [ |
|
|
Text('Commande #${commandeData['numeroCommande']}'), |
|
|
Text('Commande #${commandeData['id']}'), |
|
|
const SizedBox(height: 8), |
|
|
const SizedBox(height: 8), |
|
|
Text('${widget.tablename} libérée'), |
|
|
Text('Table ${widget.tablename} libérée'), |
|
|
const SizedBox(height: 8), |
|
|
const SizedBox(height: 8), |
|
|
Text( |
|
|
Text( |
|
|
'Montant: ${total.toStringAsFixed(2)} €', |
|
|
'Montant: ${total.toStringAsFixed(2)} €', |
|
|
@ -461,17 +456,32 @@ class _CartPageState extends State<CartPage> { |
|
|
actions: [ |
|
|
actions: [ |
|
|
TextButton( |
|
|
TextButton( |
|
|
onPressed: () { |
|
|
onPressed: () { |
|
|
Navigator.of(context).pop(); |
|
|
Navigator.of(context).pop(); // Fermer le dialog |
|
|
Navigator.of(context).pop(); // Retour au menu principal |
|
|
// Naviguer vers la page des tables |
|
|
|
|
|
Navigator.of(context).pushAndRemoveUntil( |
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
builder: |
|
|
|
|
|
(context) => const MainLayout(child: TablesScreen()), |
|
|
|
|
|
), |
|
|
|
|
|
(route) => false, |
|
|
|
|
|
); |
|
|
}, |
|
|
}, |
|
|
child: const Text('Non merci'), |
|
|
child: const Text('Non merci'), |
|
|
), |
|
|
), |
|
|
ElevatedButton( |
|
|
ElevatedButton( |
|
|
onPressed: () async { |
|
|
onPressed: () async { |
|
|
Navigator.of(context).pop(); |
|
|
Navigator.of(context).pop(); // Fermer le dialog |
|
|
await _imprimerTicketPaiement(commandeData, total); |
|
|
await _imprimerTicketPaiement(commandeData, total); |
|
|
Navigator.of(context).pop(); // Retour au menu principal |
|
|
// Naviguer vers la page des tables après l'impression |
|
|
|
|
|
Navigator.of(context).pushAndRemoveUntil( |
|
|
|
|
|
MaterialPageRoute( |
|
|
|
|
|
builder: |
|
|
|
|
|
(context) => const MainLayout(child: TablesScreen()), |
|
|
|
|
|
), |
|
|
|
|
|
(route) => false, |
|
|
|
|
|
); |
|
|
}, |
|
|
}, |
|
|
|
|
|
style: ElevatedButton.styleFrom(backgroundColor: Colors.green), |
|
|
child: const Text('Imprimer'), |
|
|
child: const Text('Imprimer'), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
|