- ArchivedRecord, ArchivedRecordRelation 모델 추가 - ArchivedRecordService 추가 (읽기 전용) - 목록/상세 컨트롤러 및 뷰 구현 - HTMX 기반 테이블 필터링 및 페이지네이션 - 사이드바 메뉴 연결
142 lines
8.1 KiB
PHP
142 lines
8.1 KiB
PHP
<div class="overflow-x-auto">
|
|
<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-semibold text-gray-700 uppercase tracking-wider" style="width: 60px;">ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 100px;">타입</th>
|
|
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">원본 ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider">데이터 요약</th>
|
|
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 120px;">삭제자</th>
|
|
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 160px;">삭제일시</th>
|
|
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">관련 테이블</th>
|
|
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">노트</th>
|
|
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">작업</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@forelse($records as $record)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
|
{{ $record->id }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ $record->record_type === 'tenant' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800' }}">
|
|
{{ $record->record_type_label }}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
|
{{ $record->original_id }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-900">
|
|
<div class="max-w-xs truncate" title="{{ $record->main_data_summary }}">
|
|
{{ $record->main_data_summary }}
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $record->deletedByUser?->name ?? '-' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
|
{{ $record->deleted_at?->format('Y-m-d H:i') ?? '-' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
@if($record->relations_count > 0)
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
|
|
{{ $record->relations_count }}
|
|
</span>
|
|
@else
|
|
<span class="text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
@if($record->notes)
|
|
<span class="inline-flex items-center justify-center w-6 h-6 rounded-full bg-yellow-100 text-yellow-600" title="{{ $record->notes }}">
|
|
<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="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" />
|
|
</svg>
|
|
</span>
|
|
@else
|
|
<span class="text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
<a href="{{ route('archived-records.show', $record->id) }}"
|
|
class="text-blue-600 hover:text-blue-900 transition"
|
|
title="상세 보기">
|
|
<svg class="w-5 h-5 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
|
</svg>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="9" class="px-6 py-12 text-center text-gray-500">
|
|
<div class="flex flex-col items-center">
|
|
<svg class="w-12 h-12 text-gray-300 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
|
|
</svg>
|
|
<p>백업된 데이터가 없습니다.</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{{-- 페이지네이션 --}}
|
|
@if($records->hasPages())
|
|
<div class="px-6 py-4 border-t border-gray-200">
|
|
<div class="flex items-center justify-between">
|
|
<div class="text-sm text-gray-700">
|
|
총 <span class="font-medium">{{ $records->total() }}</span>개 중
|
|
<span class="font-medium">{{ $records->firstItem() }}</span> -
|
|
<span class="font-medium">{{ $records->lastItem() }}</span>개 표시
|
|
</div>
|
|
<div class="flex gap-2">
|
|
{{-- 이전 페이지 --}}
|
|
@if($records->onFirstPage())
|
|
<span class="px-3 py-1 text-sm text-gray-400 bg-gray-100 rounded cursor-not-allowed">이전</span>
|
|
@else
|
|
<button type="button"
|
|
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
|
|
hx-get="/api/admin/archived-records?page={{ $records->currentPage() - 1 }}"
|
|
hx-target="#archived-record-table"
|
|
hx-include="#filterForm">
|
|
이전
|
|
</button>
|
|
@endif
|
|
|
|
{{-- 페이지 번호 --}}
|
|
@foreach(range(max(1, $records->currentPage() - 2), min($records->lastPage(), $records->currentPage() + 2)) as $page)
|
|
@if($page == $records->currentPage())
|
|
<span class="px-3 py-1 text-sm text-white bg-blue-600 rounded">{{ $page }}</span>
|
|
@else
|
|
<button type="button"
|
|
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
|
|
hx-get="/api/admin/archived-records?page={{ $page }}"
|
|
hx-target="#archived-record-table"
|
|
hx-include="#filterForm">
|
|
{{ $page }}
|
|
</button>
|
|
@endif
|
|
@endforeach
|
|
|
|
{{-- 다음 페이지 --}}
|
|
@if($records->hasMorePages())
|
|
<button type="button"
|
|
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
|
|
hx-get="/api/admin/archived-records?page={{ $records->currentPage() + 1 }}"
|
|
hx-target="#archived-record-table"
|
|
hx-include="#filterForm">
|
|
다음
|
|
</button>
|
|
@else
|
|
<span class="px-3 py-1 text-sm text-gray-400 bg-gray-100 rounded cursor-not-allowed">다음</span>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|