From 059da2af1b00c8bc996a002af2e24ccc66bf5431 Mon Sep 17 00:00:00 2001 From: Stephane Date: Sun, 3 Aug 2025 18:32:53 +0300 Subject: [PATCH] dddd --- lib/pages/cart_page.dart | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/pages/cart_page.dart b/lib/pages/cart_page.dart index 37f7bc1..c312031 100644 --- a/lib/pages/cart_page.dart +++ b/lib/pages/cart_page.dart @@ -404,12 +404,7 @@ class _CartPageState extends State { ); // 3. Succès - Navigator.of(context).pushAndRemoveUntil( - MaterialPageRoute( - builder: (context) => const MainLayout(child: TablesScreen()), - ), - (route) => false, - ); + _showPaymentSuccessDialog(commandeData, total); } else { throw Exception('Erreur lors du paiement'); } @@ -446,9 +441,9 @@ class _CartPageState extends State { content: Column( mainAxisSize: MainAxisSize.min, children: [ - Text('Commande #${commandeData['numeroCommande']}'), + Text('Commande #${commandeData['id']}'), const SizedBox(height: 8), - Text('${widget.tablename} libérée'), + Text('Table ${widget.tablename} libérée'), const SizedBox(height: 8), Text( 'Montant: ${total.toStringAsFixed(2)} €', @@ -461,17 +456,32 @@ class _CartPageState extends State { actions: [ TextButton( onPressed: () { - Navigator.of(context).pop(); - Navigator.of(context).pop(); // Retour au menu principal + Navigator.of(context).pop(); // Fermer le dialog + // Naviguer vers la page des tables + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute( + builder: + (context) => const MainLayout(child: TablesScreen()), + ), + (route) => false, + ); }, child: const Text('Non merci'), ), ElevatedButton( onPressed: () async { - Navigator.of(context).pop(); + Navigator.of(context).pop(); // Fermer le dialog 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'), ), ],