- LoginToken: APP_ENV 기반 도메인 매핑 (local→dev.*, production→stage.sam.it.kr) - DEV접속 → SAM접속 텍스트 변경 - 사용자 테이블: 이메일 컬럼 제거, 이름 아래 이메일 표시, 뱃지 버튼 UI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
168 lines
11 KiB
PHP
168 lines
11 KiB
PHP
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
|
|
<x-table-swipe>
|
|
<table class="min-w-full">
|
|
<thead class="bg-gray-50 border-b">
|
|
<tr>
|
|
<th class="px-3 py-3 text-center w-10">
|
|
<input type="checkbox" onchange="toggleSelectAll(this)" class="rounded border-gray-300">
|
|
</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">ID</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">이름</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">테넌트</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">부서</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">역할</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">재직</th>
|
|
<th class="px-3 py-3 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">상태</th>
|
|
<th class="px-3 py-3 text-center 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="{{ $user->deleted_at ? 'bg-gray-100' : '' }} hover:bg-gray-50 cursor-pointer"
|
|
onclick="UserModal.open({{ $user->id }})"
|
|
data-user-id="{{ $user->id }}">
|
|
<td class="px-3 py-4 text-center" onclick="event.stopPropagation()">
|
|
<input type="checkbox" class="bulk-checkbox rounded border-gray-300"
|
|
value="{{ $user->id }}"
|
|
data-deleted="{{ $user->deleted_at ? '1' : '0' }}"
|
|
onchange="updateBulkButtonState()">
|
|
</td>
|
|
<td class="px-3 py-4 whitespace-nowrap text-sm text-gray-900 text-center">
|
|
{{ $user->user_id ?? '-' }}
|
|
</td>
|
|
<td class="px-3 py-4 text-left">
|
|
<div class="text-sm font-medium text-gray-900">{{ $user->name }}</div>
|
|
<div class="text-xs text-gray-500">{{ $user->email }}</div>
|
|
@if($user->is_super_admin && auth()->user()?->is_super_admin)
|
|
<span class="text-xs text-red-600 font-semibold">슈퍼 관리자</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-4 text-center">
|
|
@if($user->tenants && $user->tenants->count() > 0)
|
|
<div class="flex flex-wrap gap-1 justify-center">
|
|
@foreach($user->tenants as $tenant)
|
|
<span class="px-1.5 py-0.5 text-xs rounded cursor-pointer hover:ring-2 hover:ring-indigo-300 {{ $tenant->pivot->is_default ? 'bg-indigo-100 text-indigo-700' : 'bg-gray-100 text-gray-600' }}"
|
|
data-context-menu="tenant"
|
|
data-entity-id="{{ $tenant->id }}"
|
|
data-entity-name="{{ $tenant->company_name }}"
|
|
title="클릭하여 메뉴 열기">
|
|
{{ $tenant->company_name }}
|
|
</span>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<span class="text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-4 text-center">
|
|
@if($user->departmentUsers && $user->departmentUsers->count() > 0)
|
|
<div class="flex flex-wrap gap-1 justify-center">
|
|
@foreach($user->departmentUsers as $du)
|
|
<span class="px-1.5 py-0.5 text-xs rounded {{ $du->is_primary ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-600' }}">
|
|
{{ $du->department?->name ?? '-' }}
|
|
</span>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<span class="text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-4 text-center">
|
|
@if($user->userRoles && $user->userRoles->count() > 0)
|
|
<div class="flex flex-wrap gap-1 justify-center">
|
|
@foreach($user->userRoles as $ur)
|
|
<div class="text-left px-2 py-1 rounded {{ $ur->role?->guard_name === 'web' ? 'bg-blue-50 border border-blue-200' : 'bg-purple-50 border border-purple-200' }}">
|
|
<div class="text-xs font-medium {{ $ur->role?->guard_name === 'web' ? 'text-blue-700' : 'text-purple-700' }}">
|
|
{{ $ur->role?->name ?? '-' }}
|
|
</div>
|
|
@if($ur->role?->description)
|
|
<div class="text-[10px] text-gray-500 leading-tight">{{ $ur->role->description }}</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<span class="text-gray-400">-</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-4 whitespace-nowrap text-center">
|
|
@php $empStatus = $user->employee_status ?? 'active'; @endphp
|
|
@if($empStatus === 'active')
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">재직</span>
|
|
@elseif($empStatus === 'leave')
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">휴직</span>
|
|
@else
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">퇴직</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-3 py-4 whitespace-nowrap text-center">
|
|
@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-4 py-3 whitespace-nowrap text-center" onclick="event.stopPropagation()">
|
|
@php
|
|
$canModify = ! $user->is_super_admin || auth()->user()?->is_super_admin;
|
|
@endphp
|
|
@if($user->deleted_at)
|
|
<div class="flex flex-col items-center gap-1">
|
|
@if($canModify)
|
|
<button onclick="confirmRestore({{ $user->id }}, @js($user->name))"
|
|
class="px-2.5 py-1 text-xs font-medium rounded bg-green-100 text-green-700 hover:bg-green-200 transition">
|
|
복원
|
|
</button>
|
|
@endif
|
|
@if(auth()->user()?->is_super_admin)
|
|
<button onclick="confirmForceDelete({{ $user->id }}, @js($user->name))"
|
|
class="px-2.5 py-1 text-xs font-medium rounded bg-red-100 text-red-700 hover:bg-red-200 transition">
|
|
영구삭제
|
|
</button>
|
|
@endif
|
|
@if(!$canModify && !auth()->user()?->is_super_admin)
|
|
<span class="text-gray-400 text-xs">삭제됨</span>
|
|
@endif
|
|
</div>
|
|
@elseif($canModify)
|
|
<div class="inline-flex flex-col gap-1">
|
|
<button onclick="openDevSite({{ $user->id }}, @js($user->name))"
|
|
class="w-full px-2.5 py-1 text-xs font-medium rounded bg-emerald-100 text-emerald-700 hover:bg-emerald-200 transition text-center"
|
|
title="SAM 사이트에 이 사용자로 로그인">
|
|
SAM 접속
|
|
</button>
|
|
<div class="flex gap-1">
|
|
<a href="{{ route('users.edit', $user->id) }}"
|
|
onclick="event.stopPropagation()"
|
|
class="flex-1 px-2.5 py-1 text-xs font-medium rounded bg-blue-100 text-blue-700 hover:bg-blue-200 transition text-center">
|
|
수정
|
|
</a>
|
|
<button onclick="confirmDelete({{ $user->id }}, @js($user->name))"
|
|
class="flex-1 px-2.5 py-1 text-xs font-medium rounded bg-red-100 text-red-700 hover:bg-red-200 transition text-center">
|
|
삭제
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<span class="text-gray-400 text-xs">수정 불가</span>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="9" class="px-6 py-4 text-center text-gray-500">
|
|
사용자가 없습니다.
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</x-table-swipe>
|
|
</div>
|
|
|
|
<!-- 페이지네이션 -->
|
|
@include('partials.pagination', [
|
|
'paginator' => $users,
|
|
'target' => '#user-table',
|
|
'includeForm' => '#filterForm'
|
|
]) |