feat(daily-logs, pm): 스크럼 UI/UX 개선
Daily Logs 페이지: - 미완료 항목 상태 변경 시 카드 유지 (done만 제거) - 카드 정렬을 날짜 오래된 순으로 변경 - 요약 내용 nl2br 적용 및 접힘 시 2줄 제한 - 아코디언 항목 담당자별 그룹핑으로 통합 Project Management 페이지: - 오늘의 활동을 칸반(3열) → 담당자 카드 스타일로 변경 - 완료 항목도 함께 표시 (취소선, 초록 배지) - 미완료/완료 건수 헤더에 표시
This commit is contained in:
@@ -24,6 +24,7 @@ public function index(): View
|
||||
$projects = $this->projectService->getActiveProjects();
|
||||
$stats = $this->dailyLogService->getStats($tenantId);
|
||||
$weeklyTimeline = $this->dailyLogService->getWeeklyTimeline($tenantId);
|
||||
$pendingEntries = $this->dailyLogService->getPendingEntries($tenantId);
|
||||
$assigneeTypes = AdminPmDailyLogEntry::getAssigneeTypes();
|
||||
$entryStatuses = AdminPmDailyLogEntry::getStatuses();
|
||||
$assignees = $this->dailyLogService->getAssigneeList($tenantId);
|
||||
@@ -32,6 +33,7 @@ public function index(): View
|
||||
'projects',
|
||||
'stats',
|
||||
'weeklyTimeline',
|
||||
'pendingEntries',
|
||||
'assigneeTypes',
|
||||
'entryStatuses',
|
||||
'assignees'
|
||||
|
||||
@@ -441,4 +441,55 @@ public function getAssigneeList(int $tenantId): array
|
||||
'teams' => $teams,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 미완료 항목(예정, 진행중) 조회 - 담당자별 그룹핑, 날짜 오래된 순 정렬
|
||||
*/
|
||||
public function getPendingEntries(int $tenantId, ?int $projectId = null, int $limit = 100): array
|
||||
{
|
||||
$query = AdminPmDailyLogEntry::query()
|
||||
->select('admin_pm_daily_log_entries.*')
|
||||
->with(['dailyLog:id,log_date,project_id', 'dailyLog.project:id,name'])
|
||||
->join('admin_pm_daily_logs', 'admin_pm_daily_log_entries.daily_log_id', '=', 'admin_pm_daily_logs.id')
|
||||
->where('admin_pm_daily_logs.tenant_id', $tenantId)
|
||||
->when($projectId, fn ($q) => $q->where('admin_pm_daily_logs.project_id', $projectId))
|
||||
->whereIn('admin_pm_daily_log_entries.status', ['todo', 'in_progress'])
|
||||
->orderBy('admin_pm_daily_logs.log_date', 'asc') // 날짜 오래된 순
|
||||
->orderBy('admin_pm_daily_log_entries.id', 'asc')
|
||||
->limit($limit);
|
||||
|
||||
$entries = $query->get();
|
||||
|
||||
// 담당자별로 그룹핑
|
||||
$grouped = $entries->groupBy('assignee_name')->map(function ($items, $assigneeName) {
|
||||
$todoItems = $items->where('status', 'todo');
|
||||
$inProgressItems = $items->where('status', 'in_progress');
|
||||
|
||||
// 항목들을 날짜 오래된 순으로 정렬
|
||||
$sortedEntries = $items->sortBy(fn ($e) => $e->dailyLog?->log_date)->values();
|
||||
|
||||
return [
|
||||
'assignee_name' => $assigneeName,
|
||||
'total_count' => $items->count(),
|
||||
'todo_count' => $todoItems->count(),
|
||||
'in_progress_count' => $inProgressItems->count(),
|
||||
'oldest_date' => $sortedEntries->first()?->dailyLog?->log_date, // 카드 정렬용
|
||||
'entries' => $sortedEntries->map(function ($entry) {
|
||||
return [
|
||||
'id' => $entry->id,
|
||||
'daily_log_id' => $entry->daily_log_id,
|
||||
'log_date' => $entry->dailyLog?->log_date,
|
||||
'project_name' => $entry->dailyLog?->project?->name,
|
||||
'content' => $entry->content,
|
||||
'status' => $entry->status,
|
||||
];
|
||||
})->values()->toArray(),
|
||||
];
|
||||
});
|
||||
|
||||
// 담당자 카드도 가장 오래된 항목 날짜 기준으로 정렬
|
||||
$sorted = $grouped->sortBy('oldest_date')->values()->toArray();
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition"
|
||||
@foreach($weeklyTimeline as $index => $day)
|
||||
<div class="relative group">
|
||||
<button type="button"
|
||||
onclick="{{ $day['log'] ? 'scrollToTableRow(' . $day['log']['id'] . ')' : 'openCreateModalWithDate(\'' . $day['date'] . '\')' }}"
|
||||
onclick="{{ $day['log'] ? 'scrollToCard(' . $day['log']['id'] . ')' : 'openCreateModalWithDate(\'' . $day['date'] . '\')' }}"
|
||||
data-log-id="{{ $day['log']['id'] ?? '' }}"
|
||||
data-date="{{ $day['date'] }}"
|
||||
class="day-card w-full text-left p-3 rounded-lg border-2 transition-all hover:shadow-md
|
||||
@@ -110,6 +110,92 @@ class="day-card w-full text-left p-3 rounded-lg border-2 transition-all hover:sh
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 미완료 항목 (예정/진행중) - 담당자별 그룹핑 -->
|
||||
@if(count($pendingEntries) > 0)
|
||||
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="text-sm font-medium text-gray-500 flex items-center gap-2">
|
||||
<svg class="w-4 h-4 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
|
||||
</svg>
|
||||
미완료 항목
|
||||
</h2>
|
||||
@php $totalPending = collect($pendingEntries)->sum('total_count'); @endphp
|
||||
<span class="text-xs text-gray-400">{{ count($pendingEntries) }}명 / {{ $totalPending }}건</span>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-4" id="pendingEntriesGrid">
|
||||
@foreach($pendingEntries as $group)
|
||||
@php
|
||||
$entriesJson = collect($group['entries'])->map(fn($e) => [
|
||||
'id' => $e['id'],
|
||||
'content' => $e['content'],
|
||||
'status' => $e['status'],
|
||||
'daily_log_id' => $e['daily_log_id'] ?? null,
|
||||
])->toJson();
|
||||
@endphp
|
||||
<div class="pending-assignee-card bg-white rounded-lg p-3 border border-gray-200 hover:border-blue-300 transition-all shrink-0"
|
||||
style="width: 300px;"
|
||||
data-assignee="{{ $group['assignee_name'] }}">
|
||||
<!-- 담당자 이름 + 수정 버튼 -->
|
||||
<div class="flex items-center justify-between mb-2 pb-2 border-b border-gray-100">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-sm font-semibold text-gray-900">{{ $group['assignee_name'] }}</span>
|
||||
<span class="text-xs text-gray-400">({{ $group['total_count'] }})</span>
|
||||
</div>
|
||||
<button onclick='openPendingEditModal({!! htmlspecialchars($entriesJson, ENT_QUOTES) !!}, "{{ addslashes($group['assignee_name']) }}")'
|
||||
class="p-1 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded transition-colors" title="수정">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 항목 목록 -->
|
||||
<div class="space-y-1.5">
|
||||
@foreach($group['entries'] as $entry)
|
||||
<div class="group" data-entry-id="{{ $entry['id'] }}">
|
||||
<div class="flex items-center gap-2">
|
||||
<!-- 상태 + 날짜 -->
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded shrink-0 {{ $entry['status'] === 'in_progress' ? 'bg-yellow-100 text-yellow-700' : 'bg-gray-100 text-gray-600' }}">
|
||||
{{ $entry['status'] === 'in_progress' ? '진행' : '예정' }}
|
||||
</span>
|
||||
<span class="text-[10px] text-gray-400 shrink-0">{{ \Carbon\Carbon::parse($entry['log_date'])->format('m/d') }}</span>
|
||||
<!-- 내용 (클릭하면 펼침) -->
|
||||
<span class="pending-entry-text flex-1 text-sm text-gray-700 truncate cursor-pointer hover:text-blue-600"
|
||||
onclick="togglePendingEntry(this)"
|
||||
title="{{ $entry['content'] }}">{{ $entry['content'] }}</span>
|
||||
<!-- 상태변경 버튼 -->
|
||||
<div class="flex gap-0.5 opacity-30 group-hover:opacity-100 transition-opacity shrink-0">
|
||||
@if($entry['status'] !== 'todo')
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus({{ $entry['id'] }}, 'todo')"
|
||||
class="p-0.5 text-gray-400 hover:bg-gray-100 rounded" title="예정">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
@endif
|
||||
@if($entry['status'] !== 'in_progress')
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus({{ $entry['id'] }}, 'in_progress')"
|
||||
class="p-0.5 text-yellow-500 hover:bg-yellow-50 rounded" title="진행중">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/></svg>
|
||||
</button>
|
||||
@endif
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus({{ $entry['id'] }}, 'done')"
|
||||
class="p-0.5 text-green-500 hover:bg-green-50 rounded" title="완료">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 펼쳐지는 전체 내용 (전체 너비) -->
|
||||
<div class="pending-entry-full hidden mt-1.5 text-sm text-gray-600 bg-gray-50 rounded p-2 whitespace-pre-wrap">{{ $entry['content'] }}</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- 필터 영역 -->
|
||||
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
|
||||
<form id="filterForm" class="flex gap-4 flex-wrap">
|
||||
@@ -180,6 +266,65 @@ class="bg-white rounded-lg shadow-sm overflow-hidden">
|
||||
'entryStatuses' => $entryStatuses,
|
||||
'assignees' => $assignees
|
||||
])
|
||||
|
||||
<!-- 미완료 항목 수정 모달 -->
|
||||
<div id="pendingEditModal" class="fixed inset-0 z-50 hidden overflow-y-auto" aria-labelledby="pending-edit-modal-title" role="dialog" aria-modal="true">
|
||||
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
||||
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" onclick="closePendingEditModal()"></div>
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen">​</span>
|
||||
<div class="inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full sm:p-6">
|
||||
<div>
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h3 class="text-lg font-medium text-gray-900 flex items-center gap-2" id="pending-edit-modal-title">
|
||||
<svg class="w-5 h-5 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||
</svg>
|
||||
<span>미완료 항목 수정</span>
|
||||
</h3>
|
||||
<button type="button" onclick="closePendingEditModal()" class="text-gray-400 hover:text-gray-500">
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 p-3 bg-gray-50 rounded-lg">
|
||||
<span class="text-xs text-gray-500">담당자</span>
|
||||
<p id="pendingEditAssigneeName" class="font-medium text-gray-900"></p>
|
||||
</div>
|
||||
|
||||
<form id="pendingEditForm" onsubmit="submitPendingEditEntries(event)">
|
||||
<!-- 업무 항목 목록 -->
|
||||
<div class="mb-4">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<label class="block text-sm font-medium text-gray-700">업무 내용</label>
|
||||
<button type="button" onclick="addPendingEntryRow()" class="text-xs text-indigo-600 hover:text-indigo-800 flex items-center gap-1">
|
||||
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
항목 추가
|
||||
</button>
|
||||
</div>
|
||||
<div id="pendingEditEntriesContainer" class="space-y-2">
|
||||
<!-- 동적으로 항목 행들이 추가됨 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-3 pt-4 border-t border-gray-200">
|
||||
<button type="button" onclick="closePendingEditModal()"
|
||||
class="flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
|
||||
취소
|
||||
</button>
|
||||
<button type="submit" id="pendingEditSubmitBtn"
|
||||
class="flex-1 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 disabled:opacity-50">
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@@ -711,5 +856,334 @@ function openQuickAddTableEntry(logId) {
|
||||
tableOpenAccordionId = null;
|
||||
}
|
||||
});
|
||||
|
||||
// ========================================
|
||||
// 미완료 항목 펼치기/접기
|
||||
// ========================================
|
||||
function togglePendingEntry(textEl) {
|
||||
const entryDiv = textEl.closest('[data-entry-id]');
|
||||
const fullDiv = entryDiv.querySelector('.pending-entry-full');
|
||||
|
||||
if (fullDiv.classList.contains('hidden')) {
|
||||
// 펼치기 - 타이틀은 truncate 유지, 전체 내용 표시
|
||||
fullDiv.classList.remove('hidden');
|
||||
textEl.classList.add('text-blue-600');
|
||||
} else {
|
||||
// 접기
|
||||
fullDiv.classList.add('hidden');
|
||||
textEl.classList.remove('text-blue-600');
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// 미완료 항목 상태 업데이트
|
||||
// ========================================
|
||||
function updatePendingStatus(entryId, status) {
|
||||
fetch(`/api/admin/daily-logs/entries/${entryId}/status`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
body: JSON.stringify({ status })
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
const item = document.querySelector(`[data-entry-id="${entryId}"]`);
|
||||
if (item) {
|
||||
if (status === 'done') {
|
||||
// 완료 처리: 항목 제거 애니메이션
|
||||
const parentCard = item.closest('.pending-assignee-card');
|
||||
item.style.transition = 'opacity 0.3s, transform 0.3s';
|
||||
item.style.opacity = '0';
|
||||
item.style.transform = 'scale(0.95)';
|
||||
setTimeout(() => {
|
||||
item.remove();
|
||||
// 담당자 카드에 항목이 없으면 카드도 제거
|
||||
if (parentCard && parentCard.querySelectorAll('[data-entry-id]').length === 0) {
|
||||
parentCard.style.transition = 'opacity 0.3s, transform 0.3s';
|
||||
parentCard.style.opacity = '0';
|
||||
parentCard.style.transform = 'scale(0.95)';
|
||||
setTimeout(() => {
|
||||
parentCard.remove();
|
||||
// 전체 섹션 체크
|
||||
const grid = document.getElementById('pendingEntriesGrid');
|
||||
if (grid && grid.children.length === 0) {
|
||||
grid.closest('.bg-white')?.remove();
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
// 예정/진행중 변경: 상태 뱃지만 업데이트
|
||||
const badge = item.querySelector('span.px-1\\.5');
|
||||
if (badge) {
|
||||
if (status === 'in_progress') {
|
||||
badge.className = 'px-1.5 py-0.5 text-[10px] rounded shrink-0 bg-yellow-100 text-yellow-700';
|
||||
badge.textContent = '진행';
|
||||
} else {
|
||||
badge.className = 'px-1.5 py-0.5 text-[10px] rounded shrink-0 bg-gray-100 text-gray-600';
|
||||
badge.textContent = '예정';
|
||||
}
|
||||
}
|
||||
// 상태변경 버튼들도 업데이트
|
||||
updatePendingEntryButtons(item, entryId, status);
|
||||
}
|
||||
}
|
||||
// 로그 리스트도 새로고침
|
||||
htmx.trigger('#log-table', 'filterSubmit');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 미완료 항목 버튼 업데이트
|
||||
function updatePendingEntryButtons(item, entryId, currentStatus) {
|
||||
const buttonsDiv = item.querySelector('.flex.gap-0\\.5');
|
||||
if (!buttonsDiv) return;
|
||||
|
||||
let buttonsHtml = '';
|
||||
|
||||
if (currentStatus !== 'todo') {
|
||||
buttonsHtml += `
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus(${entryId}, 'todo')"
|
||||
class="p-0.5 text-gray-400 hover:bg-gray-100 rounded" title="예정">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
if (currentStatus !== 'in_progress') {
|
||||
buttonsHtml += `
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus(${entryId}, 'in_progress')"
|
||||
class="p-0.5 text-yellow-500 hover:bg-yellow-50 rounded" title="진행중">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/></svg>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
buttonsHtml += `
|
||||
<button onclick="event.stopPropagation(); updatePendingStatus(${entryId}, 'done')"
|
||||
class="p-0.5 text-green-500 hover:bg-green-50 rounded" title="완료">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
</button>
|
||||
`;
|
||||
|
||||
buttonsDiv.innerHTML = buttonsHtml;
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// 미완료 항목 수정 모달 관련 함수
|
||||
// ========================================
|
||||
let pendingEditEntries = [];
|
||||
let pendingEditAssigneeName = '';
|
||||
|
||||
// 모달 열기
|
||||
function openPendingEditModal(entriesJson, assigneeName) {
|
||||
pendingEditEntries = entriesJson;
|
||||
pendingEditAssigneeName = assigneeName;
|
||||
|
||||
document.getElementById('pendingEditAssigneeName').textContent = assigneeName;
|
||||
|
||||
// 컨테이너 초기화 및 항목 추가
|
||||
const container = document.getElementById('pendingEditEntriesContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
entriesJson.forEach((entry, index) => {
|
||||
addPendingEntryRow(entry, index);
|
||||
});
|
||||
|
||||
document.getElementById('pendingEditModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 모달 닫기
|
||||
function closePendingEditModal() {
|
||||
document.getElementById('pendingEditModal').classList.add('hidden');
|
||||
pendingEditEntries = [];
|
||||
pendingEditAssigneeName = '';
|
||||
}
|
||||
|
||||
// 항목 행 추가
|
||||
function addPendingEntryRow(entry = null, index = null) {
|
||||
const container = document.getElementById('pendingEditEntriesContainer');
|
||||
if (index === null) {
|
||||
index = container.children.length;
|
||||
}
|
||||
|
||||
const currentStatus = entry?.status || 'todo';
|
||||
|
||||
const html = `
|
||||
<div class="pending-edit-row flex gap-2 items-start p-2 bg-gray-50 rounded-lg" data-entry-id="${entry?.id || ''}" data-index="${index}">
|
||||
<!-- 상태 버튼 그룹 -->
|
||||
<div class="flex gap-1 shrink-0 pt-1">
|
||||
<button type="button" onclick="togglePendingStatus(this, 'todo')"
|
||||
class="status-btn p-1.5 rounded transition-all ${currentStatus === 'todo' ? 'bg-gray-200 ring-2 ring-gray-400' : 'hover:bg-gray-100'}"
|
||||
data-status="todo" title="예정">
|
||||
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
<button type="button" onclick="togglePendingStatus(this, 'in_progress')"
|
||||
class="status-btn p-1.5 rounded transition-all ${currentStatus === 'in_progress' ? 'bg-yellow-100 ring-2 ring-yellow-400' : 'hover:bg-yellow-50'}"
|
||||
data-status="in_progress" title="진행중">
|
||||
<svg class="w-4 h-4 text-yellow-500" fill="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/></svg>
|
||||
</button>
|
||||
<button type="button" onclick="togglePendingStatus(this, 'done')"
|
||||
class="status-btn p-1.5 rounded transition-all ${currentStatus === 'done' ? 'bg-green-100 ring-2 ring-green-400' : 'hover:bg-green-50'}"
|
||||
data-status="done" title="완료">
|
||||
<svg class="w-4 h-4 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" name="pending_entries[${index}][status]" value="${currentStatus}">
|
||||
<div class="flex-1">
|
||||
<textarea name="pending_entries[${index}][content]" rows="2" required
|
||||
class="w-full px-3 py-1.5 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 resize-none"
|
||||
placeholder="업무 내용">${escapeHtml(entry?.content || '')}</textarea>
|
||||
</div>
|
||||
<input type="hidden" name="pending_entries[${index}][id]" value="${entry?.id || ''}">
|
||||
<input type="hidden" name="pending_entries[${index}][daily_log_id]" value="${entry?.daily_log_id || ''}">
|
||||
<button type="button" onclick="removePendingEntryRow(this)" class="p-1.5 text-red-500 hover:bg-red-50 rounded shrink-0 pt-1" title="삭제">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
|
||||
// 상태 버튼 토글
|
||||
function togglePendingStatus(btn, status) {
|
||||
const row = btn.closest('.pending-edit-row');
|
||||
const statusInput = row.querySelector('input[name*="[status]"]');
|
||||
const buttons = row.querySelectorAll('.status-btn');
|
||||
|
||||
// 모든 버튼 스타일 초기화
|
||||
buttons.forEach(b => {
|
||||
b.classList.remove('bg-gray-200', 'ring-2', 'ring-gray-400', 'bg-yellow-100', 'ring-yellow-400', 'bg-green-100', 'ring-green-400');
|
||||
});
|
||||
|
||||
// 선택된 버튼 스타일 적용
|
||||
if (status === 'todo') {
|
||||
btn.classList.add('bg-gray-200', 'ring-2', 'ring-gray-400');
|
||||
} else if (status === 'in_progress') {
|
||||
btn.classList.add('bg-yellow-100', 'ring-2', 'ring-yellow-400');
|
||||
} else if (status === 'done') {
|
||||
btn.classList.add('bg-green-100', 'ring-2', 'ring-green-400');
|
||||
}
|
||||
|
||||
// hidden input 값 업데이트
|
||||
statusInput.value = status;
|
||||
}
|
||||
|
||||
// 항목 행 삭제
|
||||
function removePendingEntryRow(btn) {
|
||||
const row = btn.closest('.pending-edit-row');
|
||||
row.remove();
|
||||
reindexPendingEntryRows();
|
||||
}
|
||||
|
||||
// 인덱스 재정렬
|
||||
function reindexPendingEntryRows() {
|
||||
const rows = document.querySelectorAll('.pending-edit-row');
|
||||
rows.forEach((row, index) => {
|
||||
row.dataset.index = index;
|
||||
row.querySelectorAll('[name^="pending_entries["]').forEach(input => {
|
||||
input.name = input.name.replace(/pending_entries\[\d+\]/, `pending_entries[${index}]`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 폼 제출
|
||||
function submitPendingEditEntries(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const submitBtn = document.getElementById('pendingEditSubmitBtn');
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.textContent = '저장 중...';
|
||||
|
||||
const rows = document.querySelectorAll('.pending-edit-row');
|
||||
const updatePromises = [];
|
||||
const deletePromises = [];
|
||||
|
||||
// 기존 항목 ID 수집
|
||||
const currentIds = Array.from(rows).map(row => row.dataset.entryId).filter(id => id);
|
||||
const originalIds = pendingEditEntries.map(e => String(e.id));
|
||||
|
||||
// 삭제할 항목
|
||||
const deletedIds = originalIds.filter(id => !currentIds.includes(id));
|
||||
deletedIds.forEach(id => {
|
||||
deletePromises.push(
|
||||
fetch(`/api/admin/daily-logs/entries/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' }
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// 수정/추가할 항목
|
||||
rows.forEach(row => {
|
||||
const entryId = row.dataset.entryId;
|
||||
const status = row.querySelector('input[name*="[status]"]').value;
|
||||
const content = row.querySelector('textarea').value;
|
||||
const dailyLogId = row.querySelector('input[name*="[daily_log_id]"]').value;
|
||||
|
||||
if (!content.trim()) return;
|
||||
|
||||
if (entryId) {
|
||||
// 기존 항목 수정
|
||||
updatePromises.push(
|
||||
fetch(`/api/admin/daily-logs/entries/${entryId}`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
body: JSON.stringify({ content, status })
|
||||
})
|
||||
);
|
||||
} else if (dailyLogId) {
|
||||
// 새 항목 추가
|
||||
updatePromises.push(
|
||||
fetch(`/api/admin/daily-logs/${dailyLogId}/entries`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
assignee_type: 'user',
|
||||
assignee_name: pendingEditAssigneeName,
|
||||
content,
|
||||
status
|
||||
})
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Promise.all([...deletePromises, ...updatePromises])
|
||||
.then(() => {
|
||||
closePendingEditModal();
|
||||
// 페이지 새로고침으로 미완료 항목 갱신
|
||||
location.reload();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
alert('저장 중 오류가 발생했습니다.');
|
||||
})
|
||||
.finally(() => {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = '저장';
|
||||
});
|
||||
}
|
||||
|
||||
// ESC 키로 모달 닫기
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
if (!document.getElementById('pendingEditModal').classList.contains('hidden')) {
|
||||
closePendingEditModal();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,125 +1,136 @@
|
||||
<!-- 일일 로그 테이블 -->
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">날짜</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">프로젝트</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">요약</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">항목</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">작성자</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">상태</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">액션</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@forelse($logs as $log)
|
||||
<!-- 메인 행 (클릭 가능) -->
|
||||
<tr class="log-row cursor-pointer hover:bg-gray-50 {{ $log->trashed() ? 'bg-red-50' : '' }}"
|
||||
data-log-id="{{ $log->id }}"
|
||||
onclick="toggleTableAccordion({{ $log->id }}, event)">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<svg class="accordion-chevron w-4 h-4 mr-2 text-gray-400 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||
</svg>
|
||||
<div>
|
||||
<div class="text-sm font-medium text-gray-900">
|
||||
{{ $log->log_date->format('Y-m-d') }}
|
||||
</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
{{ $log->log_date->format('l') }}
|
||||
<!-- 일일 로그 카드 리스트 -->
|
||||
<div class="space-y-3 p-4">
|
||||
@forelse($logs as $log)
|
||||
<!-- 로그 카드 -->
|
||||
<div class="log-card bg-white border rounded-lg overflow-hidden {{ $log->trashed() ? 'border-red-300 bg-red-50' : 'border-gray-200 hover:border-blue-300' }} transition-all"
|
||||
data-log-id="{{ $log->id }}">
|
||||
<!-- 카드 헤더 (클릭 가능) -->
|
||||
<div class="card-header cursor-pointer p-4" onclick="toggleCardAccordion({{ $log->id }}, event)">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<!-- 좌측: 날짜 + 요약 -->
|
||||
<div class="flex items-start gap-4 flex-1 min-w-0">
|
||||
<!-- 날짜 영역 -->
|
||||
<div class="flex-shrink-0 text-center">
|
||||
<div class="flex items-center gap-2">
|
||||
<svg class="accordion-chevron w-4 h-4 text-gray-400 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
|
||||
</svg>
|
||||
<div>
|
||||
<div class="text-lg font-bold text-gray-900">
|
||||
{{ $log->log_date->format('m/d') }}
|
||||
</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
{{ $log->log_date->format('D') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
@if($log->project)
|
||||
<span class="px-2 py-1 text-xs font-medium rounded-full bg-blue-100 text-blue-800">
|
||||
{{ $log->project->name }}
|
||||
</span>
|
||||
@else
|
||||
<span class="text-gray-400">전체</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
@if($log->summary)
|
||||
<div class="text-sm text-gray-900 truncate max-w-xs" title="{{ $log->summary }}">
|
||||
{{ Str::limit($log->summary, 50) }}
|
||||
</div>
|
||||
@else
|
||||
<span class="text-gray-400">-</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="text-sm text-gray-900">{{ $log->entries_count }}개</span>
|
||||
@if($log->entries->count() > 0)
|
||||
<div class="flex space-x-1">
|
||||
@php
|
||||
$stats = $log->entry_stats;
|
||||
@endphp
|
||||
@if($stats['todo'] > 0)
|
||||
<span class="w-2 h-2 rounded-full bg-gray-400" title="예정: {{ $stats['todo'] }}"></span>
|
||||
@endif
|
||||
@if($stats['in_progress'] > 0)
|
||||
<span class="w-2 h-2 rounded-full bg-yellow-400" title="진행중: {{ $stats['in_progress'] }}"></span>
|
||||
@endif
|
||||
@if($stats['done'] > 0)
|
||||
<span class="w-2 h-2 rounded-full bg-green-400" title="완료: {{ $stats['done'] }}"></span>
|
||||
|
||||
<!-- 요약 + 프로젝트 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
@if($log->project)
|
||||
<span class="px-2 py-0.5 text-xs font-medium rounded-full bg-blue-100 text-blue-800 flex-shrink-0">
|
||||
{{ $log->project->name }}
|
||||
</span>
|
||||
@endif
|
||||
@if($log->trashed())
|
||||
<span class="px-2 py-0.5 text-xs font-semibold rounded-full bg-red-100 text-red-800 flex-shrink-0">
|
||||
삭제됨
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@if($log->summary)
|
||||
<p class="text-sm text-gray-700 line-clamp-2" title="{{ $log->summary }}">
|
||||
{!! nl2br(e($log->summary)) !!}
|
||||
</p>
|
||||
@else
|
||||
<p class="text-sm text-gray-400">요약 없음</p>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $log->creator?->name ?? '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
@if($log->trashed())
|
||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">
|
||||
삭제됨
|
||||
</span>
|
||||
@else
|
||||
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
|
||||
활성
|
||||
</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-2" onclick="event.stopPropagation()">
|
||||
@if($log->trashed())
|
||||
<!-- 삭제된 항목 -->
|
||||
<button onclick="confirmRestore({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="text-green-600 hover:text-green-900">복원</button>
|
||||
@if(auth()->user()?->is_super_admin)
|
||||
<button onclick="confirmForceDelete({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="text-red-600 hover:text-red-900">영구삭제</button>
|
||||
@endif
|
||||
@else
|
||||
<!-- 일반 항목 액션 -->
|
||||
<button onclick="editLog({{ $log->id }})"
|
||||
class="text-indigo-600 hover:text-indigo-900">수정</button>
|
||||
<button onclick="confirmDelete({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="text-red-600 hover:text-red-900">삭제</button>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 아코디언 상세 행 (숨겨진 상태) -->
|
||||
<tr class="accordion-row hidden" data-accordion-for="{{ $log->id }}">
|
||||
<td colspan="7" class="px-6 py-4 bg-gray-50">
|
||||
<div class="accordion-content" id="accordion-content-{{ $log->id }}">
|
||||
<div class="text-center py-4 text-gray-500">로딩 중...</div>
|
||||
|
||||
<!-- 우측: 통계 + 액션 -->
|
||||
<div class="flex items-center gap-4 flex-shrink-0">
|
||||
<!-- 항목 통계 -->
|
||||
<div class="text-right">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-sm font-medium text-gray-700">{{ $log->entries_count }}개</span>
|
||||
@if($log->entries->count() > 0)
|
||||
<div class="flex items-center gap-1">
|
||||
@php $stats = $log->entry_stats; @endphp
|
||||
@if($stats['todo'] > 0)
|
||||
<span class="flex items-center gap-0.5 text-xs text-gray-500">
|
||||
<span class="w-2 h-2 rounded-full bg-gray-400"></span>{{ $stats['todo'] }}
|
||||
</span>
|
||||
@endif
|
||||
@if($stats['in_progress'] > 0)
|
||||
<span class="flex items-center gap-0.5 text-xs text-yellow-600">
|
||||
<span class="w-2 h-2 rounded-full bg-yellow-400"></span>{{ $stats['in_progress'] }}
|
||||
</span>
|
||||
@endif
|
||||
@if($stats['done'] > 0)
|
||||
<span class="flex items-center gap-0.5 text-xs text-green-600">
|
||||
<span class="w-2 h-2 rounded-full bg-green-400"></span>{{ $stats['done'] }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="text-xs text-gray-400 mt-0.5">
|
||||
{{ $log->creator?->name ?? '-' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 액션 버튼 -->
|
||||
<div class="flex items-center gap-1" onclick="event.stopPropagation()">
|
||||
@if($log->trashed())
|
||||
<button onclick="confirmRestore({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="p-2 text-green-600 hover:bg-green-50 rounded-lg transition" title="복원">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
||||
</svg>
|
||||
</button>
|
||||
@if(auth()->user()?->is_super_admin)
|
||||
<button onclick="confirmForceDelete({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="p-2 text-red-600 hover:bg-red-50 rounded-lg transition" title="영구삭제">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
</button>
|
||||
@endif
|
||||
@else
|
||||
<button onclick="editLog({{ $log->id }})"
|
||||
class="p-2 text-indigo-600 hover:bg-indigo-50 rounded-lg transition" title="수정">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button onclick="confirmDelete({{ $log->id }}, '{{ $log->log_date->format('Y-m-d') }}')"
|
||||
class="p-2 text-red-600 hover:bg-red-50 rounded-lg transition" title="삭제">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
||||
</svg>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="7" class="px-6 py-12 text-center text-gray-500">
|
||||
일일 로그가 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 아코디언 상세 내용 (숨겨진 상태) -->
|
||||
<div class="card-accordion hidden border-t border-gray-200 bg-gray-50" data-accordion-for="{{ $log->id }}">
|
||||
<div class="accordion-content p-4" id="card-accordion-content-{{ $log->id }}">
|
||||
<div class="text-center py-4 text-gray-500">로딩 중...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="text-center py-12 text-gray-500">
|
||||
일일 로그가 없습니다.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<!-- 페이지네이션 -->
|
||||
@if($logs->hasPages())
|
||||
@@ -127,3 +138,254 @@ class="text-red-600 hover:text-red-900">삭제</button>
|
||||
{{ $logs->withQueryString()->links() }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<script>
|
||||
// 카드 아코디언 기능
|
||||
let cardOpenAccordionId = null;
|
||||
|
||||
function toggleCardAccordion(logId, event) {
|
||||
// 클릭한 요소가 버튼이면 무시
|
||||
if (event.target.closest('button') || event.target.closest('a')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const card = document.querySelector(`.log-card[data-log-id="${logId}"]`);
|
||||
const accordion = card.querySelector('.card-accordion');
|
||||
const chevron = card.querySelector('.accordion-chevron');
|
||||
|
||||
// 같은 카드를 다시 클릭하면 닫기
|
||||
if (cardOpenAccordionId === logId) {
|
||||
accordion.classList.add('hidden');
|
||||
chevron.classList.remove('rotate-90');
|
||||
card.classList.remove('ring-2', 'ring-blue-500');
|
||||
cardOpenAccordionId = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// 다른 열린 아코디언 닫기
|
||||
if (cardOpenAccordionId !== null) {
|
||||
const prevCard = document.querySelector(`.log-card[data-log-id="${cardOpenAccordionId}"]`);
|
||||
if (prevCard) {
|
||||
prevCard.querySelector('.card-accordion')?.classList.add('hidden');
|
||||
prevCard.querySelector('.accordion-chevron')?.classList.remove('rotate-90');
|
||||
prevCard.classList.remove('ring-2', 'ring-blue-500');
|
||||
}
|
||||
}
|
||||
|
||||
// 현재 아코디언 열기
|
||||
accordion.classList.remove('hidden');
|
||||
chevron.classList.add('rotate-90');
|
||||
card.classList.add('ring-2', 'ring-blue-500');
|
||||
cardOpenAccordionId = logId;
|
||||
|
||||
// 데이터 로드
|
||||
loadCardAccordionContent(logId);
|
||||
}
|
||||
|
||||
function loadCardAccordionContent(logId) {
|
||||
const contentDiv = document.getElementById(`card-accordion-content-${logId}`);
|
||||
contentDiv.innerHTML = '<div class="text-center py-4 text-gray-500">로딩 중...</div>';
|
||||
|
||||
fetch(`/api/admin/daily-logs/${logId}`, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
renderCardAccordionContent(logId, data.data);
|
||||
} else {
|
||||
contentDiv.innerHTML = '<div class="text-center py-4 text-red-500">데이터 로드 실패</div>';
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
contentDiv.innerHTML = '<div class="text-center py-4 text-red-500">데이터 로드 실패</div>';
|
||||
});
|
||||
}
|
||||
|
||||
function renderCardAccordionContent(logId, log) {
|
||||
const contentDiv = document.getElementById(`card-accordion-content-${logId}`);
|
||||
|
||||
const statusColors = {
|
||||
'todo': 'bg-gray-100 text-gray-700',
|
||||
'in_progress': 'bg-yellow-100 text-yellow-700',
|
||||
'done': 'bg-green-100 text-green-700'
|
||||
};
|
||||
const statusLabels = {
|
||||
'todo': '예정',
|
||||
'in_progress': '진행중',
|
||||
'done': '완료'
|
||||
};
|
||||
|
||||
// HTML 이스케이프 헬퍼
|
||||
function escapeHtml(text) {
|
||||
if (!text) return '';
|
||||
const div = document.createElement('div');
|
||||
div.textContent = text;
|
||||
return div.innerHTML;
|
||||
}
|
||||
function nl2br(text) {
|
||||
if (!text) return '';
|
||||
return escapeHtml(text).replace(/\n/g, '<br>');
|
||||
}
|
||||
|
||||
let entriesHtml = '';
|
||||
if (log.entries && log.entries.length > 0) {
|
||||
// 담당자별로 그룹핑
|
||||
const grouped = {};
|
||||
log.entries.forEach(entry => {
|
||||
const name = entry.assignee_name || '미지정';
|
||||
if (!grouped[name]) {
|
||||
grouped[name] = [];
|
||||
}
|
||||
grouped[name].push(entry);
|
||||
});
|
||||
|
||||
// 담당자별 카드 생성
|
||||
entriesHtml = Object.entries(grouped).map(([assigneeName, entries]) => `
|
||||
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
||||
<!-- 담당자 헤더 -->
|
||||
<div class="px-3 py-2 bg-gray-100 border-b border-gray-200 flex items-center justify-between">
|
||||
<span class="text-sm font-semibold text-gray-900">${escapeHtml(assigneeName)}</span>
|
||||
<span class="text-xs text-gray-500">${entries.length}건</span>
|
||||
</div>
|
||||
<!-- 항목 목록 -->
|
||||
<div class="divide-y divide-gray-100">
|
||||
${entries.map(entry => `
|
||||
<div class="p-3 hover:bg-gray-50" data-entry-id="${entry.id}">
|
||||
<div class="flex items-start gap-2">
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded shrink-0 ${statusColors[entry.status]}">${statusLabels[entry.status]}</span>
|
||||
<div class="flex-1 min-w-0">
|
||||
<p class="text-sm text-gray-700">${nl2br(entry.content)}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-0.5 shrink-0">
|
||||
${entry.status !== 'todo' ? `
|
||||
<button onclick="updateCardEntryStatus(${logId}, ${entry.id}, 'todo')" class="p-1 text-gray-400 hover:bg-gray-100 rounded" title="예정">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>` : ''}
|
||||
${entry.status !== 'in_progress' ? `
|
||||
<button onclick="updateCardEntryStatus(${logId}, ${entry.id}, 'in_progress')" class="p-1 text-yellow-500 hover:bg-yellow-50 rounded" title="진행중">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/></svg>
|
||||
</button>` : ''}
|
||||
${entry.status !== 'done' ? `
|
||||
<button onclick="updateCardEntryStatus(${logId}, ${entry.id}, 'done')" class="p-1 text-green-500 hover:bg-green-50 rounded" title="완료">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
</button>` : ''}
|
||||
<button onclick="deleteCardEntry(${logId}, ${entry.id})" class="p-1 text-red-400 hover:bg-red-50 rounded" title="삭제">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
} else {
|
||||
entriesHtml = '<div class="text-center py-4 text-gray-400">등록된 항목이 없습니다.</div>';
|
||||
}
|
||||
|
||||
// 요약 섹션 (전체 내용)
|
||||
const summaryHtml = log.summary ? `
|
||||
<div class="mb-4 p-3 bg-white rounded-lg border border-gray-200">
|
||||
<div class="text-xs font-medium text-gray-500 mb-1">요약</div>
|
||||
<div class="text-sm text-gray-700">${nl2br(log.summary)}</div>
|
||||
</div>
|
||||
` : '';
|
||||
|
||||
contentDiv.innerHTML = `
|
||||
<div class="space-y-3">
|
||||
${summaryHtml}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||
${entriesHtml}
|
||||
</div>
|
||||
<div class="pt-3 border-t border-gray-200 flex justify-between items-center">
|
||||
<button onclick="openQuickAddCardEntry(${logId})" class="text-sm text-blue-600 hover:text-blue-800 font-medium">
|
||||
+ 항목 추가
|
||||
</button>
|
||||
<button onclick="editLog(${logId})" class="text-sm text-indigo-600 hover:text-indigo-800 font-medium">
|
||||
전체 수정
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
function updateCardEntryStatus(logId, entryId, status) {
|
||||
fetch(`/api/admin/daily-logs/entries/${entryId}/status`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
||||
},
|
||||
body: JSON.stringify({ status })
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
loadCardAccordionContent(logId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteCardEntry(logId, entryId) {
|
||||
if (confirm('이 항목을 삭제하시겠습니까?')) {
|
||||
fetch(`/api/admin/daily-logs/entries/${entryId}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
loadCardAccordionContent(logId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openQuickAddCardEntry(logId) {
|
||||
const content = prompt('업무 내용을 입력하세요:');
|
||||
if (content && content.trim()) {
|
||||
const assigneeName = prompt('담당자 이름을 입력하세요:');
|
||||
if (assigneeName && assigneeName.trim()) {
|
||||
fetch(`/api/admin/daily-logs/${logId}/entries`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
||||
},
|
||||
body: JSON.stringify({
|
||||
assignee_type: 'user',
|
||||
assignee_name: assigneeName.trim(),
|
||||
content: content.trim(),
|
||||
status: 'todo'
|
||||
})
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.success) {
|
||||
loadCardAccordionContent(logId);
|
||||
} else {
|
||||
alert(result.message || '오류가 발생했습니다.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 주간 타임라인에서 카드로 스크롤
|
||||
function scrollToCard(logId) {
|
||||
const card = document.querySelector(`.log-card[data-log-id="${logId}"]`);
|
||||
if (card) {
|
||||
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
setTimeout(() => {
|
||||
const fakeEvent = { target: card };
|
||||
toggleCardAccordion(logId, fakeEvent);
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -20,6 +20,48 @@ class="flex items-center gap-2 px-3 py-2 rounded-lg text-sm text-gray-700 hover:
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- 프로젝트 관리 그룹 -->
|
||||
<li class="pt-4 pb-1 border-t border-gray-200 mt-2">
|
||||
<button onclick="toggleGroup('pm-group')" class="w-full flex items-center justify-between px-3 py-2 text-xs font-bold text-gray-600 uppercase tracking-wider hover:bg-gray-50 rounded">
|
||||
<span>프로젝트 관리</span>
|
||||
<svg id="pm-group-icon" class="w-3 h-3 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
<ul id="pm-group" class="space-y-1 mt-1">
|
||||
<li>
|
||||
<a href="{{ route('pm.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('pm.index') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
|
||||
</svg>
|
||||
<span class="font-medium">프로젝트 대시보드</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('pm.projects.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('pm.projects.*') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
|
||||
</svg>
|
||||
<span class="font-medium">프로젝트</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('daily-logs.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('daily-logs.*') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<span class="font-medium">일일 스크럼</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 시스템 관리 그룹 -->
|
||||
<li class="pt-4 pb-1 border-t border-gray-200 mt-2">
|
||||
<button onclick="toggleGroup('system-group')" class="w-full flex items-center justify-between px-3 py-2 text-xs font-bold text-gray-600 uppercase tracking-wider hover:bg-gray-50 rounded">
|
||||
@@ -271,48 +313,6 @@ class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 프로젝트 관리 그룹 -->
|
||||
<li class="pt-4 pb-1 border-t border-gray-200 mt-2">
|
||||
<button onclick="toggleGroup('pm-group')" class="w-full flex items-center justify-between px-3 py-2 text-xs font-bold text-gray-600 uppercase tracking-wider hover:bg-gray-50 rounded">
|
||||
<span>프로젝트 관리</span>
|
||||
<svg id="pm-group-icon" class="w-3 h-3 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
<ul id="pm-group" class="space-y-1 mt-1">
|
||||
<li>
|
||||
<a href="{{ route('pm.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('pm.index') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
|
||||
</svg>
|
||||
<span class="font-medium">대시보드</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('pm.projects.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('pm.projects.*') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
|
||||
</svg>
|
||||
<span class="font-medium">프로젝트</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('daily-logs.index') }}"
|
||||
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('daily-logs.*') ? 'bg-primary text-white hover:bg-primary' : '' }}"
|
||||
style="padding-left: 2rem;">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<span class="font-medium">일일 스크럼</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- 개발 도구 그룹 -->
|
||||
<li class="pt-4 pb-1 border-t border-gray-200 mt-2">
|
||||
<button onclick="toggleGroup('dev-tools-group')" class="w-full flex items-center justify-between px-3 py-2 text-xs font-bold text-gray-600 uppercase tracking-wider hover:bg-gray-50 rounded">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
|
||||
</svg>
|
||||
프로젝트 관리 대시보드
|
||||
프로젝트 대시보드
|
||||
</h1>
|
||||
<a href="{{ route('pm.projects.create') }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition">
|
||||
+ 새 프로젝트
|
||||
@@ -199,21 +199,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 오늘의 스크럼 (칸반 스타일) -->
|
||||
<!-- 오늘의 스크럼 (담당자별 카드) -->
|
||||
@php
|
||||
$todoEntries = $scrumEntries->where('status', 'todo');
|
||||
$inProgressEntries = $scrumEntries->where('status', 'in_progress');
|
||||
$doneEntries = $scrumEntries->where('status', 'done');
|
||||
$allGrouped = $scrumEntries->groupBy('assignee_name');
|
||||
$pendingCount = $scrumEntries->whereIn('status', ['todo', 'in_progress'])->count();
|
||||
$doneCount = $scrumEntries->where('status', 'done')->count();
|
||||
@endphp
|
||||
<div class="mt-4 pt-4 border-t border-gray-100">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h4 class="text-sm font-medium text-gray-700 flex items-center gap-1">
|
||||
<h4 class="text-sm font-medium text-gray-700 flex items-center gap-2">
|
||||
<svg class="w-4 h-4 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
|
||||
</svg>
|
||||
오늘의 활동
|
||||
@if($scrumEntries->count() > 0)
|
||||
<span class="text-xs text-gray-400 ml-1">({{ $scrumEntries->count() }})</span>
|
||||
@if($pendingCount > 0)
|
||||
<span class="text-xs px-1.5 py-0.5 rounded-full bg-orange-100 text-orange-700">{{ $pendingCount }}</span>
|
||||
@endif
|
||||
@if($doneCount > 0)
|
||||
<span class="text-xs px-1.5 py-0.5 rounded-full bg-green-100 text-green-700">✓{{ $doneCount }}</span>
|
||||
@endif
|
||||
</h4>
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -235,144 +238,81 @@ class="text-xs text-gray-500 hover:text-gray-700">
|
||||
</div>
|
||||
|
||||
@if($scrumEntries->count() > 0)
|
||||
<!-- 칸반 3컬럼 레이아웃 (담당자별 그룹핑) -->
|
||||
<div class="grid grid-cols-3 gap-2">
|
||||
<!-- 예정 컬럼 -->
|
||||
<div class="bg-gray-50 rounded-lg p-2">
|
||||
<div class="flex items-center gap-1 mb-2 pb-1 border-b border-gray-200">
|
||||
<span class="w-2 h-2 bg-gray-400 rounded-full"></span>
|
||||
<span class="text-xs font-medium text-gray-600">예정</span>
|
||||
<span class="text-xs text-gray-400">({{ $todoEntries->count() }})</span>
|
||||
<!-- 담당자별 카드 (가로 스크롤) -->
|
||||
<div class="flex gap-3 overflow-x-auto pb-2 -mx-1 px-1">
|
||||
@foreach($allGrouped as $assigneeName => $groupedEntries)
|
||||
@php
|
||||
$entriesJson = $groupedEntries->map(fn($e) => [
|
||||
'id' => $e->id,
|
||||
'daily_log_id' => $e->daily_log_id,
|
||||
'content' => $e->content,
|
||||
'status' => $e->status
|
||||
])->values()->toJson();
|
||||
$todoCount = $groupedEntries->where('status', 'todo')->count();
|
||||
$inProgressCount = $groupedEntries->where('status', 'in_progress')->count();
|
||||
$assigneeDoneCount = $groupedEntries->where('status', 'done')->count();
|
||||
@endphp
|
||||
<div class="bg-white rounded-lg p-3 border border-gray-200 hover:border-blue-300 transition-all shrink-0" style="width: 280px;">
|
||||
<!-- 담당자 헤더 -->
|
||||
<div class="flex items-center justify-between mb-2 pb-2 border-b border-gray-100 cursor-pointer hover:text-indigo-600"
|
||||
onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>
|
||||
<span class="text-sm font-semibold text-gray-900">{{ $assigneeName }}</span>
|
||||
<div class="flex items-center gap-1">
|
||||
@if($todoCount > 0)
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded bg-gray-100 text-gray-600">{{ $todoCount }}</span>
|
||||
@endif
|
||||
@if($inProgressCount > 0)
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded bg-yellow-100 text-yellow-700">{{ $inProgressCount }}</span>
|
||||
@endif
|
||||
@if($assigneeDoneCount > 0)
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded bg-green-100 text-green-700">✓{{ $assigneeDoneCount }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-2 max-h-40 overflow-y-auto">
|
||||
@forelse($todoEntries->groupBy('assignee_name') as $assigneeName => $groupedEntries)
|
||||
@php
|
||||
$entriesJson = $groupedEntries->map(fn($e) => [
|
||||
'id' => $e->id,
|
||||
'daily_log_id' => $e->daily_log_id,
|
||||
'content' => $e->content,
|
||||
'status' => $e->status
|
||||
])->values()->toJson();
|
||||
@endphp
|
||||
<div class="bg-white rounded p-2 shadow-sm border border-gray-100">
|
||||
<p class="text-xs font-semibold text-gray-700 mb-1.5 pb-1 border-b border-gray-100 cursor-pointer hover:text-indigo-600"
|
||||
onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ $assigneeName }}</p>
|
||||
<div class="space-y-1">
|
||||
@foreach($groupedEntries as $entry)
|
||||
<div class="group flex items-start justify-between gap-1 text-xs py-0.5 hover:bg-gray-50 rounded px-1 -mx-1">
|
||||
<span class="text-gray-600 truncate flex-1 cursor-pointer" onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ Str::limit($entry->content, 25) }}</span>
|
||||
<div class="flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'in_progress')" class="p-0.5 text-blue-400 hover:text-blue-600" title="진행중으로">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8"/></svg>
|
||||
</button>
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'done')" class="p-0.5 text-green-400 hover:text-green-600" title="완료로">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
</button>
|
||||
<button onclick="quickDeleteEntry({{ $entry->id }})" class="p-0.5 text-red-400 hover:text-red-600" title="삭제">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<!-- 항목 목록 -->
|
||||
<div class="space-y-1.5 max-h-40 overflow-y-auto">
|
||||
@foreach($groupedEntries->sortBy(fn($e) => $e->status === 'done' ? 1 : 0) as $entry)
|
||||
<div class="group" data-entry-id="{{ $entry->id }}">
|
||||
<div class="flex items-center gap-2">
|
||||
<!-- 상태 뱃지 -->
|
||||
@if($entry->status === 'done')
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded shrink-0 bg-green-100 text-green-700">완료</span>
|
||||
@elseif($entry->status === 'in_progress')
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded shrink-0 bg-yellow-100 text-yellow-700">진행</span>
|
||||
@else
|
||||
<span class="px-1.5 py-0.5 text-[10px] rounded shrink-0 bg-gray-100 text-gray-600">예정</span>
|
||||
@endif
|
||||
<!-- 내용 -->
|
||||
<span class="flex-1 text-xs truncate {{ $entry->status === 'done' ? 'text-gray-400 line-through' : 'text-gray-700' }}" title="{{ $entry->content }}">{{ $entry->content }}</span>
|
||||
<!-- 상태변경 버튼 -->
|
||||
<div class="flex gap-0.5 opacity-30 group-hover:opacity-100 transition-opacity shrink-0">
|
||||
@if($entry->status !== 'todo')
|
||||
<button onclick="event.stopPropagation(); changeEntryStatus({{ $entry->id }}, 'todo')"
|
||||
class="p-0.5 text-gray-400 hover:bg-gray-100 rounded" title="예정">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
@endif
|
||||
@if($entry->status !== 'in_progress')
|
||||
<button onclick="event.stopPropagation(); changeEntryStatus({{ $entry->id }}, 'in_progress')"
|
||||
class="p-0.5 text-yellow-500 hover:bg-yellow-50 rounded" title="진행중">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/></svg>
|
||||
</button>
|
||||
@endif
|
||||
@if($entry->status !== 'done')
|
||||
<button onclick="event.stopPropagation(); changeEntryStatus({{ $entry->id }}, 'done')"
|
||||
class="p-0.5 text-green-500 hover:bg-green-50 rounded" title="완료">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-xs text-gray-400 text-center py-2">-</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 진행중 컬럼 -->
|
||||
<div class="bg-blue-50 rounded-lg p-2">
|
||||
<div class="flex items-center gap-1 mb-2 pb-1 border-b border-blue-200">
|
||||
<span class="w-2 h-2 bg-blue-500 rounded-full animate-pulse"></span>
|
||||
<span class="text-xs font-medium text-blue-700">진행중</span>
|
||||
<span class="text-xs text-blue-400">({{ $inProgressEntries->count() }})</span>
|
||||
</div>
|
||||
<div class="space-y-2 max-h-40 overflow-y-auto">
|
||||
@forelse($inProgressEntries->groupBy('assignee_name') as $assigneeName => $groupedEntries)
|
||||
@php
|
||||
$entriesJson = $groupedEntries->map(fn($e) => [
|
||||
'id' => $e->id,
|
||||
'daily_log_id' => $e->daily_log_id,
|
||||
'content' => $e->content,
|
||||
'status' => $e->status
|
||||
])->values()->toJson();
|
||||
@endphp
|
||||
<div class="bg-white rounded p-2 shadow-sm border border-blue-100">
|
||||
<p class="text-xs font-semibold text-gray-700 mb-1.5 pb-1 border-b border-blue-100 cursor-pointer hover:text-indigo-600"
|
||||
onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ $assigneeName }}</p>
|
||||
<div class="space-y-1">
|
||||
@foreach($groupedEntries as $entry)
|
||||
<div class="group flex items-start justify-between gap-1 text-xs py-0.5 hover:bg-blue-50 rounded px-1 -mx-1">
|
||||
<span class="text-gray-600 truncate flex-1 cursor-pointer" onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ Str::limit($entry->content, 25) }}</span>
|
||||
<div class="flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'todo')" class="p-0.5 text-gray-400 hover:text-gray-600" title="예정으로">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'done')" class="p-0.5 text-green-400 hover:text-green-600" title="완료로">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
||||
</button>
|
||||
<button onclick="quickDeleteEntry({{ $entry->id }})" class="p-0.5 text-red-400 hover:text-red-600" title="삭제">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-xs text-blue-400 text-center py-2">-</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 완료 컬럼 -->
|
||||
<div class="bg-green-50 rounded-lg p-2">
|
||||
<div class="flex items-center gap-1 mb-2 pb-1 border-b border-green-200">
|
||||
<svg class="w-3 h-3 text-green-600" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span class="text-xs font-medium text-green-700">완료</span>
|
||||
<span class="text-xs text-green-400">({{ $doneEntries->count() }})</span>
|
||||
</div>
|
||||
<div class="space-y-2 max-h-40 overflow-y-auto">
|
||||
@forelse($doneEntries->groupBy('assignee_name') as $assigneeName => $groupedEntries)
|
||||
@php
|
||||
$entriesJson = $groupedEntries->map(fn($e) => [
|
||||
'id' => $e->id,
|
||||
'daily_log_id' => $e->daily_log_id,
|
||||
'content' => $e->content,
|
||||
'status' => $e->status
|
||||
])->values()->toJson();
|
||||
@endphp
|
||||
<div class="bg-white rounded p-2 shadow-sm border border-green-100">
|
||||
<p class="text-xs font-semibold text-gray-700 mb-1.5 pb-1 border-b border-green-100 cursor-pointer hover:text-indigo-600"
|
||||
onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ $assigneeName }}</p>
|
||||
<div class="space-y-1">
|
||||
@foreach($groupedEntries as $entry)
|
||||
<div class="group flex items-start justify-between gap-1 text-xs py-0.5 hover:bg-green-50 rounded px-1 -mx-1">
|
||||
<span class="text-gray-400 truncate flex-1 line-through cursor-pointer" onclick='openEditEntryModal(@json($entriesJson), "{{ addslashes($assigneeName) }}", {{ $project->id }}, "{{ addslashes($project->name) }}")'>{{ Str::limit($entry->content, 25) }}</span>
|
||||
<div class="flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'todo')" class="p-0.5 text-gray-400 hover:text-gray-600" title="예정으로">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" stroke-width="2"/></svg>
|
||||
</button>
|
||||
<button onclick="changeEntryStatus({{ $entry->id }}, 'in_progress')" class="p-0.5 text-blue-400 hover:text-blue-600" title="진행중으로">
|
||||
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8"/></svg>
|
||||
</button>
|
||||
<button onclick="quickDeleteEntry({{ $entry->id }})" class="p-0.5 text-red-400 hover:text-red-600" title="삭제">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-xs text-green-400 text-center py-2">-</p>
|
||||
@endforelse
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<!-- 활동 없음 -->
|
||||
@@ -381,7 +321,7 @@ class="text-xs text-gray-500 hover:text-gray-700">
|
||||
<button type="button"
|
||||
onclick="openAddEntryModal({{ $project->id }}, '{{ $project->name }}', null)"
|
||||
class="mt-2 text-xs text-indigo-600 hover:text-indigo-800">
|
||||
+ 첫 활동 추가하기
|
||||
+ 활동 추가하기
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
@@ -986,4 +926,4 @@ function closeEditEntryModal() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
@@ -6,12 +6,7 @@
|
||||
<!-- 페이지 헤더 -->
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div class="flex items-center gap-4">
|
||||
<a href="{{ route('pm.index') }}" class="inline-flex items-center gap-1 px-3 py-1.5 text-sm text-gray-600 bg-gray-100 hover:bg-gray-200 rounded-lg transition">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
대시보드
|
||||
</a>
|
||||
|
||||
<h1 class="text-2xl font-bold text-gray-800 flex items-center gap-2">
|
||||
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" />
|
||||
@@ -20,6 +15,12 @@
|
||||
</h1>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ route('pm.index') }}" class="inline-flex items-center gap-1 px-3 py-1.5 text-sm bg-white hover:bg-gray-300 text-gray-700 rounded-lg transition">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
대시보드
|
||||
</a>
|
||||
<a href="{{ route('pm.import') }}" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition flex items-center gap-2">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
|
||||
@@ -148,4 +149,4 @@ class="bg-white rounded-lg shadow-sm overflow-hidden">
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@endpush
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user