Files
sam-manage/resources/views/roles/partials/table.blade.php
권혁성 dfe97308f3 deploy: 2026-03-11 배포
- feat: MNG→SAM 자동 로그인 토큰 (LoginToken 모델 도메인 매핑)
- feat: 사용자/역할/부서 관리 개선 (Controller, Service, View)
- feat: 메뉴 관리 개선 (MenuService, menu-tree.js)
- fix: 문서 뷰어, FCM 토큰, 방화셔터 도면, 테넌트 테이블 뷰 수정
2026-03-11 02:12:51 +09:00

99 lines
5.3 KiB
PHP

@php
$tenantId = session('selected_tenant_id');
$isAllTenants = !$tenantId || $tenantId === 'all';
@endphp
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
<x-table-swipe>
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-3 py-2 text-center w-10">
<input type="checkbox" onchange="toggleSelectAll(this)" class="rounded border-gray-300">
</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">ID</th>
@if($isAllTenants)
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">테넌트</th>
@endif
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">역할 이름</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">Guard</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">설명</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">권한 </th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">생성일</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider whitespace-nowrap">액션</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($roles as $role)
<tr>
<td class="px-3 py-4 text-center">
<input type="checkbox" class="bulk-checkbox rounded border-gray-300"
value="{{ $role->id }}"
onchange="updateBulkButtonState()">
</td>
<td class="px-3 py-4 whitespace-nowrap text-sm text-gray-900 text-center">
{{ $role->id }}
</td>
@if($isAllTenants)
<td class="px-3 py-4 whitespace-nowrap text-left">
@if($role->tenant)
<span class="px-2 py-1 text-xs font-medium bg-gray-100 text-gray-600 rounded cursor-pointer hover:bg-gray-200"
data-context-menu="tenant"
data-entity-id="{{ $role->tenant->id }}"
data-entity-name="{{ $role->tenant->company_name }}"
title="클릭하여 메뉴 열기">
{{ $role->tenant->company_name }}
</span>
@else
<span class="px-2 py-1 text-xs font-medium bg-gray-100 text-gray-400 rounded">미지정</span>
@endif
</td>
@endif
<td class="px-3 py-4 whitespace-nowrap text-left">
<div class="text-sm font-medium text-gray-900">{{ $role->name }}</div>
</td>
<td class="px-3 py-4 whitespace-nowrap text-center">
<span class="px-2 py-1 text-xs font-medium rounded {{ $role->guard_name === 'api' ? 'bg-blue-100 text-blue-700' : 'bg-green-100 text-green-700' }}">
{{ strtoupper($role->guard_name ?? '-') }}
</span>
</td>
<td class="px-3 py-4 text-left">
<div class="text-sm text-gray-500">{{ $role->description ?? '-' }}</div>
</td>
<td class="px-3 py-4 whitespace-nowrap text-sm text-center text-gray-900">
{{ $role->permissions_count ?? 0 }}
</td>
<td class="px-3 py-4 whitespace-nowrap text-sm text-gray-500 text-center">
{{ $role->created_at?->format('Y-m-d') ?? '-' }}
</td>
<td class="px-4 py-3 whitespace-nowrap text-center">
<div class="inline-flex gap-1">
<a href="{{ route('roles.edit', $role->id) }}"
class="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({{ $role->id }}, '{{ $role->name }}')"
class="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>
</td>
</tr>
@empty
<tr>
<td colspan="{{ $isAllTenants ? 9 : 8 }}" class="px-6 py-12 text-center text-gray-500">
등록된 역할이 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</x-table-swipe>
</div>
<!-- 페이지네이션 -->
@include('partials.pagination', [
'paginator' => $roles,
'target' => '#role-table',
'includeForm' => '#filterForm'
])