From 14ce881a3cae1f617cfffedb5d4d543d28db562d Mon Sep 17 00:00:00 2001 From: ASUS Date: Thu, 10 Jul 2025 08:30:16 +0300 Subject: [PATCH] cacher boutton facture --- lib/Views/commandManagement.dart | 76 ++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/lib/Views/commandManagement.dart b/lib/Views/commandManagement.dart index ef3ebf1..c747583 100644 --- a/lib/Views/commandManagement.dart +++ b/lib/Views/commandManagement.dart @@ -41,6 +41,9 @@ class _GestionCommandesPageState extends State { bool _showCancelledOrders = false; final userController = Get.find(); + bool verifAdmin() { + return userController.role == 'Super Admin'; + } @override void initState() { super.initState(); @@ -251,9 +254,7 @@ Future buildIconGift() async { } // Bon de livraison============================================== - bool verifAdmin() { - return userController.role == 'Super Admin'; - } + Future _generateBonLivraison(Commande commande) async { final details = await _database.getDetailsCommande(commande.id!); final client = await _database.getClientById(commande.clientId); @@ -374,8 +375,8 @@ Future _generateBonLivraison(Commande commande) async { pw.Text('📞 033 37 808 18', style: tinyTextStyle), pw.Text('🌐 www.guycom.mg', style: tinyTextStyle), pw.SizedBox(height: 2), - pw.Text('NIF: 4000106673 - STAT 95210 11 2017 1 003651', - style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)), + // pw.Text('NIF: 4000106673 - STAT 95210 11 2017 1 003651', + // style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)), ], ), ], @@ -498,6 +499,15 @@ Future _generateBonLivraison(Commande commande) async { style: tinyTextStyle), if (produit?.imei != null && produit!.imei!.isNotEmpty) pw.Text('IMEI: ${produit.imei}', style: tinyTextStyle), + pw.Row( + children: [ + if (produit?.ram != null && produit!.ram!.isNotEmpty) + pw.Text('${produit.ram}', style: smallTextStyle), + if (produit?.memoireInterne != null && produit!.memoireInterne!.isNotEmpty) + pw.Text(' | ${produit.memoireInterne}', style: smallTextStyle), + pw.Text(' | ${produit.reference}', style: smallTextStyle), + ], + ), ], ), ), @@ -894,7 +904,7 @@ Future _generateInvoice(Commande commande) async { pw.SizedBox(height: 8), pw.Row(children: [iconPhone, pw.SizedBox(width: 4), pw.Text('033 37 808 18', style: smallTextStyle)]), pw.Row(children: [iconGlobe, pw.SizedBox(width: 4), pw.Text('www.guycom.mg', style: smallTextStyle)]), - pw.Row(children: [iconGlobe, pw.SizedBox(width: 4), pw.Text('NIF: 1026/GC78-20-02-22', style: smallTextStyle)]), + pw.Row(children: [iconGlobe, pw.SizedBox(width: 4), pw.Text('NIF: 4000106673 - STAT 95210 11 2017 1 003651', style: smallTextStyle)]), pw.Text('Facebook: GuyCom', style: smallTextStyle), ], ), @@ -1360,32 +1370,32 @@ Future _generateInvoice(Commande commande) async { child: pw.Column( crossAxisAlignment: pw.CrossAxisAlignment.start, children: [ - pw.Text( - 'Vendeur validateur:', - style: pw.TextStyle( - fontSize: 9, - fontWeight: pw.FontWeight.bold, - color: PdfColors.grey700, - ), - ), - pw.SizedBox(height: 3), - pw.Text( - validateur != null - ? '${validateur.name} ${validateur.lastName ?? ''}'.trim() - : 'Non spécifié', - style: pw.TextStyle( - fontSize: 10, - color: PdfColors.black, - ), - ), - pw.SizedBox(height: 3), - pw.Text( - 'Date: ${DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())}', - style: pw.TextStyle( - fontSize: 8, - color: PdfColors.grey600, - ), - ), + // pw.Text( + // 'Vendeur validateur:', + // style: pw.TextStyle( + // fontSize: 9, + // fontWeight: pw.FontWeight.bold, + // color: PdfColors.grey700, + // ), + // ), + // pw.SizedBox(height: 3), + // pw.Text( + // validateur != null + // ? '${validateur.name} ${validateur.lastName ?? ''}'.trim() + // : 'Non spécifié', + // style: pw.TextStyle( + // fontSize: 10, + // color: PdfColors.black, + // ), + // ), + // pw.SizedBox(height: 3), + // pw.Text( + // 'Date: ${DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())}', + // style: pw.TextStyle( + // fontSize: 8, + // color: PdfColors.grey600, + // ), + // ), ], ), ), @@ -2564,6 +2574,7 @@ final emojiSuportFont = pw.Font.ttf( await rootBundle.load('assets/NotoEmoji-Reg tooltip: 'Générer le Bon de livraison', ), ), + if (verifAdmin()) ...[ const SizedBox(width: 10,), Container( decoration: BoxDecoration( @@ -2586,6 +2597,7 @@ final emojiSuportFont = pw.Font.ttf( await rootBundle.load('assets/NotoEmoji-Reg tooltip: 'Générer la facture', ), ), + ] ], ), children: [