cacher boutton facture
This commit is contained in:
parent
6bc8373cad
commit
14ce881a3c
@ -41,6 +41,9 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
||||
bool _showCancelledOrders = false;
|
||||
final userController = Get.find<UserController>();
|
||||
|
||||
bool verifAdmin() {
|
||||
return userController.role == 'Super Admin';
|
||||
}
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -251,9 +254,7 @@ Future<pw.Widget> buildIconGift() async {
|
||||
}
|
||||
|
||||
// Bon de livraison==============================================
|
||||
bool verifAdmin() {
|
||||
return userController.role == 'Super Admin';
|
||||
}
|
||||
|
||||
Future<void> _generateBonLivraison(Commande commande) async {
|
||||
final details = await _database.getDetailsCommande(commande.id!);
|
||||
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('🌐 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<void> _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<void> _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<void> _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: [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user