- 테넌트 선택을 각 페이지에서 헤더로 통합 이동 - 페이지 제목 이모지 제거 및 상단 여백(mt-6) 축소 - 역할 권한 관리 페이지 레이아웃을 다른 페이지와 통일 - 메뉴명 스타일 개선 (depth 들여쓰기, └ 기호 적용) - 상위 메뉴 컬럼 제거로 테이블 간소화 - RolePermissionService에 depth 계산 로직 추가 - pagination.js를 body 끝으로 이동하여 로딩 오류 해결 - 역할 선택 UI를 셀렉트박스에서 버튼 형태로 변경 - 역할 버튼 hover 효과 개선 (선택된 버튼 가독성 향상) 변경된 파일: - resources/views/partials/header.blade.php: 테넌트 선택 UI 추가 - resources/views/dashboard|menus|users|departments|permissions|roles/index.blade.php: tenant-selector 제거, 여백 축소 - resources/views/layouts/app.blade.php: pagination.js 위치 변경 - app/Services/RolePermissionService.php: depth 계산 로직 추가 - resources/views/role-permissions/: 역할 권한 관리 페이지 개선 - routes/web.php, routes/api.php: 역할 권한 관리 라우트 추가
90 lines
3.3 KiB
PHP
90 lines
3.3 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', '권한 관리')
|
|
|
|
@section('content')
|
|
<!-- 페이지 헤더 -->
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h1 class="text-2xl font-bold text-gray-800">권한 관리</h1>
|
|
<a href="{{ route('permissions.create') }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition">
|
|
+ 새 권한
|
|
</a>
|
|
</div>
|
|
|
|
<!-- 필터 영역 -->
|
|
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
|
|
<form id="filterForm" class="flex gap-4">
|
|
<!-- 검색 -->
|
|
<div class="flex-1">
|
|
<input type="text"
|
|
name="search"
|
|
placeholder="권한 이름으로 검색..."
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
|
|
<!-- Guard 필터 -->
|
|
<div class="w-48">
|
|
<select name="guard_name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
<option value="">전체 Guard</option>
|
|
<option value="web">web</option>
|
|
<option value="api">api</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- 검색 버튼 -->
|
|
<button type="submit" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg transition">
|
|
검색
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 테이블 영역 (HTMX로 로드) -->
|
|
<div id="permission-table"
|
|
hx-get="/api/admin/permissions"
|
|
hx-trigger="load, filterSubmit from:body"
|
|
hx-include="#filterForm"
|
|
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
|
|
class="bg-white rounded-lg shadow-sm overflow-hidden">
|
|
<!-- 로딩 스피너 -->
|
|
<div class="flex justify-center items-center p-12">
|
|
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
|
<script>
|
|
// 폼 제출 시 HTMX 이벤트 트리거
|
|
document.getElementById('filterForm').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
htmx.trigger('#permission-table', 'filterSubmit');
|
|
});
|
|
|
|
// 권한 삭제 확인
|
|
function confirmDelete(id, name) {
|
|
if (confirm(`"${name}" 권한을 삭제하시겠습니까?\n\n이 권한이 할당된 역할이 있는 경우 삭제할 수 없습니다.`)) {
|
|
fetch(`/api/admin/permissions/${id}`, {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
|
'Accept': 'application/json'
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
htmx.trigger('#permission-table', 'filterSubmit');
|
|
alert(data.message);
|
|
} else {
|
|
alert(data.message);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
alert('권한 삭제 중 오류가 발생했습니다.');
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
@endpush
|