From 450379dd24e6104609c17d400f10e68b215faf09 Mon Sep 17 00:00:00 2001 From: Michal Feher Date: Tue, 6 Feb 2024 15:01:15 +0100 Subject: [PATCH] no message --- be/app/Http/Controllers/SubTaskController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/be/app/Http/Controllers/SubTaskController.php b/be/app/Http/Controllers/SubTaskController.php index 6dd68fb..0801a1e 100644 --- a/be/app/Http/Controllers/SubTaskController.php +++ b/be/app/Http/Controllers/SubTaskController.php @@ -174,6 +174,12 @@ class SubTaskController extends Controller $mastertask = MasterTask::find($mastertask_id); $subtasks = $mastertask->subtasks()->createMany($request->all()['data']['employees']); + // syncnutie timeblocks + foreach ( $request->all()['data']['employees'] as $key => $employee ) { + if ($data['data']['employees'][$key]['user_id'] == $employee['id']) + $subtasks[$key]->syncTimeblocks($data['data']['employees'][$key]['timeblocks']); + } + // upload attachmentu if ($request->file('data')) { $attachments = Attachment::uploadAttachmentsToS3($request->file('data')['files'], $mastertask); @@ -184,10 +190,6 @@ class SubTaskController extends Controller if ($request->file('data')) { $subtask->attachments()->createMany($attachments); } - - // syncnutie timeblocks - if ($data['data']['user_id'] == $subtask->user_id) - $subtask->syncTimeblocks($data['data']['timeblocks']); } return response()->json([