This commit is contained in:
Stephane 2025-07-25 14:36:26 +03:00
parent 99d570bd3a
commit 13296529c3
3 changed files with 840 additions and 828 deletions

View File

@ -806,24 +806,12 @@ class AppDatabase {
Future<List<Commande>> getCommandes() async { Future<List<Commande>> getCommandes() async {
final db = await database; final db = await database;
final result = await db.query(''' final result = await db.query('''
SELECT SELECT c.*, cl.nom as clientNom, cl.prenom as clientPrenom, cl.email as clientEmail
c.*, FROM commandes c
cl.nom as clientNom, LEFT JOIN clients cl ON c.clientId = cl.id
cl.prenom as clientPrenom, ORDER BY c.dateCommande DESC
cl.email as clientEmail, ''');
u.nom as commandeurNom,
u.prenom as commandeurPrenom,
pdv.nom as pointDeVenteNom,
pdv.id as pointDeVenteId
FROM commandes c
LEFT JOIN clients cl ON c.clientId = cl.id
LEFT JOIN users u ON c.commandeurId = u.id
LEFT JOIN points_de_vente pdv ON u.point_de_vente_id = pdv.id
ORDER BY c.dateCommande DESC
''');
return result.map((row) => Commande.fromMap(row.fields)).toList(); return result.map((row) => Commande.fromMap(row.fields)).toList();
} }

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ class DatabaseConfig {
static const String localDatabase = 'guycom'; static const String localDatabase = 'guycom';
// Production (public) MySQL settings // Production (public) MySQL settings
static const String prodHost = '185.70.105.157'; static const String prodHost = '102.17.52.31';
static const String prodUsername = 'guycom'; static const String prodUsername = 'guycom';
static const String prodPassword = '3iV59wjRdbuXAPR'; static const String prodPassword = '3iV59wjRdbuXAPR';
static const String prodDatabase = 'guycom'; static const String prodDatabase = 'guycom';