@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import ' package:http/http.dart ' as http ;
import ' dart:convert ' ;
import ' package:intl/intl.dart ' ;
class OrderHistoryPage extends StatefulWidget {
@ override
_OrderHistoryPageState createState ( ) = > _OrderHistoryPageState ( ) ;
@ -612,7 +614,7 @@ Widget _buildTableView() {
cells: [
DataCell ( Text ( commande . numeroCommande ? ? ' - ' ) ) ,
DataCell ( Text ( commande . tablename ? ? ' - ' ) ) ,
DataCell ( Text ( _formatPrice ( commande . totalTtc ? ? 0 ) ) ) ,
DataCell ( Text ( NumberFormat ( " #,##0.00 " , " fr_FR " ) . format ( commande . totalHt ? ? 0 ) ) ) ,
DataCell (
IconButton (
icon: Icon ( Icons . info , color: Color ( 0xFF4CAF50 ) ) ,
@ -643,11 +645,11 @@ void _showCommandeDetails(CommandeData commande) {
Text (
' Date de paiement: ${ commande . datePaiement ! = null ? _formatDateTime ( commande . datePaiement ! ) : " - " } ' ,
) ,
Text ( ' Total TTC : ${ _formatPrice ( commande . totalTtc ? ? 0 ) } ' ) ,
Text ( ' Total: ${ NumberFormat ( " #,##0.00 " , " fr_FR " ) . format ( commande . totalHt ? ? 0 ) } ' ) ,
SizedBox ( height: 10 ) ,
const Text ( ' Articles: ' , style: TextStyle ( fontWeight: FontWeight . bold ) ) ,
. . . ? commande . items ? . map ( ( item ) = > Text (
' ${ item . quantite } × ${ item . menuNom } - ${ _formatPrice ( item . totalItem ) } ' ) ) ,
' ${ item . quantite } × ${ item . menuNom } - ${ NumberFormat ( " #,##0.00 " , " fr _FR " ) . format ( item . totalItem ) } ' ) ) ,
] ,
) ,
) ,
@ -898,7 +900,7 @@ void _showCommandeDetails(CommandeData commande) {
) ,
) ,
Text (
' ${ item . quantite } × ${ _formatPrice ( item . prixUnitaire ) } ' ,
' ${ item . quantite } × ${ NumberFormat ( " #,##0.00 " , " fr _FR " ) . format ( item . prixUnitaire ) } ' ,
style: TextStyle (
fontSize: 10 ,
color: Colors . grey ,
@ -908,7 +910,7 @@ void _showCommandeDetails(CommandeData commande) {
) ,
) ,
Text (
_formatPrice ( item . totalItem ) ,
NumberFormat ( " #,##0.00 " , " fr _FR " ) . format ( item . totalItem ) ,
style: TextStyle (
fontSize: 13 ,
fontWeight: FontWeight . bold ,
@ -965,7 +967,7 @@ void _showCommandeDetails(CommandeData commande) {
) ,
if ( ( commande . totalTva ? ? 0 ) > 0 )
Text (
' TVA: ${ _formatPrice ( commande . totalTva ? ? 0 ) } ' ,
' TVA: ${ NumberFormat ( " #,##0.00 " , " fr _FR " ) . format ( commande . totalTva ? ? 0 ) } ' ,
style: TextStyle (
fontSize: 9 ,
color: Colors . grey . shade500 ,
@ -990,7 +992,7 @@ void _showCommandeDetails(CommandeData commande) {
size: 14 ,
) ,
Text (
_formatPrice ( commande . totalTtc ? ? 0 ) ,
NumberFormat ( " #,##0.00 " , " fr_FR " ) . format ( commande . totalHt ? ? 0 ) ,
style: TextStyle (
fontSize: 14 ,
fontWeight: FontWeight . bold ,
@ -1009,9 +1011,6 @@ void _showCommandeDetails(CommandeData commande) {
return ' ${ dateTime . day . toString ( ) . padLeft ( 2 , ' 0 ' ) } / ${ dateTime . month . toString ( ) . padLeft ( 2 , ' 0 ' ) } / ${ dateTime . year } à ${ dateTime . hour . toString ( ) . padLeft ( 2 , ' 0 ' ) } : ${ dateTime . minute . toString ( ) . padLeft ( 2 , ' 0 ' ) } ' ;
}
String _formatPrice ( double priceInCents ) {
return ' ${ ( priceInCents / 100 ) . toStringAsFixed ( 2 ) } Ar ' ;
}
String _getMenuIcon ( String menuNom ) {
String lowerName = menuNom . toLowerCase ( ) ;
@ -1121,7 +1120,7 @@ class CommandeData {
final datePaiement = _parseDateTime ( json [ ' date_paiement ' ] ) ? ? _parseDateTime ( json [ ' date_service ' ] ) ;
final totalTtc = _parseDouble ( json [ ' total_ttc ' ] ) ? ? _parseDouble ( json [ ' total ' ] ) ;
final totalHt = _parseDouble ( json [ ' total_ttc ' ] ) ? ? _parseDouble ( json [ ' total ' ] ) ;
final modePaiement = json [ ' mode_paiement ' ] ? . toString ( ) ? ? json [ ' payment_method ' ] ? . toString ( ) ;
@ -1136,7 +1135,7 @@ class CommandeData {
statut: json [ ' statut ' ] ? . toString ( ) ,
totalHt: _parseDouble ( json [ ' total_ht ' ] ) ,
totalTva: _parseDouble ( json [ ' total_tva ' ] ) ,
totalTtc: totalTtc ,
totalTtc: totalHt ,
modePaiement: modePaiement ,
commentaires: json [ ' commentaires ' ] ? . toString ( ) ,
serveur: serveur ,