feat(mng): 삭제된 데이터 백업 기능 추가

- ArchivedRecord, ArchivedRecordRelation 모델 추가
- ArchivedRecordService 추가 (읽기 전용)
- 목록/상세 컨트롤러 및 뷰 구현
- HTMX 기반 테이블 필터링 및 페이지네이션
- 사이드바 메뉴 연결
This commit is contained in:
2025-11-26 22:23:37 +09:00
parent f82fd5ff1b
commit 6ad76239a9
11 changed files with 749 additions and 2 deletions

View File

@@ -0,0 +1,87 @@
<?php
namespace App\Http\Controllers\Api\Admin;
use App\Http\Controllers\Controller;
use App\Services\ArchivedRecordService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ArchivedRecordController extends Controller
{
public function __construct(
private readonly ArchivedRecordService $archivedRecordService
) {}
/**
* 아카이브 레코드 목록 조회
*/
public function index(Request $request): JsonResponse
{
$records = $this->archivedRecordService->getArchivedRecords(
$request->all(),
$request->integer('per_page', 15)
);
// HTMX 요청 시 HTML 반환
if ($request->header('HX-Request')) {
$html = view('archived-records.partials.table', compact('records'))->render();
return response()->json([
'html' => $html,
]);
}
// 일반 요청 시 JSON 반환
return response()->json([
'success' => true,
'data' => $records->items(),
'meta' => [
'current_page' => $records->currentPage(),
'last_page' => $records->lastPage(),
'per_page' => $records->perPage(),
'total' => $records->total(),
],
]);
}
/**
* 특정 아카이브 레코드 조회
*/
public function show(Request $request, int $id): JsonResponse
{
$record = $this->archivedRecordService->getArchivedRecordById($id);
if (! $record) {
return response()->json([
'success' => false,
'message' => '아카이브 레코드를 찾을 수 없습니다.',
], 404);
}
// HTMX 요청 시 HTML 반환
if ($request->header('HX-Request')) {
return response()->json([
'html' => view('archived-records.partials.detail', compact('record'))->render(),
]);
}
return response()->json([
'success' => true,
'data' => $record,
]);
}
/**
* 아카이브 통계
*/
public function stats(Request $request): JsonResponse
{
$stats = $this->archivedRecordService->getStats();
return response()->json([
'success' => true,
'data' => $stats,
]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use App\Services\ArchivedRecordService;
use Illuminate\View\View;
class ArchivedRecordController extends Controller
{
public function __construct(
private readonly ArchivedRecordService $archivedRecordService
) {}
/**
* 아카이브 레코드 목록 (Blade 화면만)
*/
public function index(): View
{
$deletedByUsers = $this->archivedRecordService->getDeletedByUsers();
return view('archived-records.index', compact('deletedByUsers'));
}
/**
* 아카이브 레코드 상세 보기 (Blade 화면만)
*/
public function show(int $id): View
{
$record = $this->archivedRecordService->getArchivedRecordById($id);
if (! $record) {
abort(404, '아카이브 레코드를 찾을 수 없습니다.');
}
return view('archived-records.show', compact('record'));
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace App\Models\Archives;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ArchivedRecord extends Model
{
protected $table = 'archived_records';
protected $fillable = [
'record_type',
'original_id',
'main_data',
'schema_version',
'deleted_by',
'deleted_at',
'notes',
];
protected $casts = [
'main_data' => 'array',
'deleted_at' => 'datetime',
'original_id' => 'integer',
'deleted_by' => 'integer',
];
/**
* 관계: 삭제한 사용자
*/
public function deletedByUser(): BelongsTo
{
return $this->belongsTo(User::class, 'deleted_by');
}
/**
* 관계: 연관 테이블 데이터
*/
public function relations(): HasMany
{
return $this->hasMany(ArchivedRecordRelation::class, 'archived_record_id');
}
/**
* Scope: 테넌트 타입만
*/
public function scopeTenant($query)
{
return $query->where('record_type', 'tenant');
}
/**
* Scope: 사용자 타입만
*/
public function scopeUser($query)
{
return $query->where('record_type', 'user');
}
/**
* 레코드 타입 레이블
*/
public function getRecordTypeLabelAttribute(): string
{
return match ($this->record_type) {
'tenant' => '테넌트',
'user' => '사용자',
default => $this->record_type,
};
}
/**
* 메인 데이터 요약
*/
public function getMainDataSummaryAttribute(): string
{
if (empty($this->main_data)) {
return '-';
}
$data = $this->main_data;
$name = $data['name'] ?? $data['title'] ?? '-';
$id = $data['id'] ?? $this->original_id;
return "{$name} (ID: {$id})";
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Models\Archives;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ArchivedRecordRelation extends Model
{
protected $table = 'archived_record_relations';
protected $fillable = [
'archived_record_id',
'table_name',
'data',
'record_count',
];
protected $casts = [
'data' => 'array',
'record_count' => 'integer',
'archived_record_id' => 'integer',
];
/**
* 관계: 상위 아카이브 레코드
*/
public function archivedRecord(): BelongsTo
{
return $this->belongsTo(ArchivedRecord::class, 'archived_record_id');
}
/**
* 테이블명 레이블
*/
public function getTableNameLabelAttribute(): string
{
return match ($this->table_name) {
'users' => '사용자',
'roles' => '역할',
'permissions' => '권한',
'departments' => '부서',
'menus' => '메뉴',
'products' => '제품',
'materials' => '자재',
'boms' => 'BOM',
'categories' => '카테고리',
'files' => '파일',
'audit_logs' => '감사 로그',
default => $this->table_name,
};
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace App\Services;
use App\Models\Archives\ArchivedRecord;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
class ArchivedRecordService
{
/**
* 아카이브 레코드 목록 조회 (페이지네이션)
*/
public function getArchivedRecords(array $filters = [], int $perPage = 15): LengthAwarePaginator
{
$query = ArchivedRecord::query()
->with(['deletedByUser', 'relations'])
->withCount('relations');
// 레코드 타입 필터
if (! empty($filters['record_type'])) {
$query->where('record_type', $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', '');
});
}
}
// 검색
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}%"]);
});
}
// 정렬 (기본: 삭제일시 내림차순)
$sortBy = $filters['sort_by'] ?? 'deleted_at';
$sortDirection = $filters['sort_direction'] ?? 'desc';
$query->orderBy($sortBy, $sortDirection);
return $query->paginate($perPage);
}
/**
* 특정 아카이브 레코드 조회
*/
public function getArchivedRecordById(int $id): ?ArchivedRecord
{
return ArchivedRecord::with(['deletedByUser', 'relations'])
->find($id);
}
/**
* 삭제자 목록 조회 (필터용)
*/
public function getDeletedByUsers(): array
{
return ArchivedRecord::query()
->whereNotNull('deleted_by')
->with('deletedByUser:id,name')
->get()
->pluck('deletedByUser')
->filter()
->unique('id')
->values()
->toArray();
}
/**
* 아카이브 통계
*/
public function getStats(): array
{
return [
'total' => ArchivedRecord::count(),
'tenants' => ArchivedRecord::tenant()->count(),
'users' => ArchivedRecord::user()->count(),
'with_notes' => ArchivedRecord::whereNotNull('notes')
->where('notes', '!=', '')
->count(),
];
}
}

View File

@@ -0,0 +1,115 @@
@extends('layouts.app')
@section('title', '삭제된 데이터 백업')
@section('content')
<!-- 페이지 헤더 -->
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold text-gray-800">삭제된 데이터 백업</h1>
</div>
<!-- 필터 영역 -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
<form id="filterForm" class="flex flex-wrap gap-4">
<!-- 레코드 타입 -->
<div class="w-32">
<select name="record_type"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">전체 타입</option>
<option value="tenant">테넌트</option>
<option value="user">사용자</option>
</select>
</div>
<!-- 삭제자 -->
<div class="w-40">
<select name="deleted_by"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">전체 삭제자</option>
@foreach($deletedByUsers as $user)
<option value="{{ $user['id'] }}">{{ $user['name'] }}</option>
@endforeach
</select>
</div>
<!-- 노트 유무 -->
<div class="w-32">
<select name="has_notes"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">노트 전체</option>
<option value="yes">노트 있음</option>
<option value="no">노트 없음</option>
</select>
</div>
<!-- 검색 -->
<div class="flex-1 min-w-[200px]">
<input type="text"
name="search"
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>
<!-- 검색 버튼 -->
<button type="submit" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg transition">
검색
</button>
</form>
</div>
<!-- 범례 -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
<div class="flex items-center gap-6 text-sm">
<span class="font-medium text-gray-700">범례:</span>
<div class="flex items-center gap-2">
<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>
<span class="text-gray-500">테넌트 데이터</span>
</div>
<div class="flex items-center gap-2">
<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>
<span class="text-gray-500">사용자 데이터</span>
</div>
</div>
</div>
<!-- 테이블 영역 (HTMX로 로드) -->
<div id="archived-record-table"
hx-get="/api/admin/archived-records"
hx-trigger="load, filterSubmit from:body"
hx-include="#filterForm"
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
class="bg-white rounded-lg shadow-sm overflow-hidden">
<!-- 로딩 스피너 -->
<div class="flex justify-center items-center p-12">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
</div>
@endsection
@push('scripts')
<script>
// 폼 제출 시 HTMX 이벤트 트리거
document.getElementById('filterForm').addEventListener('submit', function(e) {
e.preventDefault();
htmx.trigger('#archived-record-table', 'filterSubmit');
});
// HTMX 응답 처리
document.body.addEventListener('htmx:afterSwap', function(event) {
if (event.detail.target.id === 'archived-record-table') {
try {
const response = JSON.parse(event.detail.xhr.response);
if (response.html) {
event.detail.target.innerHTML = response.html;
}
} catch (e) {
// JSON 파싱 실패 시 HTML 직접 사용
}
}
});
</script>
@endpush

View File

@@ -0,0 +1,141 @@
<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

View File

@@ -0,0 +1,112 @@
@extends('layouts.app')
@section('title', '삭제된 데이터 상세')
@section('content')
<!-- 페이지 헤더 -->
<div class="flex justify-between items-center mb-6">
<div class="flex items-center gap-4">
<a href="{{ route('archived-records.index') }}"
class="text-gray-500 hover:text-gray-700 transition">
<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="M15 19l-7-7 7-7" />
</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>
</div>
<div class="p-6">
<dl class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 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>
</div>
<div>
<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>
</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>
</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>
</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>
<!-- 메인 데이터 -->
<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>
<div class="p-6">
@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>
@else
<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>
</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
</div>
</div>
@endforeach
</div>
</div>
@endif
@endsection

View File

@@ -227,8 +227,8 @@ class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:
</a>
</li>
<li>
<a href="#"
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100"
<a href="{{ route('archived-records.index') }}"
class="flex items-center gap-2 pr-3 py-2 rounded-lg text-sm text-gray-700 hover:bg-gray-100 {{ request()->routeIs('archived-records.*') ? '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="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4" />

View File

@@ -133,4 +133,11 @@
Route::get('/export-csv', [\App\Http\Controllers\Api\Admin\PermissionAnalyzeController::class, 'exportCsv'])->name('exportCsv');
Route::post('/recalculate', [\App\Http\Controllers\Api\Admin\PermissionAnalyzeController::class, 'recalculate'])->name('recalculate');
});
// 삭제된 데이터 백업 API
Route::prefix('archived-records')->name('archived-records.')->group(function () {
Route::get('/stats', [\App\Http\Controllers\Api\Admin\ArchivedRecordController::class, 'stats'])->name('stats');
Route::get('/', [\App\Http\Controllers\Api\Admin\ArchivedRecordController::class, 'index'])->name('index');
Route::get('/{id}', [\App\Http\Controllers\Api\Admin\ArchivedRecordController::class, 'show'])->name('show');
});
});

View File

@@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\ArchivedRecordController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\DepartmentController;
use App\Http\Controllers\MenuController;
@@ -87,6 +88,12 @@
// 권한 분석 (Blade 화면만)
Route::get('/permission-analyze', [\App\Http\Controllers\PermissionAnalyzeController::class, 'index'])->name('permission-analyze.index');
// 삭제된 데이터 백업 (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('/dashboard', function () {
return view('dashboard.index');