feat(mng): 아카이브 레코드 batch 그룹핑 UI 구현
- ArchivedRecordService: batch_id 기준 그룹핑 쿼리 추가 - Controller: batchId 파라미터로 상세 조회 변경 - 목록: 작업 설명, 레코드 타입, 레코드 수 표시 - 상세: batch 내 모든 레코드를 카드 형태로 표시 - 한번의 삭제 작업이 하나의 행으로 표시됨
This commit is contained in:
@@ -14,11 +14,11 @@ public function __construct(
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 아카이브 레코드 목록 조회
|
||||
* 아카이브 레코드 목록 조회 (batch 그룹핑)
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$records = $this->archivedRecordService->getArchivedRecords(
|
||||
$records = $this->archivedRecordService->getArchivedRecordsBatched(
|
||||
$request->all(),
|
||||
$request->integer('per_page', 15)
|
||||
);
|
||||
@@ -46,13 +46,13 @@ public function index(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 아카이브 레코드 조회
|
||||
* 특정 batch의 레코드 조회
|
||||
*/
|
||||
public function show(Request $request, int $id): JsonResponse
|
||||
public function show(Request $request, string $batchId): JsonResponse
|
||||
{
|
||||
$record = $this->archivedRecordService->getArchivedRecordById($id);
|
||||
$records = $this->archivedRecordService->getRecordsByBatchId($batchId);
|
||||
|
||||
if (! $record) {
|
||||
if ($records->isEmpty()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '아카이브 레코드를 찾을 수 없습니다.',
|
||||
@@ -62,13 +62,13 @@ public function show(Request $request, int $id): JsonResponse
|
||||
// HTMX 요청 시 HTML 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
return response()->json([
|
||||
'html' => view('archived-records.partials.detail', compact('record'))->render(),
|
||||
'html' => view('archived-records.partials.detail', compact('records'))->render(),
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $record,
|
||||
'data' => $records,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,25 @@ public function index(): View
|
||||
}
|
||||
|
||||
/**
|
||||
* 아카이브 레코드 상세 보기 (Blade 화면만)
|
||||
* 아카이브 레코드 상세 보기 (batch 기준)
|
||||
*/
|
||||
public function show(int $id): View
|
||||
public function show(string $batchId): View
|
||||
{
|
||||
$record = $this->archivedRecordService->getArchivedRecordById($id);
|
||||
$records = $this->archivedRecordService->getRecordsByBatchId($batchId);
|
||||
|
||||
if (! $record) {
|
||||
if ($records->isEmpty()) {
|
||||
abort(404, '아카이브 레코드를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
return view('archived-records.show', compact('record'));
|
||||
// 첫 번째 레코드에서 batch 정보 추출
|
||||
$batchInfo = [
|
||||
'batch_id' => $batchId,
|
||||
'batch_description' => $records->first()->batch_description,
|
||||
'deleted_by' => $records->first()->deletedByUser?->name ?? '-',
|
||||
'deleted_at' => $records->first()->deleted_at,
|
||||
'record_count' => $records->count(),
|
||||
];
|
||||
|
||||
return view('archived-records.show', compact('records', 'batchInfo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ class ArchivedRecord extends Model
|
||||
protected $table = 'archived_records';
|
||||
|
||||
protected $fillable = [
|
||||
'batch_id',
|
||||
'batch_description',
|
||||
'record_type',
|
||||
'original_id',
|
||||
'main_data',
|
||||
|
||||
@@ -4,48 +4,43 @@
|
||||
|
||||
use App\Models\Archives\ArchivedRecord;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ArchivedRecordService
|
||||
{
|
||||
/**
|
||||
* 아카이브 레코드 목록 조회 (페이지네이션)
|
||||
* 아카이브 레코드 목록 조회 (batch_id로 그룹핑, 페이지네이션)
|
||||
*/
|
||||
public function getArchivedRecords(array $filters = [], int $perPage = 15): LengthAwarePaginator
|
||||
public function getArchivedRecordsBatched(array $filters = [], int $perPage = 15): LengthAwarePaginator
|
||||
{
|
||||
// batch_id별로 그룹핑하여 첫 번째 레코드만 조회
|
||||
$query = ArchivedRecord::query()
|
||||
->with(['deletedByUser', 'relations'])
|
||||
->withCount('relations');
|
||||
->select([
|
||||
'batch_id',
|
||||
'batch_description',
|
||||
DB::raw('MIN(id) as id'),
|
||||
DB::raw('GROUP_CONCAT(DISTINCT record_type) as record_types'),
|
||||
DB::raw('COUNT(*) as record_count'),
|
||||
DB::raw('MIN(deleted_by) as deleted_by'),
|
||||
DB::raw('MIN(deleted_at) as deleted_at'),
|
||||
])
|
||||
->groupBy('batch_id', 'batch_description');
|
||||
|
||||
// 레코드 타입 필터
|
||||
if (! empty($filters['record_type'])) {
|
||||
$query->where('record_type', $filters['record_type']);
|
||||
$query->having('record_types', 'like', "%{$filters['record_type']}%");
|
||||
}
|
||||
|
||||
// 삭제자 필터
|
||||
if (! empty($filters['deleted_by'])) {
|
||||
$query->where('deleted_by', $filters['deleted_by']);
|
||||
}
|
||||
|
||||
// 노트 유무 필터
|
||||
if (isset($filters['has_notes'])) {
|
||||
if ($filters['has_notes'] === 'yes' || $filters['has_notes'] === '1') {
|
||||
$query->whereNotNull('notes')->where('notes', '!=', '');
|
||||
} elseif ($filters['has_notes'] === 'no' || $filters['has_notes'] === '0') {
|
||||
$query->where(function ($q) {
|
||||
$q->whereNull('notes')->orWhere('notes', '');
|
||||
});
|
||||
}
|
||||
$query->having('deleted_by', $filters['deleted_by']);
|
||||
}
|
||||
|
||||
// 검색
|
||||
if (! empty($filters['search'])) {
|
||||
$search = $filters['search'];
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('record_type', 'like', "%{$search}%")
|
||||
->orWhere('notes', 'like', "%{$search}%")
|
||||
->orWhereRaw("JSON_EXTRACT(main_data, '$.name') LIKE ?", ["%{$search}%"])
|
||||
->orWhereRaw("JSON_EXTRACT(main_data, '$.title') LIKE ?", ["%{$search}%"]);
|
||||
});
|
||||
$query->where('batch_description', 'like', "%{$search}%");
|
||||
}
|
||||
|
||||
// 정렬 (기본: 삭제일시 내림차순)
|
||||
@@ -56,6 +51,17 @@ public function getArchivedRecords(array $filters = [], int $perPage = 15): Leng
|
||||
return $query->paginate($perPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 batch의 모든 레코드 조회
|
||||
*/
|
||||
public function getRecordsByBatchId(string $batchId): Collection
|
||||
{
|
||||
return ArchivedRecord::with(['deletedByUser', 'relations'])
|
||||
->where('batch_id', $batchId)
|
||||
->orderBy('id')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 아카이브 레코드 조회
|
||||
*/
|
||||
@@ -65,6 +71,17 @@ public function getArchivedRecordById(int $id): ?ArchivedRecord
|
||||
->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* batch_id로 첫 번째 레코드 조회 (상세 페이지 진입용)
|
||||
*/
|
||||
public function getFirstRecordByBatchId(string $batchId): ?ArchivedRecord
|
||||
{
|
||||
return ArchivedRecord::with(['deletedByUser', 'relations'])
|
||||
->where('batch_id', $batchId)
|
||||
->orderBy('id')
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제자 목록 조회 (필터용)
|
||||
*/
|
||||
@@ -87,12 +104,10 @@ public function getDeletedByUsers(): array
|
||||
public function getStats(): array
|
||||
{
|
||||
return [
|
||||
'total' => ArchivedRecord::count(),
|
||||
'total_batches' => ArchivedRecord::distinct('batch_id')->count('batch_id'),
|
||||
'total_records' => ArchivedRecord::count(),
|
||||
'tenants' => ArchivedRecord::tenant()->count(),
|
||||
'users' => ArchivedRecord::user()->count(),
|
||||
'with_notes' => ArchivedRecord::whereNotNull('notes')
|
||||
->where('notes', '!=', '')
|
||||
->count(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<input type="text"
|
||||
name="search"
|
||||
placeholder="이름, 노트 내용으로 검색..."
|
||||
placeholder="작업 설명으로 검색..."
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,64 +2,53 @@
|
||||
<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">작업 설명</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-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">레코드 수</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 class="px-6 py-4 text-sm text-gray-900">
|
||||
<div class="font-medium">{{ $record->batch_description ?? '삭제 작업' }}</div>
|
||||
<div class="text-xs text-gray-500 mt-1">ID: {{ Str::limit($record->batch_id, 8, '...') }}</div>
|
||||
</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 }}
|
||||
@php
|
||||
$types = explode(',', $record->record_types ?? '');
|
||||
@endphp
|
||||
<div class="flex flex-wrap gap-1">
|
||||
@foreach($types as $type)
|
||||
@if($type === 'tenant')
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">테넌트</span>
|
||||
@elseif($type === 'user')
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">사용자</span>
|
||||
@else
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">{{ $type }}</span>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $record->deletedByUser?->name ?? '-' }}
|
||||
<td class="px-6 py-4 whitespace-nowrap text-center">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
|
||||
{{ $record->record_count }}건
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $record->deleted_at?->format('Y-m-d H:i') ?? '-' }}
|
||||
@php
|
||||
$deletedByUser = $record->deleted_by ? \App\Models\User::find($record->deleted_by) : null;
|
||||
@endphp
|
||||
{{ $deletedByUser?->name ?? '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $record->deleted_at ? \Carbon\Carbon::parse($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) }}"
|
||||
<a href="{{ route('archived-records.show', $record->batch_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">
|
||||
@@ -71,7 +60,7 @@ class="text-blue-600 hover:text-blue-900 transition"
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="9" class="px-6 py-12 text-center text-gray-500">
|
||||
<td colspan="6" 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" />
|
||||
@@ -90,7 +79,7 @@ class="text-blue-600 hover:text-blue-900 transition"
|
||||
<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->total() }}</span>개 작업 중
|
||||
<span class="font-medium">{{ $records->firstItem() }}</span> -
|
||||
<span class="font-medium">{{ $records->lastItem() }}</span>개 표시
|
||||
</div>
|
||||
|
||||
@@ -13,100 +13,131 @@ class="text-gray-500 hover:text-gray-700 transition">
|
||||
</svg>
|
||||
</a>
|
||||
<h1 class="text-2xl font-bold text-gray-800">삭제된 데이터 상세</h1>
|
||||
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium {{ $record->record_type === 'tenant' ? 'bg-blue-100 text-blue-800' : 'bg-green-100 text-green-800' }}">
|
||||
{{ $record->record_type_label }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 기본 정보 -->
|
||||
<!-- 작업 요약 정보 -->
|
||||
<div class="bg-white rounded-lg shadow-sm mb-6">
|
||||
<div class="px-6 py-4 border-b border-gray-200">
|
||||
<h2 class="text-lg font-semibold text-gray-800">기본 정보</h2>
|
||||
<h2 class="text-lg font-semibold text-gray-800">작업 요약</h2>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<dl class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<dl class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">ID</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $record->id }}</dd>
|
||||
<dt class="text-sm font-medium text-gray-500">작업 설명</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 font-medium">{{ $batchInfo['batch_description'] ?? '삭제 작업' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">레코드 타입</dt>
|
||||
<dt class="text-sm font-medium text-gray-500">삭제된 레코드 수</dt>
|
||||
<dd class="mt-1">
|
||||
<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 class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
|
||||
{{ $batchInfo['record_count'] }}건
|
||||
</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">원본 ID</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $record->original_id }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">스키마 버전</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $record->schema_version ?? '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">삭제자</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $record->deletedByUser?->name ?? '-' }}</dd>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $batchInfo['deleted_by'] }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-sm font-medium text-gray-500">삭제일시</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $record->deleted_at?->format('Y-m-d H:i:s') ?? '-' }}</dd>
|
||||
<dd class="mt-1 text-sm text-gray-900">{{ $batchInfo['deleted_at']?->format('Y-m-d H:i:s') ?? '-' }}</dd>
|
||||
</div>
|
||||
@if($record->notes)
|
||||
<div class="md:col-span-2 lg:col-span-3">
|
||||
<dt class="text-sm font-medium text-gray-500">노트</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 bg-gray-50 p-3 rounded">{{ $record->notes }}</dd>
|
||||
</div>
|
||||
@endif
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 메인 데이터 -->
|
||||
<!-- 삭제된 레코드 목록 -->
|
||||
@foreach($records as $index => $record)
|
||||
<div class="bg-white rounded-lg shadow-sm mb-6">
|
||||
<div class="px-6 py-4 border-b border-gray-200">
|
||||
<h2 class="text-lg font-semibold text-gray-800">메인 데이터</h2>
|
||||
<div class="px-6 py-4 border-b border-gray-200 flex items-center justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 text-gray-600 text-sm font-medium">
|
||||
{{ $index + 1 }}
|
||||
</span>
|
||||
<h2 class="text-lg font-semibold text-gray-800">{{ $record->record_type_label }}</h2>
|
||||
<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 }}
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-sm text-gray-500">원본 ID: {{ $record->original_id }}</span>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
|
||||
<!-- 메인 데이터 -->
|
||||
<div class="p-6 border-b border-gray-200">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-3">메인 데이터</h3>
|
||||
@if($record->main_data)
|
||||
<pre class="bg-gray-900 text-green-400 p-4 rounded-lg overflow-x-auto text-sm font-mono">{{ json_encode($record->main_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}</pre>
|
||||
@php
|
||||
$mainData = is_array($record->main_data) ? $record->main_data : json_decode($record->main_data, true);
|
||||
@endphp
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mb-4">
|
||||
@foreach(array_slice($mainData ?? [], 0, 8) as $key => $value)
|
||||
<div class="bg-gray-50 p-3 rounded">
|
||||
<dt class="text-xs font-medium text-gray-500">{{ $key }}</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 truncate" title="{{ is_array($value) ? json_encode($value) : $value }}">
|
||||
@if(is_array($value))
|
||||
<span class="text-gray-400">[배열]</span>
|
||||
@elseif(is_null($value))
|
||||
<span class="text-gray-400">null</span>
|
||||
@else
|
||||
{{ Str::limit((string)$value, 50) }}
|
||||
@endif
|
||||
</dd>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<details class="mt-2">
|
||||
<summary class="text-sm text-blue-600 cursor-pointer hover:text-blue-800">전체 데이터 보기</summary>
|
||||
<pre class="mt-2 bg-gray-900 text-green-400 p-4 rounded-lg overflow-x-auto text-sm font-mono max-h-64">{{ json_encode($mainData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}</pre>
|
||||
</details>
|
||||
@else
|
||||
<p class="text-gray-500">데이터가 없습니다.</p>
|
||||
<p class="text-gray-500">메인 데이터가 없습니다.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 관련 테이블 데이터 -->
|
||||
@if($record->relations->isNotEmpty())
|
||||
<div class="bg-white rounded-lg shadow-sm">
|
||||
<div class="px-6 py-4 border-b border-gray-200">
|
||||
<h2 class="text-lg font-semibold text-gray-800">관련 테이블 데이터</h2>
|
||||
<p class="text-sm text-gray-500 mt-1">총 {{ $record->relations->count() }}개 테이블</p>
|
||||
</div>
|
||||
<div class="p-6 space-y-6">
|
||||
@foreach($record->relations as $relation)
|
||||
<div class="border border-gray-200 rounded-lg">
|
||||
<div class="px-4 py-3 bg-gray-50 border-b border-gray-200 flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-medium text-gray-900">{{ $relation->table_name_label }}</span>
|
||||
<span class="text-xs text-gray-500">({{ $relation->table_name }})</span>
|
||||
<!-- 관련 테이블 데이터 -->
|
||||
@if($record->relations->isNotEmpty())
|
||||
<div class="p-6">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-3">관련 테이블 데이터 ({{ $record->relations->count() }}개)</h3>
|
||||
<div class="space-y-4">
|
||||
@foreach($record->relations as $relation)
|
||||
<details class="border border-gray-200 rounded-lg">
|
||||
<summary class="px-4 py-3 bg-gray-50 cursor-pointer hover:bg-gray-100 flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-medium text-gray-900">{{ $relation->table_name_label }}</span>
|
||||
<span class="text-xs text-gray-500">({{ $relation->table_name }})</span>
|
||||
</div>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-800">
|
||||
{{ $relation->record_count }}건
|
||||
</span>
|
||||
</summary>
|
||||
<div class="p-4 border-t border-gray-200">
|
||||
@if($relation->data)
|
||||
<pre class="bg-gray-900 text-green-400 p-4 rounded-lg overflow-x-auto text-sm font-mono max-h-64">{{ json_encode(is_array($relation->data) ? $relation->data : json_decode($relation->data, true), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}</pre>
|
||||
@else
|
||||
<p class="text-gray-500">데이터가 없습니다.</p>
|
||||
@endif
|
||||
</div>
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-800">
|
||||
{{ $relation->record_count }} 건
|
||||
</span>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
@if($relation->data)
|
||||
<pre class="bg-gray-900 text-green-400 p-4 rounded-lg overflow-x-auto text-sm font-mono max-h-96">{{ json_encode($relation->data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}</pre>
|
||||
@else
|
||||
<p class="text-gray-500">데이터가 없습니다.</p>
|
||||
@endif
|
||||
</details>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- 노트 -->
|
||||
@if($record->notes)
|
||||
<div class="px-6 py-4 bg-yellow-50 border-t border-yellow-200">
|
||||
<div class="flex items-start gap-2">
|
||||
<svg class="w-5 h-5 text-yellow-600 mt-0.5" 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>
|
||||
<div>
|
||||
<span class="text-sm font-medium text-yellow-800">노트</span>
|
||||
<p class="text-sm text-yellow-700 mt-1">{{ $record->notes }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
@endsection
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
// 삭제된 데이터 백업 (Blade 화면만)
|
||||
Route::prefix('archived-records')->name('archived-records.')->group(function () {
|
||||
Route::get('/', [ArchivedRecordController::class, 'index'])->name('index');
|
||||
Route::get('/{id}', [ArchivedRecordController::class, 'show'])->name('show');
|
||||
Route::get('/{batchId}', [ArchivedRecordController::class, 'show'])->name('show');
|
||||
});
|
||||
|
||||
// 대시보드
|
||||
|
||||
Reference in New Issue
Block a user