mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Fix issue where deliveries show orders from incorrect stores
Correctly filter available orders in the Create Delivery modal to only display orders associated with the selected supplier and store, and reset the selected order when the store changes. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/ah44t7Y
This commit is contained in:
1 parent
42c5163dc2
commit
72f2632f01
3 files changed
+413
-243
No files matched your search
@@ -31,6 +31,10 @@ externalPort = 3002
|
||||
localPort = 41343
|
||||
externalPort = 3001
|
||||
|
||||
[[ports]]
|
||||
localPort = 41735
|
||||
externalPort = 4200
|
||||
|
||||
[workflows]
|
||||
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'],
|
||||
});
|
||||
|
||||
// Filtrer les commandes par fournisseur sélectionné - montrer toutes les commandes non livrées
|
||||
const availableOrders = allOrders.filter(order =>
|
||||
formData.supplierId ? (order.supplierId === parseInt(formData.supplierId) && order.status !== 'delivered') : false
|
||||
);
|
||||
// Filtrer les commandes par fournisseur ET magasin sélectionnés - montrer toutes les commandes non livrées
|
||||
const availableOrders = allOrders.filter(order => {
|
||||
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
|
||||
useEffect(() => {
|
||||
@@ -124,6 +130,13 @@ export default function CreateDeliveryModal({
|
||||
}
|
||||
}, [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({
|
||||
mutationFn: async (data: any) => {
|
||||
await apiRequest("/api/deliveries", "POST", data);
|
||||
|
||||
Reference in new issue
Block a user