feat:상담매니저 선택 UI 실시간 검색으로 개선
- 드롭다운 선택 방식에서 실시간 검색 UI로 변경 - getAllManagerUsers() 메서드 추가 (manager 역할 사용자 조회) - searchManagers() API 추가 (이름/이메일 검색) - 자신이 유치한 파트너뿐만 아니라 모든 상담매니저 역할 사용자 선택 가능 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -251,10 +251,8 @@ private function getDashboardData(Request $request): array
|
||||
->get()
|
||||
->keyBy('tenant_id');
|
||||
|
||||
// 내가 유치한 영업파트너 목록 (드롭다운용)
|
||||
$allManagers = auth()->user()->children()
|
||||
->where('is_active', true)
|
||||
->get(['id', 'name', 'email']);
|
||||
// 상담매니저 역할을 가진 모든 사용자 (드롭다운용)
|
||||
$allManagers = $this->getAllManagerUsers();
|
||||
|
||||
// 내가 매니저로만 참여하는 건 (다른 사람이 등록, 내가 매니저)
|
||||
$managerOnlyProspects = $this->getManagerOnlyProspects($currentUserId);
|
||||
@@ -412,10 +410,8 @@ public function refreshTenantList(Request $request): View
|
||||
->get()
|
||||
->keyBy('tenant_id');
|
||||
|
||||
// 내가 유치한 영업파트너 목록 (드롭다운용)
|
||||
$allManagers = auth()->user()->children()
|
||||
->where('is_active', true)
|
||||
->get(['id', 'name', 'email']);
|
||||
// 상담매니저 역할을 가진 모든 사용자 (드롭다운용)
|
||||
$allManagers = $this->getAllManagerUsers();
|
||||
|
||||
return view('sales.dashboard.partials.tenant-list', compact(
|
||||
'tenants',
|
||||
@@ -768,6 +764,55 @@ private function getCommissionData(): array
|
||||
return compact('commissionSummary', 'recentCommissions', 'partner');
|
||||
}
|
||||
|
||||
/**
|
||||
* 상담매니저 역할을 가진 모든 사용자 조회
|
||||
*/
|
||||
private function getAllManagerUsers()
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
|
||||
return User::whereHas('userRoles', function ($q) use ($tenantId) {
|
||||
$q->where('tenant_id', $tenantId)
|
||||
->whereHas('role', function ($rq) {
|
||||
$rq->where('name', 'manager');
|
||||
});
|
||||
})
|
||||
->where('is_active', true)
|
||||
->where('id', '!=', auth()->id()) // 본인 제외
|
||||
->get(['id', 'name', 'email']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 매니저 검색 API (AJAX)
|
||||
*/
|
||||
public function searchManagers(Request $request): JsonResponse
|
||||
{
|
||||
$query = $request->input('q', '');
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
|
||||
$managers = User::whereHas('userRoles', function ($q) use ($tenantId) {
|
||||
$q->where('tenant_id', $tenantId)
|
||||
->whereHas('role', function ($rq) {
|
||||
$rq->where('name', 'manager');
|
||||
});
|
||||
})
|
||||
->where('is_active', true)
|
||||
->where('id', '!=', auth()->id())
|
||||
->when($query, function ($q) use ($query) {
|
||||
$q->where(function ($subQ) use ($query) {
|
||||
$subQ->where('name', 'like', "%{$query}%")
|
||||
->orWhere('email', 'like', "%{$query}%");
|
||||
});
|
||||
})
|
||||
->limit(10)
|
||||
->get(['id', 'name', 'email']);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'managers' => $managers,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 영업파트너 가이드북 도움말 모달
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user