feat: [hr] 직급/직책 인라인 추가 기능 구현
- Position 생성 API 엔드포인트 추가 (POST /admin/hr/positions) - 직급/직책 select 옆 "+" 버튼으로 모달 열기 - 모달에서 이름 입력 → API 저장 → 드롭다운에 자동 추가 및 선택 - 중복 key 방지 (기존 값이면 그대로 반환) - create/edit 뷰 모두 적용
This commit is contained in:
@@ -170,4 +170,27 @@ public function destroy(Request $request, int $id): JsonResponse|Response
|
||||
'message' => '퇴직 처리되었습니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 직급/직책 추가
|
||||
*/
|
||||
public function storePosition(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'type' => 'required|string|in:rank,title',
|
||||
'name' => 'required|string|max:50',
|
||||
]);
|
||||
|
||||
$position = $this->employeeService->createPosition($validated['type'], $validated['name']);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => ($validated['type'] === 'rank' ? '직급' : '직책').'이 추가되었습니다.',
|
||||
'data' => [
|
||||
'id' => $position->id,
|
||||
'key' => $position->key,
|
||||
'name' => $position->name,
|
||||
],
|
||||
], 201);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user