|
@@ -41,14 +41,14 @@ class ProjectKanbanService
|
|
|
}
|
|
|
|
|
|
return [
|
|
|
- 'group_data' => $this->getKanbanGroupData($groupIds, $group),
|
|
|
+ 'group_data' => $this->getKanbanGroupData($groupIds, $group,$items),
|
|
|
'group' => $group,
|
|
|
- 'tasks' => $items,
|
|
|
+// 'tasks' => $items,
|
|
|
'status_items' => $statusItems,
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- protected function getKanbanGroupData(array $ids, string $group)
|
|
|
+ protected function getKanbanGroupData(array $ids, string $group,$items)
|
|
|
{
|
|
|
$orderBy = match ($group) {
|
|
|
"requirement_asc" => ['id', 'asc'],
|
|
@@ -58,13 +58,20 @@ class ProjectKanbanService
|
|
|
default => null
|
|
|
};
|
|
|
|
|
|
+ $collection = Requirement::query()->whereIn("id", $ids)
|
|
|
+ ->when($orderBy, fn($query) => $query->orderBy(...$orderBy))
|
|
|
+ ->get([
|
|
|
+ 'id', 'title', 'priority', 'status'
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $collection->each(function ($item, $key)use ($collection,$items) {
|
|
|
+
|
|
|
+ $collection[$key]=(object)array_merge($collection[$key]->toarray(),$items[$collection[$key]->id]);
|
|
|
+ });
|
|
|
+
|
|
|
return match ($group) {
|
|
|
"assign", "finished_by" => UserProfileResource::collection(User::query()->whereIn("id", $ids)->get()),
|
|
|
- default => Requirement::query()->whereIn("id", $ids)
|
|
|
- ->when($orderBy, fn($query) => $query->orderBy(...$orderBy))
|
|
|
- ->get([
|
|
|
- 'id', 'title', 'priority', 'status'
|
|
|
- ]),
|
|
|
+ default => $collection,
|
|
|
};
|
|
|
}
|
|
|
}
|