Files
sam-manage/resources/views/role-permissions/partials/permission-matrix.blade.php

67 lines
4.0 KiB
PHP
Raw Normal View History

<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-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 60px;">순번</th>
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider">메뉴명</th>
<th class="px-6 py-3 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider">URL</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">순서</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">조회</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">생성</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">수정</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">삭제</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">승인</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 80px;">내보내기</th>
<th class="px-6 py-3 text-center text-xs font-semibold text-gray-700 uppercase tracking-wider" style="width: 70px;">관리</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@php
$permissionTypes = ['view', 'create', 'update', 'delete', 'approve', 'export', 'manage'];
@endphp
@forelse($menus as $index => $menu)
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 text-center">
{{ $index + 1 }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center text-sm text-gray-900" style="padding-left: {{ ($menu->depth ?? 0) * 20 }}px;">
@if(($menu->depth ?? 0) > 0)
<span class="mr-2 text-gray-400"></span>
@endif
<span>{{ $menu->name }}</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="truncate max-w-xs inline-block" title="{{ $menu->url }}">
{{ $menu->url }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 text-center">
{{ $menu->sort_order }}
</td>
@foreach($permissionTypes as $type)
<td class="px-6 py-4 whitespace-nowrap text-center">
<input
type="checkbox"
{{ isset($permissions[$menu->id][$type]) && $permissions[$menu->id][$type] ? 'checked' : '' }}
class="h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary cursor-pointer"
hx-post="/api/admin/role-permissions/toggle"
hx-target="#permission-matrix"
hx-include="[name='role_id']"
hx-vals='{"menu_id": {{ $menu->id }}, "permission_type": "{{ $type }}"}'
>
</td>
@endforeach
</tr>
@empty
<tr>
<td colspan="11" class="px-6 py-12 text-center text-gray-500">
활성화된 메뉴가 없습니다.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>