|
|
|
@ -1,5 +1,3 @@ |
|
|
|
// Remplacez complètement votre fichier CommandeDetails par celui-ci : |
|
|
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:youmazgestion/Models/client.dart'; |
|
|
|
import 'package:youmazgestion/Services/stock_managementDatabase.dart'; |
|
|
|
@ -24,7 +22,8 @@ class CommandeDetails extends StatelessWidget { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
Widget _buildTableCell(String text, {bool isAmount = false, Color? textColor}) { |
|
|
|
Widget _buildTableCell(String text, |
|
|
|
{bool isAmount = false, Color? textColor}) { |
|
|
|
return Padding( |
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
child: Text( |
|
|
|
@ -66,7 +65,9 @@ class CommandeDetails extends StatelessWidget { |
|
|
|
), |
|
|
|
); |
|
|
|
} else { |
|
|
|
return _buildTableCell('${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)} MGA', isAmount: true); |
|
|
|
return _buildTableCell( |
|
|
|
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixUnitaire)} MGA', |
|
|
|
isAmount: true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -130,7 +131,9 @@ class CommandeDetails extends StatelessWidget { |
|
|
|
), |
|
|
|
); |
|
|
|
} else { |
|
|
|
return _buildTableCell('${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)} MGA', isAmount: true); |
|
|
|
return _buildTableCell( |
|
|
|
'${NumberFormat('#,##0', 'fr_FR').format(detail.prixFinal)} MGA', |
|
|
|
isAmount: true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -178,21 +181,27 @@ class CommandeDetails extends StatelessWidget { |
|
|
|
children: [ |
|
|
|
Icon( |
|
|
|
hasRemises ? Icons.discount : Icons.receipt_long, |
|
|
|
color: hasRemises ? Colors.orange.shade700 : Colors.blue.shade700, |
|
|
|
color: hasRemises |
|
|
|
? Colors.orange.shade700 |
|
|
|
: Colors.blue.shade700, |
|
|
|
), |
|
|
|
const SizedBox(width: 8), |
|
|
|
Text( |
|
|
|
hasRemises ? 'Détails de la commande (avec remises)' : 'Détails de la commande', |
|
|
|
hasRemises |
|
|
|
? 'Détails de la commande (avec remises)' |
|
|
|
: 'Détails de la commande', |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontSize: 16, |
|
|
|
color: hasRemises ? Colors.orange.shade800 : Colors.black87, |
|
|
|
color: |
|
|
|
hasRemises ? Colors.orange.shade800 : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
if (hasRemises) ...[ |
|
|
|
const Spacer(), |
|
|
|
Container( |
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), |
|
|
|
padding: const EdgeInsets.symmetric( |
|
|
|
horizontal: 8, vertical: 4), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.orange.shade100, |
|
|
|
borderRadius: BorderRadius.circular(12), |
|
|
|
@ -231,60 +240,71 @@ class CommandeDetails extends StatelessWidget { |
|
|
|
], |
|
|
|
), |
|
|
|
...details.map((detail) => TableRow( |
|
|
|
decoration: detail.aRemise |
|
|
|
? BoxDecoration( |
|
|
|
color: const Color.fromARGB(255, 243, 191, 114), |
|
|
|
border: Border( |
|
|
|
left: BorderSide( |
|
|
|
color: Colors.orange.shade300, |
|
|
|
width: 3, |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
: null, |
|
|
|
children: [ |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
detail.produitNom ?? 'Produit inconnu', |
|
|
|
style: const TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
if (detail.aRemise) ...[ |
|
|
|
const SizedBox(height: 2), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Icon( |
|
|
|
Icons.local_offer, |
|
|
|
size: 12, |
|
|
|
color: Colors.teal.shade700, |
|
|
|
decoration: detail.aRemise |
|
|
|
? BoxDecoration( |
|
|
|
color: const Color.fromARGB(255, 243, 191, 114), |
|
|
|
border: Border( |
|
|
|
left: BorderSide( |
|
|
|
color: Colors.orange.shade300, |
|
|
|
width: 3, |
|
|
|
), |
|
|
|
const SizedBox(width: 4), |
|
|
|
), |
|
|
|
) |
|
|
|
: null, |
|
|
|
children: [ |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.all(8.0), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
detail.produitNom ?? 'Produit inconnu', |
|
|
|
style: const TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
if (detail.produitImei != null) ...[ |
|
|
|
const SizedBox(height: 2), |
|
|
|
Text( |
|
|
|
'Avec remise', |
|
|
|
style: TextStyle( |
|
|
|
'IMEI: ${detail.produitImei}', |
|
|
|
style: const TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: Colors.teal.shade700, |
|
|
|
color: Colors.grey, |
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
if (detail.aRemise) ...[ |
|
|
|
const SizedBox(height: 2), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Icon( |
|
|
|
Icons.local_offer, |
|
|
|
size: 12, |
|
|
|
color: Colors.teal.shade700, |
|
|
|
), |
|
|
|
const SizedBox(width: 4), |
|
|
|
Text( |
|
|
|
'Avec remise', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: Colors.teal.shade700, |
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
_buildTableCell('${detail.quantite}'), |
|
|
|
_buildPriceColumn(detail), |
|
|
|
if (hasRemises) _buildRemiseColumn(detail), |
|
|
|
_buildTotalColumn(detail), |
|
|
|
], |
|
|
|
)), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
_buildTableCell('${detail.quantite}'), |
|
|
|
_buildPriceColumn(detail), |
|
|
|
if (hasRemises) _buildRemiseColumn(detail), |
|
|
|
_buildTotalColumn(detail), |
|
|
|
], |
|
|
|
)), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|