demande de sortie
This commit is contained in:
parent
2764111fa4
commit
3e6a81c2c3
@ -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…
Reference in New Issue
Block a user