mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 22:48:15 +02:00
Merge pull request #462 from R0m1k3/1.1
Fix issue where deliveries show orders from incorrect stores
This commit is contained in:
3 files changed
+413
-243
No files matched your search
@@ -31,6 +31,10 @@ externalPort = 3002
|
|||||||
localPort = 41343
|
localPort = 41343
|
||||||
externalPort = 3001
|
externalPort = 3001
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 41735
|
||||||
|
externalPort = 4200
|
||||||
|
|
||||||
[workflows]
|
[workflows]
|
||||||
runButton = "Project"
|
runButton = "Project"
|
||||||
|
|
||||||
|
|||||||
+392
-239
File diff suppressed because it is too large.
Load diff
@@ -61,10 +61,16 @@ export default function CreateDeliveryModal({
|
|||||||
queryKey: ['/api/orders'],
|
queryKey: ['/api/orders'],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filtrer les commandes par fournisseur sélectionné - montrer toutes les commandes non livrées
|
// Filtrer les commandes par fournisseur ET magasin sélectionnés - montrer toutes les commandes non livrées
|
||||||
const availableOrders = allOrders.filter(order =>
|
const availableOrders = allOrders.filter(order => {
|
||||||
formData.supplierId ? (order.supplierId === parseInt(formData.supplierId) && order.status !== 'delivered') : false
|
if (!formData.supplierId || !formData.groupId) return false;
|
||||||
);
|
|
||||||
|
return (
|
||||||
|
order.supplierId === parseInt(formData.supplierId) &&
|
||||||
|
order.groupId === parseInt(formData.groupId) &&
|
||||||
|
order.status !== 'delivered'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// Auto-sélectionner le magasin selon les règles
|
// Auto-sélectionner le magasin selon les règles
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -124,6 +130,13 @@ export default function CreateDeliveryModal({
|
|||||||
}
|
}
|
||||||
}, [formData.supplierId]);
|
}, [formData.supplierId]);
|
||||||
|
|
||||||
|
// Réinitialiser la commande sélectionnée quand on change de magasin
|
||||||
|
useEffect(() => {
|
||||||
|
if (formData.groupId) {
|
||||||
|
setFormData(prev => ({ ...prev, orderId: "" }));
|
||||||
|
}
|
||||||
|
}, [formData.groupId]);
|
||||||
|
|
||||||
const createDeliveryMutation = useMutation({
|
const createDeliveryMutation = useMutation({
|
||||||
mutationFn: async (data: any) => {
|
mutationFn: async (data: any) => {
|
||||||
await apiRequest("/api/deliveries", "POST", data);
|
await apiRequest("/api/deliveries", "POST", data);
|
||||||
|
|||||||
Reference in new issue
Block a user