Browse Source

demande de sortie

28062025_02
Stephane 5 months ago
parent
commit
3e6a81c2c3
  1. 25
      lib/Views/demande_sortie_personnelle_page.dart

25
lib/Views/demande_sortie_personnelle_page.dart

@ -124,17 +124,30 @@ class _DemandeSortiePersonnellePageState
try { try {
final products = await _database.getProducts(); final products = await _database.getProducts();
setState(() { setState(() {
_products = products _products = products.where((p) {
.where((p) => // Check stock availability
(p.stock ?? 0) > 0 && print("point de vente id: ${_userController.pointDeVenteId}");
p.pointDeVenteId == _userController.pointDeVenteId) bool hasStock = _userController.pointDeVenteId == 0
.toList(); ? (p.stock ?? 0) > 0
: (p.stock ?? 0) > 0 &&
p.pointDeVenteId == _userController.pointDeVenteId;
return hasStock;
}).toList();
// Setting filtered products
_filteredProducts = _products; _filteredProducts = _products;
// End loading state
_isLoading = false; _isLoading = false;
}); });
// Start the animation
_animationController.forward(); _animationController.forward();
} catch (e) { } catch (e) {
setState(() => _isLoading = false); // Handle any errors
setState(() {
_isLoading = false;
});
_showErrorSnackbar('Impossible de charger les produits: $e'); _showErrorSnackbar('Impossible de charger les produits: $e');
} }
} }

Loading…
Cancel
Save