Files
sam-manage/resources/views/tenants/partials/table.blade.php
hskwon 695e3873d9 chore: 관리 페이지 뷰 및 라우트 정비
- ArchivedRecordController 수정
- 각종 테이블 뷰 개선 (archived-records, boards, departments, menus, tenants)
- web.php 라우트 정비
2025-11-30 21:05:13 +09:00

130 lines
7.4 KiB
PHP

<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-sm font-semibold text-gray-700 uppercase tracking-wider">ID</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">회사명</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">코드</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">상태</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">유형</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">이메일</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">전화번호</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">사용자</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">부서</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">메뉴</th>
<th class="px-3 py-2 text-center text-sm font-semibold text-gray-700 uppercase tracking-wider">역할</th>
<th class="px-3 py-2 text-left text-sm font-semibold text-gray-700 uppercase tracking-wider">생성일</th>
<th class="px-6 py-3 text-right text-sm font-semibold text-gray-700 uppercase tracking-wider">액션</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@forelse($tenants as $tenant)
<tr class="{{ $tenant->deleted_at ? 'bg-gray-100' : '' }} hover:bg-gray-50 cursor-pointer"
onclick="TenantModal.open({{ $tenant->id }})"
data-tenant-id="{{ $tenant->id }}">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
{{ $tenant->id }}
</td>
<td class="px-3 py-2 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900 cursor-pointer hover:text-blue-600"
data-context-menu="tenant"
data-entity-id="{{ $tenant->id }}"
data-entity-name="{{ $tenant->company_name }}">
{{ $tenant->company_name }}
</div>
@if($tenant->ceo_name)
<div class="text-sm text-gray-500">대표: {{ $tenant->ceo_name }}</div>
@endif
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-900">
{{ $tenant->code }}
</td>
<td class="px-3 py-2 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full
{{ $tenant->status_badge_color === 'success' ? 'bg-green-100 text-green-800' : '' }}
{{ $tenant->status_badge_color === 'warning' ? 'bg-yellow-100 text-yellow-800' : '' }}
{{ $tenant->status_badge_color === 'error' ? 'bg-red-100 text-red-800' : '' }}">
{{ $tenant->status_label }}
</span>
</td>
<td class="px-3 py-2 whitespace-nowrap text-center">
@php
$typeLabels = ['STD' => '일반', 'TPL' => '템플릿', 'HQ' => '본사'];
$typeColors = [
'STD' => 'bg-gray-100 text-gray-800',
'TPL' => 'bg-purple-100 text-purple-800',
'HQ' => 'bg-blue-100 text-blue-800'
];
$type = $tenant->tenant_type ?? 'STD';
@endphp
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $typeColors[$type] ?? 'bg-gray-100 text-gray-800' }}">
{{ $typeLabels[$type] ?? $type }}
</span>
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ $tenant->email ?? '-' }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ $tenant->phone ?? '-' }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-center text-gray-900">
{{ $tenant->users_count ?? 0 }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-center text-gray-900">
{{ $tenant->departments_count ?? 0 }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-center text-gray-900">
{{ $tenant->menus_count ?? 0 }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-center text-gray-900">
{{ $tenant->roles_count ?? 0 }}
</td>
<td class="px-3 py-2 whitespace-nowrap text-sm text-gray-500">
{{ $tenant->created_at?->format('Y-m-d') ?? '-' }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium" onclick="event.stopPropagation()">
@if($tenant->deleted_at)
<!-- 삭제된 항목 - 슈퍼관리자만 복구/영구삭제 가능 -->
@if(auth()->user()?->is_super_admin)
<button onclick="confirmRestore({{ $tenant->id }}, '{{ $tenant->company_name }}')"
class="text-green-600 hover:text-green-900 mr-3">
복원
</button>
<button onclick="confirmForceDelete({{ $tenant->id }}, '{{ $tenant->company_name }}')"
class="text-red-600 hover:text-red-900">
영구삭제
</button>
@else
<span class="text-gray-400 text-xs">삭제됨</span>
@endif
@else
<!-- 활성 항목 -->
<a href="{{ route('tenants.edit', $tenant->id) }}"
onclick="event.stopPropagation()"
class="text-blue-600 hover:text-blue-900 mr-3">
수정
</a>
<button onclick="confirmDelete({{ $tenant->id }}, '{{ $tenant->company_name }}')"
class="text-red-600 hover:text-red-900">
삭제
</button>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="13" class="px-6 py-12 text-center text-gray-500">
등록된 테넌트가 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- 페이지네이션 -->
@include('partials.pagination', [
'paginator' => $tenants,
'target' => '#tenant-table',
'includeForm' => '#filterForm'
])