feat: Phase 4-3 부서 관리 시스템 구현
- DepartmentService, DepartmentController (Blade/API) 생성 - 부서 CRUD 기능 완성 (목록/생성/수정/삭제) - FormRequest 검증 (StoreDepartmentRequest, UpdateDepartmentRequest) - HTMX 패턴 적용 (index, create, edit, partials/table) - 계층 구조 지원 (parent-child relationships) - 활성/비활성 상태 관리 - 정렬 순서 관리 - Tenant Selector 통합 - Sidebar 메뉴에 부서 관리 추가 주요 기능: - 자기 참조 방지 (parent_id validation) - 하위 부서 존재 시 삭제 방지 - Conditional tenant filtering 적용 - Active/Inactive 필터링 - HTMX 페이지네이션 (target, includeForm 파라미터 포함) 정책: - 모든 리스트 화면은 1페이지만 있어도 페이지네이션 표시
This commit is contained in:
48
app/Http/Controllers/DepartmentController.php
Normal file
48
app/Http/Controllers/DepartmentController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\DepartmentService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DepartmentService $departmentService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 부서 목록 (Blade 화면만)
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
return view('departments.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 부서 생성 화면
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
$departments = $this->departmentService->getActiveDepartments();
|
||||
|
||||
return view('departments.create', compact('departments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 부서 수정 화면
|
||||
*/
|
||||
public function edit(int $id): View
|
||||
{
|
||||
$department = $this->departmentService->getDepartmentById($id);
|
||||
|
||||
if (!$department) {
|
||||
abort(404, '부서를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
$departments = $this->departmentService->getActiveDepartments();
|
||||
|
||||
return view('departments.edit', compact('department', 'departments'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user