Files
sam-manage/resources/views/daily-logs/partials/table.blade.php

140 lines
8.2 KiB
PHP

<!-- 일일 로그 카드 리스트 -->
<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 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>
</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>
</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())
<div class="px-6 py-4 border-t border-gray-200">
{{ $logs->withQueryString()->links() }}
</div>
@endif