From 6a2457ca68b4d4448055f5b605f6554100cda36e Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Fri, 22 Aug 2025 07:32:16 +0000 Subject: [PATCH] Enable task creation with selected store for administrators Update TaskFormInline to accept selectedStoreId and user, passing them to the backend for task creation. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 72798e04-65c2-4587-bc41-77a3d4984153 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/72798e04-65c2-4587-bc41-77a3d4984153/rxmoj25 --- client/src/pages/Tasks.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/pages/Tasks.tsx b/client/src/pages/Tasks.tsx index 796ab40..10db8e1 100644 --- a/client/src/pages/Tasks.tsx +++ b/client/src/pages/Tasks.tsx @@ -39,7 +39,7 @@ type TaskWithRelations = Task & { }; // Composant TaskForm inline - Version production ultra-simple -function TaskFormInline({ task, onClose }: any) { +function TaskFormInline({ task, onClose, selectedStoreId, user }: any) { const { toast } = useToast(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -90,8 +90,9 @@ function TaskFormInline({ task, onClose }: any) { const method = task ? 'PUT' : 'POST'; if (!task) { - (taskData as any).groupId = 1; - (taskData as any).createdBy = 'admin'; + // Utiliser le magasin sélectionné ou le premier disponible comme fallback + (taskData as any).groupId = selectedStoreId ? parseInt(selectedStoreId.toString()) : 1; + (taskData as any).createdBy = user?.username || 'admin'; } console.log('📤 Sending request:', { url, method, taskData }); @@ -778,6 +779,8 @@ export default function Tasks() { setShowCreateModal(false)} /> @@ -1324,6 +1327,8 @@ export default function Tasks() { { setShowEditModal(false); setSelectedTask(null);