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