diff --git a/attached_assets/Pasted--isProduction-true-hasDbUrl-true-dbHost-logiflow-db-5432-Using-Dat-1755171652151_1755171652152.txt b/attached_assets/Pasted--isProduction-true-hasDbUrl-true-dbHost-logiflow-db-5432-Using-Dat-1755171652151_1755171652152.txt new file mode 100644 index 0000000..d7e43b7 --- /dev/null +++ b/attached_assets/Pasted--isProduction-true-hasDbUrl-true-dbHost-logiflow-db-5432-Using-Dat-1755171652151_1755171652152.txt @@ -0,0 +1,201 @@ + + isProduction: true, + + hasDbUrl: true, + + dbHost: 'logiflow-db:5432' + +} + +βœ… Using DatabaseStorage (production PostgreSQL) + +⏰ Automatic backup scheduled for 2:00 AM daily (native timer) + +πŸ” Using development storage and authentication + +🐳 PRODUCTION: Starting LogiFlow application + +🐳 Environment: { NODE_ENV: 'production', DATABASE_URL: 'Present', PORT: '3000' } + +πŸ”§ Registering all production routes... + +πŸ”„ Running automatic production migrations... + +πŸ”„ MIGRATION: Starting SAV production migrations... + +πŸ”„ MIGRATION: Database URL configured: postgresql://logiflow_admin:Lo... + +βœ… MIGRATION: Connected to PostgreSQL database + +πŸ”„ MIGRATION: Checking if priority column exists... + +πŸ”„ MIGRATION: Priority column check result: 1 + +βœ… MIGRATION: Priority column already exists, skipping migration + +πŸ”Œ MIGRATION: Database connection closed + +πŸ”§ Using memory session store for development + +Warning: connect.session() MemoryStore is not + +designed for a production environment, as it will leak + +memory, and will not scale past a single process. + +βœ… All routes registered successfully for production + +🐳 Serving static files from: /app/dist/public + +🐳 PRODUCTION: LogiFlow serving on port 3000 + +HEAD /api/health 200 in 5ms + +HEAD /api/health 200 in 0ms + +HEAD /api/health 200 in 1ms + +HEAD /api/health 200 in 1ms + +HEAD /api/health 200 in 1ms + +HEAD /api/health 200 in 0ms + +HEAD /api/health 200 in 1ms + +πŸ“„ SPA: Serving index.html for /sav + +GET /api/user 401 in 1ms + +πŸ“„ SPA: Serving index.html for /auth + +GET /api/user 401 in 1ms + +GET /api/user 401 in 1ms + +GET /api/default-credentials-check 304 in 22ms + +πŸ” comparePasswords: { + + supplied: 'HIDDEN', + + stored: 'b23ec450a63faf3957a1...', + + hasFormat: true + +} + +πŸ” Password comparison result: true + +POST /api/login 200 in 53ms + +GET /api/user 200 in 5ms + +GET /api/user 304 in 11ms + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: undefined, + + withBL: undefined, + + userRole: 'employee' + +} + +Non-admin filtering deliveries with groupIds: [ 2 ] + +πŸ“Š Calcul statistiques mensuelles: { + + year: 2025, + + month: 8, + + startDate: '2025-08-01', + + endDate: '2025-09-01', + + groupIds: [ 2 ] + +} + +GET /api/user 304 in 85ms + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: undefined, + + userRole: 'employee' + +} + +Non-admin filtering with groupIds: [ 2 ] + +Customer Orders API called with: { groupIds: [ 2 ], userRole: 'employee' } + +Tasks API called with: { groupIds: [ 2 ], userRole: 'employee' } + +GET /api/publicities 304 in 179ms + +πŸ”— PRODUCTION: getDeliveries() rΓ©cupΓ©rΓ© 38 livraisons avec relations + +Deliveries returned: 38 items + +GET /api/dlc-products/stats 200 in 186ms + +GET /api/deliveries 200 in 194ms + +Customer Orders returned: 25 items + +Tasks returned: 9 items + +GET /api/customer-orders 200 in 249ms + +GET /api/tasks 200 in 241ms + +πŸ“Š Statistiques calculΓ©es: { + + ordersCount: 8, + + deliveriesCount: 21, + + pendingOrdersCount: 4, + + averageDeliveryTime: 0.17647058823529413, + + totalPalettes: 57, + + totalPackages: 17 + +} + +GET /api/stats/monthly 200 in 279ms + +πŸ”— PRODUCTION: getOrders() rΓ©cupΓ©rΓ© 18 commandes avec relations + +Orders returned: 18 items + +GET /api/orders 200 in 285ms + +GET /api/user 304 in 8ms + +GET /api/publicities 304 in 18ms + +GET /api/groups 200 in 5ms + +GET /api/user 304 in 3ms + +GET /api/suppliers 304 in 6ms + +GET /api/user 304 in 4ms + +HEAD /api/health 200 in 1ms + diff --git a/attached_assets/{FBB1645E-85AB-4676-B0E3-314DFB0355D8}_1755171691871.png b/attached_assets/{FBB1645E-85AB-4676-B0E3-314DFB0355D8}_1755171691871.png new file mode 100644 index 0000000..724f0b4 Binary files /dev/null and b/attached_assets/{FBB1645E-85AB-4676-B0E3-314DFB0355D8}_1755171691871.png differ diff --git a/client/src/components/CustomerOrderForm.tsx b/client/src/components/CustomerOrderForm.tsx index 220ec0b..1540ddb 100644 --- a/client/src/components/CustomerOrderForm.tsx +++ b/client/src/components/CustomerOrderForm.tsx @@ -106,13 +106,19 @@ export function CustomerOrderForm({ }); const handleSubmit = (data: CustomerOrderFormData) => { - console.log("Form submission data:", data); - console.log("Form errors:", form.formState.errors); - console.log("Form is valid:", form.formState.isValid); + console.log("πŸš€ FORM SUBMIT STARTED"); + console.log("πŸ“ Form submission data:", data); + console.log("πŸ” Form errors:", form.formState.errors); + console.log("βœ… Form is valid:", form.formState.isValid); + console.log("πŸ‘€ User context:", { + role: user?.role, + userGroups: user?.userGroups, + selectedStoreId + }); // Validate required fields if (!data.customerName || data.customerName.trim() === '') { - console.error("Customer name is required but empty"); + console.error("❌ Customer name is required but empty"); return; } @@ -142,13 +148,15 @@ export function CustomerOrderForm({ supplierId: data.supplierId || 1, }; - console.log("βœ… Customer Order Submit:", { + console.log("βœ… Customer Order Submit FINAL:", { userRole: user?.role, assignedGroupId: groupId, submitData: submitData }); + console.log("πŸ”₯ CALLING onSubmit with data:", submitData); onSubmit(submitData); + console.log("πŸ”₯ onSubmit CALLED"); }; // Auto-ensure groupId is always set to user's assigned group diff --git a/client/src/pages/CustomerOrders.tsx b/client/src/pages/CustomerOrders.tsx index 7bffa21..cf0f61c 100644 --- a/client/src/pages/CustomerOrders.tsx +++ b/client/src/pages/CustomerOrders.tsx @@ -77,8 +77,12 @@ export default function CustomerOrders() { // Create mutation const createMutation = useMutation({ - mutationFn: (data: any) => apiRequest('/api/customer-orders', 'POST', data), - onSuccess: () => { + mutationFn: (data: any) => { + console.log("πŸ”₯ CREATE MUTATION STARTED with data:", data); + return apiRequest('/api/customer-orders', 'POST', data); + }, + onSuccess: (result) => { + console.log("βœ… CREATE MUTATION SUCCESS:", result); // Force refresh of the query with store context queryClient.invalidateQueries({ predicate: (query) => query.queryKey[0]?.toString()?.includes('/api/customer-orders') ?? false }); queryClient.refetchQueries({ predicate: (query) => query.queryKey[0]?.toString()?.includes('/api/customer-orders') ?? false }); @@ -89,6 +93,7 @@ export default function CustomerOrders() { }); }, onError: (error: any) => { + console.error("❌ CREATE MUTATION ERROR:", error); toast({ title: "Erreur", description: error.message || "Erreur lors de la crΓ©ation de la commande", @@ -204,7 +209,15 @@ export default function CustomerOrders() { }; const handleCreateOrder = (data: any) => { + console.log("🎯 HANDLE CREATE ORDER CALLED with data:", data); + console.log("🎯 createMutation state:", { + isIdle: createMutation.isIdle, + isPending: createMutation.isPending, + isError: createMutation.isError, + isSuccess: createMutation.isSuccess + }); createMutation.mutate(data); + console.log("🎯 createMutation.mutate CALLED"); }; const handleEditOrder = (data: any) => {