Browse Source

demande de sortie

28062025_02
Stephane 4 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 {
final products = await _database.getProducts();
setState(() {
_products = products
.where((p) =>
(p.stock ?? 0) > 0 &&
p.pointDeVenteId == _userController.pointDeVenteId)
.toList();
_products = products.where((p) {
// Check stock availability
print("point de vente id: ${_userController.pointDeVenteId}");
bool hasStock = _userController.pointDeVenteId == 0
? (p.stock ?? 0) > 0
: (p.stock ?? 0) > 0 &&
p.pointDeVenteId == _userController.pointDeVenteId;
return hasStock;
}).toList();
// Setting filtered products
_filteredProducts = _products;
// End loading state
_isLoading = false;
});
// Start the animation
_animationController.forward();
} catch (e) {
setState(() => _isLoading = false);
// Handle any errors
setState(() {
_isLoading = false;
});
_showErrorSnackbar('Impossible de charger les produits: $e');
}
}

Loading…
Cancel
Save