Files
sam-manage/resources/views/archived-records/index.blade.php
hskwon 6ad76239a9 feat(mng): 삭제된 데이터 백업 기능 추가
- ArchivedRecord, ArchivedRecordRelation 모델 추가
- ArchivedRecordService 추가 (읽기 전용)
- 목록/상세 컨트롤러 및 뷰 구현
- HTMX 기반 테이블 필터링 및 페이지네이션
- 사이드바 메뉴 연결
2025-11-26 22:23:37 +09:00

116 lines
4.6 KiB
PHP

@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