Files
sam-manage/resources/views/users/partials/table.blade.php
hskwon 894055786e 사용자 관리 복구 및 영구삭제 기능 추가
- UserService: audit 컬럼 처리 추가 (created_by, updated_by, deleted_by)
- UserService: restoreUser(), forceDeleteUser() 메서드 추가
- UserController: restore(), forceDestroy() 엔드포인트 추가
- 권한 체크: 영구삭제는 슈퍼관리자만 가능
- UI: 삭제된 사용자에 복원/영구삭제 버튼 추가
- Routes: restore, forceDestroy 라우트 추가
- UserService::getUsers()에 withTrashed() 추가
2025-11-24 19:30:36 +09:00

86 lines
4.5 KiB
PHP

<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<table class="w-full">
<thead class="bg-gray-50 border-b">
<tr>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">이름</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">이메일</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">연락처</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">테넌트</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">상태</th>
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">작업</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($users as $user)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ $user->user_id ?? '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">{{ $user->name }}</div>
@if($user->is_super_admin)
<span class="text-xs text-red-600 font-semibold">슈퍼 관리자</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $user->email }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $user->phone ?? '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $user->currentTenant()?->company_name ?? '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
@if($user->is_active)
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
활성
</span>
@else
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">
비활성
</span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
@if($user->deleted_at)
<!-- 삭제된 항목 -->
<button onclick="confirmRestore({{ $user->id }}, '{{ $user->name }}')"
class="text-green-600 hover:text-green-900 mr-3">
복원
</button>
@if(auth()->user()?->is_super_admin)
<button onclick="confirmForceDelete({{ $user->id }}, '{{ $user->name }}')"
class="text-red-600 hover:text-red-900">
영구삭제
</button>
@endif
@else
<!-- 활성 항목 -->
<a href="{{ route('users.edit', $user->id) }}" class="text-blue-600 hover:text-blue-900 mr-3">
수정
</a>
<button onclick="confirmDelete({{ $user->id }}, '{{ $user->name }}')" class="text-red-600 hover:text-red-900">
삭제
</button>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-6 py-4 text-center text-gray-500">
사용자가 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- 페이지네이션 -->
@include('partials.pagination', [
'paginator' => $users,
'target' => '#user-table',
'includeForm' => '#filterForm'
])