mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
no message
This commit is contained in:
1 parent
38fb8afd11
commit
47a521a83d
2 files changed
+5
-6
No files matched your search
@@ -144,9 +144,9 @@ class SubTaskController extends Controller
|
||||
$subtask = $mastertask->subtasks()->create($request->all()['data']);
|
||||
|
||||
// syncnutie timeblocks
|
||||
if (!empty($data['data']['timeblocks'])) {
|
||||
//if (!empty($data['data']['timeblocks'])) {
|
||||
$subtask->syncTimeblocks($data['data']['timeblocks']);
|
||||
}
|
||||
//}
|
||||
|
||||
// upload attachmentu
|
||||
if ($request->file('data')) {
|
||||
@@ -184,14 +184,10 @@ class SubTaskController extends Controller
|
||||
$subtask->update($request->all()['data']);
|
||||
|
||||
// syncnutie vykazu
|
||||
if (!empty($data['data']['timesheets'])) {
|
||||
$subtask->syncTimesheets($data['data']['timesheets']);
|
||||
}
|
||||
|
||||
// syncnutie timeblocks
|
||||
if (!empty($data['data']['timeblocks'])) {
|
||||
$subtask->syncTimeblocks($data['data']['timeblocks']);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Subtask updated successfully',
|
||||
|
||||
@@ -65,6 +65,9 @@ class SubTask extends Model
|
||||
|
||||
public function syncTimeblocks(Array $timeblocks)
|
||||
{
|
||||
if (empty($timeblocks)) {
|
||||
return $this->timeblocks()->delete();
|
||||
}
|
||||
// pripravenie array na upsert
|
||||
$timeblocks = array_map(function($item) {
|
||||
$item['sub_task_id'] = $this->id;
|
||||
|
||||
Reference in new issue
Block a user