diff --git a/app/Http/Requests/DailyLog/UpdateDailyLogRequest.php b/app/Http/Requests/DailyLog/UpdateDailyLogRequest.php index 097f48f6..5e9acc63 100644 --- a/app/Http/Requests/DailyLog/UpdateDailyLogRequest.php +++ b/app/Http/Requests/DailyLog/UpdateDailyLogRequest.php @@ -14,6 +14,7 @@ public function authorize(): bool public function rules(): array { return [ + 'log_date' => ['sometimes', 'date', 'date_format:Y-m-d'], 'project_id' => ['nullable', 'integer', 'exists:admin_pm_projects,id'], 'summary' => ['nullable', 'string', 'max:5000'], 'entries' => ['nullable', 'array'], @@ -29,6 +30,7 @@ public function rules(): array public function attributes(): array { return [ + 'log_date' => '로그 날짜', 'project_id' => '프로젝트', 'summary' => '요약', 'entries' => '항목', diff --git a/app/Services/ProjectManagement/DailyLogService.php b/app/Services/ProjectManagement/DailyLogService.php index ae84abd2..66ea27c1 100644 --- a/app/Services/ProjectManagement/DailyLogService.php +++ b/app/Services/ProjectManagement/DailyLogService.php @@ -130,6 +130,7 @@ public function updateDailyLog(int $id, array $data): AdminPmDailyLog $log = AdminPmDailyLog::findOrFail($id); $log->update([ + 'log_date' => $data['log_date'] ?? $log->log_date, 'project_id' => $data['project_id'] ?? $log->project_id, 'summary' => $data['summary'] ?? $log->summary, 'updated_by' => auth()->id(), diff --git a/resources/views/daily-logs/index.blade.php b/resources/views/daily-logs/index.blade.php index 158bb163..41b9c6be 100644 --- a/resources/views/daily-logs/index.blade.php +++ b/resources/views/daily-logs/index.blade.php @@ -201,6 +201,13 @@ function nl2br(text) { return escapeHtml(text).replace(/\n/g, '
'); } + // ISO 날짜를 YYYY-MM-DD 형식으로 변환 + function formatDateForInput(dateString) { + if (!dateString) return ''; + // ISO 형식 또는 일반 날짜 문자열에서 YYYY-MM-DD 추출 + return dateString.substring(0, 10); + } + // 폼 제출 시 HTMX 이벤트 트리거 document.getElementById('filterForm').addEventListener('submit', function(e) { e.preventDefault(); @@ -245,7 +252,7 @@ function editLog(id) { if (data.success) { document.getElementById('modalTitle').textContent = '일일 로그 수정'; document.getElementById('logId').value = data.data.id; - document.getElementById('logDate').value = data.data.log_date; + document.getElementById('logDate').value = formatDateForInput(data.data.log_date); document.getElementById('projectId').value = data.data.project_id || ''; document.getElementById('summary').value = data.data.summary || ''; diff --git a/resources/views/daily-logs/partials/modal-form.blade.php b/resources/views/daily-logs/partials/modal-form.blade.php index 674e6074..b3daad42 100644 --- a/resources/views/daily-logs/partials/modal-form.blade.php +++ b/resources/views/daily-logs/partials/modal-form.blade.php @@ -47,7 +47,7 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none foc @@ -91,4 +91,4 @@ class="px-4 py-2 text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition" - \ No newline at end of file +