feat(frontend): module Achats complet (commandes, réception, stock)
- Modèles Fournisseur, PurchaseOrder, PurchaseOrderLine - FournisseurService + PurchaseOrderService (create, receive) - AchatsProvider : chargement parallèle commandes + fournisseurs - AchatsScreen : liste avec badges statut colorés (violet) - PurchaseOrderFormScreen : lignes dynamiques, calcul HT/TVA/TTC - PurchaseOrderDetailScreen : détail + bouton Réceptionner - Réception → entrée stock automatique via backend Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import 'api_client.dart';
|
||||
import '../models/fournisseur.dart';
|
||||
|
||||
class FournisseurService {
|
||||
static Future<List<Fournisseur>> fetchAll() async {
|
||||
final res = await ApiClient.instance.get('/fournisseurs');
|
||||
return (res.data as List).map((e) => Fournisseur.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static Future<Fournisseur> create(Fournisseur f) async {
|
||||
final res = await ApiClient.instance.post('/fournisseurs', data: f.toJson());
|
||||
return Fournisseur.fromJson(res.data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'api_client.dart';
|
||||
import '../models/purchase_order.dart';
|
||||
|
||||
class PurchaseOrderService {
|
||||
static Future<List<PurchaseOrder>> fetchAll() async {
|
||||
final res = await ApiClient.instance.get('/purchase-orders');
|
||||
return (res.data as List).map((e) => PurchaseOrder.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static Future<PurchaseOrder> create(PurchaseOrder order) async {
|
||||
final res = await ApiClient.instance.post('/purchase-orders', data: order.toJson());
|
||||
return PurchaseOrder.fromJson(res.data);
|
||||
}
|
||||
|
||||
static Future<void> receive(int orderId, Map<String, dynamic> reception) async {
|
||||
await ApiClient.instance.post('/purchase-orders/$orderId/receive', data: reception);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user