|
|
@ -1524,6 +1524,45 @@ void _toggleTodayFilter() { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NOUVELLES VARIABLES pour les filtres de sorties |
|
|
|
|
|
DateTimeRange? _sortiesDateRange; |
|
|
|
|
|
bool _sortiesShowOnlyToday = false; |
|
|
|
|
|
|
|
|
|
|
|
// ... autres variables existantes |
|
|
|
|
|
|
|
|
|
|
|
// NOUVELLE MÉTHODE: Sélectionner la période pour les sorties |
|
|
|
|
|
Future<void> _selectSortiesDateRange(BuildContext context, StateSetter setDialogState) async { |
|
|
|
|
|
final DateTimeRange? picked = await showDateRangePicker( |
|
|
|
|
|
context: context, |
|
|
|
|
|
firstDate: DateTime(2020), |
|
|
|
|
|
lastDate: DateTime.now().add(const Duration(days: 365)), |
|
|
|
|
|
initialDateRange: _sortiesDateRange ?? |
|
|
|
|
|
DateTimeRange( |
|
|
|
|
|
start: DateTime.now().subtract(const Duration(days: 30)), |
|
|
|
|
|
end: DateTime.now(), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (picked != null) { |
|
|
|
|
|
setDialogState(() { |
|
|
|
|
|
_sortiesDateRange = picked; |
|
|
|
|
|
_sortiesShowOnlyToday = false; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NOUVELLE MÉTHODE: Toggle du filtre "aujourd'hui" pour les sorties |
|
|
|
|
|
void _toggleSortiesTodayFilter(StateSetter setDialogState) { |
|
|
|
|
|
setDialogState(() { |
|
|
|
|
|
_sortiesShowOnlyToday = !_sortiesShowOnlyToday; |
|
|
|
|
|
if (_sortiesShowOnlyToday) { |
|
|
|
|
|
_sortiesDateRange = null; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// MÉTHODE MISE À JOUR: _showPointVenteDetails avec les nouveaux filtres |
|
|
void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
final isMobile = MediaQuery.of(context).size.width < 600; |
|
|
final isMobile = MediaQuery.of(context).size.width < 600; |
|
|
final pointVenteId = pointVenteData['point_vente_id'] as int; |
|
|
final pointVenteId = pointVenteData['point_vente_id'] as int; |
|
|
@ -1536,11 +1575,16 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
title: Text('Détails - $pointVenteNom'), |
|
|
title: Text('Détails - $pointVenteNom'), |
|
|
content: Container( |
|
|
content: Container( |
|
|
width: double.maxFinite, |
|
|
width: double.maxFinite, |
|
|
height: 500, |
|
|
height: 600, // Augmenté pour inclure les commandes |
|
|
child: SingleChildScrollView( |
|
|
child: SingleChildScrollView( |
|
|
child: Column( |
|
|
child: Column( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
|
|
|
// FILTRES UNIFIÉS |
|
|
|
|
|
Text('Filtres généraux:', |
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14)), |
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
Wrap( |
|
|
Wrap( |
|
|
spacing: 8, |
|
|
spacing: 8, |
|
|
runSpacing: 8, |
|
|
runSpacing: 8, |
|
|
@ -1551,18 +1595,15 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
_showOnlyToday = !_showOnlyToday; |
|
|
_showOnlyToday = !_showOnlyToday; |
|
|
if (_showOnlyToday) _dateRange = null; |
|
|
if (_showOnlyToday) _dateRange = null; |
|
|
}); |
|
|
}); |
|
|
|
|
|
setState(() {}); |
|
|
}, |
|
|
}, |
|
|
icon: Icon( |
|
|
icon: Icon( |
|
|
_showOnlyToday ? Icons.today : Icons.calendar_today, |
|
|
_showOnlyToday ? Icons.today : Icons.calendar_today, |
|
|
size: 20, |
|
|
size: 20, |
|
|
), |
|
|
), |
|
|
label: Text(_showOnlyToday |
|
|
label: Text(_showOnlyToday |
|
|
? isMobile |
|
|
? (isMobile ? 'Toutes dates' : 'Toutes les dates') |
|
|
? 'Toutes dates' |
|
|
: (isMobile ? 'Aujourd\'hui' : 'Aujourd\'hui seulement')), |
|
|
: 'Toutes les dates' |
|
|
|
|
|
: isMobile |
|
|
|
|
|
? 'Aujourd\'hui' |
|
|
|
|
|
: 'Aujourd\'hui seulement'), |
|
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
style: ElevatedButton.styleFrom( |
|
|
backgroundColor: _showOnlyToday |
|
|
backgroundColor: _showOnlyToday |
|
|
? Colors.green.shade600 |
|
|
? Colors.green.shade600 |
|
|
@ -1592,16 +1633,13 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
_dateRange = picked; |
|
|
_dateRange = picked; |
|
|
_showOnlyToday = false; |
|
|
_showOnlyToday = false; |
|
|
}); |
|
|
}); |
|
|
|
|
|
setState(() {}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
icon: const Icon(Icons.date_range, size: 20), |
|
|
icon: const Icon(Icons.date_range, size: 20), |
|
|
label: Text(_dateRange != null |
|
|
label: Text(_dateRange != null |
|
|
? isMobile |
|
|
? (isMobile ? 'Période sélectionnée' : 'Période sélectionnée') |
|
|
? 'Période' |
|
|
: (isMobile ? 'Choisir période' : 'Choisir période')), |
|
|
: 'Période sélectionnée' |
|
|
|
|
|
: isMobile |
|
|
|
|
|
? 'Période' |
|
|
|
|
|
: 'Choisir période'), |
|
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
style: ElevatedButton.styleFrom( |
|
|
backgroundColor: _dateRange != null |
|
|
backgroundColor: _dateRange != null |
|
|
? Colors.orange.shade600 |
|
|
? Colors.orange.shade600 |
|
|
@ -1613,12 +1651,71 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
|
|
|
if (_showOnlyToday || _dateRange != null) |
|
|
|
|
|
ElevatedButton.icon( |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
setDialogState(() { |
|
|
|
|
|
_showOnlyToday = false; |
|
|
|
|
|
_dateRange = null; |
|
|
|
|
|
}); |
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
}, |
|
|
|
|
|
icon: const Icon(Icons.clear, size: 20), |
|
|
|
|
|
label: Text('Reset', style: TextStyle(fontSize: 12)), |
|
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
|
|
backgroundColor: Colors.red.shade600, |
|
|
|
|
|
foregroundColor: Colors.white, |
|
|
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
|
|
horizontal: isMobile ? 10 : 12, |
|
|
|
|
|
vertical: 8, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
SizedBox(height: 16), |
|
|
// Affichage de la période sélectionnée |
|
|
|
|
|
if (_showOnlyToday || _dateRange != null) |
|
|
|
|
|
Container( |
|
|
|
|
|
margin: EdgeInsets.only(top: 12, bottom: 8), |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: (_showOnlyToday ? Colors.green : Colors.orange).withOpacity(0.1), |
|
|
|
|
|
borderRadius: BorderRadius.circular(16), |
|
|
|
|
|
border: Border.all( |
|
|
|
|
|
color: (_showOnlyToday ? Colors.green : Colors.orange).withOpacity(0.3), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon( |
|
|
|
|
|
_showOnlyToday ? Icons.today : Icons.date_range, |
|
|
|
|
|
size: 16, |
|
|
|
|
|
color: _showOnlyToday ? Colors.green : Colors.orange, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 6), |
|
|
|
|
|
Flexible( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
_showOnlyToday |
|
|
|
|
|
? 'Filtré sur aujourd\'hui' |
|
|
|
|
|
: _dateRange != null |
|
|
|
|
|
? 'Du ${DateFormat('dd/MM/yyyy').format(_dateRange!.start)} au ${DateFormat('dd/MM/yyyy').format(_dateRange!.end)}' |
|
|
|
|
|
: 'Toutes les dates', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
color: _showOnlyToday ? Colors.green : Colors.orange, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 12), |
|
|
|
|
|
|
|
|
// Statistiques générales avec FutureBuilder pour refresh automatique |
|
|
// Statistiques générales |
|
|
FutureBuilder<Map<String, dynamic>>( |
|
|
FutureBuilder<Map<String, dynamic>>( |
|
|
future: _getDetailedPointVenteStats(pointVenteId), |
|
|
future: _getDetailedPointVenteStats(pointVenteId), |
|
|
builder: (context, snapshot) { |
|
|
builder: (context, snapshot) { |
|
|
@ -1643,46 +1740,181 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 12), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOUVELLE SECTION: Liste des commandes |
|
|
SizedBox(height: 16), |
|
|
SizedBox(height: 16), |
|
|
Text('Top 5 des produits:', style: TextStyle(fontWeight: FontWeight.bold)), |
|
|
Divider(), |
|
|
|
|
|
|
|
|
|
|
|
Text('Commandes récentes (max 10):', |
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold)), |
|
|
|
|
|
|
|
|
SizedBox(height: 8), |
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
// Top produits avec filtre |
|
|
|
|
|
FutureBuilder<List<Map<String, dynamic>>>( |
|
|
FutureBuilder<List<Map<String, dynamic>>>( |
|
|
future: _database.getTopProduitsParPointDeVente( |
|
|
future: _database.getCommandesParPointDeVente( |
|
|
pointVenteId, |
|
|
pointVenteId, |
|
|
dateDebut: _dateRange?.start, |
|
|
dateDebut: _dateRange?.start, |
|
|
dateFin: _dateRange?.end, |
|
|
dateFin: _dateRange?.end, |
|
|
aujourdHuiSeulement: _showOnlyToday, |
|
|
aujourdHuiSeulement: _showOnlyToday, |
|
|
|
|
|
limit: 10, |
|
|
), |
|
|
), |
|
|
builder: (context, snapshot) { |
|
|
builder: (context, snapshot) { |
|
|
if (snapshot.connectionState == ConnectionState.waiting) { |
|
|
if (snapshot.connectionState == ConnectionState.waiting) { |
|
|
return Center(child: CircularProgressIndicator()); |
|
|
return Center(child: CircularProgressIndicator()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) { |
|
|
if (snapshot.hasError) { |
|
|
return Text('Aucun produit vendu${_showOnlyToday ? ' aujourd\'hui' : _dateRange != null ? ' pour cette période' : ''}', style: TextStyle(color: Colors.grey)); |
|
|
return Text('Erreur de chargement des commandes', |
|
|
|
|
|
style: TextStyle(color: Colors.red)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!snapshot.hasData || snapshot.data!.isEmpty) { |
|
|
|
|
|
String message = 'Aucune commande trouvée'; |
|
|
|
|
|
if (_showOnlyToday) { |
|
|
|
|
|
message = 'Aucune commande aujourd\'hui'; |
|
|
|
|
|
} else if (_dateRange != null) { |
|
|
|
|
|
message = 'Aucune commande pour cette période'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Text(message, style: TextStyle(color: Colors.grey)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
final produits = snapshot.data!; |
|
|
final commandes = snapshot.data! |
|
|
|
|
|
.map((map) => Commande.fromMap(map)) |
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
return Column( |
|
|
|
|
|
children: commandes.map(_buildCommandeCardForDialog).toList(), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
), |
|
|
|
|
|
// Section des sorties personnelles |
|
|
|
|
|
SizedBox(height: 16), |
|
|
|
|
|
Divider(), |
|
|
|
|
|
|
|
|
|
|
|
Text('Historique des sorties personnelles:', |
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold)), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
|
|
|
// ... (reste du code pour les sorties, inchangé) |
|
|
|
|
|
FutureBuilder<List<Map<String, dynamic>>>( |
|
|
|
|
|
future: _database.getHistoriqueSortiesPersonnelles( |
|
|
|
|
|
pointDeVenteId: pointVenteId, |
|
|
|
|
|
dateDebut: _dateRange?.start, |
|
|
|
|
|
dateFin: _dateRange?.end, |
|
|
|
|
|
aujourdHuiSeulement: _showOnlyToday, |
|
|
|
|
|
limit: 10, |
|
|
|
|
|
), |
|
|
|
|
|
builder: (context, snapshot) { |
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) { |
|
|
|
|
|
return Center(child: CircularProgressIndicator()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (snapshot.hasError) { |
|
|
|
|
|
return Text('Erreur de chargement des sorties', |
|
|
|
|
|
style: TextStyle(color: Colors.red)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!snapshot.hasData || snapshot.data!.isEmpty) { |
|
|
|
|
|
String message = 'Aucune sortie personnelle trouvée'; |
|
|
|
|
|
if (_showOnlyToday) { |
|
|
|
|
|
message = 'Aucune sortie aujourd\'hui'; |
|
|
|
|
|
} else if (_dateRange != null) { |
|
|
|
|
|
message = 'Aucune sortie pour cette période'; |
|
|
|
|
|
} |
|
|
|
|
|
return Text(message, style: TextStyle(color: Colors.grey)); |
|
|
|
|
|
} |
|
|
|
|
|
final sorties = snapshot.data!; |
|
|
return Column( |
|
|
return Column( |
|
|
children: produits.map((produit) => Padding( |
|
|
children: sorties.map((sortie) => Card( |
|
|
padding: EdgeInsets.symmetric(vertical: 4), |
|
|
margin: EdgeInsets.symmetric(vertical: 2), |
|
|
child: Row( |
|
|
child: Padding( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
padding: EdgeInsets.all(6), |
|
|
children: [ |
|
|
child: Column( |
|
|
Expanded( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
child: Text( |
|
|
children: [ |
|
|
produit['produit_nom'] ?? 'N/A', |
|
|
Row( |
|
|
style: TextStyle(fontSize: 12), |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
overflow: TextOverflow.ellipsis, |
|
|
children: [ |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
sortie['produit_nom'] ?? 'N/A', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
fontSize: 14, |
|
|
|
|
|
), |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 2), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: _getStatusColorForSorties(sortie['statut']), |
|
|
|
|
|
borderRadius: BorderRadius.circular(12), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
sortie['statut'] ?? 'N/A', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
fontSize: 10, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 3), |
|
|
Text( |
|
|
Row( |
|
|
'${produit['quantite_vendue'] ?? 0} vendus', |
|
|
children: [ |
|
|
style: TextStyle(fontSize: 12, color: Colors.grey), |
|
|
Icon(Icons.inventory, size: 14, color: Colors.grey), |
|
|
), |
|
|
SizedBox(width: 4), |
|
|
], |
|
|
Text( |
|
|
|
|
|
'Qté: ${sortie['quantite'] ?? 0}', |
|
|
|
|
|
style: TextStyle(fontSize: 14, color: Colors.black), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 128), |
|
|
|
|
|
Icon(Icons.person, size: 14, color: Colors.grey), |
|
|
|
|
|
SizedBox(width: 4), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
'${sortie['admin_nom'] ?? ''} ${sortie['admin_nom_famille'] ?? ''}', |
|
|
|
|
|
style: TextStyle(fontSize: 14, color: Colors.grey), |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
if (sortie['date_sortie'] != null) ...[ |
|
|
|
|
|
SizedBox(height: 2), |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.access_time, size: 14, color: Colors.grey), |
|
|
|
|
|
SizedBox(width: 4), |
|
|
|
|
|
Text( |
|
|
|
|
|
_formatDateSortie(sortie['date_sortie']), |
|
|
|
|
|
style: TextStyle(fontSize: 12, color: Colors.grey), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
if (sortie['motif'] != null && sortie['motif'].toString().isNotEmpty) ...[ |
|
|
|
|
|
SizedBox(height: 3), |
|
|
|
|
|
Text( |
|
|
|
|
|
'Motif: ${sortie['motif']}', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 11, |
|
|
|
|
|
color: Colors.grey[600], |
|
|
|
|
|
fontStyle: FontStyle.italic, |
|
|
|
|
|
), |
|
|
|
|
|
maxLines: 2, |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
)).toList(), |
|
|
)).toList(), |
|
|
); |
|
|
); |
|
|
@ -1693,16 +1925,6 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
actions: [ |
|
|
actions: [ |
|
|
if (_showOnlyToday || _dateRange != null) |
|
|
|
|
|
TextButton( |
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
setDialogState(() { |
|
|
|
|
|
_showOnlyToday = false; |
|
|
|
|
|
_dateRange = null; |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
child: Text('Réinitialiser'), |
|
|
|
|
|
), |
|
|
|
|
|
TextButton( |
|
|
TextButton( |
|
|
onPressed: () => Navigator.pop(context), |
|
|
onPressed: () => Navigator.pop(context), |
|
|
child: Text('Fermer'), |
|
|
child: Text('Fermer'), |
|
|
@ -1712,6 +1934,492 @@ void _showPointVenteDetails(Map<String, dynamic> pointVenteData) async { |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
// Ajoutez cette variable d'état dans votre classe _DashboardPageState |
|
|
|
|
|
Set<int> _expandedCommandes = <int>{}; |
|
|
|
|
|
|
|
|
|
|
|
// Remplacez votre méthode _buildCommandeCardForDialog par celle-ci : |
|
|
|
|
|
Widget _buildCommandeCardForDialog(Commande commande) { |
|
|
|
|
|
final bool isExpanded = _expandedCommandes.contains(commande.id); |
|
|
|
|
|
|
|
|
|
|
|
return FutureBuilder<List<DetailCommande>>( |
|
|
|
|
|
future: _database.getDetailsCommande(commande.id!), |
|
|
|
|
|
builder: (context, snapshot) { |
|
|
|
|
|
double totalRemises = 0; |
|
|
|
|
|
bool aDesRemises = false; |
|
|
|
|
|
|
|
|
|
|
|
if (snapshot.hasData) { |
|
|
|
|
|
for (final detail in snapshot.data!) { |
|
|
|
|
|
totalRemises += detail.montantRemise; |
|
|
|
|
|
if (detail.aRemise) aDesRemises = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return AnimatedContainer( |
|
|
|
|
|
duration: Duration(milliseconds: 300), |
|
|
|
|
|
curve: Curves.easeInOut, |
|
|
|
|
|
child: InkWell( |
|
|
|
|
|
onTap: () { |
|
|
|
|
|
setState(() { |
|
|
|
|
|
if (isExpanded) { |
|
|
|
|
|
_expandedCommandes.remove(commande.id); |
|
|
|
|
|
} else { |
|
|
|
|
|
_expandedCommandes.add(commande.id!); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
borderRadius: BorderRadius.circular(8), |
|
|
|
|
|
child: Card( |
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 4), |
|
|
|
|
|
elevation: isExpanded ? 4 : 2, |
|
|
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
|
|
borderRadius: BorderRadius.circular(8), |
|
|
|
|
|
side: aDesRemises |
|
|
|
|
|
? BorderSide(color: Colors.orange.shade300, width: 1) |
|
|
|
|
|
: BorderSide.none, |
|
|
|
|
|
), |
|
|
|
|
|
child: Padding( |
|
|
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
// En-tête de la commande (toujours visible) |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
|
|
|
width: 40, |
|
|
|
|
|
height: 40, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: _getStatutColor(commande.statut).withOpacity(0.1), |
|
|
|
|
|
borderRadius: BorderRadius.circular(20), |
|
|
|
|
|
border: aDesRemises |
|
|
|
|
|
? Border.all(color: Colors.orange.shade300, width: 1) |
|
|
|
|
|
: null, |
|
|
|
|
|
), |
|
|
|
|
|
child: Column( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon( |
|
|
|
|
|
aDesRemises |
|
|
|
|
|
? Icons.discount |
|
|
|
|
|
: _getStatutIcon(commande.statut), |
|
|
|
|
|
size: 16, |
|
|
|
|
|
color: aDesRemises |
|
|
|
|
|
? Colors.teal.shade700 |
|
|
|
|
|
: commande.statut == StatutCommande.annulee |
|
|
|
|
|
? Colors.red |
|
|
|
|
|
: Colors.blue.shade600, |
|
|
|
|
|
), |
|
|
|
|
|
Text( |
|
|
|
|
|
'#${commande.id}', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 8, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 12), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Text( |
|
|
|
|
|
commande.clientNomComplet, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 14, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
), |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(height: 2), |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.calendar_today, size: 12, color: Colors.grey), |
|
|
|
|
|
SizedBox(width: 4), |
|
|
|
|
|
Text( |
|
|
|
|
|
DateFormat('dd/MM/yyyy').format(commande.dateCommande), |
|
|
|
|
|
style: TextStyle(fontSize: 11, color: Colors.grey), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 12), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 2), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: _getStatutColor(commande.statut).withOpacity(0.2), |
|
|
|
|
|
borderRadius: BorderRadius.circular(10), |
|
|
|
|
|
), |
|
|
|
|
|
child: Text( |
|
|
|
|
|
commande.statutLibelle, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 10, |
|
|
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
|
|
color: commande.statut == StatutCommande.annulee |
|
|
|
|
|
? Colors.red |
|
|
|
|
|
: Colors.blue.shade700, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
// Icône d'expansion |
|
|
|
|
|
AnimatedRotation( |
|
|
|
|
|
turns: isExpanded ? 0.5 : 0, |
|
|
|
|
|
duration: Duration(milliseconds: 300), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.expand_more, |
|
|
|
|
|
color: Colors.grey[600], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
|
|
|
// Montant (toujours visible) |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.attach_money, size: 14, color: Colors.green.shade600), |
|
|
|
|
|
SizedBox(width: 4), |
|
|
|
|
|
Text( |
|
|
|
|
|
'${NumberFormat('#,##0', 'fr_FR').format(commande.montantTotal)} MGA', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 13, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: Colors.green.shade700, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
if (totalRemises > 0) ...[ |
|
|
|
|
|
SizedBox(width: 8), |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 2), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.orange.shade100, |
|
|
|
|
|
borderRadius: BorderRadius.circular(8), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.discount, size: 10, color: Colors.teal.shade700), |
|
|
|
|
|
SizedBox(width: 2), |
|
|
|
|
|
Text( |
|
|
|
|
|
'-${NumberFormat('#,##0', 'fr_FR').format(totalRemises)}', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 9, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: Colors.teal.shade700, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// Détails étendus (visibles seulement si expanded) |
|
|
|
|
|
AnimatedCrossFade( |
|
|
|
|
|
duration: Duration(milliseconds: 300), |
|
|
|
|
|
crossFadeState: isExpanded |
|
|
|
|
|
? CrossFadeState.showSecond |
|
|
|
|
|
: CrossFadeState.showFirst, |
|
|
|
|
|
firstChild: SizedBox.shrink(), |
|
|
|
|
|
secondChild: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
SizedBox(height: 12), |
|
|
|
|
|
Divider(color: Colors.grey[300]), |
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
|
|
|
// Informations du commandeur |
|
|
|
|
|
if (commande.commandeurnom != null && commande.commandeurnom!.isNotEmpty) |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.all(8), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.blue.shade50, |
|
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.person, size: 16, color: Colors.blue[600]), |
|
|
|
|
|
SizedBox(width: 8), |
|
|
|
|
|
Text( |
|
|
|
|
|
'Commandeur: ', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
color: Colors.grey[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
'${commande.commandeurnom ?? ''} ${commande.commandeurPrenom ?? ''}', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: Colors.blue[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
|
|
|
// Statut détaillé |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.all(8), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: _getStatutColor(commande.statut).withOpacity(0.1), |
|
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
|
), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon( |
|
|
|
|
|
_getStatutIcon(commande.statut), |
|
|
|
|
|
size: 16, |
|
|
|
|
|
color: commande.statut == StatutCommande.annulee |
|
|
|
|
|
? Colors.red |
|
|
|
|
|
: Colors.blue[600], |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 8), |
|
|
|
|
|
Text( |
|
|
|
|
|
'Statut: ', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
color: Colors.grey[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Text( |
|
|
|
|
|
commande.statutLibelle, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: commande.statut == StatutCommande.annulee |
|
|
|
|
|
? Colors.red |
|
|
|
|
|
: Colors.blue[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 8), |
|
|
|
|
|
|
|
|
|
|
|
// Liste des produits commandés |
|
|
|
|
|
if (snapshot.hasData && snapshot.data!.isNotEmpty) ...[ |
|
|
|
|
|
Container( |
|
|
|
|
|
padding: EdgeInsets.all(8), |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.green.shade50, |
|
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
|
), |
|
|
|
|
|
child: Column( |
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.shopping_cart, size: 16, color: Colors.green[600]), |
|
|
|
|
|
SizedBox(width: 8), |
|
|
|
|
|
Text( |
|
|
|
|
|
'Produits commandés:', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12, |
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
color: Colors.green[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(height: 6), |
|
|
|
|
|
...snapshot.data!.map((detail) => Padding( |
|
|
|
|
|
padding: EdgeInsets.only(left: 24, bottom: 4), |
|
|
|
|
|
child: Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Container( |
|
|
|
|
|
width: 4, |
|
|
|
|
|
height: 4, |
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: Colors.green[600], |
|
|
|
|
|
borderRadius: BorderRadius.circular(2), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 8), |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
'${detail.produitNom} (x${detail.quantite})', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 11, |
|
|
|
|
|
color: Colors.green[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Text( |
|
|
|
|
|
'${NumberFormat('#,##0', 'fr_FR').format(detail.sousTotal)} MGA', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 11, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
color: Colors.green[700], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
)).toList(), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Color _getStatutColor(StatutCommande statut) { |
|
|
|
|
|
switch (statut) { |
|
|
|
|
|
case StatutCommande.enAttente: |
|
|
|
|
|
return Colors.orange.shade100; |
|
|
|
|
|
case StatutCommande.confirmee: |
|
|
|
|
|
return Colors.blue.shade100; |
|
|
|
|
|
case StatutCommande.annulee: |
|
|
|
|
|
return Colors.red.shade100; |
|
|
|
|
|
default: |
|
|
|
|
|
return Colors.grey.shade100; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IconData _getStatutIcon(StatutCommande statut) { |
|
|
|
|
|
switch (statut) { |
|
|
|
|
|
case StatutCommande.enAttente: |
|
|
|
|
|
return Icons.pending; |
|
|
|
|
|
case StatutCommande.confirmee: |
|
|
|
|
|
return Icons.check_circle; |
|
|
|
|
|
case StatutCommande.annulee: |
|
|
|
|
|
return Icons.cancel; |
|
|
|
|
|
default: |
|
|
|
|
|
return Icons.help; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Méthodes utilitaires à ajouter dans votre classe |
|
|
|
|
|
Color _getStatusColorForSorties(String? statut) { |
|
|
|
|
|
switch (statut?.toLowerCase()) { |
|
|
|
|
|
case 'en_attente': |
|
|
|
|
|
return Colors.orange; |
|
|
|
|
|
case 'approuve': |
|
|
|
|
|
return Colors.green; |
|
|
|
|
|
case 'refuse': |
|
|
|
|
|
return Colors.red; |
|
|
|
|
|
default: |
|
|
|
|
|
return Colors.grey; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Version corrigée de _formatDate qui gère à la fois DateTime et String |
|
|
|
|
|
String _formatDateSortie(dynamic dateValue) { |
|
|
|
|
|
if (dateValue == null) return 'N/A'; |
|
|
|
|
|
|
|
|
|
|
|
DateTime? date; |
|
|
|
|
|
|
|
|
|
|
|
// Gestion des différents types de données |
|
|
|
|
|
if (dateValue is DateTime) { |
|
|
|
|
|
date = dateValue; |
|
|
|
|
|
} else if (dateValue is String) { |
|
|
|
|
|
if (dateValue.isEmpty) return 'N/A'; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
// Essayer différents formats de parsing |
|
|
|
|
|
if (dateValue.contains('T')) { |
|
|
|
|
|
// Format ISO 8601 (ex: 2024-01-15T10:30:00.000Z) |
|
|
|
|
|
date = DateTime.parse(dateValue); |
|
|
|
|
|
} else if (dateValue.contains('-') && dateValue.contains(':')) { |
|
|
|
|
|
// Format personnalisé (ex: 15-01-2024 10:30:00) |
|
|
|
|
|
final inputFormat = DateFormat('dd-MM-yyyy HH:mm:ss'); |
|
|
|
|
|
date = inputFormat.parse(dateValue); |
|
|
|
|
|
} else { |
|
|
|
|
|
// Essayer le parsing par défaut |
|
|
|
|
|
date = DateTime.tryParse(dateValue); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
print('Erreur de parsing de date: $e pour la valeur: $dateValue'); |
|
|
|
|
|
return 'Date invalide'; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
return 'Format de date non supporté'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (date == null) return 'Date invalide'; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
final outputFormat = DateFormat('dd/MM/yyyy HH:mm'); |
|
|
|
|
|
return outputFormat.format(date); |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
print('Erreur de formatage de date: $e'); |
|
|
|
|
|
return 'Erreur de format'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Version alternative plus robuste |
|
|
|
|
|
String _formatDateSortieAlternative(dynamic dateValue) { |
|
|
|
|
|
if (dateValue == null) return 'N/A'; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
DateTime date; |
|
|
|
|
|
|
|
|
|
|
|
if (dateValue is DateTime) { |
|
|
|
|
|
date = dateValue; |
|
|
|
|
|
} else if (dateValue is String) { |
|
|
|
|
|
// Convertir en DateTime selon différents formats possibles |
|
|
|
|
|
if (dateValue.contains('T')) { |
|
|
|
|
|
date = DateTime.parse(dateValue); |
|
|
|
|
|
} else { |
|
|
|
|
|
// Essayer le format dd-MM-yyyy HH:mm:ss |
|
|
|
|
|
final parts = dateValue.split(' '); |
|
|
|
|
|
if (parts.length >= 2) { |
|
|
|
|
|
final datePart = parts[0]; |
|
|
|
|
|
final timePart = parts[1]; |
|
|
|
|
|
|
|
|
|
|
|
final dateComponents = datePart.split('-'); |
|
|
|
|
|
final timeComponents = timePart.split(':'); |
|
|
|
|
|
|
|
|
|
|
|
if (dateComponents.length == 3 && timeComponents.length >= 2) { |
|
|
|
|
|
date = DateTime( |
|
|
|
|
|
int.parse(dateComponents[2]), // année |
|
|
|
|
|
int.parse(dateComponents[1]), // mois |
|
|
|
|
|
int.parse(dateComponents[0]), // jour |
|
|
|
|
|
int.parse(timeComponents[0]), // heure |
|
|
|
|
|
int.parse(timeComponents[1]), // minute |
|
|
|
|
|
timeComponents.length > 2 ? int.parse(timeComponents[2].split('.')[0]) : 0, // seconde |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
date = DateTime.now(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
date = DateTime.parse(dateValue); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
return 'Format non supporté'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return DateFormat('dd/MM/yyyy HH:mm').format(date); |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
print('Erreur de formatage de date: $e pour la valeur: $dateValue'); |
|
|
|
|
|
return 'Format invalide'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Future<Map<String, dynamic>> _getDetailedPointVenteStats(int pointVenteId) async { |
|
|
Future<Map<String, dynamic>> _getDetailedPointVenteStats(int pointVenteId) async { |
|
|
final ventesData = await _database.getVentesParPointDeVente( |
|
|
final ventesData = await _database.getVentesParPointDeVente( |
|
|
@ -1734,14 +2442,30 @@ Future<Map<String, dynamic>> _getDetailedPointVenteStats(int pointVenteId) async |
|
|
return pointVenteStats; |
|
|
return pointVenteStats; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Widget _buildStatRow(String label, String value) { |
|
|
Widget _buildStatRow(String title, String value) { |
|
|
return Padding( |
|
|
return Container( |
|
|
padding: EdgeInsets.symmetric(vertical: 4), |
|
|
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 4), // Padding minimal |
|
|
child: Row( |
|
|
child: Row( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
|
children: [ |
|
|
children: [ |
|
|
Text(label, style: TextStyle(fontSize: 12)), |
|
|
Text( |
|
|
Text(value, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500)), |
|
|
title, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
fontSize: 15, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
SizedBox(width: 6), // Espace minimal entre titre et valeur |
|
|
|
|
|
Expanded( |
|
|
|
|
|
child: Text( |
|
|
|
|
|
value, |
|
|
|
|
|
textAlign: TextAlign.right, |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 15, |
|
|
|
|
|
color: Colors.grey[700], |
|
|
|
|
|
), |
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
|