diff --git a/app/Models/Admin/AdminPmProject.php b/app/Models/Admin/AdminPmProject.php index a129bab2..bd9c9737 100644 --- a/app/Models/Admin/AdminPmProject.php +++ b/app/Models/Admin/AdminPmProject.php @@ -151,4 +151,25 @@ public function getIssueStatsAttribute(): array 'closed' => $this->issues()->where('status', AdminPmIssue::STATUS_CLOSED)->count(), ]; } + + /** + * 상태 라벨 (한글) + */ + public function getStatusLabelAttribute(): string + { + return self::getStatuses()[$this->status] ?? $this->status; + } + + /** + * 상태별 색상 클래스 + */ + public function getStatusColorAttribute(): string + { + return match ($this->status) { + self::STATUS_ACTIVE => 'bg-green-100 text-green-800', + self::STATUS_COMPLETED => 'bg-blue-100 text-blue-800', + self::STATUS_ON_HOLD => 'bg-yellow-100 text-yellow-800', + default => 'bg-gray-100 text-gray-800', + }; + } } diff --git a/app/Services/ProjectManagement/ProjectService.php b/app/Services/ProjectManagement/ProjectService.php index 8cb70f7f..52cfc9e2 100644 --- a/app/Services/ProjectManagement/ProjectService.php +++ b/app/Services/ProjectManagement/ProjectService.php @@ -211,7 +211,7 @@ public function changeStatus(int $id, string $status): AdminPmProject */ public function duplicateProject(int $id, ?string $newName = null): AdminPmProject { - $original = AdminPmProject::with('tasks')->findOrFail($id); + $original = AdminPmProject::with(['tasks.issues'])->findOrFail($id); $newProject = $original->replicate(); $newProject->name = $newName ?? $original->name.' (복사본)'; @@ -223,7 +223,7 @@ public function duplicateProject(int $id, ?string $newName = null): AdminPmProje $newProject->updated_at = now(); $newProject->save(); - // 작업 복제 + // 작업 및 이슈 복제 (task_id 매핑 유지) foreach ($original->tasks as $task) { $newTask = $task->replicate(); $newTask->project_id = $newProject->id; @@ -234,8 +234,22 @@ public function duplicateProject(int $id, ?string $newName = null): AdminPmProje $newTask->created_at = now(); $newTask->updated_at = now(); $newTask->save(); + + // 해당 작업의 이슈들 복제 + foreach ($task->issues as $issue) { + $newIssue = $issue->replicate(); + $newIssue->project_id = $newProject->id; + $newIssue->task_id = $newTask->id; + $newIssue->status = AdminPmIssue::STATUS_OPEN; + $newIssue->created_by = auth()->id(); + $newIssue->updated_by = null; + $newIssue->deleted_by = null; + $newIssue->created_at = now(); + $newIssue->updated_at = now(); + $newIssue->save(); + } } - return $newProject->load('tasks'); + return $newProject->load('tasks.issues'); } } diff --git a/resources/views/project-management/index.blade.php b/resources/views/project-management/index.blade.php index a3044382..c838dec6 100644 --- a/resources/views/project-management/index.blade.php +++ b/resources/views/project-management/index.blade.php @@ -45,12 +45,19 @@
완료율 {{ $donePercent }}%
| ID | +# | 프로젝트명 | 상태 | 진행률 | 작업 | 이슈 | 기간 | -액션 | +액션 | |
|---|---|---|---|---|---|---|---|---|---|---|
| - {{ $project->id }} + | + {{ $loop->iteration + (($projects->currentPage() - 1) * $projects->perPage()) }} | @@ -32,20 +41,47 @@ |
-
-
-
+
+
+
+
+
+
+
+
+
+ {{ $inProgressPct }}%
+
+ {{ $donePct }}%
+ +
+ {{ $inProgressPct - $donePct }}%
- {{ $project->progress }}%
|
- - {{ $project->tasks_count ?? 0 }} + |
+
+ {{ $taskTotal }}
+
+ {{ $taskInProgress }}
+ {{ $taskDone }}
+
+ |
- - {{ $project->issues_count ?? 0 }} + |
+ @php
+ $issueTotal = $issueStats['total'] ?? 0;
+ $issueOpen = $issueStats['open'] ?? 0;
+ $issueInProgress = $issueStats['in_progress'] ?? 0;
+ $issueResolved = $issueStats['resolved'] ?? 0;
+ @endphp
+
+ {{ $issueTotal }}
+
+ {{ $issueOpen }}
+ {{ $issueInProgress }}
+ {{ $issueResolved }}
+
+ |
@if($project->start_date || $project->end_date) @@ -54,35 +90,56 @@ - @endif | -+ |
@if($project->deleted_at)
-
-
-
+
+ @if(auth()->user()?->is_super_admin)
+
+
+
+
+ @else
+ 삭제됨
+ @endif
@else
-
- 보기
-
-
- 수정
-
-
-
+
@endif
|