Browse Source

cacher boutton facture

28062025_02
ASUS 5 months ago
parent
commit
14ce881a3c
  1. 76
      lib/Views/commandManagement.dart

76
lib/Views/commandManagement.dart

@ -41,6 +41,9 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
bool _showCancelledOrders = false; bool _showCancelledOrders = false;
final userController = Get.find<UserController>(); final userController = Get.find<UserController>();
bool verifAdmin() {
return userController.role == 'Super Admin';
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -251,9 +254,7 @@ Future<pw.Widget> buildIconGift() async {
} }
// Bon de livraison============================================== // Bon de livraison==============================================
bool verifAdmin() {
return userController.role == 'Super Admin';
}
Future<void> _generateBonLivraison(Commande commande) async { Future<void> _generateBonLivraison(Commande commande) async {
final details = await _database.getDetailsCommande(commande.id!); final details = await _database.getDetailsCommande(commande.id!);
final client = await _database.getClientById(commande.clientId); final client = await _database.getClientById(commande.clientId);
@ -374,8 +375,8 @@ Future<void> _generateBonLivraison(Commande commande) async {
pw.Text('📞 033 37 808 18', style: tinyTextStyle), pw.Text('📞 033 37 808 18', style: tinyTextStyle),
pw.Text('🌐 www.guycom.mg', style: tinyTextStyle), pw.Text('🌐 www.guycom.mg', style: tinyTextStyle),
pw.SizedBox(height: 2), pw.SizedBox(height: 2),
pw.Text('NIF: 4000106673 - STAT 95210 11 2017 1 003651', // pw.Text('NIF: 4000106673 - STAT 95210 11 2017 1 003651',
style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)), // style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
], ],
), ),
], ],
@ -498,6 +499,15 @@ Future<void> _generateBonLivraison(Commande commande) async {
style: tinyTextStyle), style: tinyTextStyle),
if (produit?.imei != null && produit!.imei!.isNotEmpty) if (produit?.imei != null && produit!.imei!.isNotEmpty)
pw.Text('IMEI: ${produit.imei}', style: tinyTextStyle), 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<void> _generateInvoice(Commande commande) async {
pw.SizedBox(height: 8), pw.SizedBox(height: 8),
pw.Row(children: [iconPhone, pw.SizedBox(width: 4), pw.Text('033 37 808 18', style: smallTextStyle)]), 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('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), pw.Text('Facebook: GuyCom', style: smallTextStyle),
], ],
), ),
@ -1360,32 +1370,32 @@ Future<void> _generateInvoice(Commande commande) async {
child: pw.Column( child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start, crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [ children: [
pw.Text( // pw.Text(
'Vendeur validateur:', // 'Vendeur validateur:',
style: pw.TextStyle( // style: pw.TextStyle(
fontSize: 9, // fontSize: 9,
fontWeight: pw.FontWeight.bold, // fontWeight: pw.FontWeight.bold,
color: PdfColors.grey700, // color: PdfColors.grey700,
), // ),
), // ),
pw.SizedBox(height: 3), // pw.SizedBox(height: 3),
pw.Text( // pw.Text(
validateur != null // validateur != null
? '${validateur.name} ${validateur.lastName ?? ''}'.trim() // ? '${validateur.name} ${validateur.lastName ?? ''}'.trim()
: 'Non spécifié', // : 'Non spécifié',
style: pw.TextStyle( // style: pw.TextStyle(
fontSize: 10, // fontSize: 10,
color: PdfColors.black, // color: PdfColors.black,
), // ),
), // ),
pw.SizedBox(height: 3), // pw.SizedBox(height: 3),
pw.Text( // pw.Text(
'Date: ${DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())}', // 'Date: ${DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())}',
style: pw.TextStyle( // style: pw.TextStyle(
fontSize: 8, // fontSize: 8,
color: PdfColors.grey600, // 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', tooltip: 'Générer le Bon de livraison',
), ),
), ),
if (verifAdmin()) ...[
const SizedBox(width: 10,), const SizedBox(width: 10,),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -2586,6 +2597,7 @@ final emojiSuportFont = pw.Font.ttf( await rootBundle.load('assets/NotoEmoji-Reg
tooltip: 'Générer la facture', tooltip: 'Générer la facture',
), ),
), ),
]
], ],
), ),
children: [ children: [

Loading…
Cancel
Save