92 lines
2.7 KiB
PHP
92 lines
2.7 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers;
|
||
|
|
|
||
|
|
use App\Models\Admin\AdminPmDailyLogEntry;
|
||
|
|
use App\Services\ProjectManagement\DailyLogService;
|
||
|
|
use App\Services\ProjectManagement\ProjectService;
|
||
|
|
use Illuminate\View\View;
|
||
|
|
|
||
|
|
class DailyLogController extends Controller
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
private readonly DailyLogService $dailyLogService,
|
||
|
|
private readonly ProjectService $projectService
|
||
|
|
) {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 일일 로그 목록 화면
|
||
|
|
*/
|
||
|
|
public function index(): View
|
||
|
|
{
|
||
|
|
$tenantId = session('current_tenant_id', 1);
|
||
|
|
|
||
|
|
$projects = $this->projectService->getActiveProjects();
|
||
|
|
$stats = $this->dailyLogService->getStats($tenantId);
|
||
|
|
$weeklyTimeline = $this->dailyLogService->getWeeklyTimeline($tenantId);
|
||
|
|
$assigneeTypes = AdminPmDailyLogEntry::getAssigneeTypes();
|
||
|
|
$entryStatuses = AdminPmDailyLogEntry::getStatuses();
|
||
|
|
$assignees = $this->dailyLogService->getAssigneeList($tenantId);
|
||
|
|
|
||
|
|
return view('daily-logs.index', compact(
|
||
|
|
'projects',
|
||
|
|
'stats',
|
||
|
|
'weeklyTimeline',
|
||
|
|
'assigneeTypes',
|
||
|
|
'entryStatuses',
|
||
|
|
'assignees'
|
||
|
|
));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 일일 로그 상세 화면
|
||
|
|
*/
|
||
|
|
public function show(int $id): View
|
||
|
|
{
|
||
|
|
$tenantId = session('current_tenant_id', 1);
|
||
|
|
|
||
|
|
$log = $this->dailyLogService->getDailyLogById($id, true);
|
||
|
|
|
||
|
|
if (! $log) {
|
||
|
|
abort(404, '일일 로그를 찾을 수 없습니다.');
|
||
|
|
}
|
||
|
|
|
||
|
|
$projects = $this->projectService->getActiveProjects();
|
||
|
|
$assigneeTypes = AdminPmDailyLogEntry::getAssigneeTypes();
|
||
|
|
$entryStatuses = AdminPmDailyLogEntry::getStatuses();
|
||
|
|
$assignees = $this->dailyLogService->getAssigneeList($tenantId);
|
||
|
|
|
||
|
|
return view('daily-logs.show', compact(
|
||
|
|
'log',
|
||
|
|
'projects',
|
||
|
|
'assigneeTypes',
|
||
|
|
'entryStatuses',
|
||
|
|
'assignees'
|
||
|
|
));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 오늘 날짜 로그 화면 (자동 생성)
|
||
|
|
*/
|
||
|
|
public function today(): View
|
||
|
|
{
|
||
|
|
$tenantId = session('current_tenant_id', 1);
|
||
|
|
$today = now()->format('Y-m-d');
|
||
|
|
|
||
|
|
$log = $this->dailyLogService->getOrCreateByDate($tenantId, $today);
|
||
|
|
|
||
|
|
$projects = $this->projectService->getActiveProjects();
|
||
|
|
$assigneeTypes = AdminPmDailyLogEntry::getAssigneeTypes();
|
||
|
|
$entryStatuses = AdminPmDailyLogEntry::getStatuses();
|
||
|
|
$assignees = $this->dailyLogService->getAssigneeList($tenantId);
|
||
|
|
|
||
|
|
return view('daily-logs.show', compact(
|
||
|
|
'log',
|
||
|
|
'projects',
|
||
|
|
'assigneeTypes',
|
||
|
|
'entryStatuses',
|
||
|
|
'assignees'
|
||
|
|
));
|
||
|
|
}
|
||
|
|
}
|