Change DA to MGA
This commit is contained in:
parent
da03076411
commit
38af810b79
@ -27,7 +27,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
StatutCommande? _selectedStatut;
|
StatutCommande? _selectedStatut;
|
||||||
DateTime? _selectedDate;
|
DateTime? _selectedDate;
|
||||||
final TextEditingController _searchController = TextEditingController();
|
final TextEditingController _searchController = TextEditingController();
|
||||||
bool _showCancelledOrders = false; // Nouveau: contrôle l'affichage des commandes annulées
|
bool _showCancelledOrders =
|
||||||
|
false; // Nouveau: contrôle l'affichage des commandes annulées
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -43,26 +44,33 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
_filterCommandes();
|
_filterCommandes();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List> loadImage() async {
|
Future<Uint8List> loadImage() async {
|
||||||
final data = await rootBundle.load('assets/youmaz2.png');
|
final data = await rootBundle.load('assets/youmaz2.png');
|
||||||
return data.buffer.asUint8List();
|
return data.buffer.asUint8List();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _filterCommandes() {
|
void _filterCommandes() {
|
||||||
final query = _searchController.text.toLowerCase();
|
final query = _searchController.text.toLowerCase();
|
||||||
setState(() {
|
setState(() {
|
||||||
_filteredCommandes = _commandes.where((commande) {
|
_filteredCommandes = _commandes.where((commande) {
|
||||||
final matchesSearch = commande.clientNomComplet.toLowerCase().contains(query) ||
|
final matchesSearch =
|
||||||
|
commande.clientNomComplet.toLowerCase().contains(query) ||
|
||||||
commande.id.toString().contains(query);
|
commande.id.toString().contains(query);
|
||||||
final matchesStatut = _selectedStatut == null || commande.statut == _selectedStatut;
|
final matchesStatut =
|
||||||
|
_selectedStatut == null || commande.statut == _selectedStatut;
|
||||||
final matchesDate = _selectedDate == null ||
|
final matchesDate = _selectedDate == null ||
|
||||||
DateFormat('yyyy-MM-dd').format(commande.dateCommande) ==
|
DateFormat('yyyy-MM-dd').format(commande.dateCommande) ==
|
||||||
DateFormat('yyyy-MM-dd').format(_selectedDate!);
|
DateFormat('yyyy-MM-dd').format(_selectedDate!);
|
||||||
|
|
||||||
// Nouveau: filtrer les commandes annulées selon le toggle
|
// Nouveau: filtrer les commandes annulées selon le toggle
|
||||||
final shouldShowCancelled = _showCancelledOrders || commande.statut != StatutCommande.annulee;
|
final shouldShowCancelled =
|
||||||
|
_showCancelledOrders || commande.statut != StatutCommande.annulee;
|
||||||
|
|
||||||
return matchesSearch && matchesStatut && matchesDate && shouldShowCancelled;
|
return matchesSearch &&
|
||||||
|
matchesStatut &&
|
||||||
|
matchesDate &&
|
||||||
|
shouldShowCancelled;
|
||||||
}).toList();
|
}).toList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -148,12 +156,11 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
width: 100,
|
width: 100,
|
||||||
height: 80,
|
height: 80,
|
||||||
decoration: pw.BoxDecoration(
|
decoration: pw.BoxDecoration(
|
||||||
border: pw.Border.all(color: PdfColors.blue900, width: 2),
|
border:
|
||||||
|
pw.Border.all(color: PdfColors.blue900, width: 2),
|
||||||
borderRadius: pw.BorderRadius.circular(8),
|
borderRadius: pw.BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: pw.Center(
|
child: pw.Center(child: pw.Image(image)),
|
||||||
child: pw.Image(image)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
pw.SizedBox(height: 10),
|
pw.SizedBox(height: 10),
|
||||||
pw.Text('guycom', style: headerStyle),
|
pw.Text('guycom', style: headerStyle),
|
||||||
@ -175,7 +182,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
child: pw.Column(
|
child: pw.Column(
|
||||||
crossAxisAlignment: pw.CrossAxisAlignment.start,
|
crossAxisAlignment: pw.CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
pw.Text('FACTURE',
|
pw.Text(
|
||||||
|
'FACTURE',
|
||||||
style: pw.TextStyle(
|
style: pw.TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: pw.FontWeight.bold,
|
fontWeight: pw.FontWeight.bold,
|
||||||
@ -184,7 +192,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
),
|
),
|
||||||
pw.SizedBox(height: 8),
|
pw.SizedBox(height: 8),
|
||||||
pw.Text('N°: ${commande.id}', style: titleStyle),
|
pw.Text('N°: ${commande.id}', style: titleStyle),
|
||||||
pw.Text('Date: ${DateFormat('dd/MM/yyyy').format(commande.dateCommande)}'),
|
pw.Text(
|
||||||
|
'Date: ${DateFormat('dd/MM/yyyy').format(commande.dateCommande)}'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -212,7 +221,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
style: pw.TextStyle(fontSize: 12)),
|
style: pw.TextStyle(fontSize: 12)),
|
||||||
if (client?.telephone != null)
|
if (client?.telephone != null)
|
||||||
pw.Text('Tél: ${client!.telephone}',
|
pw.Text('Tél: ${client!.telephone}',
|
||||||
style: pw.TextStyle(fontSize: 10, color: PdfColors.grey600)),
|
style: pw.TextStyle(
|
||||||
|
fontSize: 10, color: PdfColors.grey600)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -224,15 +234,21 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
pw.SizedBox(height: 10),
|
pw.SizedBox(height: 10),
|
||||||
|
|
||||||
pw.Table(
|
pw.Table(
|
||||||
border: pw.TableBorder.all(color: PdfColors.grey400, width: 0.5),
|
border:
|
||||||
|
pw.TableBorder.all(color: PdfColors.grey400, width: 0.5),
|
||||||
children: [
|
children: [
|
||||||
pw.TableRow(
|
pw.TableRow(
|
||||||
decoration: const pw.BoxDecoration(color: PdfColors.blue900),
|
decoration:
|
||||||
|
const pw.BoxDecoration(color: PdfColors.blue900),
|
||||||
children: [
|
children: [
|
||||||
_buildTableCell('Produit', titleStyle.copyWith(color: PdfColors.white)),
|
_buildTableCell('Produit',
|
||||||
_buildTableCell('Qté', titleStyle.copyWith(color: PdfColors.white)),
|
titleStyle.copyWith(color: PdfColors.white)),
|
||||||
_buildTableCell('Prix unit.', titleStyle.copyWith(color: PdfColors.white)),
|
_buildTableCell(
|
||||||
_buildTableCell('Total', titleStyle.copyWith(color: PdfColors.white)),
|
'Qté', titleStyle.copyWith(color: PdfColors.white)),
|
||||||
|
_buildTableCell('Prix unit.',
|
||||||
|
titleStyle.copyWith(color: PdfColors.white)),
|
||||||
|
_buildTableCell(
|
||||||
|
'Total', titleStyle.copyWith(color: PdfColors.white)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
...details.asMap().entries.map((entry) {
|
...details.asMap().entries.map((entry) {
|
||||||
@ -247,8 +263,10 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
children: [
|
children: [
|
||||||
_buildTableCell(detail.produitNom ?? 'Produit inconnu'),
|
_buildTableCell(detail.produitNom ?? 'Produit inconnu'),
|
||||||
_buildTableCell(detail.quantite.toString()),
|
_buildTableCell(detail.quantite.toString()),
|
||||||
_buildTableCell('${detail.prixUnitaire.toStringAsFixed(2)} DA'),
|
_buildTableCell(
|
||||||
_buildTableCell('${detail.sousTotal.toStringAsFixed(2)} DA'),
|
'${detail.prixUnitaire.toStringAsFixed(2)} DA'),
|
||||||
|
_buildTableCell(
|
||||||
|
'${detail.sousTotal.toStringAsFixed(2)} DA'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -301,7 +319,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
pw.SizedBox(height: 5),
|
pw.SizedBox(height: 5),
|
||||||
pw.Text(
|
pw.Text(
|
||||||
'Cette facture est générée automatiquement par le système Youmaz Gestion',
|
'Cette facture est générée automatiquement par le système Youmaz Gestion',
|
||||||
style: pw.TextStyle(fontSize: 8, color: PdfColors.grey600),
|
style:
|
||||||
|
pw.TextStyle(fontSize: 8, color: PdfColors.grey600),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -464,7 +483,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
controller: _searchController,
|
controller: _searchController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Rechercher par client ou numéro de commande',
|
labelText: 'Rechercher par client ou numéro de commande',
|
||||||
prefixIcon: Icon(Icons.search, color: Colors.blue.shade800),
|
prefixIcon:
|
||||||
|
Icon(Icons.search, color: Colors.blue.shade800),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide.none,
|
borderSide: BorderSide.none,
|
||||||
@ -501,7 +521,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
value: _selectedStatut,
|
value: _selectedStatut,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Filtrer par statut',
|
labelText: 'Filtrer par statut',
|
||||||
prefixIcon: Icon(Icons.filter_list, color: Colors.blue.shade600),
|
prefixIcon: Icon(Icons.filter_list,
|
||||||
|
color: Colors.blue.shade600),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
borderSide: BorderSide.none,
|
borderSide: BorderSide.none,
|
||||||
@ -590,11 +611,13 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.calendar_today, color: Colors.blue.shade600),
|
icon: Icon(Icons.calendar_today,
|
||||||
|
color: Colors.blue.shade600),
|
||||||
label: Text(
|
label: Text(
|
||||||
_selectedDate == null
|
_selectedDate == null
|
||||||
? 'Date'
|
? 'Date'
|
||||||
: DateFormat('dd/MM/yyyy').format(_selectedDate!),
|
: DateFormat('dd/MM/yyyy')
|
||||||
|
.format(_selectedDate!),
|
||||||
style: const TextStyle(color: Colors.black87),
|
style: const TextStyle(color: Colors.black87),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -647,7 +670,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
@ -756,7 +780,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
Icon(
|
Icon(
|
||||||
_getStatutIcon(commande.statut),
|
_getStatutIcon(commande.statut),
|
||||||
size: 20,
|
size: 20,
|
||||||
color: commande.statut == StatutCommande.annulee
|
color:
|
||||||
|
commande.statut == StatutCommande.annulee
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: Colors.blue.shade600,
|
: Colors.blue.shade600,
|
||||||
),
|
),
|
||||||
@ -790,7 +815,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
DateFormat('dd/MM/yyyy').format(commande.dateCommande),
|
DateFormat('dd/MM/yyyy')
|
||||||
|
.format(commande.dateCommande),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey.shade600,
|
color: Colors.grey.shade600,
|
||||||
@ -811,7 +837,8 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: commande.statut == StatutCommande.annulee
|
color: commande.statut ==
|
||||||
|
StatutCommande.annulee
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: Colors.blue.shade700,
|
: Colors.blue.shade700,
|
||||||
),
|
),
|
||||||
@ -829,7 +856,7 @@ class _GestionCommandesPageState extends State<GestionCommandesPage> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
'${commande.montantTotal.toStringAsFixed(2)} DA',
|
'${commande.montantTotal.toStringAsFixed(2)} MGA',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -982,10 +1009,13 @@ class _CommandeDetails extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
...details.map((detail) => TableRow(
|
...details.map((detail) => TableRow(
|
||||||
children: [
|
children: [
|
||||||
_buildTableCell(detail.produitNom ?? 'Produit inconnu'),
|
_buildTableCell(
|
||||||
|
detail.produitNom ?? 'Produit inconnu'),
|
||||||
_buildTableCell('${detail.quantite}'),
|
_buildTableCell('${detail.quantite}'),
|
||||||
_buildTableCell('${detail.prixUnitaire.toStringAsFixed(2)} DA'),
|
_buildTableCell(
|
||||||
_buildTableCell('${detail.sousTotal.toStringAsFixed(2)} DA'),
|
'${detail.prixUnitaire.toStringAsFixed(2)} MGA'),
|
||||||
|
_buildTableCell(
|
||||||
|
'${detail.sousTotal.toStringAsFixed(2)} MGA'),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
@ -1010,7 +1040,7 @@ class _CommandeDetails extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${commande.montantTotal.toStringAsFixed(2)} DA',
|
'${commande.montantTotal.toStringAsFixed(2)} MGA',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
@ -1204,7 +1234,8 @@ class _CommandeActions extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.check_circle, color: Colors.green.shade600, size: 16),
|
Icon(Icons.check_circle,
|
||||||
|
color: Colors.green.shade600, size: 16),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
'Commande livrée',
|
'Commande livrée',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user